checkpkg: implement comparison against alternative targets
This allows comparing the currently built set of packages against targets named by filename, url, or pkgname. One example use is to compare a package against a different version that was never in the repos; another example use is to compare a *-git package against the non-git version. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
This commit is contained in:
parent
8dbf95cdd4
commit
c14338c0fe
25
checkpkg.in
25
checkpkg.in
|
@ -36,6 +36,8 @@ STARTDIR=$(pwd)
|
||||||
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
||||||
|
|
||||||
for _pkgname in "${pkgname[@]}"; do
|
for _pkgname in "${pkgname[@]}"; do
|
||||||
|
comparepkg=$_pkgname
|
||||||
|
pkgurl=
|
||||||
target_pkgver=$(get_full_version "$_pkgname")
|
target_pkgver=$(get_full_version "$_pkgname")
|
||||||
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
||||||
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
||||||
|
@ -43,16 +45,29 @@ for _pkgname in "${pkgname[@]}"; do
|
||||||
|
|
||||||
ln -s "$pkgfile" "$TEMPDIR"
|
ln -s "$pkgfile" "$TEMPDIR"
|
||||||
|
|
||||||
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname") ||
|
if (( $# )); then
|
||||||
die "Couldn't download previous package for %s." "$_pkgname"
|
case $1 in
|
||||||
|
/*|*/*)
|
||||||
|
pkgurl=file://$(readlink -m "$1") ;;
|
||||||
|
*.pkg.tar*)
|
||||||
|
pkgurl=$1 ;;
|
||||||
|
'')
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
comparepkg=$1 ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
[[ -n $pkgurl ]] || pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$comparepkg") ||
|
||||||
|
die "Couldn't download previous package for %s." "$comparepkg"
|
||||||
|
|
||||||
oldpkg=${pkgurl##*://*/}
|
oldpkg=${pkgurl##*/}
|
||||||
|
|
||||||
if [[ ${oldpkg##*/} = "${pkgfile##*/}" ]]; then
|
if [[ ${oldpkg} = "${pkgfile##*/}" ]]; then
|
||||||
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $pkgurl = file://* ]]; then
|
if [[ $pkgurl = file://* || ( $pkgurl = /* && -f $pkgurl ) ]]; then
|
||||||
ln -s "${pkgurl#file://}" "$TEMPDIR/$oldpkg"
|
ln -s "${pkgurl#file://}" "$TEMPDIR/$oldpkg"
|
||||||
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
||||||
ln -s "$PKGDEST/$oldpkg" "$TEMPDIR/$oldpkg"
|
ln -s "$PKGDEST/$oldpkg" "$TEMPDIR/$oldpkg"
|
||||||
|
|
Loading…
Reference in New Issue