File:  [LON-CAPA] / nsdl / build / Makefile
Revision 1.5: download - view: text, annotated - select for diffs
Sun Jul 14 00:27:56 2002 UTC (21 years, 8 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
implementing nsdl gateway build target; BUG FIX 340

    1: # The NSDL to LON-CAPA Gateway Server
    2: 
    3: # Scott Harrison
    4: # $Id: Makefile,v 1.5 2002/07/14 00:27:56 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_scripts: 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_web_layer: 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:
   87: 	@echo "Not yet implemented"
   88: 
   89: TEST_lpml_scripts:
   90: 	@echo "Not yet implemented"
   91: 
   92: TEST_system_dependencies:
   93: 	@echo "Not yet implemented"
   94: 
   95: TEST_web_layer:
   96: 	@echo "Not yet implemented"
   97: 
   98: HTML:
   99: 	@echo "Not yet implemented"
  100: 
  101: doc:
  102: 	@echo "Not yet implemented"
  103: 
  104: status:
  105: 	@echo "Not yet implemented"
  106: 
  107: statuspost:
  108: 	@echo "Not yet implemented"
  109: 
  110: tardist:
  111: 	@echo "Not yet implemented"
  112: 
  113: warningnote:
  114: 	@if (test -s WARNINGS); then \
  115: 		W=`grep -c '\*\*\*\* WARNING' WARNINGS`; \
  116: 		E=`grep -c '\*\*\*\* ERROR' WARNINGS`; \
  117: 		N=`grep -c '\*\*\*\* NOTE' WARNINGS`; \
  118: 		echo "--->  $$W WARNINGS ENCOUNTERED!       "; \
  119: 		echo "--->  $$E ERRORS ENCOUNTERED!         "; \
  120: 		echo "--->  $$N NOTES ENCOUNTERED!          "; \
  121: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
  122: 		echo "!!!!  Please read the WARNINGS file !!!!"; \
  123: 		echo "!!!!   to make sure everything is   !!!!"; \
  124: 		echo "!!!!    correct and taken care of   !!!!"; \
  125: 		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
  126: 	fi
  127: 
  128: lpmladm:
  129: 	@if (test $(METAMTARGET) = "TRANSPORT"); then \
  130: 		echo "Transporting to $(HOSTNAME)"; \
  131: 		sudo mkdir lpmladm.$(TIMESTAMP); \
  132: 		sudo make DIST=$(DIST) CATEGORY=$(CATEGORY) \
  133: 		SOURCE="$(SOURCE)" \
  134: 		TARGET="lpmladm.$(TIMESTAMP)" \
  135: 		NORESTORECONF="$(NORESTORECONF)" "$(MTARGET)"; \
  136: 		cd lpmladm.$(TIMESTAMP); \
  137: 		sudo tar czf ../tarball$(TIMESTAMP).tar.gz .; \
  138: 		cd ..; scp tarball$(TIMESTAMP).tar.gz \
  139: 		lpmladm@$(HOSTNAME):~/tarball$(TIMESTAMP).tar.gz; \
  140: 		sudo rm -Rf lpmladm.$(TIMESTAMP); \
  141: 		sudo rm -f tarball$(TIMESTAMP).tar.gz; \
  142: 		ssh lpmladm@$(HOSTNAME) sudo mv tarball$(TIMESTAMP).tar.gz /; \
  143: 		ssh lpmladm@$(HOSTNAME) sudo tar -x -z -C / \
  144: 		-p --same-owner -f \
  145: 		/tarball$(TIMESTAMP).tar.gz; \
  146: 		ssh lpmladm@$(HOSTNAME) sudo rm -f \
  147: 		/tarball$(TIMESTAMP).tar.gz; \
  148: 	elif (test $(METAMTARGET) = "LAUNCH"); then \
  149: 		echo "Launching process on $(HOSTNAME)"; \
  150: 		LAUNCHSAVE=$(OUTSTREAM) $(SAVE); \
  151: 		make DIST=$(DIST) CATEGORY=$(CATEGORY) SOURCE="$(SOURCE)" \
  152: 		TARGET="$(TARGET)" NORESTORECONF="$(NORESTORECONF)" \
  153: 		LAUNCH="$(LAUNCHSAVE)" "$(MTARGET)"; \
  154: 		scp $(SAVE) lpmladm@$(HOSTNAME):$(SAVE); \
  155: 		ssh lpmladm@$(HOSTNAME) sudo -u $(LAUNCHUSER) perl $(SAVE); \
  156: 	else \
  157: 		echo "**** ERROR **** Incorrect METAMTARGET"; \
  158: 	fi
  159: #		ssh lpmladm@$(HOSTNAME) sudo rm -f $(SAVE); \
  160: 
  161: clean:
  162: 	@echo "Not yet implemented"
  163: 

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