]> git.pld-linux.org Git - projects/pld-builder.new.git/commitdiff
Allow make-request.sh working even of systems without rpm or not being PLD
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Wed, 12 Dec 2018 08:14:19 +0000 (09:14 +0100)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Wed, 12 Dec 2018 08:14:19 +0000 (09:14 +0100)
client/make-request.sh

index b647e1588ed4876f6c8f65e190db4e862127e880..ed17f2dbe062991062df6bf4558b288cb885c719 100755 (executable)
@@ -189,17 +189,25 @@ autotag() {
 # get autotag for specs
 # WARNING: This may checkout some files from VCS
 get_autotag() {
-       local pkg spec rpmdir
+       local pkg spec rpmdir gitdir
 
-       rpmdir=$(rpm -E %_topdir)
+       rpmdir=$(rpm -E %_topdir 2> /dev/null)
        for pkg in "$@"; do
-               cd $rpmdir
                # strip branches
                pkg=${pkg%:*}
                # strip .spec extension
                pkg=${pkg%.spec}
+
+               if [ -n "$rpmdir" ]; then
+                       cd $rpmdir
+               else
+                       gitdir=$(mktemp -d) || exit 1
+                       cd $gitdir
+                       git clone --depth=1 git://git.pld-linux.org/packages/$pkg
+               fi
+
                # checkout only if missing
-               if [ ! -e $pkg/$pkg.spec ]; then
+               if [ ! -e $pkg/$pkg.spec -a -x $rpmdir/builder ]; then
                        $rpmdir/builder -g $pkg -ns -r HEAD 1>&2
                fi
                if [ ! -e $pkg/$pkg.spec ]; then
@@ -209,6 +217,8 @@ get_autotag() {
                        cd $pkg
                        autotag $pkg.spec
                fi
+
+               [ -d "$gitdir" ] && rm -rf "$gitdir"
        done
 }
 
This page took 0.080623 seconds and 4 git commands to generate.