]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - relup.sh
do not remove macros.build from macrofiles for parsing spec
[packages/rpm-build-tools.git] / relup.sh
index a60c9be0a7410e97e1a65bf364ebb1f0b86260a7..9a07402e5bfc5f0a574a31c602f59cd8f45de329 100755 (executable)
--- a/relup.sh
+++ b/relup.sh
@@ -17,13 +17,15 @@ get_dump() {
 }
 
 usage="Usage:
-${0##*/} [-i] [-u] [-t] [-n] [-m <MESSAGE>] <SPECLIST>
+${0##*/} [-i] [-g] [-u] [-t|-n] [-m <MESSAGE>] <SPECLIST>
 
 Options:
 -i
   Try to increment package release
+-g
+ get packages if missing, do nothing else
 -u
-  git pull first
+ update packages (git pull)
 -t | -n
   Test mode (dry-run). do not commit
 -m
@@ -88,7 +90,7 @@ if [ ! -x /usr/bin/getopt ]; then
        exit 1
 fi
 
-t=$(getopt -o 'm:inuth' -n "${0##*/}" -- "$@") || exit $?
+t=$(getopt -o 'm:inguth' -n "${0##*/}" -- "$@") || exit $?
 # Note the quotes around `$t': they are essential!
 eval set -- "$t"
 
@@ -100,6 +102,9 @@ while true; do
        -u)
                update=1
                ;;
+       -g)
+               get=1
+               ;;
        -t | -n)
                test=1
                ;;
@@ -140,14 +145,21 @@ for pkg in "$@"; do
        # pkgdir: package/
        pkgdir=${spec%/*}
 
+       # specname: only spec filename
+       specname=${spec##*/}
+
        # start real work
        echo "$pkg ..."
 
        # get package
-       if [ "$update" = "1" ]; then
+       [ "$get" = 1 -a -d "$pkgdir" ] && continue
+
+       if [ "$update" = "1" -o "$get" = "1" ]; then
                ./builder -g -ns "$spec"
        fi
 
+       [ "$get" = 1 ] && continue
+
        # update .spec files
        rel=$(get_release "$spec")
        if [ "$inc" = 1 ]; then
@@ -159,6 +171,9 @@ for pkg in "$@"; do
                        newrel=$(bump_release ${rel})
                        set_release "$spec" $rel $newrel
                fi
+
+               # refetch release
+               rel=$(get_release "$spec")
        fi
 
        # commit the changes
@@ -168,7 +183,7 @@ for pkg in "$@"; do
        echo git commit -m "$msg" $spec
        if [ "$test" != 1 ]; then
                cd $pkgdir
-               git commit -m "$msg" $spec
+               git commit -m "$msg" $specname
                git push
                cd ..
        fi
This page took 0.034256 seconds and 4 git commands to generate.