aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2014-11-20 20:01:13 +0100
committerJohannes Löthberg <johannes@kyriasis.com>2014-11-20 20:04:04 +0100
commit5d6ba702cb6e80730d450882fee4b2673b82deb7 (patch)
tree1ea2fe42f05b96e21968c8df79cb1e24a8f148ea
parent0792f8e8cfb2b0abaf6a54e6d54f4b1a3890c341 (diff)
downloadvcs-rebuild-5d6ba702cb6e80730d450882fee4b2673b82deb7.tar.xz
Make get_pkgver_sha work on strings
-rwxr-xr-xbuild-updated-packages.bash18
1 files changed, 13 insertions, 5 deletions
diff --git a/build-updated-packages.bash b/build-updated-packages.bash
index 197c536..037473f 100755
--- a/build-updated-packages.bash
+++ b/build-updated-packages.bash
@@ -8,16 +8,24 @@ cd "$PKGBUILD_DIR"
# Get commit sha from PKGVER of PKGBUILD
#
# Arguments:
-# $1 Path to the directory containing the PKGBUILD
+# $1 Whether the source is a PKGBUILD or string
+# $2 Path to the directory containing the PKGBUILD
# to get the sha from
get_pkgver_sha() {
- (source "$1"/PKGBUILD
- printf "%s" "$(sed -r 's/.*\.r[0-9]*\.g?//' <<<$pkgver)")
+ if [[ "$1" -eq "pkgbuild" ]]; then
+ source "$1"/PKGBUILD
+ elif [[ "$1" -eq "string" ]]; then
+ pkgver="$2"
+ else
+ printf "%s\n" "get_pkgver_sha failed" 1>&2
+ fi
+
+ printf "%s" "$(sed -r 's/.*\.r[0-9]*\.g?//' <<<$pkgver)"
}
main() {
for package in "${packages[@]}"; do
- old_version[$package]=$(get_pkgver_sha "$package")
+ old_version[$package]=$(get_pkgver_sha "pkgbuild" "$package")
(cd "$package"
makepkg --nobuild &>/dev/null) &
done
@@ -25,7 +33,7 @@ main() {
local needs_rebuild=()
for package in "${packages[@]}"; do
- new_head=$(get_pkgver_sha "$package")
+ new_head=$(get_pkgver_sha "pkgbuild" "$package")
if [[ "${old_version[$package]}" != "$new_head" ]]; then
needs_rebuild+=("$package")