Skip to content
checkpkg.in 2.06 KiB
Newer Older
Jason Chu's avatar
Jason Chu committed
#!/bin/bash

m4_include(lib/common.sh)

# Source makepkg.conf; fail if it is not found
if [[ -r '/etc/makepkg.conf' ]]; then
	source '/etc/makepkg.conf'
	die '/etc/makepkg.conf not found!'
fi

# Source user-specific makepkg.conf overrides
if [[ -r ~/.makepkg.conf ]]; then
if [[ ! -f PKGBUILD ]]; then
	die 'This must be run in the directory of a built package.'
if [[ $arch == 'any' ]]; then
	CARCH='any'
Ionut Biru's avatar
Ionut Biru committed
STARTDIR=$(pwd)
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
for _pkgname in "${pkgname[@]}"; do
	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"
	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"
	oldpkg=${pkgurl##*://*/}
	if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
		die "The built package (%s) is the one in the repo right now!" "$_pkgname"
	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"
	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"
Jason Chu's avatar
Jason Chu committed

	find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
	find-libprovides "$pkgfile" 2>/dev/null | 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"
Jason Chu's avatar
Jason Chu committed
	else
		msg "No soname differences for $_pkgname."
Jason Chu's avatar
Jason Chu committed
	fi
msg "Files saved to $TEMPDIR"