From b86efd8389fa6b8e7d0974bf02c029474caeab8f Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 13 Dec 2023 02:32:07 -0500 Subject: sbopkglint: don't suggest noarch if package contains static libs. --- TODO | 2 +- sbopkglint.d/15-noarch.t.sh | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index ba0dae9..5300183 100644 --- a/TODO +++ b/TODO @@ -3,12 +3,12 @@ DONE: sbolint and sbopkglint both: complain if PRGNAM has invalid characters. DONE: if sbopkglint finds a hardcoded $PKG in /var/lib/pkgtools/scripts/*, mention doinst.sh in the error message DONE: check arch of static libs (like the shared lib checks). +DONE: if package contains any static libs, don't suggest noarch. Not yet implemented: TODO: don't complain about: --- non-image files in icon dirs: [text/xml]: -rw-r--r-- 1 root root 11763 Oct 30 19:35 usr/share/pixmaps/pidgin/guifications/themes/default/theme.xml -TODO: if package contains any static libs, don't suggest noarch. TODO: stop checking shared libs for +x and being stripped if they're not directly in /lib /lib64 /usr/lib /usr/lib64. too many packages trigger this, and it just doesn't matter much. diff --git a/sbopkglint.d/15-noarch.t.sh b/sbopkglint.d/15-noarch.t.sh index 858b19e..075fdb1 100644 --- a/sbopkglint.d/15-noarch.t.sh +++ b/sbopkglint.d/15-noarch.t.sh @@ -10,15 +10,22 @@ # for packages that aren't noarch, recommend noarch if it looks like one. # the recommendation is not an error! +# shared libs and executables: find * -type f -print0 | xargs -0 file -m /etc/file/magic/elf | grep ELF | cut -d: -f1 | xargs -rd "\n" ls -lb > .elfbins.$$ +# static libs (for now, just going by filename!) +find * -type f -a -name '*.a' | xargs -rd "\n" ls -lb > .statlibs.$$ + if [ "$ARCH" = "noarch" ]; then [ -s .elfbins.$$ ] && \ warn "package claims to be noarch, but contains ELF binaries:" && \ cat .elfbins.$$ -elif [ ! -s .elfbins.$$ ] && [ ! -e usr/lib ] && [ ! -e usr/lib64 ]; then + [ -s .statlibs.$$ ] && \ + warn "package claims to be noarch, but contains static libraries:" && \ + cat .statlibs.$$ +elif [ ! -s .statlibs.$$ ] && [ ! -s .elfbins.$$ ] && [ ! -e usr/lib ] && [ ! -e usr/lib64 ]; then x="$( find usr/share/pkgconfig -type f -exec grep 'usr/lib' {} \+ 2>/dev/null )" [ -z "$x" ] && note "package might be a good candidate for noarch" fi -rm -f .elfbins.$$ +rm -f .elfbins.$$ .statlibs.$$ -- cgit v1.2.3