2 # Script to build a package. It uses init_buildsystem to setup a chroot
3 # building tree. This script needs a directory as parameter. This directory
4 # has to include sources and a recipe file.
6 # BUILD_ROOT here the packages will be built
8 ################################################################
10 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License version 2 or 3 as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program (see the file COPYING); if not, write to the
23 # Free Software Foundation, Inc.,
24 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26 ################################################################
28 # some VMs do not allow to specify the init process...
29 if test "$0" = /sbin/init ; then
30 exec /.build/build "$@"
33 test -z "$BUILD_DIR" -a -e /.build/build.data -a -z "$BUILD_IGNORE_2ND_STAGE" && BUILD_DIR=/.build
34 test -z "$BUILD_DIR" && BUILD_DIR=/usr/lib/build
35 test -z "$BUILD_ROOT" && BUILD_ROOT=/var/tmp/build-root
36 test -z "$CONFIG_DIR" && CONFIG_DIR="$BUILD_DIR/configs"
38 export BUILD_ARCH BUILD_HOST_ARCH BUILD_ROOT BUILD_RPMS BUILD_DIR BUILD_DEBUG
47 . "$BUILD_DIR/build-vm"
49 # slurp in recipe support
50 . "$BUILD_DIR/build-recipe"
52 # slurp in package binary support
53 . "$BUILD_DIR/build-pkg"
55 # need to restore build root owner for non-root builds
58 # Default uid:gid for the build user
68 NO_TOPDIR_CLEANUP=false
101 CACHE_DIR=/var/cache/build
104 CCACHE_SETUP_START_TIME=
107 # This is for insserv
108 export YAST_IS_RUNNING=instsys
118 Some comments for build
119 -----------------------
121 With build you can create binary packages. They will be built in a chroot
122 system. This chroot system will be setup automatically. Normally you can
123 simply call build with a spec file as parameter - nothing else has to be
126 If you want to set the directory were the chroot system will be setup
127 (at the moment it uses $BUILD_ROOT),
128 simply set the the environment variable BUILD_ROOT.
132 export BUILD_ROOT=/var/tmp/mybuildroot
135 Normally build builds the complete package including src.rpm (rpmbuild -ba).
136 If you want let build only make the binary package, simply set
138 export BUILD_RPM_BUILD_STAGE=-bb
140 (or -bc, -bp, -bi, ... see "Maximum RPM" for more details [*]).
142 When the build command succeeds, the rpm files can be found under
143 $BUILD_ROOT/usr/src/packages/RPMS/
148 --help You already got it :)
150 --kill Instead of starting a build kill the one currently
153 --shell Instead of starting a build start a root shell in
156 --clean Delete old build root before initializing it
158 --no-init Skip initialization of build root and start with build
161 --no-checks Do not run checks (postbuild and %check)
163 --lint Run rpmlint after build.
166 Capture build output to logfile. Defaults to
167 .build.log in the build root for non-VM builds.
170 Use package repository at PATH_OR_URL. Supported formats
171 are rpm-md, yast2, debian, and arch linux.
172 Alternatively zypp://NAME specifies the zypp
173 repository NAME. The repo must be refreshed with zypp
174 so package meta data is available locally. With emtpy
175 NAME all enabled repositories are used.
177 --rpms path1:path2:...
178 Specify path where to find the RPMs for the build system
180 --arch arch1:arch2:...
181 Specify what architectures to select from the RPMs
183 --verify Run verify when initializing the build root
187 Also install package 'pack'
190 Use 'rootdir' to setup chroot environment
193 Use 'cachedir' to cache remote repo's packages. The
194 default cache dir is /var/cache/build, every repo
195 given by --repo corresponds to a subdir named
196 as md5sum of its repo url, for example:
197 /var/cache/build/3e8ea9b47808629414a0cebc33ea285e
199 --oldpackages oldpackagesdir
200 Define a directory with a former build
202 --baselibs Create -32bit/-64bit/-x86 rpms for other architectures
205 List rpms that would be used to create a fresh build root.
206 Does not create the build root or perform a build.
212 Enable feature X for build
215 Disable feature X for build
218 Define macro X with value Y
221 Override Release in spec file
224 Set stage for rpmbuild. Defaults to -ba.
227 Set target platform for rpmbuild
229 --jobs N Use N parallel processes during build.
230 Sets %jobs and %_smp_mflags macros and
231 defines the number of CPUs to use for
234 --threads N sets number of threads for VM
237 Use ccache to speed up rebuilds
239 --pkg-ccache /path/to/ccache.tar.gz
240 path to archive of ccache directory content.
241 Its contents will be extracted to /.ccache
244 Use N parallel build jobs with icecream
247 Copy overlay filesystem to buildroot after installing
248 all RPMs. This must be a valid directory.
251 Copy overlay folder (RSYNCSRC) to a folder (RSYNCDEST)
252 inside the buildroot using rsync.
253 It will "%define RSYNCDONE 1" for handling %setup in your
257 %setup -n aaa_base -T -D -b 5 -b 7
259 %setup -n aaa_base -b 5 -b 7
262 --rsync-dest RSYNCDEST
263 Copy overlay folder (RSYNCSRC) to a folder (RSYNCDEST)
264 inside the buildroot using rsync.
267 Specify the uid and gid to use for the abuild user.
268 This is useful if you are hacking in the buildroot.
269 This must be set to the same value if the buildroot is re-used.
272 monitor used resources during build inside VM
275 Use KVM to secure build process. Your hardware needs to support
279 Use XEN to secure build process, you to run in a XEN Dom0 environment.
282 Use Linux Containers to isolate the process. This may not be 100% safe.
291 Use any generic emulator to isolate the build process. You need to write
292 an emulator/emulator.sh script and put it next to the build script sources.
294 --emulator-script SCRIPT
295 specify another emulator instead of emulator.sh
298 Use virtual machine instead of chroot
299 TYPE is one of xen|kvm|uml|qemu|lxc|zvm|openstack|ec2|docker|pvm
302 GUEST is a z/VM build worker controlled by the controlling
306 Each worker in z/VM needs a uniq number. This is needed to
307 calculate uniq device addresses for root and swap device.
310 EC2 only: defines amazon control server
313 openstack only: defines control server name
316 Use FILE as disk for virtual machine.
317 Defaults to \$BUILD_ROOT.img if unset
320 Use FILE as swap space for virtual machine. The swap space is
321 also used for retrieving packages from the VM so its size must
322 be sufficiently large
324 --vm-disk-size SIZEINMB
325 --vm-swap-size SIZEINMB
326 --vm-disk-filesystem TYPE
327 Defaults for automatic setup of VM root/swap files
330 Set amount of RAM for VMs
332 --vm-hugetlbfs HUGETLBFSPATH
333 Use hugetlb for memory management, path to mounted hugetlbfs.
337 Kernel and initrd to use for VM (kvm and qemu only)
340 User name to run qemu/kvm process
343 Is forwarding PORT to a telnet session inside of the VM.
344 Specify also needed extra packages via -x parameter, usually:
345 --vm-telnet 1234 -x telnet-server -x net-tools
346 And connect from the host via
348 NOTE: The telnet server gets started after all packages got installed.
353 KVM only: Attach kvm option
354 Available options are -net, -netdev, -device
355 (This options in kvm can not guarantee reproducible builds)
357 Enable creation of a debuginfo package
359 Enable build without cumulative build.
361 Remember to have fun!
363 [*] Maximum RPM: http://www.rpm.org/max-rpm/
368 echo "Usage: `basename $0` [--no-init|--clean|--rpms path|--verify|--help] [dir-to-build|recipe-to-build]"
374 # return values: 0 -> success, new packages built
375 # 1 -> error, build failed
376 # 2 -> successfull build, but no changes to former built packages
377 # 3 -> something wrong with build host
379 cleanup_and_exit () {
381 test -z "$1" && set 0
382 rm -f "$BUILD_ROOT"/.repo.config
383 rm -f "$BUILD_ROOT"/exit
384 if test "$1" -eq 1 -a -x /bin/df ; then
386 echo "$HOST failed \"build $RECIPEFILE\" at `date --utc`."
388 # okay, it failed, but maybe because disk space?
389 if df "$BUILD_ROOT" 2>/dev/null | grep -q "100%"; then
390 df "$BUILD_ROOT" 2>/dev/null
392 echo "$HOST ran out of disk space. Please try again."
397 if test -n "$RUNNING_IN_VM" ; then
398 echo "$1" > /.build/_exitcode
399 test -n "$browner" && chown "$browner" "$BUILD_ROOT"
402 buildroot_umount /proc/sys/fs/binfmt_misc
403 buildroot_umount /proc
404 buildroot_umount /sys
405 buildroot_umount /dev/pts
406 buildroot_umount /dev/shm
407 test -n "$VM_IMAGE" -a "$VM_IMAGE" != 1 && umount "$BUILD_ROOT" 2>/dev/null || true
408 test -n "$VM_TYPE" && vm_cleanup
427 # create a shell script from command line. Used for preserving arguments
437 if test -n "$CCACHE" ; then
438 CCACHE_SETUP_START_TIME=`date +%s`
439 if mkdir -p "$BUILD_ROOT"/var/lib/build/ccache/bin; then
440 for i in $(ls $BUILD_ROOT/usr/bin | grep -E '^(cc|gcc|[cg][+][+]|clang|clang[+][+])([-]?[.0-9])*$'); do
441 rm -f "$BUILD_ROOT"/var/lib/build/ccache/bin/$i
442 test -e "$BUILD_ROOT"/usr/bin/$i || continue
443 echo '#! /bin/sh' > "$BUILD_ROOT"/var/lib/build/ccache/bin/$i
444 echo "test -e /usr/bin/$i || exit 1" >> "$BUILD_ROOT"/var/lib/build/ccache/bin/$i
445 echo 'export PATH=/usr/lib/icecc/bin:/opt/icecream/bin:/usr/bin:$PATH' >> "$BUILD_ROOT"/var/lib/build/ccache/bin/$i
446 echo "ccache $i \"\$@\"" >> "$BUILD_ROOT"/var/lib/build/ccache/bin/$i
447 chmod 755 "$BUILD_ROOT"/var/lib/build/ccache/bin/$i
448 echo "Installed ccache wrapper as $BUILD_ROOT/var/lib/build/ccache/bin/$i"
451 mkdir -p "$BUILD_ROOT/.ccache"
452 # overwrite /etc/profile.d/build_ccache.sh
453 echo 'export CCACHE_DIR=/.ccache' > "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
454 echo 'export PATH=/var/lib/build/ccache/bin:$PATH' >> "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
457 # Disable compression setting temporary
458 # Until ccache is applied to qemu-accel, it is very slow when using the function, so it will be applied later.
460 # https://ccache.dev/releasenotes.html#_ccache_4_0
461 # Changed compression algorithm from Deflate (zlib) to Zstandard, enabled by default.
462 enable_compression=false
464 local cconf="$BUILD_ROOT"/etc/ccache.conf
465 if test -e $cconf; then
466 grep -q "^compression*" $cconf && sed -i "s:compression.*:compression = $enable_compression:g" $cconf || echo "compression = $enable_compression" >> $cconf
467 grep -q "^cache_dir*" $cconf && sed -i "s:cache_dir.*:cache_dir = /.ccache:g" $cconf || echo "cache_dir = /.ccache" >> $cconf
469 echo "compression = $enable_compression" >> $cconf
470 echo "cache_dir = /.ccache" >> $cconf
472 local ccachetar="$BUILD_ROOT/.build.oldpackages/_ccache.tar"
473 test -e $ccachetar && tar -xf $ccachetar -C "$BUILD_ROOT/.ccache/"
475 chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT/.ccache"
477 CCACHE_SETUP_START_TIME=
478 rm -f "$BUILD_ROOT"/var/lib/build/ccache/bin/{gcc,g++,cc,c++,clang,clang++}
483 local icecreamdir=/var/run/icecream
484 if test "$(readlink "$BUILD_ROOT/var/run")" = /run ; then
485 icecreamdir=/run/icecream
487 if test "$icecream" -eq 0 ; then
488 rm -rf "$BUILD_ROOT$icecreamdir"
489 rm -f "$BUILD_ROOT/etc/profile.d/build_icecream.sh"
493 if ! chroot "$BUILD_ROOT" rpm -q icecream >/dev/null 2>/dev/null; then
494 echo "*** icecream package not installed ***"
498 echo "using icecream with $icecream jobs"
500 if test -z "$CCACHE" ; then
501 echo 'export PATH=/usr/lib/icecc/bin:/opt/icecream/bin:$PATH' > "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
503 echo 'export CCACHE_PATH=/usr/lib/icecc/bin:/opt/icecream/bin' > "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
506 local icecc_vers=(`shopt -s nullglob; echo "$BUILD_ROOT"$icecreamdir/*.tar.{bz2,gz}`)
507 icecc_vers=${icecc_vers//"$BUILD_ROOT"/}
509 # XXX use changelog like autobuild does instead?
510 # only run create-env if compiler or glibc changed
511 if test -z "$icecc_vers" \
512 -o ! -e "$BUILD_ROOT/$icecc_vers" \
513 -o "$BUILD_ROOT/usr/bin/gcc" -nt "$BUILD_ROOT/$icecc_vers" \
514 -o "$BUILD_ROOT/usr/bin/g++" -nt "$BUILD_ROOT/$icecc_vers" \
515 -o "$BUILD_ROOT/usr/bin/as" -nt "$BUILD_ROOT/$icecc_vers" \
516 -o "$BUILD_ROOT/lib/libc.so.6" -nt "$BUILD_ROOT/$icecc_vers"
518 rm -rf "$BUILD_ROOT$icecreamdir"
519 mkdir -p "$BUILD_ROOT$icecreamdir"
520 if test -e "$BUILD_ROOT"/usr/bin/create-env ; then
521 createenv=/usr/bin/create-env
522 elif test -e "$BUILD_ROOT"/usr/lib/icecc/icecc-create-env ; then
523 createenv="/usr/lib/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
524 elif test -e "$BUILD_ROOT"/usr/lib64/icecc/icecc-create-env ; then
525 createenv="/usr/lib64/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
527 echo "create-env not found"
530 echo "creating new env in '$icecreamdir'"
531 chroot "$BUILD_ROOT" bash -c "cd $icecreamdir; $createenv" || cleanup_and_exit 1
532 icecc_vers=(`shopt -s nullglob; echo "$BUILD_ROOT"/$icecreamdir/*.tar.{bz2,gz}`)
533 icecc_vers=${icecc_vers//"$BUILD_ROOT"/}
534 echo "created icecream environment $icecc_vers"
536 echo "reusing existing icecream environment $icecc_vers"
538 if test -n "$icecc_vers" ; then
539 echo "export ICECC_VERSION=$icecc_vers" >> "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
544 if test -n "$VM_IMAGE" -o -n "$RUNNING_IN_VM" ; then
548 if [ $arch == "x86_64" ];then
549 echo "on X86_64, no limit mem size"
558 eval "limit=\$(($2/3*4))"
562 eval "limit=\$(($2/3*4+$limit))"
565 done < <(cat /proc/meminfo) # cat for proc stuff
567 echo "Memory limit set to ${limit}KB"
576 if test "$BUILDTYPE" == arch || test "$BUILDTYPE" = collax ; then
579 if test "$BUILDTYPE" == dsc ; then
582 if test -e "$BUILD_ROOT"$TOPDIR/SOURCES/baselibs.conf ; then
583 BASELIBS_CFG="-c $TOPDIR/SOURCES/baselibs.conf"
585 if test -e "$BUILD_ROOT"/usr/lib/build/baselibs_global.conf; then
586 BASELIBS_GLOBAL="-c /usr/lib/build/baselibs_global.conf"
591 mount -n -tproc none "$BUILD_ROOT"/proc 2> /dev/null
592 # don't use -R as extracted sources, build root etc might be below $TOPDIR
593 chown "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"/* "$BUILD_ROOT$TOPDIR"/RPMS/* || true
595 local mkbaselibs="/usr/lib/build/mkbaselibs"
597 # $BUILD_DIR is set to /.build when using a vm. So we need to
598 # hardcode /usr/lib/build instead of $BUILD_DIR to prefer
599 # mkbaselibs from the distro.
600 if test -f "$BUILD_ROOT"$mkbaselibs; then
601 if test -z "$BASELIBS_CFG" -a -e "$BUILD_ROOT"/usr/lib/build/baselibs.conf ; then
602 BASELIBS_CFG="-c /usr/lib/build/baselibs.conf"
605 if test "$CREATE_BASELIBS" = 'internal'; then
606 echo "Warning: mkbaselibs missing in build root, skipping baselibs"
609 # use external version
610 whichone=" (external)"
611 mkbaselibs="/.mkbaselibs/mkbaselibs"
612 rm -rf "$BUILD_ROOT/.mkbaselibs"
613 mkdir -p "$BUILD_ROOT/.mkbaselibs"
614 cp -f $BUILD_DIR/mkbaselibs "$BUILD_ROOT"/.mkbaselibs/
615 if test "$BUILDTYPE" == "dsc" ; then
616 cp -f $BUILD_DIR/baselibs_global-deb.conf "$BUILD_ROOT"/.mkbaselibs/baselibs_g.conf
617 cp -f "$BUILD_ROOT"$TOPDIR/SOURCES/baselibs-deb.conf "$BUILD_ROOT"/.mkbaselibs/baselibs-deb.conf
618 BASELIBS_CFG="-c /.mkbaselibs/baselibs-deb.conf"
620 cp -f $BUILD_DIR/baselibs_global.conf "$BUILD_ROOT"/.mkbaselibs/baselibs_g.conf
621 if test -z "$BASELIBS_CFG" -a -e $BUILD_DIR/baselibs.conf; then
622 cp -f $BUILD_DIR/baselibs.conf "$BUILD_ROOT"/.mkbaselibs/baselibs.conf
623 BASELIBS_CFG="-c /.mkbaselibs/baselibs.conf"
626 if test -e "$BUILD_ROOT"/.mkbaselibs/baselibs_g.conf; then
627 BASELIBS_GLOBAL="-c /.mkbaselibs/baselibs_g.conf"
630 echo "... creating baselibs$whichone"
631 pkgs_origin=(`echo ${pkgs[*]} | sed 's/\"//g'`)
634 chroot "$BUILD_ROOT" su -c "$mkbaselibs $BASELIBS_GLOBAL $BASELIBS_CFG $line" - $BUILD_USER || cleanup_and_exit 1
635 done < <(IFS=$'\n'; echo "${pkgs_origin[*]#$BUILD_ROOT}" | xargs -n 1024)
636 rm -rf "$BUILD_ROOT/.mkbaselibs"
643 test -z "$RUNNING_IN_VM" || return 0
644 if test -z "$old_packages" ; then
645 rm -rf "$BUILD_ROOT"/.build.oldpackages*
648 for d in "${old_packages[@]}"; do
649 dest="$BUILD_ROOT/.build.oldpackages"
650 test "$i" = 0 || dest="$dest$i"
651 if test -d "$d" -a "$d" != "$dest" ; then
660 become_root_or_fail() {
661 if test ! -w /root ; then
662 echo "You have to be root to use $0" >&2
669 # strip trailing slash
670 test "$BUILD_ROOT" != / && BUILD_ROOT="${BUILD_ROOT%/}"
671 if test -d "$BUILD_ROOT" ; then
672 # check if it is owned by root
673 if test -z "$RUNNING_IN_VM" -a \! -O "$BUILD_ROOT" -a "`stat -c %u "$BUILD_ROOT"`" -ne 0 ; then
674 echo "BUILD_ROOT=$BUILD_ROOT must be owned by root. Exit..."
678 test "$BUILD_ROOT" != "${BUILD_ROOT%/*}" && mkdir -p "${BUILD_ROOT%/*}"
679 if ! mkdir "$BUILD_ROOT" ; then
680 echo "can not create BUILD_ROOT=$BUILD_ROOT. Exit..."
685 if test ! -w "$BUILD_ROOT" ; then
686 echo "Error: BUILD_ROOT=$BUILD_ROOT not writeable, try --clean."
690 rm -rf "$BUILD_ROOT/.build.packages"
691 if test -z "$VM_TYPE" -a -z "$RUNNING_IN_VM" ; then
692 # don't touch this in VM
693 rm -rf "$BUILD_ROOT/.build"
694 mkdir -p "$BUILD_ROOT/.build"
699 if test -d "$OVERLAY"; then
701 echo "Copying overlay to BUILD_ROOT"
702 tar -cpf - . | (cd "$BUILD_ROOT" ; tar -xvf -)
705 echo "OVERLAY ($OVERLAY) is no directory - skipping"
710 if test -n "$RSYNCDEST" ; then
711 if test -d "$RSYNCSRC" ; then
712 if ! test -d "$BUILD_ROOT/$RSYNCDEST" ; then
713 echo "ATTENTION! Creating missing target directory ("$BUILD_ROOT"/$RSYNCDEST)."
714 mkdir -p "$BUILD_ROOT"/$RSYNCDEST
716 echo "Running rsync ..."
717 rsync -av $RSYNCSRC/* "$BUILD_ROOT"/$RSYNCDEST/
718 chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT/$RSYNCDEST"
722 echo "RSYNCSRC is not a directory - skipping"
725 echo "RSYNCSRC given, but not RSYNCDEST - skipping"
733 rm -f "$BUILD_ROOT"/.repo.config
734 for i in "${repos[@]}"; do
735 if [ "$i" == "--repo" -o "$i" == "--repository" ]; then
738 echo $i |grep -E "^http[s]?:\/\/[^\/]*\/?" >/dev/null && echo $i >> "$BUILD_ROOT"/.repo.config
739 j=$(echo $i | sed -e "s#://[^@]*@#://#")
753 export PATH=$BUILD_DIR:/sbin:/usr/sbin:/bin:/usr/bin:$PATH
755 if vm_detect_2nd_stage ; then
756 set "/.build-srcdir/$RECIPEFILE"
757 export PATH=/.build:$PATH
760 . $BUILD_DIR/common_functions || exit 1
765 if test -z "$ARG" ; then
766 echo "$PARAM needs an agrument" >&2
771 while test -n "$1"; do
774 test "$ARG" = "${ARG#-}" || ARG=
780 set -- "----noarg=$PARAM" "$@"
783 case ${PARAM/#--/-} in
789 test "$DO_INIT" = false && DO_INIT_TOPDIR=false
795 -nochecks|-no-checks)
799 CLEAN_BUILD='--clean'
800 REMOVE_CCACHE="$CLEAN_BUILD"
816 export VERIFY_BUILD_SYSTEM=true
833 -extrapacks|-extra-packs|-X)
835 BUILD_EXTRA_PACKS="$BUILD_EXTRA_PACKS $ARG"
845 CREATE_BASELIBS=internal
848 KEEP_PACKS="--keep-packs"
862 old_packages=("${old_packages[@]}" "$ARG")
892 NO_TOPDIR_CLEANUP=true
895 USEUSEDFORBUILD="--useusedforbuild"
905 -define|-with|-without)
907 PARAM="-${PARAM/#--/-}"
908 definesnstuff[${#definesnstuff[@]}]="$PARAM"
909 definesnstuff[${#definesnstuff[@]}]="$ARG"
914 repos[${#repos[@]}]="--repository"
915 repos[${#repos[@]}]="$ARG"
921 test "$icecream" -gt 0 && BUILD_JOBS="$ARG"
925 NOCUMULATE="--nocumulate"
976 if test -n "${ABUILD_ID//[0-9:]/}" ; then
977 echo "--uid argument must be uid:gid"
980 ABUILD_UID=${ABUILD_ID%:*}
981 ABUILD_GID=${ABUILD_ID#*:}
986 RPMLIST="--rpmlist $ARG"
998 DLNOSIGNATURE="--nosignature"
1001 echo "$ARG does not take an argument"
1005 USEHIGHERDEPS="--use-higher-deps"
1008 if vm_parse_options "$@" ; then
1009 set -- "${nextargs[@]}"
1010 elif recipe_parse_options "$@" ; then
1011 set -- "${nextargs[@]}"
1013 echo "Unknown option '$PARAM'. Exit."
1018 RECIPEFILES[${#RECIPEFILES[@]}]="$PARAM"
1023 if [ "$SHORT_CIRCUIT" = true -a -z "$BUILD_RPM_BUILD_STAGE" ]; then
1024 echo "--short-circuit needs a stage (use --stage)"
1028 if test -n "$KILL" ; then
1029 test -z "$SRCDIR" || usage
1030 if test -n "$VM_IMAGE" -a -n "$VM_SWAP" -a -n "$VM_TYPE"; then
1031 # mark job as failed so that we don't extract packages
1032 if test "$VM_TYPE" != zvm ; then
1033 echo -n "BUILDSTATUS1" >"$VM_SWAP"
1036 (set -C; > "$BUILD_ROOT/exit" 2>/dev/null || true)
1037 if test -n "$VM_TYPE" ; then
1040 if ! $BUILD_DIR/killchroot -s 9 "$BUILD_ROOT" ; then
1041 echo "could not kill build in $BUILD_ROOT"
1048 if test -n "$CLEAN_BUILD" ; then
1053 if test -n "$VM_TYPE" -a -z "$RUNNING_IN_VM" ; then
1057 if test -z "$RPMLIST" -a -z "$RUNNING_IN_VM" ; then
1058 if test -z "$repos" -a -z "$BUILD_RPMS" ; then
1059 repos=(--repository 'zypp://')
1067 expand_recipe_directories
1069 if test -n "$LIST_STATE" ; then
1070 BUILD_ROOT=`mktemp -d /var/tmp/build-list-state-XXXXXX`
1071 test -d "$BUILD_ROOT" || cleanup_and_exit 3
1072 RECIPEFILE=$RECIPEFILES # only one specified anyways
1073 if test "$RECIPEFILE" != "${RECIPEFILE%.src.rpm}" ; then
1074 MYSRCDIR="$BUILD_ROOT/usr/src/packages/SOURCES"
1075 recipe_unpack_srcrpm
1076 RECIPEFILE="$MYSRCDIR/$RECIPEFILE"
1078 init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" --list-state "${definesnstuff[@]}" "${repos[@]}" $DLNOSIGNATURE $KEEP_PACKS $NOCUMULATE $USEHIGHERDEPS $USEUSEDFORBUILD $RECIPEFILE $BUILD_EXTRA_PACKS
1080 rm -rf "$BUILD_ROOT"
1081 cleanup_and_exit $ERR
1084 # do vm setup if needed
1085 if test -z "$RUNNING_IN_VM" -a -n "$VM_TYPE" -a -n "$VM_IMAGE" ; then
1091 if test "$BUILD_ROOT" = / ; then
1092 browner="$(stat -c %u /)"
1095 rm -f "$BUILD_ROOT"/exit
1097 if test -w /root ; then
1098 mkdir -p "$BUILD_ROOT"/proc
1099 mkdir -p "$BUILD_ROOT"/sys
1100 mkdir -p "$BUILD_ROOT"/dev/pts
1101 mount -n -tproc none "$BUILD_ROOT"/proc || true
1102 mount -n -tdevpts -omode=0620,gid=5 none "$BUILD_ROOT"/dev/pts
1105 if test -z "$VM_IMAGE" -a -z "$LOGFILE" ; then
1106 if test -z "$RUNNING_IN_VM"; then
1107 LOGFILE="$BUILD_ROOT/.build.log"
1109 # lxc and docker are special cases: vm shares logfile with host
1114 LOGFILE="$BUILD_ROOT/.build.log"
1120 if test -n "$LOGFILE" -a -z "$RUN_SHELL" ; then
1121 echo "logging output to $LOGFILE..."
1124 # set start time, to be substracted for build log timestamps
1125 STARTTIME=`perl -e 'print time()'`
1127 if test -n "$RUNNING_IN_VM" ; then
1128 # no additional timestamps in inner vm build system
1129 exec 1> >(exec -a 'build logging' tee -a $LOGFILE) 2>&1
1130 elif test -n "$VM_IMAGE" ; then
1131 # external run of virtualization build
1132 exec 1> >(exec -a 'build logging' perl -e 'open(F,">>",$ARGV[0])||die("$ARGV[0]: $!\n");$|=1;select(F);$|=1;while(<STDIN>){my $p=sprintf("[%5ds] ", time()-'$STARTTIME');print STDOUT $p.$_;s/^\r//s;s/\r\n/\n/gs;print F $p.$_}' $LOGFILE) 2>&1
1135 exec 1> >(exec -a 'build logging' perl -e 'open(F,">>",$ARGV[0])||die("$ARGV[0]: $!\n");$|=1;select(F);$|=1;while(<STDIN>){my $p=sprintf("[%5ds] ", time()-'$STARTTIME');print STDOUT $p.$_;print F $p.$_}' $LOGFILE) 2>&1
1144 test -z "$HOST" && HOST=`hostname`
1146 if test -z "$RUNNING_IN_VM" ; then
1147 echo Using BUILD_ROOT=$BUILD_ROOT
1148 test -n "$BUILD_RPMS" && echo Using BUILD_RPMS=$BUILD_RPMS
1149 echo Using BUILD_ARCH=$BUILD_ARCH
1150 test -n "$VM_TYPE" && echo "Doing $VM_TYPE build${VM_IMAGE:+ in $VM_IMAGE}"
1154 test "$BUILD_ARCH" = all && BUILD_ARCH=
1155 BUILD_USER_ABUILD_USED=
1157 for RECIPEFILE in "${RECIPEFILES[@]}" ; do
1159 SRCDIR="${RECIPEFILE%/*}"
1160 RECIPEFILE="${RECIPEFILE##*/}"
1162 recipe_set_buildtype
1164 if test -z "$RUNNING_IN_VM" ; then
1166 echo "$HOST started \"build $RECIPEFILE\" at `date --utc`."
1168 test -n "$REASON" && echo "$REASON"
1170 TIME_START_TIME=`date +%s` # for statistics
1174 # first setup building directory...
1177 if ! test -s "$RECIPEFILE" ; then
1178 echo "$RECIPEFILE is empty. This should not happen..."
1183 # special hack to build from a .src.rpm
1184 test "$RECIPEFILE" != "${RECIPEFILE%.src.rpm}" && recipe_unpack_srcrpm
1186 echo "processing recipe $MYSRCDIR/$RECIPEFILE ..."
1189 test -z "$BUILD_EXTRA_PACKS" || ADDITIONAL_PACKS="$ADDITIONAL_PACKS $BUILD_EXTRA_PACKS"
1190 test -z "$CREATE_BASELIBS" || ADDITIONAL_PACKS="$ADDITIONAL_PACKS build"
1191 test -z "$CCACHE" || ADDITIONAL_PACKS="$ADDITIONAL_PACKS ccache"
1192 test "$icecream" = 0 || ADDITIONAL_PACKS="$ADDITIONAL_PACKS icecream gcc-c++"
1193 test -z "$DO_LINT" || ADDITIONAL_PACKS="$ADDITIONAL_PACKS rpmlint-Factory"
1194 test "$VMDISK_FILESYSTEM" = xfs && ADDITIONAL_PACKS="$ADDITIONAL_PACKS libblkid1"
1195 test "$VM_TYPE" = zvm && ADDITIONAL_PACKS="$ADDITIONAL_PACKS udev libcap2"
1197 # we need to do this before the vm is started
1198 if test -n "$CHANGELOG" -a -z "$RUNNING_IN_VM" ; then
1199 rm -f "$BUILD_ROOT"/.build-changelog
1201 *.dsc) CFFORMAT=debian ;;
1204 echo "running changelog2spec --target $CFFORMAT --file $MYSRCDIR/$RECIPEFILE"
1205 if ! $BUILD_DIR/changelog2spec --target $CFFORMAT --file "$MYSRCDIR/$RECIPEFILE" > "$BUILD_ROOT"/.build-changelog ; then
1206 rm -f "$BUILD_ROOT"/.build-changelog
1210 if test -n "$VM_TYPE" -a -z "$RUNNING_IN_VM"; then
1215 if test "$DO_INIT" = true ; then
1216 start_time=`date +%s`
1218 # create legacy .buildenv file
1220 test -z "$INCARNATION" && INCARNATION=0
1221 echo "BUILD_INCARNATION=$INCARNATION" > "$BUILD_ROOT"/.buildenv
1222 CREATE_BUILD_BINARIES=
1223 test "$BUILDTYPE" = preinstallimage && mkdir -p "$BUILD_ROOT"/.preinstall_image
1224 egrep '^#[ ]*needsbinariesforbuild[ ]*$' >/dev/null <$MYSRCDIR/$RECIPEFILE && CREATE_BUILD_BINARIES=--create-build-binaries
1225 test "$BUILDTYPE" = mock && CREATE_BUILD_BINARIES=--create-build-binaries
1226 test "$BUILDTYPE" = debootstrap && CREATE_BUILD_BINARIES=--create-build-binaries
1227 test "$BUILDTYPE" = livebuild && CREATE_BUILD_BINARIES=--create-build-binaries
1228 test "$BUILDTYPE" = snapcraft && CREATE_BUILD_BINARIES=--create-build-binaries
1229 set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $DLNOSIGNATURE $KEEP_PACKS $NOCUMULATE $USEHIGHERDEPS $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$RECIPEFILE" $ADDITIONAL_PACKS
1231 start_time=`date +%s`
1232 "$@" || cleanup_and_exit 1
1234 TIME_INSTALL=$(( `date +%s` - $start_time ))
1236 # arbitrary limit of 10MB
1237 if test $((`stat -f -c "%a*%S/1024/1024" "$BUILD_ROOT"`)) -lt 10; then
1238 # ensure that old stat is not failing (RHEL4)
1239 if df "$BUILD_ROOT" 2>/dev/null | grep -q "100%"; then
1241 echo "build does not work on a completely full filesystem"
1245 mount -n -tproc none "$BUILD_ROOT"/proc || true
1246 mount -n -tdevpts -omode=0620,gid=5 none "$BUILD_ROOT"/dev/pts
1249 # chroot based builds
1250 # rsync as source and dest could be same
1251 test -n "$PKG_CCACHE" -a -e "$PKG_CCACHE" && \
1252 mkdir -p "$BUILD_ROOT/.build.oldpackages/" && \
1253 rsync -v "$PKG_CCACHE" "$BUILD_ROOT/.build.oldpackages/_ccache.tar"
1256 # hack to process preinstallimages early
1257 if test "$BUILDTYPE" = preinstallimage ; then
1262 if test -z "$BUILD_DIST" -a -e "$BUILD_ROOT/.guessed_dist" ; then
1263 read BUILD_DIST < "$BUILD_ROOT"/.guessed_dist
1267 # install dummy sign program if needed
1269 test -f "$BUILD_ROOT"/usr/bin/sign_installed && mv "$BUILD_ROOT"/usr/bin/sign_installed "$BUILD_ROOT"/usr/bin/sign
1270 if test -n "$SIGNDUMMY" ; then
1271 test -f "$BUILD_ROOT"/usr/bin/sign && mv "$BUILD_ROOT"/usr/bin/sign "$BUILD_ROOT"/usr/bin/sign_installed
1272 cp "$BUILD_DIR"/signdummy "$BUILD_ROOT"/usr/bin/sign
1273 chmod 755 "$BUILD_ROOT"/usr/bin/sign
1277 # check if we want to build with the abuild user
1280 if test -x "$BUILD_ROOT"/bin/rpm ; then
1281 SUSE_VERSION=`chroot "$BUILD_ROOT" /bin/rpm --eval '%{?suse_version}' 2>/dev/null`
1282 test -n "$SUSE_VERSION" -a "${SUSE_VERSION:-0}" -le 1020 && BUILD_USER=root
1284 if test "$BUILD_USER" = abuild ; then
1285 egrep '^#[ ]*needsrootforbuild[ ]*$' >/dev/null <$RECIPEFILE && BUILD_USER=root
1287 egrep '^#[ ]*norootforbuild[ ]*$' >/dev/null <$RECIPEFILE && BUILD_USER=abuild
1289 test -n "$NOROOTFORBUILD" && BUILD_USER=abuild
1291 # appliance builds must run as root
1292 if test "$BUILDTYPE" = kiwi ; then
1293 imagetype=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $RECIPEFILE imagetype)
1294 test "$imagetype" = product || BUILD_USER=root
1297 # fixup passwd/group
1298 if test $BUILD_USER = abuild ; then
1299 if ! egrep '^abuild:' >/dev/null <"$BUILD_ROOT"/etc/passwd ; then
1300 echo "abuild:x:${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>"$BUILD_ROOT"/etc/passwd
1301 echo 'abuild:*:::::::' >>"$BUILD_ROOT"/etc/shadow # This is needed on Mandriva 2009
1302 echo 'abuild:*::' >>"$BUILD_ROOT"/etc/gshadow # This is needed on Ubuntu
1303 echo "abuild:x:${ABUILD_GID}:" >>"$BUILD_ROOT"/etc/group
1304 mkdir -p "$BUILD_ROOT"/home/abuild
1305 chown "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT"/home/abuild
1307 if ! egrep "^abuild:x?:${ABUILD_UID}:${ABUILD_GID}" >/dev/null <"$BUILD_ROOT"/etc/passwd ; then
1308 sed -i '/^abuild:/d' "$BUILD_ROOT"/etc/passwd
1309 sed -i '/^abuild:/d' "$BUILD_ROOT"/etc/group
1310 echo "abuild:x:${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>"$BUILD_ROOT"/etc/passwd
1311 echo "abuild:x:${ABUILD_GID}:" >>"$BUILD_ROOT"/etc/group
1312 chown "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT"/home/abuild -R
1315 if test -f "$BUILD_ROOT"/etc/shadow ; then
1316 sed -i -e "s@^root::@root:*:@" "$BUILD_ROOT"/etc/shadow
1318 if test -f "$BUILD_ROOT"/etc/gshadow ; then
1319 sed -i -e "s@^root::@root:*:@" "$BUILD_ROOT"/etc/gshadow
1321 BUILD_USER_ABUILD_USED=true
1326 if egrep '^abuild:' >/dev/null <"$BUILD_ROOT"/etc/passwd ; then
1327 rm -rf "$BUILD_ROOT/home/abuild"
1328 sed -i -e '/^abuild:/d' "$BUILD_ROOT"/etc/passwd
1329 sed -i -e '/^abuild:/d' "$BUILD_ROOT"/etc/group
1330 if test -f "$BUILD_ROOT"/etc/shadow ; then
1331 sed -i -e '/^abuild:/d' "$BUILD_ROOT"/etc/shadow
1333 if test -f "$BUILD_ROOT"/etc/gshadow ; then
1334 sed -i -e '/^abuild:/d' "$BUILD_ROOT"/etc/gshadow
1339 mount -n -tproc none "$BUILD_ROOT"/proc 2> /dev/null
1340 mount -n -tdevpts -omode=0620,gid=5 none "$BUILD_ROOT"/dev/pts 2> /dev/null
1341 # needed for POSIX semaphores
1342 test -d "$BUILD_ROOT"/dev/shm || rm -f "$BUILD_ROOT"/dev/shm
1343 mkdir -p "$BUILD_ROOT"/dev/shm
1344 mount -n -ttmpfs none "$BUILD_ROOT"/dev/shm 2> /dev/null
1346 if test -n "$RUNNING_IN_VM" ; then
1347 if test -x /sbin/ip ; then
1348 ip addr add 127.0.0.1/8 dev lo
1349 ip addr add ::1/128 dev lo
1352 ifconfig lo 127.0.0.1 up
1353 ifconfig lo add ::1/128
1355 if test -n "$VM_TELNET"; then
1356 VM_TELNET_DEVICE=$( cd /sys/class/net/; echo * )
1357 VM_TELNET_DEVICE=${VM_TELNET_DEVICE#lo }
1358 VM_TELNET_DEVICE=${VM_TELNET_DEVICE%% *}
1359 if test -z "$VM_TELNET_DEVICE"; then
1360 echo "ERROR: no network device found for telnet server"
1363 if test -x /sbin/ip ; then
1364 ip addr add 10.0.2.15/8 dev ${VM_TELNET_DEVICE}
1365 ip addr add ::1/24 dev ${VM_TELNET_DEVICE}
1366 ip link set ${VM_TELNET_DEVICE} up
1368 if ! test -x /sbin/ifconfig ; then
1369 echo "ERROR: /usr/sbin/in.telnetd is not running, please specify right package via -x option"
1372 ifconfig ${VM_TELNET_DEVICE} 10.0.2.15 up
1373 ifconfig ${VM_TELNET_DEVICE} add ::1/24
1376 if test -n "$VM_NETDEVOPT"; then
1377 let LASTIP="${VM_WORKER_NR:-0}"+10
1378 if test -x /sbin/ip ; then
1379 ip addr add 10.0.2.$LASTIP/24 dev eth0
1382 ifconfig eth0 10.0.2.$LASTIP netmask 255.255.255.0 up
1384 route add default gw 10.0.2.2 eth0
1386 if test -n "$MYHOSTNAME" ; then
1387 hostname "$MYHOSTNAME"
1389 if test -n "$VM_TELNET"; then
1390 echo WARNING: telnet option used, setting up telnet server ${VM_TELNET_DEVICE}
1391 if test -x /usr/sbin/in.telnetd; then
1392 ( /usr/sbin/in.telnetd -L /.build/telnet_login_wrapper -debug 23 & )
1394 echo "ERROR: /usr/sbin/in.telnetd is not running, please specify right package via -x option"
1403 # fill build directories with sources. Also sets TOPDIR
1406 # strip prefix from autogenerated files of source services.
1407 for i in "$BUILD_ROOT"$TOPDIR/SOURCES/_service\:* ; do
1408 mv "$i" "${i%/*}/${i##*:}"
1410 RECIPEFILE="${RECIPEFILE##*:}"
1412 # create .build.packages link
1413 rm -f "$BUILD_ROOT"/.build.packages
1414 ln -s ${TOPDIR#/} "$BUILD_ROOT"/.build.packages
1416 # nasty hack to prevent rpath on known paths
1417 # FIXME: do this only for suse
1418 if test -d "$BUILD_ROOT/etc/profile.d" ; then
1419 echo "export SUSE_IGNORED_RPATHS=/etc/ld.so.conf" > "$BUILD_ROOT/etc/profile.d/buildsystem.sh"
1422 cd "$BUILD_ROOT"$TOPDIR/SOURCES || cleanup_and_exit 1
1423 for i in *.obscpio ; do
1424 test -e "$i" || continue
1425 echo "Unpacking $i ..."
1426 echo "#!/bin/sh -e" > "$BUILD_ROOT"/.unpack.command
1427 shellquote cd "$TOPDIR/SOURCES" >> "$BUILD_ROOT"/.unpack.command
1428 echo >> "$BUILD_ROOT"/.unpack.command
1429 echo -n 'cpio --extract --owner="'$BUILD_USER'" --unconditional --preserve-modification-time --make-directories <' >> "$BUILD_ROOT"/.unpack.command
1430 shellquote "$i" >> "$BUILD_ROOT"/.unpack.command
1431 echo >> "$BUILD_ROOT"/.unpack.command
1432 shellquote rm -f "$i" >> "$BUILD_ROOT"/.unpack.command
1433 echo >> "$BUILD_ROOT"/.unpack.command
1434 chmod 0755 "$BUILD_ROOT"/.unpack.command
1435 chroot "$BUILD_ROOT" su -c /.unpack.command - $BUILD_USER
1436 rm -f "$BUILD_ROOT"/.unpack.command
1439 if test -e _service; then
1440 echo "Running build time source services..."
1441 $BUILD_DIR/runservices --buildroot "$BUILD_ROOT" || cleanup_and_exit 1
1444 # get rid of old src dir, it is no longer needed and just wastes space
1445 test "$MYSRCDIR" = "$BUILD_ROOT"/.build-srcdir && rm -rf "$MYSRCDIR"
1451 chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
1453 echo -----------------------------------------------------------------
1454 if test "$BUILD_USER" = root ; then
1455 echo ----- building $RECIPEFILE
1457 echo ----- building $RECIPEFILE "(user $BUILD_USER)"
1459 echo -----------------------------------------------------------------
1460 echo -----------------------------------------------------------------
1461 BUILD_SUCCEEDED=false
1463 if test -n "$OVERLAY" ; then
1467 if test -n "$RSYNCSRC" ; then
1471 start_time=`date +%s`
1473 if test "$DO_STATISTICS" = 1; then
1474 mkdir -p $TOPDIR/OTHER
1475 echo "TIME_main_build: $(( `date +%s` - $start_time ))" >> $TOPDIR/OTHER/_statistics
1479 test "$BUILD_SUCCEEDED" = true || cleanup_and_exit 1
1480 test -d "$SRCDIR" && cd "$SRCDIR"
1483 if test -n "$RUNNING_IN_VM" -a -n "$DO_STATISTICS" ; then
1484 touch /.build/_statistics.exit
1487 RPMS=`find "$BUILD_ROOT"/$TOPDIR/RPMS -type f -name "*.rpm" 2>/dev/null | sed 's/.*/\"&\"/g' || true`
1488 DEBS=`find "$BUILD_ROOT"/$TOPDIR/DEBS -type f -name "*.deb" 2>/dev/null | sed 's/.*/\"&\"/g' || true`
1489 if test -n "$RPMS" -a -n "$BUILD_USER_ABUILD_USED" ; then
1490 recipe_check_file_owners
1492 if test -n "$RPMS" -a -d "$BUILD_ROOT/usr/lib/build/checks" ; then
1493 export DO_RPM_REMOVE=true
1496 for SRPM in "$BUILD_ROOT"/$TOPDIR/SRPMS/*src.rpm ; do
1497 test -f "$SRPM" && PNAME=`rpm --nodigest --nosignature -qp --qf "%{NAME}" $SRPM`
1499 mount -n -tproc none "$BUILD_ROOT"/proc 2> /dev/null
1500 for CHECKSCRIPT in "$BUILD_ROOT"/usr/lib/build/checks/* ; do
1501 echo "... running ${CHECKSCRIPT##*/}"
1502 $CHECKSCRIPT || cleanup_and_exit 1
1504 umount -n "$BUILD_ROOT"/proc 2>/dev/null || true
1507 # checkscripts may have deleted some binaries
1508 RPMS=`find "$BUILD_ROOT"/$TOPDIR/RPMS -type f -name "*.rpm" 2>/dev/null | sed 's/.*/\"&\"/g' || true`
1509 DEBS=`find "$BUILD_ROOT"/$TOPDIR/DEBS -type f -name "*.deb" 2>/dev/null | sed 's/.*/\"&\"/g' || true`
1511 if test -n "$RPMS" -a "$DO_CHECKS" != false ; then
1515 if test -n "$CCACHE" ; then
1516 if test -n "$REMOVE_CCACHE" ; then
1517 echo "... cleaning ccache"
1518 test_cmd="ccache -h | grep -c evict-older-than"
1519 clean_cmd="ccache --evict-older-than $(($(date +%s) - $CCACHE_SETUP_START_TIME))s"
1520 chroot $BUILD_ROOT su -c "$test_cmd && $clean_cmd" - $BUILD_USER
1522 echo "... saving ccache"
1523 tar ${REMOVE_CCACHE:+--remove-files} -cf "$BUILD_ROOT/$TOPDIR/OTHER/_ccache.tar" -C "$BUILD_ROOT/.ccache/" .
1526 if test \( -n "$RPMS" -o -n "$DEBS" \) -a -n "$CREATE_BASELIBS"; then
1533 # TODO: don't hardcode. instead run scripts in a directory as it's done for the checks
1534 if test -n "$RPMS" -a -d "$BUILD_ROOT/.build.oldpackages" ; then
1535 recipe_compare_oldpackages
1536 # no need to create deltas if the build is the same
1537 if test ! -e "$BUILD_ROOT"/.build/.same_result_marker ; then
1538 recipe_create_deltarpms
1541 if test -n "$RUNNING_IN_VM" ; then
1542 vm_wrapup_build $(recipe_resultdirs) OTHER
1545 echo "$HOST finished \"build $RECIPEFILE\" at `date --utc`."
1548 cleanup_and_exit "$exitcode"