diff options
author | Zhang Qiang <qiang.z.zhang@intel.com> | 2012-11-09 10:18:48 +0800 |
---|---|---|
committer | Zhang Qiang <qiang.z.zhang@intel.com> | 2012-11-14 14:06:48 +0800 |
commit | dc065e1fdaca94023373aa5cadadc22747fdd521 (patch) | |
tree | 5051e24f4f76a06d2daea9763a1e72910646b71b | |
parent | 1065f89b725d5bd3dfa8e00536ae6701449e16d7 (diff) | |
download | obs-build-dc065e1fdaca94023373aa5cadadc22747fdd521.tar.gz obs-build-dc065e1fdaca94023373aa5cadadc22747fdd521.tar.bz2 obs-build-dc065e1fdaca94023373aa5cadadc22747fdd521.zip |
Add option --keep-packs to keep packages, #516
with --keep-packs, unused packages will not be removed while resusing
buildroot. This can speed up build hundred of packages significantly
Change-Id: Ic948f3b3dbe8762d54651cdd939b9c748aaab39f
-rwxr-xr-x | build | 8 | ||||
-rwxr-xr-x | init_buildsystem | 41 |
2 files changed, 30 insertions, 19 deletions
@@ -59,6 +59,7 @@ SHORT_CIRCUIT=false NO_TOPDIR_CLEANUP=false CLEAN_BUILD= USE_SYSTEM_QEMU= +KEEP_PACKS= SPECFILES=() SRCDIR= BUILD_JOBS= @@ -925,6 +926,9 @@ while test -n "$1"; do *-use-system-qemu) USE_SYSTEM_QEMU="--use-system-qemu" ;; + --keep-packs) + KEEP_PACKS="--keep-packs" + ;; *-root) needarg BUILD_ROOT="$ARG" @@ -1575,7 +1579,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do if test "$DO_INIT" = true ; then # do fist stage of init_buildsystem rm -f $BUILD_ROOT/.build.success - set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" --prepare "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USE_SYSTEM_QEMU $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS + set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" --prepare "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USE_SYSTEM_QEMU $KEEP_PACKS $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS echo "$* ..." "$@" || cleanup_and_exit 1 check_exit @@ -1856,7 +1860,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do CREATE_BUILD_BINARIES= test "$BUILDTYPE" = preinstallimage && mkdir -p $BUILD_ROOT/.preinstall_image egrep '^#[ ]*needsbinariesforbuild[ ]*$' >/dev/null <$MYSRCDIR/$SPECFILE && CREATE_BUILD_BINARIES=--create-build-binaries - set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USE_SYSTEM_QEMU $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS + set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USE_SYSTEM_QEMU $KEEP_PACKS $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS echo "$* ..." "$@" || cleanup_and_exit 1 check_exit diff --git a/init_buildsystem b/init_buildsystem index 351671e..0d6f084 100755 --- a/init_buildsystem +++ b/init_buildsystem @@ -35,6 +35,7 @@ RPMIDFMT="%{NAME}-%{VERSION}-%{RELEASE} %{BUILDTIME}\n" PREPARE_VM= USE_SYSTEM_QEMU= +KEEP_PACKS= USEUSEDFORBUILD= LIST_STATE= RPMLIST= @@ -51,6 +52,10 @@ while test -n "$1" ; do shift USE_SYSTEM_QEMU=true ;; + --keep-packs) + shift + KEEP_PACKS=true + ;; --create-build-binaries) shift CREATE_BUILD_BINARIES=true @@ -1025,23 +1030,25 @@ rpm_e() # # delete all packages we don't want # -mkdir -p $BUILD_ROOT/.init_b_cache/todelete -for PKG in $BUILD_ROOT/.init_b_cache/alreadyinstalled/* ; do - PKG=${PKG##*/} - test "$PKG" = "*" && continue - ln $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG $BUILD_ROOT/.init_b_cache/todelete/$PKG -done -for PKG in $PACKAGES_TO_INSTALL $PACKAGES_TO_CBINSTALL ; do - rm -f $BUILD_ROOT/.init_b_cache/todelete/$PKG -done -for PKG in $BUILD_ROOT/.init_b_cache/todelete/* ; do - PKG=${PKG##*/} - test "$PKG" = "*" && continue - echo "deleting $PKG" - rpm_e "$PKG" - check_exit -done -rm -rf "$BUILD_ROOT/.init_b_cache/todelete" +if [ -z "$KEEP_PACKS" ]; then + mkdir -p $BUILD_ROOT/.init_b_cache/todelete + for PKG in $BUILD_ROOT/.init_b_cache/alreadyinstalled/* ; do + PKG=${PKG##*/} + test "$PKG" = "*" && continue + ln $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG $BUILD_ROOT/.init_b_cache/todelete/$PKG + done + for PKG in $PACKAGES_TO_INSTALL $PACKAGES_TO_CBINSTALL ; do + rm -f $BUILD_ROOT/.init_b_cache/todelete/$PKG + done + for PKG in $BUILD_ROOT/.init_b_cache/todelete/* ; do + PKG=${PKG##*/} + test "$PKG" = "*" && continue + echo "deleting $PKG" + rpm_e "$PKG" + check_exit + done + rm -rf "$BUILD_ROOT/.init_b_cache/todelete" +fi rm -rf "$BUILD_ROOT/.init_b_cache/preinstalls" mkdir -p "$BUILD_ROOT/.init_b_cache/preinstalls" |