Annotation of nsdl/build/Makefile, revision 1.6

1.1       harris41    1: # The NSDL to LON-CAPA Gateway Server
                      2: 
                      3: # Scott Harrison
1.6     ! harris41    4: # $Id: Makefile,v 1.5 2002/07/14 00:27:56 harris41 Exp $
1.1       harris41    5: 
                      6: DISTPROBE=`perl ./distprobe`
                      7: DIST=$(DISTPROBE)
                      8: CATEGORY="development"
1.3       harris41    9: SOURCE=..
1.1       harris41   10: TARGET=""
                     11: NORESTORECONF="0"
                     12: HOSTNAME=""
                     13: LAUNCH=| perl
                     14: OUTSTREAM=>
                     15: SAVE=program.pl.$(TIMESTAMP)
                     16: LAUNCHSAVE=$(OUTSTREAM) $(SAVE)
                     17: METAMTARGET=""
                     18: MTARGET=""
                     19: VERSION=0.1
                     20: 
                     21: help:
                     22: 	@echo "*** You need to specify a valid target ***"
                     23: 	@echo "NOTE: You can specify options to your Makefile target."
                     24: 	@echo "(option) DIST can be redhat6, redhat7, debian2.2, or default"
                     25: 	@echo "(option) CATEGORY can be runtime or development"
                     26: 	@echo "(option) SOURCE is an absolute or relative directory path"
                     27: 	@echo "(option) TARGET is an absolute or relative directory path"
                     28: 	@echo "build: compile the CVS source tree"
                     29: 	@echo "install: install from a compiled CVS source tree to a "
                     30: 	@echo "         specified TARGET destination on the filesystem"
                     31: 	@echo "test: test different parts of the LON-CAPA system (TEST_*)"
1.6     ! harris41   32: 	@echo "TEST_lpml: make sure that the system can process "
1.1       harris41   33: 	@echo "                   the Linux Packaging Markup Language"
                     34: 	@echo "TEST_system_dependencies: make sure that all needed system "
                     35: 	@echo "                          components are active and present "
                     36: 	@echo "                          on the server such as perl modules"
                     37: 	@echo "                          and the MySQL database"
1.6     ! harris41   38: 	@echo "TEST_weblayer: mimic various web-based interactions with "
1.1       harris41   39: 	@echo "                respect to the login and various system "
                     40: 	@echo "                actions on the Gateway server"
                     41: 	@echo "HTML: generate an HTML-formatted description of the "
                     42: 	@echo "      NSDL to LON-CAPA Gateway Server CVS source files"
                     43: 	@echo "doc: compiles documentation for the system administration of"
                     44: 	@echo "     the gateway server"
                     45: 	@echo "status: compare the TARGET filesystem with a compiled CVS "
                     46: 	@echo "        source directory"
                     47: 	@echo "statuspost: post the results of "make status" to "
                     48: 	@echo "            TARGET/home/httpd/html/lon-status/filestatus.html"
                     49: 	@echo "rpmstatus: compare the rpms on a system to defined lists "
                     50: 	@echo "           CVS:doc/otherfiles/cd_rpms and "
                     51: 	@echo "           CVS:doc/otherfiles/rpm_list.txt"
                     52: 	@echo "rpmstatuspost: post the results of "make rpmstatus" to "
                     53: 	@echo "            TARGET/home/httpd/html/lon-status/rpmstatus.html"
                     54: 	@echo "tardist: build a tarball that will upgrade the software on a "
                     55: 	@echo "         system"
                     56: 
1.5       harris41   57: build: Makefile.build
                     58: 	echo -n "" > WARNINGS
                     59: 	make -f Makefile.build all
                     60: 	make warningnote
                     61: 
                     62: Makefile.build: Makefile alwaysrun
                     63: 	cat gatewayfiles.lpml | \
                     64: 	perl lpml_parse.pl build $(CATEGORY) $(DIST) "$(SOURCE)" \
                     65: 	"$(TARGET)" > Makefile.build
1.1       harris41   66: 
1.4       harris41   67: NET_install:
                     68: 	make TIMESTAMP=`date +"%s"` METAMTARGET="TRANSPORT" \
                     69: 	MTARGET="install" HOSTNAME="$(HOSTNAME)" lpmladm
                     70: 	make warningnote
                     71: 
1.3       harris41   72: install: Makefile.install
                     73: 	@echo -n "" > WARNINGS
                     74: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" \
                     75: 	directories
                     76: 	make -f Makefile.install SOURCE="$(SOURCE)" TARGET="$(TARGET)" files
                     77: 	make warningnote
                     78: 
                     79: Makefile.install: Makefile alwaysrun
                     80: 	cat gatewayfiles.lpml | \
                     81: 	perl lpml_parse.pl install $(CATEGORY) $(DIST) "$(SOURCE)" \
                     82: 	"$(TARGET)" > Makefile.install
                     83: 
                     84: alwaysrun:
1.1       harris41   85: 
1.6     ! harris41   86: test: TEST_lpml TEST_system_dependencies TEST_weblayer
        !            87: 	@echo "ALL TESTS SUCCESSFUL"
1.1       harris41   88: 
1.6     ! harris41   89: TEST_lpml:
        !            90: 	@echo "TESTING LPML INSTALLATION MECHANISM"
        !            91: 	cd lpml_test; perl filecomparetest.pl
1.1       harris41   92: 
                     93: TEST_system_dependencies:
1.6     ! harris41   94: 	@echo "TESTING WEB LAYER"
1.1       harris41   95: 
1.6     ! harris41   96: TEST_weblayer:
        !            97: 	@echo "TESTING SYSTEM DEPENDENCIES"
1.1       harris41   98: 
                     99: HTML:
1.6     ! harris41  100: 	install -d HTML
        !           101: 	cp $(SOURCE)/doc/gatewayfiles/*.gif HTML
        !           102: 	cat gatewayfiles.lpml | \
        !           103: 	perl lpml_parse.pl html development default "$(SOURCE)" '$(TARGET)' \
        !           104: 	> HTML/index.html
1.1       harris41  105: 
                    106: doc:
                    107: 	@echo "Not yet implemented"
                    108: 
                    109: status:
                    110: 	@echo "Not yet implemented"
                    111: 
                    112: statuspost:
                    113: 	@echo "Not yet implemented"
                    114: 
                    115: tardist:
                    116: 	@echo "Not yet implemented"
1.3       harris41  117: 
                    118: warningnote:
                    119: 	@if (test -s WARNINGS); then \
                    120: 		W=`grep -c '\*\*\*\* WARNING' WARNINGS`; \
                    121: 		E=`grep -c '\*\*\*\* ERROR' WARNINGS`; \
                    122: 		N=`grep -c '\*\*\*\* NOTE' WARNINGS`; \
                    123: 		echo "--->  $$W WARNINGS ENCOUNTERED!       "; \
                    124: 		echo "--->  $$E ERRORS ENCOUNTERED!         "; \
                    125: 		echo "--->  $$N NOTES ENCOUNTERED!          "; \
                    126: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
                    127: 		echo "!!!!  Please read the WARNINGS file !!!!"; \
                    128: 		echo "!!!!   to make sure everything is   !!!!"; \
                    129: 		echo "!!!!    correct and taken care of   !!!!"; \
                    130: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
                    131: 	fi
1.4       harris41  132: 
                    133: lpmladm:
                    134: 	@if (test $(METAMTARGET) = "TRANSPORT"); then \
                    135: 		echo "Transporting to $(HOSTNAME)"; \
                    136: 		sudo mkdir lpmladm.$(TIMESTAMP); \
                    137: 		sudo make DIST=$(DIST) CATEGORY=$(CATEGORY) \
                    138: 		SOURCE="$(SOURCE)" \
                    139: 		TARGET="lpmladm.$(TIMESTAMP)" \
                    140: 		NORESTORECONF="$(NORESTORECONF)" "$(MTARGET)"; \
                    141: 		cd lpmladm.$(TIMESTAMP); \
                    142: 		sudo tar czf ../tarball$(TIMESTAMP).tar.gz .; \
                    143: 		cd ..; scp tarball$(TIMESTAMP).tar.gz \
                    144: 		lpmladm@$(HOSTNAME):~/tarball$(TIMESTAMP).tar.gz; \
                    145: 		sudo rm -Rf lpmladm.$(TIMESTAMP); \
                    146: 		sudo rm -f tarball$(TIMESTAMP).tar.gz; \
                    147: 		ssh lpmladm@$(HOSTNAME) sudo mv tarball$(TIMESTAMP).tar.gz /; \
                    148: 		ssh lpmladm@$(HOSTNAME) sudo tar -x -z -C / \
                    149: 		-p --same-owner -f \
                    150: 		/tarball$(TIMESTAMP).tar.gz; \
                    151: 		ssh lpmladm@$(HOSTNAME) sudo rm -f \
                    152: 		/tarball$(TIMESTAMP).tar.gz; \
                    153: 	elif (test $(METAMTARGET) = "LAUNCH"); then \
                    154: 		echo "Launching process on $(HOSTNAME)"; \
                    155: 		LAUNCHSAVE=$(OUTSTREAM) $(SAVE); \
                    156: 		make DIST=$(DIST) CATEGORY=$(CATEGORY) SOURCE="$(SOURCE)" \
                    157: 		TARGET="$(TARGET)" NORESTORECONF="$(NORESTORECONF)" \
                    158: 		LAUNCH="$(LAUNCHSAVE)" "$(MTARGET)"; \
                    159: 		scp $(SAVE) lpmladm@$(HOSTNAME):$(SAVE); \
                    160: 		ssh lpmladm@$(HOSTNAME) sudo -u $(LAUNCHUSER) perl $(SAVE); \
                    161: 	else \
                    162: 		echo "**** ERROR **** Incorrect METAMTARGET"; \
                    163: 	fi
                    164: #		ssh lpmladm@$(HOSTNAME) sudo rm -f $(SAVE); \
1.1       harris41  165: 
1.2       harris41  166: clean:
                    167: 	@echo "Not yet implemented"
1.1       harris41  168: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>