buildit
changeset 970 272328fe1b4a
parent 967 efbd0ee6805d
child 1003 a4d17d6bc179
--- a/buildit	Wed Jun 30 14:10:39 2010 -0700
+++ b/buildit	Fri Jul 02 21:03:57 2010 -0700
@@ -37,21 +37,25 @@
 export PATH
 
 MAKE_PKGS=0
-VERBOSE_FLAGS=""	# verbosity flags passed to xmake
+VERBOSE_FLAGS=""	# verbosity flag passed to xmake/make_release_packages
+PUBLISHER_FLAGS=""
 
-set -- $(getopt pv $*)
-if [ $? != 0 ] ; then
-    print -u2 USAGE: $0 [-p] [-v]
+while getopts pP:v i; do
+    case $i in
+	p) MAKE_PKGS=1 ;;
+	v) VERBOSE_FLAGS="-v" ;;
+	P) PUBLISHER_FLAGS="-p $OPTARG" ;;
+	?) print -u2 "USAGE: $0 [-p [-P publisher]] [-v]"; exit 2 ;;
+    esac
+done
+
+shift $(($OPTIND-1))
+
+if [[ $? != 0 ]] ; then
+    print -u2 "USAGE: $0 [-p [-P publisher]] [-v]"
     exit 2
 fi
 
-for i in $* ; do 
-    case $i in
-	-p)     MAKE_PKGS=1; shift;;
-	-v)     VERBOSE_FLAGS="-v"; shift;;
-    esac
-done
-
 [ -d log ] || mkdir log
 
 # Send all further output & errors to the log file
@@ -59,7 +63,14 @@
 
 # Find hg id and export it so set-elf-comments.pl doesn't have to re-run
 # for every module built
-export XBUILD_HG_ID="$(hg id)"
+hg_id() {
+    hg id -it | read rev tag
+    case "${tag}" in
+        tip)	print "${rev}" ;;
+        *)	print "${tag}" ;;
+    esac
+}
+export XBUILD_HG_ID="$(hg_id)"
 
 START="$(perl -e 'print time')"
 
@@ -83,13 +94,20 @@
 print "------------------------------------------------------------------------------"
 
 MACH="$(uname -p)"
+
+# Remove old proto area & package area to clean after moving to new locations
 if [ "${MACH}" = "i386" ]; then
     /bin/rm -rf proto-i386-svr4
 else
     /bin/rm -rf proto-sun4-svr4
 fi
+/bin/rm -rf proto-packages
 
-XMAKE="$(pwd)/open-src/util/build-tools/xmake -k ${VERBOSE_FLAGS}"
+# Clean new proto areas for this architecture
+/bin/rm -rf "proto/root_${MACH}" "proto/metadata_${MACH}" \
+    "proto/pkg_${MACH}" "proto/tools_${MACH}"
+
+XMAKE="$(pwd)/open-src/util/build-tools/xmake ${VERBOSE_FLAGS} -k"
 
 cd open-src
 # Run as two steps to avoid race between cleaning & rebuilding when
@@ -105,5 +123,5 @@
 	"${START}"
 
 if [ "${MAKE_PKGS}" = 1 ] ; then
-    ./make_release_packages
+    ./make_release_packages ${PUBLISHER_FLAGS} ${VERBOSE_FLAGS}
 fi