From: Ludwig Nussel Date: Fri, 15 Feb 2008 15:11:17 +0000 (+0000) Subject: add --repository to replace --rpms (bnc#346113) X-Git-Tag: obs_2.0~431 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a597708235c0878bdce5a8a876f92406b3108a3;p=tools%2Fobs-build.git add --repository to replace --rpms (bnc#346113) --- diff --git a/build b/build index d47057a..1220565 100755 --- a/build +++ b/build @@ -9,14 +9,14 @@ test -z "$BUILD_DIR" && BUILD_DIR=/usr/lib/build test -z "$BUILD_ROOT" && BUILD_ROOT=/var/tmp/build-root -test -z "$BUILD_RPMS" && BUILD_RPMS=/media/dvd/suse test -z "$BUILD_ARCH" && { BUILD_ARCH=`uname -m` test i686 = "$BUILD_ARCH" && BUILD_ARCH=i586 } -export BUILD_ARCH BUILD_ROOT BUILD_RPMS BUILD_DIR +export BUILD_ARCH BUILD_ROOT BUILD_DIR definesnstuff=() +repos=() export PATH=$BUILD_DIR:$PATH @@ -348,6 +348,15 @@ while test -n "$1"; do --define|--with|--without) definesnstuff[${#definesnstuff[@]}]="$PARAM"; definesnstuff[${#definesnstuff[@]}]="$ARG"; + shift + ;; + --repository) + if [ -z "$ARG" ] ; then + echo_help + cleanup_and_exit + fi + repos[${#repos[@]}]="$PARAM"; + repos[${#repos[@]}]="$ARG"; shift ;; ----noarg) @@ -373,6 +382,9 @@ test -z "$LIST_STATE" -a "$UID" != 0 && { cleanup_and_exit 1 } +repos=("${repos[@]}" ${BUILD_RPMS//:/ /}) +: ${repos:=("/media/dvd/suse")} + if test -n "$KILL" ; then test -z "$SRCDIR" || usage if test -z "$XENIMAGE" ; then @@ -451,7 +463,7 @@ if test -n "$LIST_STATE" ; then } for SPECFILE in $BUILD_ROOT/usr/src/packages/SPECS/*.spec ; do : ; done fi - init_buildsystem --list-state "${definesnstuff[@]}" $USEUSEDFORBUILD $SPECFILE $BUILD_EXTRA_PACKS + init_buildsystem --list-state "${definesnstuff[@]}" "${repos[@]}" $USEUSEDFORBUILD $SPECFILE $BUILD_EXTRA_PACKS ERR=$? rm -rf $BUILD_ROOT cleanup_and_exit $ERR @@ -577,8 +589,8 @@ for SPECFILE in $SPECFILES ; do if test -n "$XENIMAGE" ; then # do fist stage of init_buildsystem - echo init_buildsystem $USEUSEDFORBUILD $RPMLIST $SPECFILE $ADDITIONAL_PACKS ... - init_buildsystem --prepare "${definesnstuff[@]}" $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS || cleanup_and_exit 1 + echo init_buildsystem --prepare "${definesnstuff[@]}" "${repos[@]}" $USEUSEDFORBUILD $RPMLIST $SPECFILE $ADDITIONAL_PACKS ... + init_buildsystem --prepare "${definesnstuff[@]}" "${repos[@]}" $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS || cleanup_and_exit 1 # start up xen, rerun ourself mkdir -p $BUILD_ROOT/.build cp -a $BUILD_DIR/. $BUILD_ROOT/.build @@ -591,7 +603,6 @@ for SPECFILE in $SPECFILES ; do echo "SPECFILE='${SPECFILE//\'/$Q}'" > $BUILD_ROOT/.build/build.data echo "BUILD_JOBS='${BUILD_JOBS//\'/$Q}'" >> $BUILD_ROOT/.build/build.data echo "BUILD_ARCH='${BUILD_ARCH//\'/$Q}'" >> $BUILD_ROOT/.build/build.data - echo "BUILD_RPMS='${BUILD_RPMS//\'/$Q}'" >> $BUILD_ROOT/.build/build.data case $BUILD_DIST in */*) cp $BUILD_DIST $BUILD_ROOT/.build/build.dist @@ -617,6 +628,9 @@ for SPECFILE in $SPECFILES ; do echo -n "definesnstuff=(" >> $BUILD_ROOT/.build/build.data shellquote "${definesnstuff[@]}" >> $BUILD_ROOT/.build/build.data echo ")" >> $BUILD_ROOT/.build/build.data + echo -n "repos=(" >> $BUILD_ROOT/.build/build.data + shellquote "${repos[@]}" >> $BUILD_ROOT/.build/build.data + echo ")" >> $BUILD_ROOT/.build/build.data umount $BUILD_ROOT XMROOT=file:$XENIMAGE XMROOT=${XMROOT/#file:\/dev/phy:} @@ -649,8 +663,8 @@ for SPECFILE in $SPECFILES ; do fi if test "$DO_INIT" = true ; then - echo init_buildsystem "${definesnstuff[@]}" $USEUSEDFORBUILD $RPMLIST $SPECFILE $ADDITIONAL_PACKS ... - $BUILD_INIT_BUILDSYSTEM $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS || cleanup_and_exit 1 + echo init_buildsystem "${definesnstuff[@]}" "${repos[@]}" $USEUSEDFORBUILD $RPMLIST $SPECFILE $ADDITIONAL_PACKS ... + $BUILD_INIT_BUILDSYSTEM "${definesnstuff[@]}" "${repos[@]}" $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS || cleanup_and_exit 1 fi if test -z "$BUILD_DIST" -a -e "$BUILD_ROOT/.guessed_dist" ; then diff --git a/init_buildsystem b/init_buildsystem index 9ac4722..f2df676 100755 --- a/init_buildsystem +++ b/init_buildsystem @@ -19,6 +19,7 @@ export DEBIAN_PRIORITY=critical export BUILD_DIR=${BUILD_DIR:-/usr/lib/build} PROC_IS_MOUNTED= definesnstuff=() +repos=() # should RPMs be installed with --force ? USE_FORCE=false @@ -35,7 +36,7 @@ LIST_STATE= RPMLIST= while test -n "$1" ; do - case $1 in + case "$1" in --prepare) shift PREPARE_XEN=true @@ -57,7 +58,11 @@ while test -n "$1" ; do definesnstuff[${#definesnstuff[@]}]="$1"; definesnstuff[${#definesnstuff[@]}]="$2"; shift 2 - ;; + ;; + --repository) + repos[${#repos[@]}]="$2"; + shift 2; + ;; *) break ;; @@ -65,6 +70,9 @@ while test -n "$1" ; do done PKGS="$*" +# for backward compatability +repos=("${repos[@]}" ${BUILD_RPMS//:/ /}) + # # needed functions # @@ -191,21 +199,21 @@ DEVLIST } function validate_cache_file { - test "$BUILD_RPMS" != "$(cat $CACHE_FILE.id 2>/dev/null)" && rm -f $CACHE_FILE.id + test "${repos[*]}" != "$(cat $CACHE_FILE.id 2>/dev/null)" && rm -f $CACHE_FILE.id test -f $CACHE_FILE || rm -f $CACHE_FILE.id - for SRC in ${BUILD_RPMS//:/ } ; do + for SRC in "${repos[@]}" ; do test -z "$SRC" && SRC=. - test $SRC -nt $CACHE_FILE && rm -f $CACHE_FILE.id + test "$SRC" -nt $CACHE_FILE && rm -f $CACHE_FILE.id done if ! test -f $CACHE_FILE.id ; then test -z "$LIST_STATE" && echo initializing $CACHE_FILE with find command... - for SRC in ${BUILD_RPMS//:/ } ; do + for SRC in "${repos[@]}" ; do test -z "$SRC" && SRC=. - find $SRC -type f -name packages -print -o -follow -type f \( -name "*.rpm" -o -name "*.deb" \) -a ! -name "*src.rpm" -printf '%T@/%s/%i %p\n' + find "$SRC" -type f -name packages -print -o -follow -type f \( -name "*.rpm" -o -name "*.deb" \) -a ! -name "*src.rpm" -printf '%T@/%s/%i %p\n' echo done | createrpmdeps $CACHE_FILE > $CACHE_FILE.new mv $CACHE_FILE.new $CACHE_FILE - echo "$BUILD_RPMS" > $CACHE_FILE.id + echo "${repos[*]}" > $CACHE_FILE.id fi }