projects/aports·blob v2.14.1 · refs

75 lines · 1.9 KiB

1#!/bin/sh
2
3die() {
4 echo "$@" >&2
5 exit 1
6}
7
8msg() {
9 echo "$@"
10}
11
12have_abuild_conf=
13
14for conf in /etc/abuild.conf ~/.abuild/abuild.conf; do
15 if [ -f "$conf" ]; then
16 . $conf && have_abuild_conf=yes
17 fi
18done
19
20[ -z "$have_abuild_conf" ] && die "no abuild.conf found"
21
22if ! [ -f APKBUILD ]; then
23 die 'This must be run in the directory of a built package.'
24fi
25
26. ./APKBUILD
27
28startdir="$PWD"
29tmpdir=$(mktemp -d -t checkpkg-script.XXXXXX)
30cd "$tmpdir" || die "Failed to create temp dir"
31
32for i in $pkgname $subpackages; do
33 _pkgname=${i%:*}
34 pkg=${_pkgname}-$pkgver-r$pkgrel
35 pkgfile=${pkg}.apk
36 repodir=${startdir%/*}
37 repo=${repodir##*/}
38
39 for filepath in "$PKGDEST"/$pkgfile "$REPODEST"/$repo/$CARCH/$pkgfile "$startdir"/$pkgfile; do
40 if [ -f "$filepath" ]; then
41 break
42 fi
43 done
44 [ -f "$filepath" ] || die "could not find $pkgfile"
45
46 # generate a temp repositories file with only the http repos
47 grep ^http: /etc/apk/repositories > $tmpdir/repositories
48
49 oldpkg=$(apk fetch --repositories-file $tmpdir/repositories --simulate 2>&1 | sed 's/^Downloading //')
50 if [ "${oldpkg}" = "${pkg}" ]; then
51 die "The built package ($_pkgname) is the one in the repo right now!"
52 fi
53
54 apk fetch --repositories-file $tmpdir/repositories --stdout $_pkgname \
55 | tar -zt | grep -v '^\.SIGN\.' | sort > filelist-$_pkgname-old \
56 || die "Failed to download old pkg. Maybe run 'apk update'?"
57
58 tar -ztf "$filepath" | grep -v '^\.SIGN\.' | sort > "filelist-$_pkgname"
59
60 diff -u "filelist-$_pkgname-old" "filelist-$_pkgname"
61
62 if diff "filelist-$_pkgname-old" "filelist-$_pkgname" | grep '\.so' > /dev/null 2>&1; then
63 mkdir -p pkg
64 cd pkg
65 tar -zxf "$filepath" > /dev/null
66 diff "../filelist-$_pkgname-old" "../filelist-$_pkgname" | awk '/>.*\.so/{$1 = ""; print $0}' | while read i; do
67 echo "${i}: " "$(objdump -p "$i" | grep SONAME)"
68 done
69 cd ..
70 else
71 msg "No soname differences for $_pkgname."
72 fi
73done
74
75msg "Files saved to $tmpdir"