aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlinimon <linimon@FreeBSD.org>2009-11-19 11:25:47 +0800
committerlinimon <linimon@FreeBSD.org>2009-11-19 11:25:47 +0800
commit7f03f627c2db8635148bad48ccea8d807bbab859 (patch)
tree722644b726076b6669c972b92e4fefafc1435e1b
parentc345161bd7508def017331b74ab45d9d1e8ae600 (diff)
downloadfreebsd-ports-gnome-7f03f627c2db8635148bad48ccea8d807bbab859.tar.gz
freebsd-ports-gnome-7f03f627c2db8635148bad48ccea8d807bbab859.tar.zst
freebsd-ports-gnome-7f03f627c2db8635148bad48ccea8d807bbab859.zip
Make the create command more robust by making even more directories
and checking more error results.
-rwxr-xr-xTools/portbuild/scripts/build47
1 files changed, 27 insertions, 20 deletions
diff --git a/Tools/portbuild/scripts/build b/Tools/portbuild/scripts/build
index 32cc9ef80c05..f6c2e09916c5 100755
--- a/Tools/portbuild/scripts/build
+++ b/Tools/portbuild/scripts/build
@@ -42,8 +42,22 @@ do_create() {
arch=$1
branch=$2
buildid=$3
- builddir=$4
- shift 4
+ shift 3
+
+ archdir=${pbab}/builds
+ if [ ! -d ${archdir} ]; then
+ mkdir -p ${archdir} || exit 1
+ chown -R ports-${arch}:portmgr ${archdir}
+ chmod g+w ${archdir}
+ fi
+
+ builddir=$(realpath ${archdir})/${buildid}
+ if [ -d ${builddir} ]; then
+ echo "Can't create ${builddir}, it already exists"
+ exit 1
+ fi
+ # XXX needed?
+ buildenv ${pb} ${arch} ${branch} ${builddir}
mountpoint=${builddir}
newfs=a/portbuild/${arch}/${buildid}
@@ -184,12 +198,13 @@ do_srcupdate_inner() {
echo "Reimaging ZFS src tree on ${builddir}/src"
echo "================================================"
+ strippedbranch=${branch%%-exp}
now=$(now)
srcfs=a/portbuild/${arch}/${buildid}/src
- zfs snapshot a/snap/src-${branch}@${now}
- zfs clone a/snap/src-${branch}@${now} ${srcfs}
+ zfs snapshot a/snap/src-${strippedbranch}@${now}
+ zfs clone a/snap/src-${strippedbranch}@${now} ${srcfs}
zfs set mountpoint=${builddir}/src ${srcfs}
}
@@ -485,7 +500,7 @@ fi
# Unprivileged commands
case "$cmd" in
list)
- do_list ${arch} ${branch} $@
+ do_list ${arch} ${branch} $@ || exit 1
;;
create)
# XXX some way to avoid the latest/previous dance?
@@ -495,52 +510,44 @@ case "$cmd" in
buildid=${buildid%/}
fi
- # note: the directory must not exist yet
- builddir=$(realpath ${pbab}/builds)/${buildid}
- if [ -d ${builddir} ]; then
- echo "Can't create ${builddir}, it already exists"
- exit 1
- fi
- buildenv ${pb} ${arch} ${branch} ${builddir}
-
- proxy_root create ${arch} ${branch} ${buildid} ${builddir} $@
+ proxy_root create ${arch} ${branch} ${buildid} $@ || exit 1
;;
clone)
if [ -z "${buildid}" ]; then
usage
fi
- proxy_root clone ${arch} ${branch} ${buildid} ${builddir} $@
+ proxy_root clone ${arch} ${branch} ${buildid} ${builddir} $@ || exit 1
;;
portsupdate)
if [ -z "${buildid}" ]; then
usage
fi
- proxy_root portsupdate ${arch} ${branch} ${buildid} ${builddir} $@
+ proxy_root portsupdate ${arch} ${branch} ${buildid} ${builddir} $@ || exit 1
;;
srcupdate)
if [ -z "${buildid}" ]; then
usage
fi
- proxy_root srcupdate ${arch} ${branch} ${buildid} ${builddir} $@
+ proxy_root srcupdate ${arch} ${branch} ${buildid} ${builddir} $@ || exit 1
;;
cleanup)
if [ -z "${buildid}" ]; then
usage
fi
# builddir may be null if cleaning up a destroyed build
- proxy_user cleanup ${arch} ${branch} ${buildid} "${builddir}" $@
+ proxy_user cleanup ${arch} ${branch} ${buildid} "${builddir}" $@ || exit 1
;;
upload)
if [ -z "${buildid}" ]; then
usage
fi
- proxy_user upload ${arch} ${branch} ${buildid} ${builddir} $@
+ proxy_user upload ${arch} ${branch} ${buildid} ${builddir} $@ || exit 1
;;
destroy)
if [ -z "${buildid}" ]; then
usage
fi
- proxy_root destroy ${arch} ${branch} ${buildid} ${builddir} $@
+ proxy_root destroy ${arch} ${branch} ${buildid} ${builddir} $@ || exit 1
;;
*)
echo "build: invalid command: $cmd"