File:  [LON-CAPA] / nsdl / build / Makefile
Revision 1.6: download - view: text, annotated - select for diffs
Sun Jul 14 06:39:06 2002 UTC (21 years, 8 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
implementing some testing as well as HTML target;
BUG FIX 343
BUG FIX 344
BUG FIX 345

    1: # The NSDL to LON-CAPA Gateway Server
    2: 
    3: # Scott Harrison
    4: # $Id: Makefile,v 1.6 2002/07/14 06:39:06 harris41 Exp $
    5: 
    6: DISTPROBE=`perl ./distprobe`
    7: DIST=$(DISTPROBE)
    8: CATEGORY="development"
    9: SOURCE=..
   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_*)"
   32: 	@echo "TEST_lpml: make sure that the system can process "
   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"
   38: 	@echo "TEST_weblayer: mimic various web-based interactions with "
   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: 
   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
   66: 
   67: NET_install:
   68: 	make TIMESTAMP=`date +"%s"` METAMTARGET="TRANSPORT" \
   69: 	MTARGET="install" HOSTNAME="$(HOSTNAME)" lpmladm
   70: 	make warningnote
   71: 
   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:
   85: 
   86: test: TEST_lpml TEST_system_dependencies TEST_weblayer
   87: 	@echo "ALL TESTS SUCCESSFUL"
   88: 
   89: TEST_lpml:
   90: 	@echo "TESTING LPML INSTALLATION MECHANISM"
   91: 	cd lpml_test; perl filecomparetest.pl
   92: 
   93: TEST_system_dependencies:
   94: 	@echo "TESTING WEB LAYER"
   95: 
   96: TEST_weblayer:
   97: 	@echo "TESTING SYSTEM DEPENDENCIES"
   98: 
   99: HTML:
  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
  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"
  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
  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); \
  165: 
  166: clean:
  167: 	@echo "Not yet implemented"
  168: 

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