[LON-CAPA-cvs] cvs: loncom / UPDATE /build Makefile

raeburn raeburn@source.lon-capa.org
Thu, 10 Mar 2011 16:08:24 -0000


raeburn		Thu Mar 10 16:08:24 2011 EDT

  Modified files:              
    /loncom/build	Makefile 
    /loncom	UPDATE 
  Log:
  - Bug 6356.
    First stage of "make aboutVERSION" is now:
      Copy about.html to about.html.orig and copy loncapa_apache.conf to
      loncapa_apache.conf.orig (previously done separately in make tardist).
    New make target: postaboutVERSION restores from *.orig, as follows:
      in tardist: after tarball created.
      in install: after installation occurred (first item in postinstall).
    - "make aboutVERSION" removed as final operation when running UPDATE (redundant,
      since "make rawinstall" was already run).
  
  
Index: loncom/build/Makefile
diff -u loncom/build/Makefile:1.193 loncom/build/Makefile:1.194
--- loncom/build/Makefile:1.193	Sun Feb 27 03:09:22 2011
+++ loncom/build/Makefile	Thu Mar 10 16:08:20 2011
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 
-# $Id: Makefile,v 1.193 2011/02/27 03:09:22 raeburn Exp $
+# $Id: Makefile,v 1.194 2011/03/10 16:08:20 raeburn Exp $
 
 # TYPICAL USAGE of this Makefile is primarily for two targets:
 # "make build" and "make install".
@@ -154,6 +154,8 @@
 	@echo "         /home/httpd/html/lon-status/version.txt"
 	@echo "aboutVERSION: place version information inside about.html"
 	@echo "              and loncapa_apache.conf"
+	@echo "postaboutVERSION: restore default version <!-- VERSION --> to"
+	@echo "                  about.html and loncapa_apache.conf"
 	@echo "*** Makefile.* TARGETS BUILT DYNAMICALLY FROM loncapafiles.lpml ***"
 	@echo "Makefile.configinstall: generate a Makefile for configuration"
 	@echo "                        files; built dynamically from"
@@ -315,6 +317,7 @@
 
 install: buildflag VERSION TEST_hosts_tab TEST_domain_tab Makefile.install Makefile
 	echo -n "" > WARNINGS
+	make aboutVERSION
 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
 	directories
 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" files
@@ -381,18 +384,11 @@
 	else \
 		ln -s . $(DIRTARGET); \
 	fi
-	cp -v $(SOURCE)/loncom/license/about.html \
-	$(SOURCE)/loncom/license/about.html.orig
-	cp -v $(SOURCE)/loncom/loncapa_apache.conf \
-	$(SOURCE)/loncom/loncapa_apache.conf.orig
 	make aboutVERSION
 	cd $(SOURCE); \
 	tar --no-recursion --numeric-owner --files-from MANIFEST \
 	-h -czf $(DIRTARGET).tar.gz 2>tar_WARNINGS || [ "0" == "0" ]
-	mv -v $(SOURCE)/loncom/license/about.html.orig \
-	$(SOURCE)/loncom/license/about.html
-	mv -v $(SOURCE)/loncom/loncapa_apache.conf.orig \
-	$(SOURCE)/loncom/loncapa_apache.conf
+	make postaboutVERSION
 	cat $(SOURCE)/tar_WARNINGS | \
 	xargs --replace=XXX echo '**** WARNING **** XXX' > WARNINGS
 	rm -f $(SOURCE)/tar_WARNINGS
@@ -517,6 +513,7 @@
 	tee -a WARNINGS
 
 postinstall:
+	make postaboutVERSION
 	make webserverconf
 	make reseval_fixup
 	make clean_file_permissions
@@ -548,6 +545,10 @@
 	date +"%Y%m%d" >> $(TARGET)/home/httpd/html/lon-status/version.txt
 
 aboutVERSION:
+	cp -v $(SOURCE)/loncom/license/about.html \
+	$(SOURCE)/loncom/license/about.html.orig
+	cp -v $(SOURCE)/loncom/loncapa_apache.conf \
+	$(SOURCE)/loncom/loncapa_apache.conf.orig
 	cat $(SOURCE)/loncom/license/about.html | \
 	perl -e '$$d=`date +"%Y%m%d%H"`;chomp($$d);while(<>){s/(\<\!\-\- VERSION \-\-\>|\d+\.\d+\.CVS_HEAD\-\d{10})/$(SHOWVERSION)-$$d/; print;}' > \
 	$(SOURCE)/loncom/license/about.html.new
@@ -559,6 +560,28 @@
 	mv -v $(SOURCE)/loncom/loncapa_apache.conf.new \
 	$(SOURCE)/loncom/loncapa_apache.conf
 
+postaboutVERSION:
+	if (test -e $(SOURCE)/loncom/license/about.html.orig) && \
+		(diff $(SOURCE)/loncom/license/about.html \
+		$(SOURCE)/loncom/license/about.html > /dev/null); then \
+		mv -v $(SOURCE)/loncom/license/about.html.orig \
+		$(SOURCE)/loncom/license/about.html; \
+	elif (test -e $(SOURCE)/loncom/license/about.html.orig) && \
+		!(diff $(SOURCE)/loncom/license/about.html \
+		$(SOURCE)/loncom/license/about.html > /dev/null); then \
+		rm -f $(SOURCE)/loncom/license/about.html.orig; \
+	fi
+	if (test -e $(SOURCE)/loncom/loncapa_apache.conf.orig) && \
+		(diff $(SOURCE)/loncom/license/about.html \
+		$(SOURCE)/loncom/license/about.html > /dev/null); then \
+		mv -v $(SOURCE)/loncom/loncapa_apache.conf.orig \
+		$(SOURCE)/loncom/loncapa_apache.conf; \
+	elif (test -e $(SOURCE)/loncom/loncapa_apache.conf.orig) && \
+		!(diff $(SOURCE)/loncom/license/about.html \
+		$(SOURCE)/loncom/license/about.html > /dev/null); then \
+		rm -f $(SOURCE)/loncom/loncapa_apache.conf.orig; \
+	fi
+
 # ========= *** Makefile.* TARGETS BUILT DYNAMICALLY FROM loncapafiles.lpml ***
 
 Makefile.configinstall: $(SOURCE)/doc/loncapafiles/loncapafiles.lpml \
Index: loncom/UPDATE
diff -u loncom/UPDATE:1.2 loncom/UPDATE:1.3
--- loncom/UPDATE:1.2	Mon Jul  3 04:43:00 2006
+++ loncom/UPDATE	Thu Mar 10 16:08:24 2011
@@ -10,7 +10,6 @@
 make hosts_and_domain_tab
 make postinstall
 make run_searchcat
-make aboutVERSION
 CMD
 my @commands=split(/[\n;]/,$script);
 foreach $cmd (@commands) {