summaryrefslogtreecommitdiff
path: root/commitpkg.in
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-10-20 16:17:45 -0400
committerPierre Schmitz <pierre@archlinux.de>2013-11-01 18:52:03 +0100
commit27441f201c2394a991427f6a47199dd40024497b (patch)
tree6c97472ae1045e4c49d8ff261235c7a41241e997 /commitpkg.in
parentc4f72f781b851578793b31e2c0b3f7ec839335cf (diff)
downloaddevtools-27441f201c2394a991427f6a47199dd40024497b.tar.xz
common: implement find_cached_package
This function (currently) searches through $PWD and $PKGDEST looking for a tarball matching the requested package name, architecture, and pkgver. If found, it writes the full path to the located package to stdout and returns 0, else 1. If more than 1 match is found, it's treated as an error and the user will need to figure out what to do. Use this in checkpkg and commitpkg, which previously implemented their own less complete logic, to locate the build artifacts they rely on. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Diffstat (limited to 'commitpkg.in')
-rw-r--r--commitpkg.in24
1 files changed, 3 insertions, 21 deletions
diff --git a/commitpkg.in b/commitpkg.in
index 8dcbd7c..1095006 100644
--- a/commitpkg.in
+++ b/commitpkg.in
@@ -2,22 +2,6 @@
m4_include(lib/common.sh)
-getpkgfile() {
- case $# in
- 0)
- error 'No canonical package found!'
- return 1
- ;;
- [!1])
- error 'Failed to canonicalize package name -- multiple packages found:'
- msg2 '%s' "$@"
- return 1
- ;;
- esac
-
- echo "$1"
-}
-
# Source makepkg.conf; fail if it is not found
if [[ -r '/etc/makepkg.conf' ]]; then
source '/etc/makepkg.conf'
@@ -99,9 +83,8 @@ for _arch in ${arch[@]}; do
for _pkgname in ${pkgname[@]}; do
fullver=$(get_full_version $_pkgname)
- if pkgfile=$(shopt -s nullglob;
- getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
- if grep -q "packager = Unknown Packager" <(bsdtar -xOqf $pkgfile .PKGINFO); then
+ if pkgfile=$(find_cached_package "$_pkgname" "$_arch" "$fullver"); then
+ if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then
die "PACKAGER was not set when building package"
fi
fi
@@ -151,8 +134,7 @@ for _arch in ${arch[@]}; do
for _pkgname in ${pkgname[@]}; do
fullver=$(get_full_version $_pkgname)
- if ! pkgfile=$(shopt -s nullglob;
- getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
+ if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then
warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
skip_arches+=($_arch)
continue 2