]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - builder.sh
- s/^Utilities/Applications
[packages/rpm-build-tools.git] / builder.sh
index b0c8ba6b01f5f453d86db4348ce066645f986081..f2c514f31b47530376c8c030f5f06237714cca68 100644 (file)
@@ -23,9 +23,11 @@ CLEAN=""
 DEBUG=""
 NOURLS=""
 NOCVS=""
+ALLWAYS_CVSUP="yes"
 CVSROOT=${CVSROOT:-""}
 LOGFILE=""
 CHMOD="yes"
+RPMOPTS=""
 
 PATCHES=""
 SOURCES=""
@@ -34,6 +36,8 @@ PACKAGE_RELEASE=""
 PACKAGE_VERSION=""
 PACKAGE_NAME=""
 
+DEF_NICE_LEVEL=0
+
 if [ -f ~/etc/builderrc ]; then
   . ~/etc/builderrc
 elif [ -f ~/.builderrc ]; then
@@ -52,7 +56,7 @@ Usage: builder [-D] [--debug] [-V] [--version] [-a] [--as_anon] [-b] [-ba]
        [-d <cvsroot>] [--cvsroot <cvsroot>] [-g] [--get] [-h] [--help]
        [-l <logfile>] [-m] [--mr-proper] [--logtofile <logfile>] [-q] [--quiet]
        [-r <cvstag>] [--cvstag <cvstag>] [-u] [--no-urls] [-v] [--verbose]
-       <package>.spec
+       [--opts <rpm opts>] <package>.spec
 
        -D, --debug     - enable script debugging mode,
        -V, --version   - output builder version
@@ -74,10 +78,11 @@ Usage: builder [-D] [--debug] [-V] [--version] [-a] [--as_anon] [-b] [-ba]
                          CVS repo or HTTP/FTP,
        -h, --help      - this message,
        -l, --logtofile - log all to file,
-       -m, --mr-proper - only remove all files relayted to spec file and
+       -m, --mr-proper - only remove all files related to spec file and
                          all work resources,
        -nc, --no-cvs   - don't download from CVS, if source URL is given,
        -nu, --no-urls  - don't try to download from FTP/HTTP location,
+       --opts          - additional options for rpm
        -q, --quiet     - be quiet,
        -r, --cvstag    - build package using resources from specified CVS
                          tag,
@@ -214,21 +219,23 @@ get_all_files()
            OPTIONS="$OPTIONS -A"
        fi
        for i in $SOURCES $PATCHES $ICONS; do
+           if [ ! -f `nourl $i` ] || [ $ALLWAYS_CVSUP = "yes" ] 
+             then
                if 
-                       echo $i | egrep -v '(http|ftp|https|cvs)://' |\
-                       egrep -q '\.(gz|bz2)$'
+                       echo $i | grep -vE '(http|ftp|https|cvs)://' |\
+                       grep -qE '\.(gz|bz2)$'
                then
                        echo "Warning: no URL given for $i"
                fi
                
                if      [ -z "$NOCVS" ]||\
-                       [ `echo $i | egrep -v '(ftp|http|https|cvs)://'` ]
+                       [ `echo $i | grep -vE '(ftp|http|https)://'` ]
                then
                        cvs $OPTIONS `nourl $i`
                fi
                
                if      [ -z "$NOURLS" ]&&[ ! -f "`nourl $i`" ]&&\
-                       [ `echo $i | egrep 'ftp://|http://|https://'` ]
+                       [ `echo $i | grep -E 'ftp://|http://|https://'` ]
                then
                        wget -c -nd -t0 "$i"
                fi
@@ -236,6 +243,7 @@ get_all_files()
                if [ ! -f "`nourl $i`" ]; then
                        Exit_error err_no_source_in_repo;
                fi
+           fi
        done
        
        if [ "$CHMOD" = "yes" ]; then
@@ -261,7 +269,7 @@ build_package()
        build-source )
            BUILD_SWITCH="-bs --nodeps" ;;
     esac
-    rpm $BUILD_SWITCH -v $QUIET $CLEAN $SPECFILE
+    nice -n ${DEF_NICE_LEVEL} rpm $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $SPECFILE 
 
     if [ "$?" -ne "0" ]; then
        Exit_error err_build_fail;
@@ -305,12 +313,16 @@ while test $# -gt 0 ; do
            COMMAND="usage"; shift ;;
        -l | --logtofile )
            shift; LOGFILE="${1}"; shift ;;
+       -ni| --nice )
+           shift; DEF_NICE_LEVEL=${1}; shift ;;
        -m | --mr-proper )
            COMMAND="mr-proper"; shift ;;
        -nc | --no-cvs )
            NOCVS="yes"; shift ;;
        -nu | --no-urls )
            NOURLS="yes"; shift ;;
+       --opts )
+           shift; RPMOPTS="${1}"; shift ;;
        -q | --quiet )
            QUIET="--quiet"; shift ;;
        -r | --cvstag )
This page took 0.033946 seconds and 4 git commands to generate.