]> saetta.ns0.it Git - msys2/commitdiff
Aggiunto il file in autobuilder per capire se il pacchetto deve essere compilato...
authorAndrea Zagli <andrea.zagli@email.it>
Thu, 22 Sep 2016 09:23:52 +0000 (11:23 +0200)
committerAndrea Zagli <andrea.zagli@email.it>
Thu, 22 Sep 2016 09:23:52 +0000 (11:23 +0200)
tools/autobuilder/to_be_build.sh [new file with mode: 0644]

diff --git a/tools/autobuilder/to_be_build.sh b/tools/autobuilder/to_be_build.sh
new file mode 100644 (file)
index 0000000..1cbd3eb
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+CUR=$PWD
+FROM=.
+BRANCH=HEAD
+
+while getopts ":f:b:" opt; do
+       case $opt in
+               f)
+                   FROM=$OPTARG
+                       ;;
+               b)
+                   BRANCH=$OPTARG
+                       ;;
+               \?)
+                       echo "Invalid option: -$OPTARG" >&2
+                       exit 1
+                       ;;
+               :)
+                       echo "Option -$OPTARG requires an argument." >&2
+                       exit 1
+                       ;;
+       esac
+done
+
+echo "From: "$FROM
+
+if [ ! -d $FROM ]; then echo $FROM" isn't a directory" && exit 0; fi
+
+cd $FROM
+if [ ! -e PKGBUILD ]; then "No PKGBUILD file found in "$FROM && exit 0; fi
+
+_realname=`cat PKGBUILD | grep _realname=`
+_basever=`cat PKGBUILD | grep _base_ver=`
+_pkgver=`cat PKGBUILD | grep pkgver=`
+_pkgrel=`cat PKGBUILD | grep pkgrel=`
+
+realname=${_realname:10}
+basever=${_basever:10}
+pkgver=${_pkgver:7}
+pkgrel=${_pkgrel:7}
+
+echo "realname: "$realname
+echo "basever: "$basever
+echo "pkgver: "$pkgver
+echo "pkgrel: "$pkgrel
+
+cd $realname
+
+git fetch
+
+git_list=$(git rev-list --count $BRANCH)
+git_parse=$(git rev-parse --short $BRANCH)
+
+echo "git_list: "$git_list
+echo "git_parse: "$git_parse
+
+pkgbuild_ver=$pkgver"-"$pkgrel
+git_ver=$basever"."$git_list"."$git_parse"-"$pkgrel
+
+echo "PKGBUILD ver: "$pkgbuild_ver
+echo "GIT ver: "$git_ver
+
+echo ""
+if [ "$pkgbuild_ver" != "$git_ver" ]; then
+       echo "TO BE BUILD"
+else
+       echo "Nothing to be build"
+fi
+
+cd $CUR