summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-01-31 15:17:53 +0100
committerErich Eckner <git@eckner.net>2018-01-31 15:17:53 +0100
commit4b729829aa589aed54d2811ad0190a00b6914e46 (patch)
tree4acdf120a7c6cccb6bef2af3b683ebf1deb208c7
parentb36b0ca61efc66dc0bc4037f4fb5851d0d4d5059 (diff)
downloadbuilder-4b729829aa589aed54d2811ad0190a00b6914e46.tar.xz
bin/common-functions: extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name new
-rwxr-xr-xbin/common-functions24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/common-functions b/bin/common-functions
index 553b9db..03a177b 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -1348,3 +1348,27 @@ trigger_mirror_refreshs() {
screen -S trigger-mirror-update -d -m curl -L "${trigger_url}"
done
}
+
+# extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name
+extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name() {
+ pkgname="$1"
+ pkgname="${pkgname%.pkg.tar.xz}"
+ arch="${pkgname##*-}"
+ pkgname="${pkgname%-*}"
+ sub_pkgrel="${pkgname##*-}"
+ pkgname="${pkgname%-*}"
+ pkgrel="${sub_pkgrel%.*}"
+ if [ "${pkgrel}" = "${sub_pkgrel}" ]; then
+ sub_pkgrel='0'
+ else
+ sub_pkgrel="${sub_pkgrel##*.}"
+ fi
+ epoch="${pkgname##*-}"
+ pkgname="${pkgname%-*}"
+ pkgver="${epoch#*:}"
+ if [ "${pkgver}" = "${epoch}" ]; then
+ epoch='0'
+ else
+ epoch="${epoch%%:*}"
+ fi
+}