[m-dev.] bug fix in the Morphine installation process

Erwan Jahier Erwan.Jahier at irisa.fr
Tue Mar 7 05:36:37 AEDT 2000


Tyson wrote:

| Hi,
| 
| These fixes will be committed on the version-0_9_x branch as well
| as the main branch.
| 
| ===================================================================
| 
| 
| Estimated hours taken: 1.5
| 
| A few fixes for Morphine to make installation easier.

  [delete]

| 
| extras/morphine/source/make_scenario.pl:
| 	Fix a bug -- use redirection instead of the -i option to patch,
| 	as many systems don't support -i (e.g. taifun, a Solaris box).


It turns out that on some machines here, I need to use "-i" to patch.
So if the "redirection" method fails, I try the "-i" one. 

--
Estimated hours taken: 1

Fix a problem that occurs in the Morphine installation process caused by the
system dependent synopsis of patch command.

extras/morphine/source/make_scenario.pl:
	Not all the `patch' use the same synopsis. If an attempt to patch
	files fails, try with another synopsis. If it fails again, print 
	an appropriate error message and then abort.  

	
extras/morphine/source/make_scenario.pl:
extras/morphine/INSTALL_MORPHINE:
	Print the post-installation message that says to modify the PATH 
	variable only when the installation process succeeds.


Index: INSTALL-MORPHINE
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/INSTALL-MORPHINE,v
retrieving revision 1.4
diff -u -r1.4 INSTALL-MORPHINE
--- INSTALL-MORPHINE	2000/01/03 13:26:10	1.4
+++ INSTALL-MORPHINE	2000/03/06 18:22:53
@@ -77,12 +77,6 @@
 echo "Compiling Morphine files..."
 eclipse -b ${MERCURY_MORPHINE_DIR}/source/make_scenario.pl
 
-echo ""
-echo "  Don't forget to add ${MERCURY_MORPHINE_DIR}/scripts and"
-echo "  ${MERCURY_MORPHINE_DIR}/bin to your PATH."
-echo "  Make sure that the executables mmc and eclipse are accessible "
-echo "  from your PATH too."
-
 
 
 
Index: source/make_scenario.pl
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/source/make_scenario.pl,v
retrieving revision 1.5
diff -u -r1.5 make_scenario.pl
--- source/make_scenario.pl	2000/01/03 13:24:54	1.5
+++ source/make_scenario.pl	2000/03/06 18:23:07
@@ -35,12 +35,33 @@
 
 	concat_string(["cp ", OPIUM_LIGTH_DIR, File, " ", SourceDir], Copy),
 	print(Copy),nl,
-	sh(Copy),
+	exec(Copy, []),
+	concat_string([SourceDir, File], AbsoluteFileName),
+	get_file_info(AbsoluteFileName, size, Size),
+	(	
+		concat_string(["patch ", AbsoluteFileName, " ", SourceDir, 
+			PatchFile], Patch),
+		print(Patch), nl,
+		exec(Patch, []), 
+		% Make sure the patch was applied
+		not get_file_info(AbsoluteFileName, size, Size), !
+	;
+		% Not all the patch commands use the same synopsis; some use 
+		% "-i PatchFiles", some others don't...
+		% If the previous attempt to patch files fails, we try that:
+		concat_string(["patch -i ", SourceDir, PatchFile, " ", 
+			AbsoluteFileName], Patch2),
+		print(Patch2), nl,
+		exec(Patch2, []),
+		not get_file_info(AbsoluteFileName, size, Size), !
+	;
+		print("\n*** Unable to use patch system command; patch "),
+		print("does have the same synopsis from one system "),
+		print("to another. Try to use the gnu version of patch "),
+		print("instead. \n"),
+		abort
+	).
 
-	concat_string(["patch ", SourceDir, File, " ", SourceDir, PatchFile], Patch),
-	print(Patch),nl,
-	sh(Patch).
-
 patch_all_files :-
 	patch_opium_files(error),
 	patch_opium_files(autoload),
@@ -94,6 +115,13 @@
 	make(control_flow, morphine, [active, traceable, global], Source, OD),
 	make(help, morphine, [active, traceable, global], Source, OD),
 
+	concat_string([
+		"\nThe installation of Morphine succeeded!\n",
+		"Don't forget to add ", MorphineDir,"\nand ",
+		MorphineDir, "/bin to your PATH.\n",
+		"Make sure that the executables mmc and eclipse are ",
+		"accessible from your PATH too.\n"], SuccessMsg),
+	print(SuccessMsg),
 	halt.
 
-- 
R1.


--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list