]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - builder.sh
- tread everything as metapackage when getting deps via rpm-getdeps (experimental...
[packages/rpm-build-tools.git] / builder.sh
index b2d503703b5bcc7d63584259b75f66ba5e9ab33e..3598f1b972e0615acf45985d8ebccd6a42843779 100644 (file)
@@ -23,7 +23,7 @@
 
 VERSION="\
 Build package utility from PLD CVS repository
-V 0.11 (C) 1999-2003 Free Penguins".
+V 0.11 (C) 1999-2004 Free Penguins".
 PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
 
 COMMAND="build"
@@ -40,6 +40,7 @@ NODIST=""
 UPDATE=""
 UPDATE5=""
 ADD5=""
+NO5=""
 ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
 CVSROOT=""
 
@@ -120,12 +121,12 @@ fi
 #LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
 #
 if [ -n "$HOME_ETC" ]; then
-       USER_CFG=$HOME_ETC/.builderrc
+       USER_CFG="$HOME_ETC/.builderrc"
 else
        USER_CFG=~/.builderrc
 fi
 
-[ -f $USER_CFG ] && . $USER_CFG
+[ -f "$USER_CFG" ] && . "$USER_CFG"
 
 run_poldek()
 {
@@ -176,6 +177,7 @@ Usage: builder [-D|--debug] [-V|--version] [-a|--as_anon] [-b|-ba|--build]
        
 -5, --update-md5    - update md5 comments in spec, implies -nd -ncs
 -a5, --add-md5      - add md5 comments to URL sources, implies -nc -nd -ncs
+-n5, --no-md5       - ignore md5 comments in spec
 -D, --debug         - enable script debugging mode,
 -V, --version       - output builder version
 -a, --as_anon       - get files via pserver as cvs@$CVS_SERVER,
@@ -210,6 +212,7 @@ Usage: builder [-D|--debug] [-V|--version] [-a|--as_anon] [-b|-ba|--build]
 -nu, --no-urls      - don't try to download from FTP/HTTP location,
 -ns, --no-srcs      - don't download Sources
 -ns0, --no-source0  - don't download Source0
+-nn, --no-net       - don't download anything from the net
 --opts <rpm opts>   - additional options for rpm
 -q, --quiet         - be quiet,
 --date yyyy-mm-dd   - build package using resources from specified CVS date,
@@ -362,13 +365,11 @@ get_spec()
                set -v;
        fi
 
+       cd "$SPECS_DIR"
+       if [ \! -f "$SPECFILE" ]; then
+               SPECFILE="`basename $SPECFILE .spec`.spec";
+       fi
        if [ "$NOCVSSPEC" != "yes" ]; then
-               cd $SPECS_DIR
-
-               if [ \! -f "$SPECFILE" ]; then
-                       SPECFILE="`basename $SPECFILE .spec`.spec";
-               fi
-
                OPTIONS="up "
 
                if [ -n "$CVSROOT" ]; then
@@ -453,6 +454,7 @@ src_no ()
 
 src_md5 ()
 {
+       [ X"$NO5" = X"yes" ] && return
        no=$(src_no "$1")
        [ -z "$no" ] && return
        cd $SPECS_DIR
@@ -502,7 +504,7 @@ get_files()
        fi
 
        if [ -n "$1$2$3$4$5$6$7$8$9${10}" ]; then
-               cd $SOURCE_DIR
+               cd "$SOURCE_DIR"
 
                OPTIONS="up "
                if [ -n "$CVSROOT" ]; then
@@ -701,7 +703,7 @@ tag_files()
                        OPTIONS="-d $CVSROOT $OPTIONS"
                fi
 
-               cd $SOURCE_DIR
+               cd "$SOURCE_DIR"
                for i in $TAG_FILES
                do
                        # don't tag files stored on distfiles
@@ -718,7 +720,7 @@ tag_files()
                        fi
                done
 
-               cd $SPECS_DIR
+               cd "$SPECS_DIR"
                if [ "$TAG_VERSION" = "yes" ]; then
                        cvs $OPTIONS $TAGVER $SPECFILE
                fi
@@ -749,7 +751,7 @@ branch_files()
                if [ -n "$CVSROOT" ]; then
                        OPTIONS="-d $CVSROOT $OPTIONS"
                fi
-               cd $SOURCE_DIR
+               cd "$SOURCE_DIR"
                for i in $TAG_FILES
                do
                        if [ -f `nourl $i` ]; then
@@ -758,7 +760,7 @@ branch_files()
                                Exit_error err_no_source_in_repo $i
                        fi
                done
-               cd $SPECS_DIR
+               cd "$SPECS_DIR"
                cvs $OPTIONS $TAG $SPECFILE
 
                unset OPTIONS
@@ -774,7 +776,7 @@ build_package()
                set -v;
        fi
 
-       cd $SPECS_DIR
+       cd "$SPECS_DIR"
 
        if [ -n "$TRY_UPGRADE" ]; then
                if [ -n "$FLOAT_VERSION" ]; then
@@ -797,7 +799,7 @@ build_package()
                        unset TOLDVER TNEWVER TNOTIFY
                fi
        fi
-       cd $SPECS_DIR
+       cd "$SPECS_DIR"
 
        case "$COMMAND" in
                build )
@@ -1004,20 +1006,37 @@ remove_build_requires()
 display_bconds()
 {
        if [ "$AVAIL_BCONDS_WITH" != "" ] || [ "$AVAIL_BCONDS_WITHOUT" != "" ]; then
-               echo -ne "We are going to build $SPECFILE with the following conditional flags:\n"
                if [ "$BCOND" != "" ]; then
+                       echo -ne "\nBuilding $SPECFILE with the following conditional flags:\n"
                        echo -ne "$BCOND"
                else
-                       echo -ne "No --with || --without conditions passed to $0"
+                       echo -ne "\nNo conditional flags passed"
                fi
-               echo -ne "\n\nfrom available:\n\n"
+               echo -ne "\n\nfrom available:\n"
                echo -ne "--with   :\t$AVAIL_BCONDS_WITH\n--without:\t$AVAIL_BCONDS_WITHOUT\n\n"
        fi
 }
 
 fetch_build_requires()
 {
-       if [ "${FETCH_BUILD_REQUIRES}" == "yes" ]; then
+       if [ "${FETCH_BUILD_REQUIRES}" = "yes" ]; then
+               if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ]; then
+                        CONF=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\-/ { print "@" $3 } ' | xargs)
+                        DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print "@" $3 } ' | xargs)
+                        if [ -n "$CONF" -o -n "$DEPS" ]; then
+                                 /usr/bin/poldek --update; /usr/bin/poldek --upa
+                        fi
+                        if [ -n "$CONF" ]; then
+                                 echo "Trying to uninstall conflicting packages ($CONF):"
+                                 /usr/bin/poldek --noask --nofollow -ev $CONF
+                        fi
+                        if [ -n "$DEPS" ]; then
+                                 echo "Trying to install dependencies ($DEPS):"
+                                 /usr/bin/poldek -uGv $DEPS
+                        fi
+                        return
+               fi
+                
                echo -ne "\nAll packages installed by fetch_build_requires() are written to:\n"
                echo -ne "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES\n"
                echo -ne "\nIf anything fails, you may get rid of them by executing:\n"
@@ -1145,7 +1164,7 @@ fetch_build_requires()
                done
                export PROMPT_COMMAND=`echo -ne "\033]0;${SPECFILE}\007"`
                if [ "$NOT_INSTALLED_PACKAGES" != "" ]; then
-                       echo "Nie uda³o siê zainstalowaæ nastêpuj±cych pakietów i ich zale¿no¶ci:"
+                       echo "Unable to install following packages and their dependencies:"
                        for pkg in "$NOT_INSTALLED_PACKAGES"
                        do
                                echo $pkg
@@ -1181,6 +1200,9 @@ do
                        UPDATE5="yes"
                        ADD5="yes"
                        shift ;;
+               -n5 | --no-md5 )
+                       NO5="yes"
+                       shift ;;
                -D | --debug )
                        DEBUG="yes"; shift ;;
                -V | --version )
@@ -1227,6 +1249,14 @@ do
                        NOSRCS="yes"; shift ;;
                -ns0 | --no-source0 )
                        NOSOURCE0="yes"; shift ;;
+               -nn | --no-net )
+                       NOCVS="yes"
+                       NOCVSSPEC="yes"
+                       NODIST="yes"
+                       NOMIRRORS="yes"
+                       NOURLS="yes"
+                       NOSRCS="yes"
+                       shift;;
                --opts )
                        shift; RPMOPTS="${1}"; shift ;;
                --with | --without )
This page took 0.045835 seconds and 4 git commands to generate.