svn commit: r221057 - projects/portbuild/scripts

Florent Thoumie flz at FreeBSD.org
Tue Apr 26 08:18:01 UTC 2011


Author: flz
Date: Tue Apr 26 08:18:01 2011
New Revision: 221057
URL: http://svn.freebsd.org/changeset/base/221057

Log:
  Add support for dopackages -target <file>, to only build a defined set of ports.

Modified:
  projects/portbuild/scripts/dopackages
  projects/portbuild/scripts/makeduds
  projects/portbuild/scripts/makeindex
  projects/portbuild/scripts/makerestr

Modified: projects/portbuild/scripts/dopackages
==============================================================================
--- projects/portbuild/scripts/dopackages	Tue Apr 26 08:18:00 2011	(r221056)
+++ projects/portbuild/scripts/dopackages	Tue Apr 26 08:18:01 2011	(r221057)
@@ -14,7 +14,7 @@ umask 002
 journalname="journal"
 
 usage () {
-    echo "usage: arch branch buildid datestamp [-incremental] [-continue] [-restart] [-nofinish] [-finish] [-nocleanup] [-keep] [-nobuild] [-noindex] [-noduds] [-norestr] [-nochecksubdirs] [-nosrc] [-srcvcs] [-noports] [-portsvcs] [-noplistcheck] [-nodistfiles] [-fetch-original] [-cdrom] [-trybroken]"
+    echo "usage: arch branch buildid datestamp [-incremental] [-continue] [-restart] [-nofinish] [-finish] [-nocleanup] [-keep] [-nobuild] [-noindex] [-noduds] [-norestr] [-nochecksubdirs] [-nosrc] [-srcvcs] [-noports] [-portsvcs] [-noplistcheck] [-nodistfiles] [-fetch-original] [-cdrom] [-trybroken] [-target <file>]"
 # XXX MCL I think it's going to be too hard to move the create in here, now.
     echo "       -incremental     : Start a new incremental build"
     echo "       -continue        : Restart an interrupted build, skipping failed ports"
@@ -37,6 +37,7 @@ usage () {
     echo "       -fetch-original  : Fetch from original MASTER_SITE"
     echo "       -cdrom           : Prepare a build for distribution on CDROM "
     echo "       -trybroken       : Try to build BROKEN ports"
+    echo "       -target <file>   : Build ports listed in file, rather than the whole ports tree"
 
     exit 1
 }
@@ -93,7 +94,7 @@ portstar() {
     md5 ${builddir}/ports-${buildid}.tbz > ${builddir}/ports-${buildid}.tbz.md5
 }
 
-# usage: makeindex pb arch branch builddir
+# usage: makeindex pb arch branch builddir [target]
 # note: can take ~24 minutes!
 makeindex () {
     pb=$1
@@ -101,13 +102,14 @@ makeindex () {
     branch=$3
     buildid=$4
     builddir=$5
+    target=$6
 
     cd ${builddir}/ports
     echo "================================================"
     echo "generating index"
     echo "================================================"
     echo "index generation started at $(date)"
-    ${pb}/scripts/makeindex ${arch} ${branch} ${buildid} || return 1
+    ${pb}/scripts/makeindex ${arch} ${branch} ${buildid} ${target} || return 1
     echo "index generation ended at $(date)"
     echo $(wc -l ${INDEXFILE} | awk '{print $1}') "lines in INDEX"
 
@@ -137,7 +139,7 @@ checkindex () {
     fi
 }
 
-# usage: makeduds pb arch branch builddir
+# usage: makeduds pb arch branch builddir [target]
 # note: can take ~21 minutes!
 makeduds () {
     pb=$1
@@ -145,6 +147,7 @@ makeduds () {
     branch=$3
     buildid=$4
     builddir=$5
+    target=$6
 
     cd ${builddir}/ports
     echo "================================================"
@@ -154,7 +157,7 @@ makeduds () {
     if [ -e ${builddir}/duds ]; then
 	cp -p ${builddir}/duds ${builddir}/duds.old
     fi
-    if ! ${pb}/scripts/makeduds ${arch} ${branch} ${buildid}; then
+    if ! ${pb}/scripts/makeduds ${arch} ${branch} ${buildid} ${target}; then
 	echo "error(s) detected, exiting script at $(date).  Failed duds list was:"
 	cat ${builddir}/duds
 	mailexit 1
@@ -170,7 +173,7 @@ makeduds () {
     cp -p ${builddir}/duds ${builddir}/duds.orig
 }
 
-# usage: restrictedlist pb arch branch builddir
+# usage: restrictedlist pb arch branch builddir [target]
 # note: can take ~25 minutes!
 restrictedlist () {
     pb=$1
@@ -178,13 +181,14 @@ restrictedlist () {
     branch=$3
     buildid=$4
     builddir=$5
+    target=$6
     
     cd ${builddir}/ports
     echo "================================================"
     echo "creating restricted list"
     echo "================================================"
     echo "restricted list generation started at $(date)"
-    ${pb}/scripts/makerestr ${arch} ${branch} ${buildid} || return 1
+    ${pb}/scripts/makerestr ${arch} ${branch} ${buildid} ${target} || return 1
     echo "restricted list generation ended at $(date)"
     echo $(grep -c '^#' ${builddir}/restricted.sh) "ports in ${builddir}/restricted.sh"
 }
@@ -357,6 +361,10 @@ while [ $# -gt 0 ]; do
 	x-nocleanup)
 	    nocleanup=1
 	    ;;
+        x-target)
+            shift
+            target=$(realpath $1)
+            ;;
 	*)
 	    usage
 	    ;;
@@ -510,11 +518,11 @@ if [ "$skipstart" = 0 ]; then
     # XXX MCL could background these?
     # not run in background to check return status
     if [ "$noindex" = 0 ]; then
-	makeindex ${pb} ${arch} ${branch} ${buildid} ${builddir} || mailexit 1
+	makeindex ${pb} ${arch} ${branch} ${buildid} ${builddir} ${target} || mailexit 1
     fi
     checkindex ${builddir} || mailexit 1
     if [ "$noduds" = 0 ]; then
-	makeduds ${pb} ${arch} ${branch} ${buildid} ${builddir} || mailexit 1
+	makeduds ${pb} ${arch} ${branch} ${buildid} ${builddir} ${target} || mailexit 1
     fi
 
     wait # for tar creation
@@ -539,7 +547,7 @@ if [ "$skipstart" = 0 ]; then
 
     # XXX These can happen after build start
     if [ "$norestr" = 0 ]; then
-	restrictedlist ${pb} ${arch} ${branch} ${buildid} ${builddir} &
+	restrictedlist ${pb} ${arch} ${branch} ${buildid} ${builddir} ${target} &
 	job_restrictedlist=$!
     fi
     

Modified: projects/portbuild/scripts/makeduds
==============================================================================
--- projects/portbuild/scripts/makeduds	Tue Apr 26 08:18:00 2011	(r221056)
+++ projects/portbuild/scripts/makeduds	Tue Apr 26 08:18:01 2011	(r221057)
@@ -1,11 +1,11 @@
 #!/bin/sh
 
 usage () {
-  echo "usage: makeduds arch branch buildid"
+  echo "usage: makeduds arch branch buildid [target]"
   exit 1
 }
 
-if [ $# -ne 3 ]; then
+if [ $# -lt 3 ]; then
   usage
 fi
 
@@ -14,7 +14,7 @@ pb=/var/portbuild
 arch=$1
 branch=$2
 buildid=$3
-shift 3
+target=$4
 
 builddir=${pb}/${arch}/${branch}/builds/${buildid}
 
@@ -39,8 +39,21 @@ export LINUXBASE=/nonexistentlinux
 export PKG_DBDIR=/nonexistentpkg
 export PORT_DBDIR=/nonexistentport
 
+DUDS_PORTS=.
+if [ -n "$target" ]; then
+  if [ -f "$target" ]; then
+    DUDS_PORTS=$(cat $target | tr '\n' ' ')
+  else
+    echo "File $target doesn't exist. Exiting."
+    exit 1
+  fi
+fi
+
 cd ${PORTSDIR}
-make -j${DUDSJOBS} ignorelist-verbose ECHO_MSG=true > ${duds}.verbose 2> /dev/null || exit 1
+(for i in ${DUDS_PORTS}; do
+    cd ${PORTSDIR}/$i
+    make -j${DUDSJOBS} ignorelist-verbose ECHO_MSG=true 
+done) > ${duds}.verbose 2> /dev/null || exit 1
 sort ${duds}.verbose > ${duds}.verbose.tmp
 mv -f ${duds}.verbose.tmp ${duds}.verbose
 cut -f 1 -d \| ${duds}.verbose > ${duds}

Modified: projects/portbuild/scripts/makeindex
==============================================================================
--- projects/portbuild/scripts/makeindex	Tue Apr 26 08:18:00 2011	(r221056)
+++ projects/portbuild/scripts/makeindex	Tue Apr 26 08:18:01 2011	(r221057)
@@ -16,18 +16,18 @@ export INDEX_JOBS=6
 pb=/var/portbuild
 
 usage () {
-  echo "usage: makeindex arch branch buildid"
+  echo "usage: makeindex arch branch buildid [target]"
   exit 1
 }
 
-if [ $# -ne 3 ]; then
+if [ $# -lt 3 ]; then
   usage
 fi
 
 arch=$1
 branch=$2
 buildid=$3
-shift 3
+target=$4
 
 builddir=${pb}/${arch}/${branch}/builds/${buildid}
 
@@ -44,8 +44,17 @@ unset DISPLAY
 # Don't pick up installed packages from the host
 export LOCALBASE=/nonexistentlocal
 
+if [ -n "$target" ]; then
+  if [ -f "$target" ]; then
+    INDEX_PORTS=$(cat $target | tr '\n' ' ')
+  else
+    echo "File $target doesn't exist. Exiting."
+    exit 1
+  fi
+fi
+
 cd ${PORTSDIR}
-make index
+make index INDEX_PORTS="${INDEX_PORTS}"
 if [ ! -e ${INDEXFILE} ]; then
   echo "makeindex: failed to make ${INDEXFILE}"
   exit 1

Modified: projects/portbuild/scripts/makerestr
==============================================================================
--- projects/portbuild/scripts/makerestr	Tue Apr 26 08:18:00 2011	(r221056)
+++ projects/portbuild/scripts/makerestr	Tue Apr 26 08:18:01 2011	(r221057)
@@ -1,10 +1,10 @@
 #!/bin/sh
 
 usage () {
-  echo "usage: makerestr arch branch buildid"
+  echo "usage: makerestr arch branch buildid [target]"
   exit 1
 }
-if [ $# -ne 3 ]; then
+if [ $# -lt 3 ]; then
   usage
 fi
 
@@ -13,7 +13,7 @@ pb=/var/portbuild
 arch=$1
 branch=$2
 buildid=$3
-shift
+target=$4
 
 . ${pb}/conf/server.conf
 . ${pb}/conf/common.conf
@@ -32,8 +32,20 @@ export LINUXBASE=/nonexistentlinux
 export PKG_DBDIR=/nonexistentpkg
 export PORT_DBDIR=/nonexistentport
 
+RESTR_PORTS=.
+if [ -n "$target" ]; then
+  if [ -f "$target" ]; then
+    RESTR_PORTS=$(cat $target | tr '\n' ' ')
+  else
+    echo "File $target doesn't exist. Exiting."
+    exit 1
+  fi
+fi
+
 cd ${PORTSDIR}
-make -j4 ECHO_MSG=true clean-restricted-list \
-  | sed -e "s!/usr/ports/packages/!${builddir}/packages/!g" \
-  -e "s!/usr/ports/!${builddir}/ports/!g" \
-  > ${builddir}/restricted.sh 2> /dev/null
+(for i in ${RESTR_PORTS}; do
+    cd ${PORTSDIR}/$i
+    make -j4 ECHO_MSG=true clean-restricted-list \
+      | sed -e "s!/usr/ports/packages/!${builddir}/packages/!g" \
+      -e "s!/usr/ports/!${builddir}/ports/!g"
+done) > ${builddir}/restricted.sh 2> /dev/null


More information about the svn-src-projects mailing list