From: Matthew Dillon Date: Fri, 24 Aug 2012 04:53:28 +0000 (-0700) Subject: fastbulk - Exit w/success on more conditions X-Git-Tag: v3.2.0~271 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/853176ea5a5da3f0eff766af4976c5ba862e0b58 fastbulk - Exit w/success on more conditions * If the binary package build succeeds but the pkg_add fails it is likely due to an install conflict. Exit w/success for this case (since our goal is to generate the binary package, we succeeded!). * Do an early check to see if the binary package has already been built and exit immediately if it has. --- diff --git a/test/fastbulk/dobuild b/test/fastbulk/dobuild index 55f1bea..1353a32 100755 --- a/test/fastbulk/dobuild +++ b/test/fastbulk/dobuild @@ -4,6 +4,8 @@ # into a particular pkgsrc directory and wants us to build it. # The script is run as /tmp/track/dobuild +set logname = "$argv[1]" + # We do not want to interfere with builds of other versions # of the same package, use a temporary lock file to prevent a # conflict. @@ -11,6 +13,20 @@ if ( $#argv == 1 ) then set pkgwild = "`bmake show-var VARNAME=PKGWILDCARD`.lck" set pkgname = "`bmake show-var VARNAME=PKGNAME`" + + if ( -f /usr/pkgsrc/packages/All/${pkgname}.tgz ) then + if ( -f /tmp/logs/good/$logname ) then + rm -f /tmp/logs/run/$logname + echo "FASTBULK QUICK ${logname}: `date`" \ + >> /tmp/logs/good/$logname + echo "FASTBULK: Package already exists, will not build" \ + >> /tmp/logs/good/$logname + else + echo "FASTBULK: Package already exists, will not build" + endif + exit 0 + endif + mkdir -p /tmp/track/locks echo "FASTBULK START ${argv[1]}: `date`" lockf "/tmp/track/locks/$pkgwild" /tmp/track/dobuild ${argv[1]} "$pkgwild" @@ -29,7 +45,6 @@ endif # interfere with the build. # set pkgname = "`bmake show-var VARNAME=PKGNAME`" -set logname = "$argv[1]" set pkgwild = "$argv[2]" unsetenv PKG_PATH @@ -106,7 +121,16 @@ if ( $status == 0 ) then setenv PKG_PATH /usr/pkgsrc/packages/All echo "pkg_add -f ${pkgname}" pkg_add -f ${pkgname} - exit $status + if ( $status != 0 ) then + if ( -f ${PKG_PATH}/${pkgname}.tgz ) then + echo "FASTBULK WARNING: Cannot install due to probable conflicts" + echo " but the binary package DID build." + echo " Exiting w/code 0 to mark as successful." + else + exit 1 + endif + endif + exit 0 endif # comment this bmake out if you want to keep the work dir