From 27441f201c2394a991427f6a47199dd40024497b Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sun, 20 Oct 2013 16:17:45 -0400 Subject: 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 Signed-off-by: Pierre Schmitz --- checkpkg.in | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'checkpkg.in') diff --git a/checkpkg.in b/checkpkg.in index 4a46df3..b3894ab 100644 --- a/checkpkg.in +++ b/checkpkg.in @@ -29,18 +29,12 @@ STARTDIR=$(pwd) TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX) for _pkgname in "${pkgname[@]}"; do - pkgfile=(${_pkgname}-$(get_full_version $_pkgname)-${CARCH}.pkg.tar?(.?z)) - if (( ${#pkgfile[*]} != 1 )); then - die 'Ambiguous package name: %s\n' "${pkgfile[*]}" + target_pkgver=$(get_full_version "$_pkgname") + if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then + die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver" fi - if [[ -f "$STARTDIR/$pkgfile" ]]; then - ln -s "$STARTDIR/$pkgfile" "$TEMPDIR/$pkgfile" - elif [[ -f "$PKGDEST/$pkgfile" ]]; then - ln -s "$PKGDEST/$pkgfile" "$TEMPDIR/$pkgfile" - else - die "File \"$pkgfile\" doesn't exist" - fi + ln -s "$pkgfile" "$TEMPDIR" pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname") -- cgit v1.2.3-70-g09d2