From 4b729829aa589aed54d2811ad0190a00b6914e46 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 31 Jan 2018 15:17:53 +0100 Subject: bin/common-functions: extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name new --- bin/common-functions | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 +} -- cgit v1.2.3-70-g09d2