2014-10-04 00:46:40 +02:00
|
|
|
#!/bin/bash
|
2014-10-04 15:41:22 +02:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
2014-10-08 13:14:28 +02:00
|
|
|
version=@version@
|
|
|
|
|
2014-10-08 00:12:14 +02:00
|
|
|
if [[ -r @libdir@/messages.sh ]];then
|
|
|
|
source @libdir@/messages.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -r @libdir@/util.sh ]];then
|
|
|
|
source @libdir@/util.sh
|
2014-10-04 15:41:22 +02:00
|
|
|
fi
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2014-11-11 23:02:40 +01:00
|
|
|
shopt -s extglob
|
|
|
|
|
|
|
|
|
2014-10-04 00:46:40 +02:00
|
|
|
# Source makepkg.conf; fail if it is not found
|
|
|
|
if [[ -r '/etc/makepkg.conf' ]]; then
|
2014-11-11 23:02:40 +01:00
|
|
|
source '/etc/makepkg.conf'
|
2014-10-04 00:46:40 +02:00
|
|
|
else
|
2014-11-11 23:02:40 +01:00
|
|
|
die '/etc/makepkg.conf not found!'
|
2014-10-04 00:46:40 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Source user-specific makepkg.conf overrides
|
|
|
|
if [[ -r ~/.makepkg.conf ]]; then
|
2014-11-11 23:02:40 +01:00
|
|
|
source ~/.makepkg.conf
|
2014-10-04 00:46:40 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -f PKGBUILD ]]; then
|
2014-11-11 23:02:40 +01:00
|
|
|
die 'This must be run in the directory of a built package.'
|
2014-10-04 00:46:40 +02:00
|
|
|
fi
|
|
|
|
|
2014-11-11 23:02:40 +01:00
|
|
|
. ./PKGBUILD
|
2014-10-04 00:46:40 +02:00
|
|
|
if [[ $arch == 'any' ]]; then
|
|
|
|
CARCH='any'
|
|
|
|
fi
|
|
|
|
|
|
|
|
STARTDIR=$(pwd)
|
2014-11-11 23:02:40 +01:00
|
|
|
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
2014-10-04 00:46:40 +02:00
|
|
|
|
|
|
|
for _pkgname in "${pkgname[@]}"; do
|
2014-11-11 23:02:40 +01: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"
|
|
|
|
fi
|
|
|
|
|
|
|
|
ln -s "$pkgfile" "$TEMPDIR"
|
|
|
|
|
|
|
|
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
|
|
|
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
die "Couldn't download previous package for %s." "$_pkgname"
|
|
|
|
fi
|
|
|
|
|
|
|
|
oldpkg=${pkgurl##*://*/}
|
|
|
|
|
|
|
|
if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
|
|
|
|
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $pkgurl = file://* ]]; then
|
|
|
|
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"
|
|
|
|
fi
|
|
|
|
|
|
|
|
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
|
|
|
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
|
|
|
|
|
|
|
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
|
|
|
|
|
|
|
find-libprovides "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/libraries-$_pkgname-old"
|
|
|
|
find-libprovides "$pkgfile" | sort > "$TEMPDIR/libraries-$_pkgname"
|
|
|
|
if ! diff_output="$(sdiff -s "$TEMPDIR/libraries-$_pkgname-old" "$TEMPDIR/libraries-$_pkgname")"; then
|
|
|
|
msg "Sonames differ in $_pkgname!"
|
|
|
|
echo "$diff_output"
|
|
|
|
else
|
|
|
|
msg "No soname differences for $_pkgname."
|
|
|
|
fi
|
2014-10-04 00:46:40 +02:00
|
|
|
done
|
|
|
|
|
2014-11-11 23:02:40 +01:00
|
|
|
|
|
|
|
# # Source makepkg.conf; fail if it is not found
|
|
|
|
# if [[ -r '/etc/makepkg.conf' ]]; then
|
|
|
|
# source '/etc/makepkg.conf'
|
|
|
|
# else
|
|
|
|
# die '/etc/makepkg.conf not found!'
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# # Source user-specific makepkg.conf overrides
|
|
|
|
# if [[ -r ~/.makepkg.conf ]]; then
|
|
|
|
# source ~/.makepkg.conf
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# if [[ ! -f PKGBUILD ]]; then
|
|
|
|
# die 'This must be run in the directory of a built package.'
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# . ./PKGBUILD
|
|
|
|
# if [[ $arch == 'any' ]]; then
|
|
|
|
# CARCH='any'
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# STARTDIR=$(pwd)
|
|
|
|
#
|
|
|
|
# TMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
|
|
|
#
|
|
|
|
# #cd "$TMPDIR"
|
|
|
|
#
|
|
|
|
# for _pkgname in "${pkgname[@]}"; do
|
|
|
|
# pkgfile=${_pkgname}-$(get_full_version $_pkgname)-${CARCH}${PKGEXT}
|
|
|
|
#
|
|
|
|
# if [[ -f "$STARTDIR/$pkgfile" ]]; then
|
|
|
|
# ln -s "$STARTDIR/$pkgfile" "$pkgfile"
|
|
|
|
# elif [[ -f "$PKGDEST/$pkgfile" ]]; then
|
|
|
|
# ln -s "$PKGDEST/$pkgfile" "$pkgfile"
|
|
|
|
# else
|
|
|
|
# die "File \"$pkgfile\" doesn't exist"
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
|
|
|
#
|
|
|
|
# if [[ $? -ne 0 ]]; then
|
|
|
|
# die "Couldn't download previous package for %s." "$_pkgname"
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# oldpkg=${pkgurl##*://*/}
|
|
|
|
#
|
|
|
|
# if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
|
|
|
|
# die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# if [[ ! -f $oldpkg ]]; then
|
|
|
|
# if [[ $pkgurl = file://* ]]; then
|
|
|
|
# ln -s "${pkgurl#file://}" "${pkgurl##file://*/}"
|
|
|
|
# elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
|
|
|
# ln -s "$PKGDEST/$oldpkg" "$oldpkg"
|
|
|
|
# elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
|
|
|
# ln -s "$STARTDIR/$oldpkg" "$oldpkg"
|
|
|
|
# else
|
|
|
|
# curl -fsLC - --retry 3 --retry-delay 3 -o "$oldpkg" "$pkgurl"
|
|
|
|
# fi
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# bsdtar tf "$oldpkg" | sort > "filelist-$_pkgname-old"
|
|
|
|
# bsdtar tf "$pkgfile" | sort > "filelist-$_pkgname"
|
|
|
|
#
|
|
|
|
# sdiff -s "filelist-$_pkgname-old" "filelist-$_pkgname"
|
|
|
|
#
|
|
|
|
# if diff "filelist-$_pkgname-old" "filelist-$_pkgname" | grep '\.so' > /dev/null 2>&1; then
|
|
|
|
# mkdir -p pkg
|
|
|
|
# cd pkg
|
|
|
|
# bsdtar xf ../"$pkgfile" > /dev/null
|
|
|
|
# diff "../filelist-$_pkgname-old" "../filelist-$_pkgname" | awk '/>.*\.so/{$1 = ""; print $0}' | while read i; do
|
|
|
|
# echo "${i}: " "$(objdump -p "$i" | grep SONAME)"
|
|
|
|
# done
|
|
|
|
# cd ..
|
|
|
|
# else
|
|
|
|
# msg "No soname differences for $_pkgname."
|
|
|
|
# fi
|
|
|
|
# done
|
|
|
|
#
|
|
|
|
# msg "Files saved to $TMPDIR"
|