summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2015-05-12 16:22:24 +0200
committerAllan McRae <allan@archlinux.org>2015-05-16 06:10:42 +0200
commit8ab106eb9b21263941a4329eb89709f35b2bd178 (patch)
treec2c870756d0b0a0ab15f1b6481ff24d48de6acec /scripts
parent61dd7e03bec4be2e5e331ecd0f01e43f685fb705 (diff)
downloadpacman-8ab106eb9b21263941a4329eb89709f35b2bd178.tar.gz
pacman-8ab106eb9b21263941a4329eb89709f35b2bd178.tar.xz
libmakepkg: extract get_full_version and get_pkg_arch
These functions group in with other functions that extract PKGBUILD information. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/libmakepkg/util/pkgbuild.sh35
-rw-r--r--scripts/makepkg.sh.in35
2 files changed, 35 insertions, 35 deletions
diff --git a/scripts/libmakepkg/util/pkgbuild.sh b/scripts/libmakepkg/util/pkgbuild.sh
index 2e97e4dc..17e4cc56 100644
--- a/scripts/libmakepkg/util/pkgbuild.sh
+++ b/scripts/libmakepkg/util/pkgbuild.sh
@@ -109,3 +109,38 @@ get_pkgbuild_attribute() {
extract_global_variable "$attrname" "$isarray" "$outputvar"
fi
}
+
+##
+# usage : get_full_version()
+# return : full version spec, including epoch (if necessary), pkgver, pkgrel
+##
+get_full_version() {
+ if (( epoch > 0 )); then
+ printf "%s\n" "$epoch:$pkgver-$pkgrel"
+ else
+ printf "%s\n" "$pkgver-$pkgrel"
+ fi
+}
+
+##
+# usage : get_pkg_arch( [$pkgname] )
+# return : architecture of the package
+##
+get_pkg_arch() {
+ if [[ -z $1 ]]; then
+ if [[ $arch = "any" ]]; then
+ printf "%s\n" "any"
+ else
+ printf "%s\n" "$CARCH"
+ fi
+ else
+ local arch_override
+ get_pkgbuild_attribute "$1" arch 1 arch_override
+ (( ${#arch_override[@]} == 0 )) && arch_override=("${arch[@]}")
+ if [[ $arch_override = "any" ]]; then
+ printf "%s\n" "any"
+ else
+ printf "%s\n" "$CARCH"
+ fi
+ fi
+}
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 11e64593..2d64997a 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -854,41 +854,6 @@ missing_source_file() {
exit 1 # $E_MISSING_FILE
}
-##
-# usage : get_full_version()
-# return : full version spec, including epoch (if necessary), pkgver, pkgrel
-##
-get_full_version() {
- if (( epoch > 0 )); then
- printf "%s\n" "$epoch:$pkgver-$pkgrel"
- else
- printf "%s\n" "$pkgver-$pkgrel"
- fi
-}
-
-##
-# usage : get_pkg_arch( [$pkgname] )
-# return : architecture of the package
-##
-get_pkg_arch() {
- if [[ -z $1 ]]; then
- if [[ $arch = "any" ]]; then
- printf "%s\n" "any"
- else
- printf "%s\n" "$CARCH"
- fi
- else
- local arch_override
- get_pkgbuild_attribute "$1" arch 1 arch_override
- (( ${#arch_override[@]} == 0 )) && arch_override=("${arch[@]}")
- if [[ $arch_override = "any" ]]; then
- printf "%s\n" "any"
- else
- printf "%s\n" "$CARCH"
- fi
- fi
-}
-
source_has_signatures() {
local file all_sources