summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Schröter <adrian@suse.de>2014-10-24 11:43:57 +0200
committerAdrian Schröter <adrian@suse.de>2014-10-24 12:21:06 +0200
commitdafe67336672360deec05588173653813bedbcfc (patch)
treece8d31295bba41d2f7a8560ae002dfb362c8dd64
parentc1860ce9b72f4d661f62f0d838536e26464da84b (diff)
- new chroot does not take / anymore but just fails.
This is fixing Ubuntu 14.10 builds (and hopefully breaks nothing else)
-rwxr-xr-xbuild15
-rw-r--r--build-pkg-arch4
-rw-r--r--build-pkg-deb12
-rw-r--r--build-pkg-rpm34
-rw-r--r--build-recipe-arch2
-rw-r--r--build-recipe-dsc10
-rw-r--r--build-recipe-kiwi22
-rw-r--r--build-recipe-livebuild12
-rw-r--r--build-recipe-mock6
-rw-r--r--build-recipe-spec14
-rw-r--r--build-vm1
-rwxr-xr-xinit_buildsystem25
12 files changed, 82 insertions, 75 deletions
diff --git a/build b/build
index 9052369..cdba8f8 100755
--- a/build
+++ b/build
@@ -35,6 +35,8 @@ test -z "$BUILD_DIR" && BUILD_DIR=/usr/lib/build
test -z "$BUILD_ROOT" && BUILD_ROOT=/var/tmp/build-root
test -z "$CONFIG_DIR" && CONFIG_DIR="$BUILD_DIR/configs"
+export CHROOT="chroot $BUILD_ROOT"
+
export BUILD_ARCH BUILD_HOST_ARCH BUILD_ROOT BUILD_RPMS BUILD_DIR BUILD_DEBUG
export BUILD_DIST
@@ -462,7 +464,7 @@ setupicecream() {
echo "create-env not found"
return 1
fi
- chroot $BUILD_ROOT bash -c "cd /var/run/icecream; $createenv" || cleanup_and_exit 1
+ $CHROOT bash -c "cd /var/run/icecream; $createenv" || cleanup_and_exit 1
icecc_vers=(`shopt -s nullglob; echo $BUILD_ROOT/var/run/icecream/*.tar.{bz2,gz}`)
icecc_vers=${icecc_vers//$BUILD_ROOT/}
else
@@ -559,7 +561,7 @@ create_baselibs() {
echo "... creating baselibs$whichone"
while read line
do
- chroot $BUILD_ROOT su -c "$mkbaselibs $BASELIBS_GLOBAL $BASELIBS_CFG $line" - $BUILD_USER || cleanup_and_exit 1
+ $CHROOT su -c "$mkbaselibs $BASELIBS_GLOBAL $BASELIBS_CFG $line" - $BUILD_USER || cleanup_and_exit 1
done < <(IFS=$'\n'; echo "${pkgs[*]#$BUILD_ROOT}" | xargs -n 1024)
rm -rf "$BUILD_ROOT/.mkbaselibs"
}
@@ -595,7 +597,10 @@ become_root_or_fail() {
mkdir_build_root() {
# strip trailing slash
- test "$BUILD_ROOT" != / && BUILD_ROOT="${BUILD_ROOT%/}"
+ if test "$BUILD_ROOT" != /; then
+ BUILD_ROOT="${BUILD_ROOT%/}"
+ export CHROOT="chroot $BUILD_ROOT"
+ fi
if test -d "$BUILD_ROOT" ; then
# check if it is owned by root
if test -z "$RUNNING_IN_VM" -a \! -O "$BUILD_ROOT" -a "`stat -c %u $BUILD_ROOT`" -ne 0 ; then
@@ -752,6 +757,7 @@ while test -n "$1"; do
-root)
needarg
BUILD_ROOT="$ARG"
+ export CHROOT="chroot $BUILD_ROOT"
shift
;;
-cachedir)
@@ -950,6 +956,7 @@ expand_recipe_directories
if test -n "$LIST_STATE" ; then
BUILD_ROOT=`mktemp -d /var/tmp/build-list-state-XXXXXX`
+ export CHROOT="chroot $BUILD_ROOT"
test -d "$BUILD_ROOT" || cleanup_and_exit 3
RECIPEFILE=$RECIPEFILES # only one specified anyways
if test "$RECIPEFILE" != "${RECIPEFILE%.src.rpm}" ; then
@@ -1142,7 +1149,7 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
#
BUILD_USER=abuild
if test -x $BUILD_ROOT/bin/rpm ; then
- SUSE_VERSION=`chroot $BUILD_ROOT /bin/rpm --eval '%{?suse_version}' 2>/dev/null`
+ SUSE_VERSION=`$CHROOT /bin/rpm --eval '%{?suse_version}' 2>/dev/null`
test -n "$SUSE_VERSION" -a "${SUSE_VERSION:-0}" -le 1020 && BUILD_USER=root
fi
if test "$BUILD_USER" = abuild ; then
diff --git a/build-pkg-arch b/build-pkg-arch
index 3b0f90e..dcbdca5 100644
--- a/build-pkg-arch
+++ b/build-pkg-arch
@@ -53,7 +53,7 @@ pkg_cumulate_arch() {
pkg_install_arch() {
# -d -d disables deps checking
- ( cd $BUILD_ROOT && chroot $BUILD_ROOT pacman -U --force -d -d --noconfirm .init_b_cache/$PKG.$PSUF 2>&1 || touch $BUILD_ROOT/exit ) | \
+ ( $CHROOT pacman -U --force -d -d --noconfirm /.init_b_cache/$PKG.$PSUF 2>&1 || touch $BUILD_ROOT/exit ) | \
perl -ne '$|=1;/^(warning: could not get filesystem information for |loading packages|looking for inter-conflicts|Targets |Total Installed Size: |Net Upgrade Size: |Proceed with installation|checking package integrity|loading package files|checking for file conflicts|checking keyring|Packages \(\d+\):|:: Proceed with installation|checking available disk space|installing |upgrading |warning:.*is up to date -- reinstalling|Optional dependencies for| )/||/^$/||print'
}
@@ -73,7 +73,7 @@ pkg_preinstall_arch() {
pkg_runscripts_arch() {
if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post" ; then
echo "running $PKG postinstall script"
- ( cd $BUILD_ROOT && chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.post" < /dev/null )
+ ( $CHROOT "/.init_b_cache/scripts/$PKG.post" < /dev/null )
rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post"
fi
}
diff --git a/build-pkg-deb b/build-pkg-deb
index 9e3f679..c6c4702 100644
--- a/build-pkg-deb
+++ b/build-pkg-deb
@@ -39,7 +39,7 @@ pkg_initdb_deb() {
rm -f $BUILD_ROOT/.init_b_cache/dpkg.deb
cp $BUILD_ROOT/.init_b_cache/rpms/dpkg.deb $BUILD_ROOT/.init_b_cache/dpkg.deb || cleanup_and_exit 1
fi
- chroot $BUILD_ROOT dpkg -i --force all .init_b_cache/dpkg.deb >/dev/null 2>&1
+ $CHROOT dpkg -i --force all .init_b_cache/dpkg.deb >/dev/null 2>&1
}
pkg_get_installed_deb() {
@@ -55,7 +55,7 @@ pkg_set_packageid_deb() {
pkg_install_deb() {
export DEBIAN_FRONTEND=noninteractive
export DEBIAN_PRIORITY=critical
- ( chroot $BUILD_ROOT dpkg --install --force all .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \
+ ( $CHROOT dpkg --install --force all /.init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \
perl -ne '$|=1;/^(Configuration file|Installing new config file|Selecting previously deselected|Selecting previously unselected|\(Reading database|Unpacking |Setting up|Creating config file|Preparing to replace dpkg)/||/^$/||print'
check_exit
# ugly workaround for upstart system. some packages (procps) try
@@ -89,9 +89,9 @@ pkg_finalize_deb() {
# configure all packages after complete installation, not for each package like rpm does
# We need to run this twice, because of cyclic dependencies as it does not succeed on most
# debian based distros in the first attempt.
- if ! chroot $BUILD_ROOT dpkg --configure --pending 2>&1; then
+ if ! $CHROOT dpkg --configure --pending 2>&1; then
echo "first configure attempt failed, trying again..."
- chroot $BUILD_ROOT dpkg --configure --pending 2>&1 || cleanup_and_exit 1
+ $CHROOT dpkg --configure --pending 2>&1 || cleanup_and_exit 1
fi
}
@@ -117,12 +117,12 @@ pkg_runscripts_deb() {
fi
if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" ; then
echo "running $PKG preinstall script"
- chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.pre" install < /dev/null
+ $CHROOT "/.init_b_cache/scripts/$PKG.pre" install < /dev/null
rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre"
fi
if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post" ; then
echo "running $PKG postinstall script"
- chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.post" configure '' < /dev/null
+ $CHROOT "/.init_b_cache/scripts/$PKG.post" configure '' < /dev/null
rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post"
fi
}
diff --git a/build-pkg-rpm b/build-pkg-rpm
index c64fc93..bd5b581 100644
--- a/build-pkg-rpm
+++ b/build-pkg-rpm
@@ -32,20 +32,20 @@ pkg_initdb_rpm() {
# rpm v5 does not have initdb
if ! test -e $BUILD_ROOT/usr/lib/rpm/cpuinfo.yaml ; then
if test -x $BUILD_ROOT/usr/bin/rpmdb ; then
- chroot $BUILD_ROOT /usr/bin/rpmdb --initdb || cleanup_and_exit 1
+ $CHROOT /usr/bin/rpmdb --initdb || cleanup_and_exit 1
else
- chroot $BUILD_ROOT rpm --initdb || cleanup_and_exit 1
+ $CHROOT rpm --initdb || cleanup_and_exit 1
fi
fi
# hack: add nofsync to db config to speed up install
mkdir -p $BUILD_ROOT/root
- DBI_OTHER=`chroot $BUILD_ROOT rpm --eval '%{?__dbi_other}'`
+ DBI_OTHER=`$CHROOT rpm --eval '%{?__dbi_other}'`
echo "%__dbi_other $DBI_OTHER nofsync" > $BUILD_ROOT/.rpmmacros
echo "%__dbi_other $DBI_OTHER nofsync" > $BUILD_ROOT/root/.rpmmacros
}
pkg_get_installed_rpm() {
- chroot $BUILD_ROOT rpm -qa --qf "%{NAME} $RPMIDFMT" | (
+ $CHROOT rpm -qa --qf "%{NAME} $RPMIDFMT" | (
while read pp ii; do
echo "$ii" > "$BUILD_ROOT/.init_b_cache/alreadyinstalled/$pp"
done
@@ -56,7 +56,7 @@ pkg_get_installed_rpm() {
}
pkg_erase_rpm() {
- chroot $BUILD_ROOT rpm --nodeps -e $PKG 2>&1 | {
+ $CHROOT rpm --nodeps -e $PKG 2>&1 | {
local retry
while read line; do
case "$line" in
@@ -71,7 +71,7 @@ pkg_erase_rpm() {
done
if test -n "$retry" ; then
echo "re-try deleting $PKG using --noscripts"
- chroot $BUILD_ROOT rpm --nodeps --noscripts -e $PKG || true
+ $CHROOT rpm --nodeps --noscripts -e $PKG || true
fi
}
}
@@ -91,7 +91,7 @@ rpm_init_cumulate() {
CUMULATED_PIDS=()
CUMULATED_HMD5=()
DO_CUMULATE=
- typeset -ri suse_version=$(chroot $BUILD_ROOT rpm --eval '%{?suse_version}' 2>/dev/null)
+ typeset -ri suse_version=$($CHROOT rpm --eval '%{?suse_version}' 2>/dev/null)
if ((suse_version > 1220)) ; then
DO_CUMULATE=true
fi
@@ -102,7 +102,7 @@ pkg_set_packageid_rpm() {
}
pkg_verify_installed_rpm() {
- chroot $BUILD_ROOT rpm --verify $PKG 2>&1 | tee $TMPFILE
+ $CHROOT rpm --verify $PKG 2>&1 | tee $TMPFILE
if grep ^missing $TMPFILE > /dev/null ; then
return 1
fi
@@ -118,7 +118,7 @@ pkg_cumulate_rpm() {
done
fi
let cumulate++
- CUMULATED_LIST[$cumulate]=".init_b_cache/$PKG.rpm"
+ CUMULATED_LIST[$cumulate]="/.init_b_cache/$PKG.rpm"
CUMULATED_PIDS[$cumulate]="$PKGID"
CUMULATED_HMD5[$cumulate]="$PKG_HDRMD5"
return 0
@@ -135,8 +135,8 @@ pkg_install_rpm() {
test -e "$i" && ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --justdb"
done
fi
- ( chroot $BUILD_ROOT rpm --ignorearch --nodeps -U --oldpackage --ignoresize $RPMCHECKOPTS \
- $ADDITIONAL_PARAMS .init_b_cache/$PKG.rpm 2>&1 || \
+ ( $CHROOT rpm --ignorearch --nodeps -U --oldpackage --ignoresize $RPMCHECKOPTS \
+ $ADDITIONAL_PARAMS /.init_b_cache/$PKG.rpm 2>&1 || \
touch $BUILD_ROOT/exit ) | \
grep -v "^warning:.*saved as.*rpmorig$"
}
@@ -151,8 +151,8 @@ pkg_finalize_rpm() {
rm -f $BUILD_ROOT/${CUMULATED_LIST[$num]}
cp $BUILD_ROOT/.init_b_cache/rpms/$PKG $BUILD_ROOT/${CUMULATED_LIST[$num]} || cleanup_and_exit 1
done > $BUILD_ROOT/.init_b_cache/manifest
- chroot $BUILD_ROOT rpm --ignorearch --nodeps -Uh --oldpackage --ignoresize --verbose $RPMCHECKOPTS \
- $ADDITIONAL_PARAMS .init_b_cache/manifest 2>&1 || touch $BUILD_ROOT/exit
+ $CHROOT rpm --ignorearch --nodeps -Uh --oldpackage --ignoresize --verbose $RPMCHECKOPTS \
+ $ADDITIONAL_PARAMS /.init_b_cache/manifest 2>&1 || touch $BUILD_ROOT/exit
for ((num=0; num<=cumulate; num++)) ; do
rm -f $BUILD_ROOT/${CUMULATED_LIST[$num]}
done
@@ -199,21 +199,21 @@ pkg_preinstall_rpm() {
# hack for rpm erasures
if test -d "$BUILD_ROOT/installed-pkg" ; then
# call for rpm-4.x and not rpm-devel
- test -z "${PKG##rpm-[0-9]*}" && chroot $BUILD_ROOT rpm --rebuilddb
+ test -z "${PKG##rpm-[0-9]*}" && $CHROOT rpm --rebuilddb
# also exec for exchanged rpm ! naming is rpm-x86-<target>-<ver>
- test -z "${PKG##rpm-x86-*[0-9]*}" && chroot $BUILD_ROOT rpm --rebuilddb
+ test -z "${PKG##rpm-x86-*[0-9]*}" && $CHROOT rpm --rebuilddb
fi
}
pkg_runscripts_rpm() {
if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" ; then
echo "running $PKG preinstall script"
- chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.pre" 0
+ $CHROOT sh "/.init_b_cache/scripts/$PKG.pre" 0
rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre"
fi
if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post" ; then
echo "running $PKG postinstall script"
- chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.post" 1
+ $CHROOT sh "/.init_b_cache/scripts/$PKG.post" 1
rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post"
fi
}
diff --git a/build-recipe-arch b/build-recipe-arch
index 2fe6159..19d04c3 100644
--- a/build-recipe-arch
+++ b/build-recipe-arch
@@ -53,5 +53,5 @@ recipe_resultdirs_arch() {
}
_arch_recipe_makepkg() {
- chroot $BUILD_ROOT su -lc "source /etc/profile; cd $TOPDIR/SOURCES && makepkg --config ../makepkg.conf $*" $BUILD_USER
+ $CHROOT su -lc "source /etc/profile; cd $TOPDIR/SOURCES && makepkg --config ../makepkg.conf $*" $BUILD_USER
}
diff --git a/build-recipe-dsc b/build-recipe-dsc
index 8b9d22e..3b8cbeb 100644
--- a/build-recipe-dsc
+++ b/build-recipe-dsc
@@ -59,7 +59,7 @@ recipe_prepare_dsc() {
for DEB_DSCFILE in $BUILD_ROOT/$DEB_SOURCEDIR/*.dsc ; do : ; done
DEB_DSCFILE="${DEB_DSCFILE##*/}"
fi
- chroot $BUILD_ROOT su -c "dpkg-source -x $DEB_SOURCEDIR/$DEB_DSCFILE $TOPDIR/BUILD" - $BUILD_USER
+ $CHROOT su -c "dpkg-source -x $DEB_SOURCEDIR/$DEB_DSCFILE $TOPDIR/BUILD" - $BUILD_USER
}
recipe_build_dsc() {
@@ -79,12 +79,12 @@ recipe_build_dsc() {
fi
if test -n "$RUN_SHELL"; then
- chroot $BUILD_ROOT su -
+ $CHROOT su -
else
- chroot $BUILD_ROOT su -c "cd $TOPDIR/BUILD && $DSC_BUILD_CMD" - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
+ $CHROOT su -c "cd $TOPDIR/BUILD && $DSC_BUILD_CMD" - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
if test "$BUILD_SUCCEEDED" = true -a "$DO_CHECKS" != "false"; then
- DEB_CHANGESFILE=${RECIPEFILE%.dsc}_"$(chroot $BUILD_ROOT su -c 'dpkg-architecture -qDEB_BUILD_ARCH')".changes
- chroot $BUILD_ROOT su -c "which lintian > /dev/null && cd $TOPDIR && echo Running lintian && (set -x && lintian -i $DEB_SOURCEDIR/$DEB_DSCFILE)" - $BUILD_USER < /dev/null
+ DEB_CHANGESFILE=${RECIPEFILE%.dsc}_"$($CHROOT su -c 'dpkg-architecture -qDEB_BUILD_ARCH')".changes
+ $CHROOT su -c "which lintian > /dev/null && cd $TOPDIR && echo Running lintian && (set -x && lintian -i $DEB_SOURCEDIR/$DEB_DSCFILE)" - $BUILD_USER < /dev/null
fi
fi
diff --git a/build-recipe-kiwi b/build-recipe-kiwi
index 2b46673..7c18460 100644
--- a/build-recipe-kiwi
+++ b/build-recipe-kiwi
@@ -294,7 +294,7 @@ run_suse_isolinux() {
i="${i##*/}"
test "$i" = scripts && continue
test "$i" != "${i%0}" && continue
- chroot $BUILD_ROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$i $TOPDIR/KIWI/$i.iso" - $BUILD_USER
+ $CHROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$i $TOPDIR/KIWI/$i.iso" - $BUILD_USER
done
}
@@ -347,12 +347,12 @@ build_kiwi_appliance() {
for imgtype in $imagetype ; do
echo "running kiwi --prepare for $imgtype..."
# Do not use $BUILD_USER here, since we always need root permissions
- chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1
+ $CHROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1
echo "running kiwi --create for $imgtype..."
mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
- chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1
+ $CHROOT su -c "cd $TOPDIR/SOURCES && kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1
rm -rf "/$TOPDIR/KIWI.bundle"
- if chroot $BUILD_ROOT su -c "kiwi --bundle-build $TOPDIR/KIWI-$imgtype -d /$TOPDIR/KIWI.bundle/ --bundle-id Build$RELEASE" - root < /dev/null; then
+ if $CHROOT su -c "kiwi --bundle-build $TOPDIR/KIWI-$imgtype -d /$TOPDIR/KIWI.bundle/ --bundle-id Build$RELEASE" - root < /dev/null; then
mv "$BUILD_ROOT/$TOPDIR/KIWI.bundle/"* "$BUILD_ROOT/$TOPDIR/KIWI/" || cleanup_and_exit 1
rmdir "$BUILD_ROOT/$TOPDIR/KIWI.bundle"
unset RUN_BUNDLE
@@ -401,7 +401,7 @@ build_kiwi_appliance() {
cp "$imageout.verified" "/$TOPDIR/OTHER/$imageout$buildnum-$imgtype.verified"
fi
EOF
- chroot $BUILD_ROOT su -c "sh -e /kiwi_post.sh" || cleanup_and_exit 1
+ $CHROOT su -c "sh -e /kiwi_post.sh" || cleanup_and_exit 1
rm -f $BUILD_ROOT/kiwi_post.sh
done
}
@@ -430,10 +430,10 @@ recipe_build_kiwi() {
fi
if test "$imagetype" != product -a "$DO_INIT" != "false" ; then
echo "creating repodata for $repo"
- if chroot $BUILD_ROOT createrepo --no-database --simple-md-filenames --help >/dev/null 2>&1 ; then
- chroot $BUILD_ROOT createrepo --no-database --simple-md-filenames "$repo"
+ if $CHROOT createrepo --no-database --simple-md-filenames --help >/dev/null 2>&1 ; then
+ $CHROOT createrepo --no-database --simple-md-filenames "$repo"
else
- chroot $BUILD_ROOT createrepo "$repo"
+ $CHROOT createrepo "$repo"
fi
fi
done
@@ -442,7 +442,7 @@ recipe_build_kiwi() {
for t in $BUILD_ROOT/$TOPDIR/SOURCES/root.tar* ; do
test -f $t || continue
mkdir -p $BUILD_ROOT/$TOPDIR/SOURCES/root
- chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}"
+ $CHROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}"
done
# fix script permissions
@@ -458,7 +458,7 @@ recipe_build_kiwi() {
for t in $r/root.tar* ; do
test -f $t || continue
mkdir -p $r/root
- chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}"
+ $CHROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}"
done
# fix script permissions
chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/images/$r/*.sh 2>/dev/null
@@ -485,7 +485,7 @@ recipe_build_kiwi() {
# Hook for running post kiwi build scripts like QA scripts if installed
if test -x $BUILD_ROOT/usr/lib/build/kiwi_post_run ; then
- chroot $BUILD_ROOT su -c /usr/lib/build/kiwi_post_run || cleanup_and_exit 1
+ $CHROOT su -c /usr/lib/build/kiwi_post_run || cleanup_and_exit 1
fi
}
diff --git a/build-recipe-livebuild b/build-recipe-livebuild
index c9d3566..22012b3 100644
--- a/build-recipe-livebuild
+++ b/build-recipe-livebuild
@@ -72,7 +72,7 @@ createrepo_debian() {
gzip -c9 dists/${DIST}/main/source/Sources \
> dists/${DIST}/main/source/Sources.gz
EOF
- chroot $BUILD_ROOT su -c "sh /.createrepo_debian.tmp.sh" - root
+ $CHROOT su -c "sh /.createrepo_debian.tmp.sh" - root
local RESULT=$?
rm -f $BUILD_ROOT/.createrepo_debian.tmp.sh
[ "${RESULT}" != 0 ] && return
@@ -117,8 +117,8 @@ createrepo_debian() {
# $RECIPEFILE the name of the live-build config tarball
recipe_build_livebuild() {
- local ARCH=$(chroot $BUILD_ROOT su -c "dpkg-architecture -qDEB_BUILD_ARCH")
- local DIST=$(chroot $BUILD_ROOT su -c "lsb_release --codename" | awk '{ print $2 }')
+ local ARCH=$($CHROOT su -c "dpkg-architecture -qDEB_BUILD_ARCH")
+ local DIST=$($CHROOT su -c "lsb_release --codename" | awk '{ print $2 }')
local LIVEBUILD_ROOT="LIVEBUILD_ROOT"
[ -z "${ARCH}" -o -z "${DIST}" ] && cleanup_and_exit 1
@@ -177,7 +177,7 @@ recipe_build_livebuild() {
if [ -x $BUILD_ROOT/usr/lib/build/livebuild_pre_run ] ; then
echo "Running OBS build livebuild_pre_run hook"
- chroot $BUILD_ROOT su -c "/usr/lib/build/livebuild_pre_run" - root \
+ $CHROOT su -c "/usr/lib/build/livebuild_pre_run" - root \
< /dev/null || cleanup_and_exit 1
fi
@@ -187,11 +187,11 @@ recipe_build_livebuild() {
$BUILD_ROOT/.build.livebuild_pre_run
chmod +x $BUILD_ROOT/.build.livebuild_pre_run
echo "Running package livebuild_pre_run hook"
- chroot $BUILD_ROOT su -c "/.build.livebuild_pre_run" - root \
+ $CHROOT su -c "/.build.livebuild_pre_run" - root \
< /dev/null || cleanup_and_exit 1
fi
- chroot $BUILD_ROOT su -c "cd $TOPDIR/$LIVEBUILD_ROOT && lb build" - root \
+ $CHROOT su -c "cd $TOPDIR/$LIVEBUILD_ROOT && lb build" - root \
< /dev/null || cleanup_and_exit 1
# Move created product to destination
diff --git a/build-recipe-mock b/build-recipe-mock
index 3298fce..8851ec2 100644
--- a/build-recipe-mock
+++ b/build-recipe-mock
@@ -33,7 +33,7 @@ recipe_build_mock() {
test -d $BUILD_ROOT/.build.binaries || cleanup_and_exit 1
if test "$DO_INIT" = true -o ! -d "$BUILD_ROOT/.build.binaries/repodata" ; then
echo "creating repository for mock..."
- chroot $BUILD_ROOT createrepo --no-database --basedir /.build.binaries -o /.build.binaries /.build.binaries
+ $CHROOT createrepo --no-database --basedir /.build.binaries -o /.build.binaries /.build.binaries
fi
MOCK_CHROOT_SETUP_CMD="$(queryconfig --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" substitute mock:chroot_setup_cmd)"
test -z "$MOCK_CHROOT_SETUP_CMD" && MOCK_CHROOT_SETUP_CMD="groupinstall buildsys-build"
@@ -64,7 +64,7 @@ recipe_build_mock() {
echo "building src rpm..."
MOCK_INIT_ARG=
test "$DO_INIT" = true || MOCK_INIT_ARG=--no-clean
- if chroot $BUILD_ROOT /usr/bin/mock -r build $MOCK_INIT_ARG --buildsrpm --spec "$TOPDIR/SOURCES/$RECIPEFILE" --sources "$TOPDIR/SOURCES" ; then
+ if $CHROOT /usr/bin/mock -r build $MOCK_INIT_ARG --buildsrpm --spec "$TOPDIR/SOURCES/$RECIPEFILE" --sources "$TOPDIR/SOURCES" ; then
BUILT_SRPM=
for i in "$BUILD_ROOT/var/lib/mock/build/result/"*src.rpm ; do
test -s "$i" && BUILT_SRPM="${i##*/}"
@@ -73,7 +73,7 @@ recipe_build_mock() {
mkdir -p "$BUILD_ROOT/$TOPDIR/SRPMS"
mv "$BUILD_ROOT/var/lib/mock/build/result/$BUILT_SRPM" "$BUILD_ROOT/$TOPDIR/SRPMS/$BUILT_SRPM"
echo "building binary rpms..."
- if chroot $BUILD_ROOT /usr/bin/mock -v -r build --rebuild --no-clean "$TOPDIR/SRPMS/$BUILT_SRPM" ; then
+ if $CHROOT /usr/bin/mock -v -r build --rebuild --no-clean "$TOPDIR/SRPMS/$BUILT_SRPM" ; then
BUILD_SUCCEEDED=true
# move result over to TOPDIR
rm -f "$TOPDIR/SRPMS/$BUILT_SRPM"
diff --git a/build-recipe-spec b/build-recipe-spec
index 94089a7..99fa243 100644
--- a/build-recipe-spec
+++ b/build-recipe-spec
@@ -22,7 +22,7 @@
################################################################
recipe_setup_spec() {
- TOPDIR=`chroot $BUILD_ROOT su -c "rpm --eval '%_topdir'" - $BUILD_USER`
+ TOPDIR=`$CHROOT su -c "rpm --eval '%_topdir'" - $BUILD_USER`
if test -z "$TOPDIR"; then
echo "Error: TOPDIR empty"
cleanup_and_exit 1
@@ -142,9 +142,9 @@ recipe_build_spec() {
chmod 755 $BUILD_ROOT/.build.command
check_exit
if test -n "$RUN_SHELL"; then
- chroot $BUILD_ROOT su -
+ $CHROOT su -
else
- chroot $BUILD_ROOT su -c /.build.command - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
+ $CHROOT su -c /.build.command - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
fi
}
@@ -199,7 +199,7 @@ recipe_run_rpmlint() {
rm -f "$BUILD_ROOT$rpmlint_logfile"
ret=0
mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null
- chroot $BUILD_ROOT su -s /opt/testing/bin/rpmlint "$BUILD_USER" -- \
+ $CHROOT su -s /opt/testing/bin/rpmlint "$BUILD_USER" -- \
--info ${LINT_RPM_FILE_LIST[*]#$BUILD_ROOT} \
${SRPM_FILE_LIST[*]#$BUILD_ROOT} > "$BUILD_ROOT$rpmlint_logfile" || ret=1
cat "$BUILD_ROOT$rpmlint_logfile"
@@ -214,8 +214,8 @@ recipe_compare_oldpackages() {
if test -x "$BUILD_ROOT/usr/lib/build/same-build-result.sh" ; then
echo "... comparing built packages with the former built"
mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null
- if chroot $BUILD_ROOT /usr/lib/build/same-build-result.sh /.build.oldpackages "$TOPDIR/RPMS" "$TOPDIR/SRPMS"; then
- chroot $BUILD_ROOT touch /.build/.same_result_marker
+ if $CHROOT /usr/lib/build/same-build-result.sh /.build.oldpackages "$TOPDIR/RPMS" "$TOPDIR/SRPMS"; then
+ $CHROOT touch /.build/.same_result_marker
# XXX: dirty build service hack. fix bs_worker. Search for
# 'same_result_marker' for traces of a first try to get rid of this
if test -n "$REASON" -a -n "$DISTURL" ; then
@@ -230,6 +230,6 @@ recipe_create_deltarpms() {
if test -x "$BUILD_ROOT/usr/bin/makedeltarpm" -a -x $BUILD_ROOT/usr/lib/build/mkdrpms ; then
echo "... creating delta rpms"
ds=("$BUILD_ROOT/$TOPDIR"/RPMS/* "$BUILD_ROOT$TOPDIR/SRPMS")
- chroot $BUILD_ROOT /usr/lib/build/mkdrpms /.build.oldpackages "${ds[@]#$BUILD_ROOT}"
+ $CHROOT /usr/lib/build/mkdrpms /.build.oldpackages "${ds[@]#$BUILD_ROOT}"
fi
}
diff --git a/build-vm b/build-vm
index fed7d00..40a7d31 100644
--- a/build-vm
+++ b/build-vm
@@ -427,6 +427,7 @@ vm_detect_2nd_stage() {
test -n "$VM_WATCHDOG" -a -z "$PERSONALITY_SET" && echo "### WATCHDOG MARKER END ###"
echo "2nd stage started in virtual machine"
BUILD_ROOT=/
+ unset CHROOT
BUILD_DIR=/.build
echo "machine type: `uname -m`"
if test "$PERSONALITY" != 0 -a -z "$PERSONALITY_SET" ; then
diff --git a/init_buildsystem b/init_buildsystem
index f61df56..ec1d862 100755
--- a/init_buildsystem
+++ b/init_buildsystem
@@ -37,7 +37,6 @@ export YAST_IS_RUNNING=instsys
# slurp in package binary support
. "$BUILD_DIR/build-pkg"
-
# need to restore build root owner for non-root builds
browner=0
definesnstuff=()
@@ -209,7 +208,7 @@ preinstall() {
}
run_pkg_scripts() {
- chroot $BUILD_ROOT /sbin/ldconfig 2>/dev/null
+ $CHROOT /sbin/ldconfig 2>/dev/null
for PKG in $PACKAGES_TO_RUNSCRIPTS ; do
pkg_runscripts
check_exit
@@ -843,7 +842,7 @@ done
rm -rf "$BUILD_ROOT/installed-pkg"
mkdir -p "$BUILD_ROOT/installed-pkg"
-test -x $BUILD_ROOT/sbin/ldconfig && chroot $BUILD_ROOT /sbin/ldconfig 2>&1
+test -x $BUILD_ROOT/sbin/ldconfig && $CHROOT /sbin/ldconfig 2>&1
MAIN_LIST="$PACKAGES_TO_INSTALL"
progress_setup MAIN_LIST
@@ -963,12 +962,12 @@ done
echo now finalizing build dir...
if test -x $BUILD_ROOT/sbin/ldconfig ; then
- CHROOT_RETURN="`chroot $BUILD_ROOT /sbin/ldconfig 2>&1`"
+ CHROOT_RETURN="`$CHROOT /sbin/ldconfig 2>&1`"
case "$CHROOT_RETURN" in
*warning:*)
- chroot $BUILD_ROOT /sbin/ldconfig
+ $CHROOT /sbin/ldconfig
echo
- echo chroot $BUILD_ROOT /sbin/ldconfig
+ echo $CHROOT /sbin/ldconfig
echo
echo "$CHROOT_RETURN"
echo
@@ -980,7 +979,7 @@ if test -x $BUILD_ROOT/sbin/ldconfig ; then
fi
if test -x $BUILD_ROOT/usr/sbin/Check && ! grep -q "/usr/sbin/Check is obsolete" $BUILD_ROOT/usr/sbin/Check ; then
- chroot $BUILD_ROOT /usr/sbin/Check
+ $CHROOT /usr/sbin/Check
fi
mkdir -p $BUILD_ROOT/var/adm/packages
@@ -988,24 +987,24 @@ touch $BUILD_ROOT/var/adm/packages
if test -x $BUILD_ROOT/sbin/SuSEconfig ; then
if grep norestarts $BUILD_ROOT/sbin/SuSEconfig > /dev/null ; then
- chroot $BUILD_ROOT /sbin/SuSEconfig --norestarts --force
+ $CHROOT /sbin/SuSEconfig --norestarts --force
else
- chroot $BUILD_ROOT /sbin/SuSEconfig --force
+ $CHROOT /sbin/SuSEconfig --force
fi
fi
if test -x $BUILD_ROOT/usr/X11R6/bin/switch2mesasoft ; then
- chroot $BUILD_ROOT /usr/X11R6/bin/switch2mesasoft
+ $CHROOT /usr/X11R6/bin/switch2mesasoft
fi
for PROG in /usr/bin/TeX/texhash /usr/bin/texhash ; do
test -x $BUILD_ROOT/$PROG && \
- chroot $BUILD_ROOT bash -c ". /etc/profile ; $PROG"
+ $CHROOT bash -c ". /etc/profile ; $PROG"
done
if test -e $BUILD_ROOT/usr/share/zoneinfo/UTC ; then
for PROG in /usr/sbin/zic /usr/bin/zic /bin/zic /sbin/zic ; do
- test -x $BUILD_ROOT/$PROG && chroot $BUILD_ROOT bash -c "$PROG -l $(readlink -f /usr/share/zoneinfo/UTC)"
+ test -x $BUILD_ROOT/$PROG && $CHROOT bash -c "$PROG -l $(readlink -f /usr/share/zoneinfo/UTC)"
done
fi
@@ -1022,7 +1021,7 @@ fi
# XXX: still needed?
if test -x $BUILD_ROOT/bin/rpm -a ! -f $BUILD_ROOT/var/lib/rpm/packages.rpm -a ! -f $BUILD_ROOT/var/lib/rpm/Packages ; then
pkg_initdb_rpm
- chroot $BUILD_ROOT rpm -q --whatprovides rpm >/dev/null 2>&1 # create provides index
+ $CHROOT rpm -q --whatprovides rpm >/dev/null 2>&1 # create provides index
fi
rm -f $BUILD_ROOT/.rpmmacros $BUILD_ROOT/root/.rpmmacros