Commit Graph

39 Commits

Author SHA1 Message Date
Natanael Copa 22e17446f7 Revert "checkapk: Check how many packages depend on a previous soname"
The implementation is difficult to get right. Keep checkapk simple.
Fixes https://gitlab.alpinelinux.org/alpine/abuild/-/merge_requests/229

This reverts commit acfa7d6732.
2024-03-29 12:19:20 +01:00
Sertonix 8588378efa checkapk: new arch can cause old apk missing 2024-03-13 11:14:34 +00:00
Sören Tempel acfa7d6732 checkapk: Check how many packages depend on a previous soname
Since the changeset committed by psykose a while ago in commit
26118d4997 we now extract the
previous soname. We can pass this previous soname to `apk search -R`
to figure out how many packages are linked against this old soname.

I believe this to be useful for reviewing MRs since the checkapk
output will directly tell us if a contributor has missed rebuilds.
It will also inform us when no rebuilds are necessary, e.g. if the
SONAME was changed but no packages is linked against the library.

Example output for `main/libsodium`:

```
>>> Size difference for libsodium: 336 KiB -> 340 KiB
--- filelist-libsodium-old      2023-09-22 11:24:54.799204225 +0200
+++ filelist-libsodium-new      2023-09-22 11:24:54.799204225 +0200
@@ -1,5 +1,5 @@
 .PKGINFO
 usr/
 usr/lib/
-usr/lib/libsodium.so.23
-usr/lib/libsodium.so.23.3.0
+usr/lib/libsodium.so.26
+usr/lib/libsodium.so.26.1.0
SODIFF:
-usr/lib/libsodium.so.23.3.0:    SONAME               libsodium.so.23
+usr/lib/libsodium.so.26.1.0:    SONAME               libsodium.so.26
REBUILDS:
*** 36 packages linked against 'libsodium.so.23' need to be rebuild!
```
2023-10-18 09:39:12 +00:00
Natanael Copa fab41364f7 checkapk: dont require abuild.conf if we have default conf
also add tests
2023-10-18 11:22:47 +02:00
Natanael Copa 643637dd5d checkapk: add test, fix usage
print --help output to stdout and errors to stderr.
2023-10-18 11:07:24 +02:00
psykose 6c20db871b checkapk: fix a mistaken grep warning
grep: warning: stray \ before -
it matches without \ anyway
2023-07-17 06:12:56 +02:00
psykose cc17a1cc79 checkapk: exit on trap signal
otherwise it cleans up but the loop keeps going and just fails until end,
just spamming the output
2023-07-11 15:38:09 +02:00
psykose 21faeb7f47 checkapk: use grep instead of awk for size checking
the previous implementation had a bug that + chars needed escaping
(which was fixed), and now has another discovered but that pkgnames
could start with a number, so the /^pkg/ match matches the pkgname again
and a size comparison gives you:

>>> Size difference for 7zip: 7zip-22.01-r5 installed size: -> 7zip-23.01-r0 installed size:

using grep -F avoids any magic character expansion and works correctly
in all cases.
2023-06-29 06:00:22 +02:00
psykose df31829660 checkapk: don't objdump invalid elfs
cleans up the output a bit for things that have .so in the name
2023-06-26 10:30:49 +02:00
psykose 535afd9544 checkapk: do simple parallel
this is quite trivial and should be safe
2023-06-26 07:52:28 +02:00
psykose 9855e304c7 checkapk: ignore missing apk error
prior to the recent reworks, this error handling path was never
triggered, because the script is ran without pipefail, and it was at
the end of a | pipe | line | sort, so all it did was be ignored for 'new
apks', when the old one would fail to fetch and be missing.

since we now do hit this path on fetch failure however, it aborts the
script when a new subpackage/package is added (since the 'old apk' won't
exist), and doesn't output a diff. since before we always ignored this,
ignore the 'old apk' perhaps not existing, which gives the currently
intended behaviour.
2023-06-26 07:41:07 +02:00
psykose 256a249feb checkapk: but actually skip symlinks
boolean logic gets confusing..
2023-06-26 04:25:08 +02:00
psykose fd5ec6b4fa checkapk: skip symlinks
this affected the old version too- duplicate sodiffs on symlinks are useless
2023-06-26 04:22:26 +02:00
psykose 9af4012177 checkapk: also make sure only sofiles objdumped 2023-06-26 04:14:15 +02:00
psykose 26118d4997 checkapk: refactor to show previous soname and decompress once and use unified context
closes #10070

previously:
>>> Size difference for gegl: 7480 KiB -> 7956 KiB
--- filelist-gegl-old	2023-06-26 02:28:40.176085274 +0200
+++ filelist-gegl	2023-06-26 02:28:40.202085952 +0200
@@ -47,12 +47,13 @@
 usr/lib/gegl-0.4/tiff-load.so
 usr/lib/gegl-0.4/tiff-save.so
 usr/lib/gegl-0.4/transformops.so
+usr/lib/gegl-0.4/vector-fill.so
 usr/lib/gegl-0.4/vector-stroke.so
 usr/lib/gegl-0.4/webp-load.so
 usr/lib/gegl-0.4/webp-save.so
 usr/lib/girepository-1.0/
 usr/lib/girepository-1.0/Gegl-0.4.typelib
 usr/lib/libgegl-0.4.so.0
-usr/lib/libgegl-0.4.so.0.443.1
+usr/lib/libgegl-0.4.so.0.445.1
 usr/lib/libgegl-npd-0.4.so
 usr/lib/libgegl-sc-0.4.so
usr/lib/gegl-0.4/vector-fill.so:    SONAME               vector-fill.so
usr/lib/libgegl-0.4.so.0.445.1:    SONAME               libgegl-0.4.so.0

now:
>>> Size difference for gegl: 7480 KiB -> 7956 KiB
--- filelist-gegl-old
+++ filelist-gegl-new
@@ -47,12 +47,13 @@
 usr/lib/gegl-0.4/tiff-load.so
 usr/lib/gegl-0.4/tiff-save.so
 usr/lib/gegl-0.4/transformops.so
+usr/lib/gegl-0.4/vector-fill.so
 usr/lib/gegl-0.4/vector-stroke.so
 usr/lib/gegl-0.4/webp-load.so
 usr/lib/gegl-0.4/webp-save.so
 usr/lib/girepository-1.0/
 usr/lib/girepository-1.0/Gegl-0.4.typelib
 usr/lib/libgegl-0.4.so.0
-usr/lib/libgegl-0.4.so.0.443.1
+usr/lib/libgegl-0.4.so.0.445.1
 usr/lib/libgegl-npd-0.4.so
 usr/lib/libgegl-sc-0.4.so
SODIFF:
+usr/lib/gegl-0.4/vector-fill.so:    SONAME               vector-fill.so
-usr/lib/libgegl-0.4.so.0.443.1:    SONAME               libgegl-0.4.so.0
+usr/lib/libgegl-0.4.so.0.445.1:    SONAME               libgegl-0.4.so.0

it also no longer relies on diffutils default output, utilising diff -U0 for comparison

there is also a slight optimisation wrt apk handling, previously it
would get decompressed twice for soname diff. now the intermediate is
stored
2023-06-26 03:17:31 +02:00
psykose 8e25f6d14a checkapk: undo broken parallel thing
this doesn't work for setting lvalues and *size= is never populated

todo: write tests.., or just port this to lua
2023-06-22 22:40:38 +02:00
psykose e3777a7259 checkapk: silence old-pkg gzip/tar errors
when apk fetch fails (a new package is added) these just say 'gzip invalid magic' or similar, as there is no old apk to compare to.

the || die is also never triggered, as it only triggers when the sort fails, since it won't trigger on earlier pipeline steps

this needs more cleaning up, but i'll leave that for the future when i write some tests.
2023-06-22 22:29:34 +02:00
psykose fdbd71d816 checkapk: use pigz when available and run newsize/oldsize in parallel 2023-06-22 13:40:37 +02:00
psykose 59caf9e11e checkapk: handle + in pkgname
the pkgname is passed to awk, and + matches in regex, so it fails to
match the actual package name.

closes #10077
2023-06-01 04:13:23 +00:00
Leo 8eeca0adad *: say we are using GPL-2.0-only 2020-10-23 11:39:18 -03:00
Sören Tempel b3c1b65f75 checkapk: calculate size difference of packages 2020-09-17 11:55:54 +00:00
Natanael Copa c486b3b4f3 allow override sharedir for testing
Aloow overrid sharedir with global ABUILD_SHAREDIR so we test the local
functions.sh instead of a system installed functions.sh
2019-11-07 11:42:23 +00:00
Natanael Copa f3dc428ea0 rename datadir -> sharedir
abuild uses datadir as local variable in various functions. Rename the
global datadir to sharedir to avoid confusion.
2019-11-07 11:42:23 +00:00
Leo 1c075c2855 Fix package version check on checkapk
The assignment of the oldpkg variable is missing the name of the package
2019-10-01 17:14:36 +01:00
Sören Tempel 015f0f69a8 checkapk: remove temporary dir on SIGINT and exit 2018-10-03 10:52:13 +00:00
Jakub Jirutka 948fedc5f7 indent heredocs when possible 2016-08-23 00:09:06 +02:00
Jakub Jirutka 042bf4297f checkapk: fix to work with https repositories 2016-08-09 15:02:17 +02:00
Timo Teräs 034e36f721 checkapk: treat subpackages items as colon separated lists
fixes to pick correct subpackage name when "pkg:split:arch" syntax
is used.
2016-07-27 14:50:32 +03:00
Natanael Copa 9f23ed5409 checkapk: run apk fetch in quiet mode to workaround bug in apk fetch
apk fetch --stdout will mix the progress bar with data output. We work
around this by run it in quiet mode.
2014-01-23 07:25:54 +00:00
Natanael Copa 4757588caf functions: rename abuild_ver to program_version 2013-10-25 07:26:22 +00:00
Natanael Copa 1822f3f624 functions: rename prog to program 2013-10-25 07:24:46 +00:00
Natanael Copa a924d3c171 checkapk: sanity check that we have CARCH set 2013-10-25 07:19:30 +00:00
Dubiousjim cfa6c7d67a various: fancier readconfig, permit env overrides 2013-07-09 07:13:46 +00:00
Dubiousjim b2d6b47be1 various: s/echo/msg/, s/echo/error/, tweak error messages 2013-07-09 07:12:56 +00:00
Dubiousjim ef9fb52908 various: use long options, rework usages 2013-07-09 06:59:30 +00:00
Dubiousjim db1314ac55 various: move conf-loading and i/o to functions 2013-07-09 06:44:01 +00:00
Dubiousjim e1339a9b77 various: add descriptions, attribution, license 2013-07-08 14:48:56 +00:00
Natanael Copa 49a048669c checkapk: find package when REPODEST is used 2013-02-13 07:30:09 +00:00
Natanael Copa 7ac5bd33b3 checkapk: new tool
Tool to help find ABI breakages in package upgrades
2012-12-30 14:13:42 +00:00