[PC-BSD Commits] r12942 - pcbsd/current/src-sh/pbi-manager
svn at pcbsd.org
svn at pcbsd.org
Wed Sep 21 12:44:53 PDT 2011
Author: kris
Date: 2011-09-21 12:44:53 -0700 (Wed, 21 Sep 2011)
New Revision: 12942
Modified:
pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:
Update to the pbi_autobuild command, now in a modules pbi.conf file we can set the PBI_AB_PRIORITY variable
to a number and that number is used to determine the PBIs priority in the build. Also bumping the ports
PBI_BUILDKEY will schedule a PBI for rebuilding immediately.
Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager 2011-09-21 18:17:26 UTC (rev 12941)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager 2011-09-21 19:44:53 UTC (rev 12942)
@@ -1444,7 +1444,7 @@
fi
PBI_PROGVERSION="${PORTVER}"
- if [ -n "${PBI_PROGVERSION}" ] ; then
+ if [ -z "${PBI_PROGVERSION}" ] ; then
echo "Warning: Unable to set PBI_PROGVERSION with:"
echo "make -C ${PORTSDIR}/${PBI_MAKEPORT} -V DISTVERSION"
fi
@@ -5180,18 +5180,30 @@
cd "${PBI_AB_CONFDIR}"
init_tmpdir
-
- for pbi in `find . -type f -name "${PBI_CONFFILE}" | grep -v '\.svn' | sort`
+
+ # Get this runs timestamp
+ PBI_AB_TIMESTAMP=`date | md5`
+
+ while
+ z=1
do
+ AB_FOUND="0"
+ unset CUR_PRIORITY_PBI CUR_WORKING_PBI
+
+ for pbi in `find . -type f -name "${PBI_CONFFILE}" | grep -v '\.svn' | sort`
+ do
# Figure out the target port for this build
- unset PBI_MAKEPORT PBI_BUILDKEY PBI_PROGVERSION PBI_REQUIRESROOT PBI_PROGNAME PBI_PROGWEB PBI_PROGAUTHOR PBI_PROGICON PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS PBI_EXCLUDELIST
+ unset PBI_MAKEPORT PBI_BUILDKEY PBI_PROGVERSION PBI_REQUIRESROOT PBI_PROGNAME PBI_PROGWEB PBI_PROGAUTHOR PBI_PROGICON PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS PBI_EXCLUDELIST PBI_AB_PRIORITY
. ${pbi}
+ # If we have a PBI already and this one has no version we can continue
+ if [ -z "${PBI_AB_PRIORITY}" -a ! -z "${CUR_WORKING_PBI}" ] ; then continue ; fi
+
_cd=$(dirname $pbi | sed 's|./||')
-
if [ -z "${PBI_MAKEPORT}" ] ; then
PBI_MAKEPORT=$(dirname $pbi | sed 's|./||')
fi
+
if [ ! -d "${PORTSDIR}/${PBI_MAKEPORT}" ] ; then
echo "Skipping invalid port ${PORTSDIR}/${PBI_MAKEPORT}"
continue
@@ -5200,21 +5212,65 @@
# Check if this port can be built on this architecture
check_port_compat_arch "${PORTSDIR}/${PBI_MAKEPORT}"
if [ "$?" = "1" ] ; then
- echo "Incompatiable port arch: ${PORTSDIR}/${PBI_MAKEPORT}"
+ #echo "Incompatiable port arch: ${PORTSDIR}/${PBI_MAKEPORT}"
continue
fi
- check_ab_needed "$PBI_MAKEPORT" "${PBI_BUILDKEY}" "$_cd"
+ check_ab_needed "$PBI_MAKEPORT" "${PBI_BUILDKEY}" "$_cd" "$PBI_AB_TIMESTAMP"
if [ "$?" = "0" ] ; then
- start_ext_ab "$PBI_MAKEPORT" \
- "${PBI_BUILDKEY}" "${PBI_PROGVERSION}" \
- "${_cd}" "${PBI_AB_OUTDIR}"
+ AB_FOUND="1"
- else
- echo "${PBI_MAKEPORT} is up to date"
+ # Check the priority of this PBI, see if it rises to the top
+ if [ -z "${CUR_PRIORITY_PBI}" ] ; then
+ CUR_WORKING_PBI="${pbi}"
+ if [ -z "$PBI_AB_PRIORITY" ] ; then
+ CUR_PRIORITY_PBI="0"
+ else
+ CUR_PRIORITY_PBI="$PBI_AB_PRIORITY"
+ fi
+ continue
+ fi
+
+ # No priority set, keep the previous build
+ if [ -z "${PBI_AB_PRIORITY}" ] ; then continue ; fi
+
+ if [ $CUR_PRIORITY_PBI -lt $PBI_AB_PRIORITY ] ; then
+ CUR_WORKING_PBI="${pbi}"
+ CUR_PRIORITY_PBI="$PBI_AB_PRIORITY"
+ continue
+ fi
+
+ continue
fi
- done
+ done
+
+ # We have something to build lets do it!
+ if [ "$AB_FOUND" = "1" ] ; then
+ pbi="$CUR_WORKING_PBI"
+ unset PBI_MAKEPORT PBI_BUILDKEY PBI_PROGVERSION PBI_REQUIRESROOT PBI_PROGNAME PBI_PROGWEB PBI_PROGAUTHOR PBI_PROGICON PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS PBI_EXCLUDELIST PBI_AB_PRIORITY
+ . ${pbi}
+
+ _cd=$(dirname $pbi | sed 's|./||')
+ if [ -z "${PBI_MAKEPORT}" ] ; then
+ PBI_MAKEPORT=$(dirname $pbi | sed 's|./||')
+ fi
+
+ echo "Starting build of: $pbi - Priority: $CUR_PRIORITY_PBI"
+
+ # Start the build now
+ start_ext_ab "$PBI_MAKEPORT" \
+ "${PBI_BUILDKEY}" "${PBI_PROGVERSION}" \
+ "${_cd}" "${PBI_AB_OUTDIR}" "${PBI_AB_TIMESTAMP}"
+
+ echo " "
+
+ else
+ # If no builds left, we are done!
+ break
+ fi
+ done
+
}
# Prune any outdir files which don't have matching modules
@@ -5245,6 +5301,7 @@
_pv="${3}"
_cd="${4}"
_od="${5}/${_cd}"
+ local _abkey="$6"
_flags=""
_flags="-c ${_cd} -d ${PORTSDIR} -o ${_od} --delbuild"
if [ ! -z "${PBI_AB_SSLPRIVKEY}" ] ; then
@@ -5254,11 +5311,21 @@
unset PBI_PROGVERSION
get_pbi_progversion
- echo "Starting build of ${_mp} - ${_pv}"
+ #echo "Starting build of ${_mp} - ${_pv}"
echo "pbi_makeport ${_flags} ${_mp}"
if [ ! -d "${_od}" ] ; then mkdir -p "${_od}" ; fi
+ # Save the autobuild hash key
+ echo "$_abkey" > ${_od}/.abkey
+
+ # Save the build key for this PBI
+ if [ ! -z "$_bk" ] ; then
+ echo "$_bk" > "${_od}/pbi-buildkey"
+ else
+ echo "__NONE__" > "${_od}/pbi-buildkey"
+ fi
+
# Clean old log files
if [ -e "${_od}/build.log" ] ; then
rm "${_od}/build.log"
@@ -5285,11 +5352,6 @@
if [ "$?" = "0" ] ; then
echo "$PBI_PROGVERSION" > "${_od}/pbi-version"
- if [ ! -z "$_bk" ] ; then
- echo "$_bk" > "${_od}/pbi-buildkey"
- else
- echo "__NONE__" > "${_od}/pbi-buildkey"
- fi
echo "OK" > "${_od}/pbi-result"
# Save the mdate file
@@ -5711,36 +5773,47 @@
_port="$1"
_bk="$2"
_cd="$3"
+ local _abkey="$4"
unset PBI_PROGVERSION
get_pbi_progversion
- echo "Checking $_port for rebuild in ${PBI_AB_OUTDIR}/$_cd with key of $_bk"
+ # Check PBI_BUILDKEY, see if we have a manual rebuild triggered
+ if [ -e "${PBI_AB_OUTDIR}/${_cd}/pbi-buildkey" ] ; then
+ if [ "`cat ${PBI_AB_OUTDIR}/${_cd}/pbi-buildkey`" != "$_bk" \
+ -a ! -z "${_bk}" ]
+ then echo "BUILDKEY bump, rebuild triggered." ; return 0 ; fi
+ fi
+ # Make sure this PBI hasn't already failed during this run
+ if [ -e "${PBI_AB_OUTDIR}/${_cd}/.abkey" ] ; then
+ if [ "`cat ${PBI_AB_OUTDIR}/${_cd}/.abkey`" = "$_abkey" ] ; then
+ return 1
+ fi
+ fi
+
+ #echo "Checking $_port for rebuild in ${PBI_AB_OUTDIR}/$_cd with key of $_bk"
+
# See if we have an existing PBI
ls ${PBI_AB_OUTDIR}/${_cd}/*.pbi >/dev/null 2>/dev/null
- if [ "${?}" != "0" ]; then echo "No existing PBI" ; return 0 ; fi
+ if [ "${?}" != "0" ]; then
+ #echo "No existing PBI"
+ return 0
+ fi
# See if we have a saved version
if [ ! -e "${PBI_AB_OUTDIR}/${_cd}/pbi-version" ]; then
- echo "No saved pbi-version"
+ #echo "No saved pbi-version"
return 0
fi
# See if the version is different now
oldVersion=`cat ${PBI_AB_OUTDIR}/${_cd}/pbi-version`
if [ "$oldVersion" != "$PBI_PROGVERSION" ]; then
- echo "Version bump: $oldVersion -> $PBI_PROGVERSION"
+ echo "$_port version bump: $oldVersion -> $PBI_PROGVERSION"
return 0
fi
- # Lastly check PBI_BUILDKEY, see if we have a manual rebuild triggered
- if [ -e "${PBI_AB_OUTDIR}/${_cd}/pbi-buildkey" ] ; then
- if [ "`cat ${PBI_AB_OUTDIR}/${_cd}/pbi-buildkey`" != "$_bk" \
- -a ! -z "${_bk}" ]
- then echo "BUILDKEY bump, rebuild triggered." ; return 0 ; fi
- fi
-
return 1
}
More information about the Commits
mailing list