2004-06-24 22:02:28 +02:00
|
|
|
#!/bin/bash
|
2017-03-28 22:13:18 +02:00
|
|
|
# License: Unspecified
|
2004-06-24 22:02:28 +02:00
|
|
|
|
2013-08-12 01:36:31 +02:00
|
|
|
shopt -s extglob
|
|
|
|
|
2011-11-01 15:33:08 +01:00
|
|
|
m4_include(lib/common.sh)
|
|
|
|
|
2008-01-13 20:53:29 +01:00
|
|
|
# Source makepkg.conf; fail if it is not found
|
2011-08-24 10:18:24 +02:00
|
|
|
if [[ -r '/etc/makepkg.conf' ]]; then
|
2017-05-06 00:41:10 +02:00
|
|
|
# shellcheck source=makepkg-x86_64.conf
|
2010-02-13 19:47:16 +01:00
|
|
|
source '/etc/makepkg.conf'
|
2008-01-13 20:53:29 +01:00
|
|
|
else
|
2011-11-01 15:33:08 +01:00
|
|
|
die '/etc/makepkg.conf not found!'
|
2008-01-13 20:53:29 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Source user-specific makepkg.conf overrides
|
2017-04-05 21:35:57 +02:00
|
|
|
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
|
2017-05-06 00:41:10 +02:00
|
|
|
# shellcheck source=/dev/null
|
2017-04-05 21:35:57 +02:00
|
|
|
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
|
|
|
|
elif [[ -r "$HOME/.makepkg.conf" ]]; then
|
2017-05-06 00:41:10 +02:00
|
|
|
# shellcheck source=/dev/null
|
2017-04-05 21:35:57 +02:00
|
|
|
source "$HOME/.makepkg.conf"
|
2008-01-13 20:53:29 +01:00
|
|
|
fi
|
2007-10-02 06:05:18 +02:00
|
|
|
|
2011-08-24 10:18:24 +02:00
|
|
|
if [[ ! -f PKGBUILD ]]; then
|
2011-11-01 15:33:08 +01:00
|
|
|
die 'This must be run in the directory of a built package.'
|
2004-06-24 22:32:57 +02:00
|
|
|
fi
|
|
|
|
|
2017-05-06 00:41:10 +02:00
|
|
|
# shellcheck source=PKGBUILD.proto
|
2013-08-12 00:09:25 +02:00
|
|
|
. ./PKGBUILD
|
2017-05-06 00:41:07 +02:00
|
|
|
if [[ ${arch[0]} == 'any' ]]; then
|
2010-02-13 19:47:16 +01:00
|
|
|
CARCH='any'
|
2009-10-06 18:18:02 +02:00
|
|
|
fi
|
2004-06-24 22:32:57 +02:00
|
|
|
|
2010-08-17 14:51:12 +02:00
|
|
|
STARTDIR=$(pwd)
|
2011-10-13 11:03:35 +02:00
|
|
|
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
2010-07-11 13:45:51 +02:00
|
|
|
|
2011-08-24 10:18:24 +02:00
|
|
|
for _pkgname in "${pkgname[@]}"; do
|
2019-03-08 03:31:58 +01:00
|
|
|
comparepkg=$_pkgname
|
|
|
|
pkgurl=
|
2013-10-20 22:17:45 +02:00
|
|
|
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"
|
2013-08-12 01:36:31 +02:00
|
|
|
fi
|
2010-02-13 19:47:16 +01:00
|
|
|
|
2013-10-20 22:17:45 +02:00
|
|
|
ln -s "$pkgfile" "$TEMPDIR"
|
2009-10-22 09:03:51 +02:00
|
|
|
|
2019-03-08 03:31:58 +01:00
|
|
|
if (( $# )); then
|
|
|
|
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"
|
2004-07-19 07:43:20 +02:00
|
|
|
|
2019-03-08 03:31:58 +01:00
|
|
|
oldpkg=${pkgurl##*/}
|
2004-06-24 22:32:57 +02:00
|
|
|
|
2019-03-08 03:31:58 +01:00
|
|
|
if [[ ${oldpkg} = "${pkgfile##*/}" ]]; then
|
2013-07-30 21:24:48 +02:00
|
|
|
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
2010-02-13 19:47:16 +01:00
|
|
|
fi
|
|
|
|
|
2019-03-08 03:31:58 +01:00
|
|
|
if [[ $pkgurl = file://* || ( $pkgurl = /* && -f $pkgurl ) ]]; then
|
2013-11-01 21:13:43 +01:00
|
|
|
ln -s "${pkgurl#file://}" "$TEMPDIR/$oldpkg"
|
|
|
|
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
|
|
|
ln -s "$PKGDEST/$oldpkg" "$TEMPDIR/$oldpkg"
|
|
|
|
elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
|
|
|
ln -s "$STARTDIR/$oldpkg" "$TEMPDIR/$oldpkg"
|
|
|
|
else
|
|
|
|
curl -fsLC - --retry 3 --retry-delay 3 -o "$TEMPDIR/$oldpkg" "$pkgurl"
|
2010-02-13 19:47:16 +01:00
|
|
|
fi
|
|
|
|
|
2013-10-24 05:34:12 +02:00
|
|
|
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
2013-08-12 01:36:31 +02:00
|
|
|
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
2010-02-13 19:47:16 +01:00
|
|
|
|
2013-08-12 01:36:31 +02:00
|
|
|
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
2004-06-24 23:10:02 +02:00
|
|
|
|
2014-10-25 17:20:48 +02:00
|
|
|
find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
|
|
|
|
find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname"
|
2014-09-21 23:21:18 +02:00
|
|
|
if ! diff_output="$(sdiff -s "$TEMPDIR/libraries-$_pkgname-old" "$TEMPDIR/libraries-$_pkgname")"; then
|
|
|
|
msg "Sonames differ in $_pkgname!"
|
|
|
|
echo "$diff_output"
|
2005-02-24 05:32:43 +01:00
|
|
|
else
|
2017-04-02 10:09:55 +02:00
|
|
|
msg "No soname differences for %s." "$_pkgname"
|
2005-02-24 05:32:43 +01:00
|
|
|
fi
|
2009-10-22 09:03:51 +02:00
|
|
|
done
|
2010-07-11 13:45:51 +02:00
|
|
|
|
2017-04-02 10:09:55 +02:00
|
|
|
msg "Files saved to %s" "$TEMPDIR"
|