summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-03-04 01:37:11 +0000
committerSam James <sam@gentoo.org>2022-04-17 15:18:20 +0100
commite8b470885ab9d44ffe46b1078b91dcdd9714e1a1 (patch)
treed82c60d83eaf24570c87f687ed179c3585b618e8 /metadata/install-qa-check.d
parentapp-emulation/xen: improve naming and type of phase shared variable (diff)
downloadgentoo-e8b470885ab9d44ffe46b1078b91dcdd9714e1a1.tar.gz
gentoo-e8b470885ab9d44ffe46b1078b91dcdd9714e1a1.tar.bz2
gentoo-e8b470885ab9d44ffe46b1078b91dcdd9714e1a1.zip
metadata/install-qa-check.d: add 60libtool-la (check for unnecessary .la files)
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'metadata/install-qa-check.d')
-rw-r--r--metadata/install-qa-check.d/60libtool-la45
1 files changed, 45 insertions, 0 deletions
diff --git a/metadata/install-qa-check.d/60libtool-la b/metadata/install-qa-check.d/60libtool-la
new file mode 100644
index 000000000000..fd21ec8406d3
--- /dev/null
+++ b/metadata/install-qa-check.d/60libtool-la
@@ -0,0 +1,45 @@
+# Check if we're installing .la files unnecessarily
+# https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0303
+
+libtool_la_check() {
+ if [[ ${CATEGORY}/${PN} == dev-libs/libltdl ]] ; then
+ # bug #293921
+ return
+ fi
+
+ # Bail out if there aren't any .la files being installed
+ local files=$(find "${ED}"/usr/lib* -name '*.la' -print 2>/dev/null)
+ [[ -n "${files[@]}" ]] || return
+
+ if grep -q "dev-libs/libltdl" <<<${RDEPEND}; then
+ # Nothing to do here
+ return
+ fi
+
+ # Iterate over all the .la files we are installing to verify there's
+ # a corresponding .a file - they're pointless without a corresponding
+ # static library.
+ local file
+ local dir
+ local base
+ local bad_files=()
+ for file in "${files[@]}" ; do
+ dir=$(dirname ${file})
+ base=${dir%/}
+ base=${base%.la}
+
+ if [[ ! -f ${dir}/${base}.a ]] ; then
+ bad_files+=( ${file} )
+ fi
+ done
+
+ if [[ -n "${bad_files[@]}" ]] ; then
+ eqawarn "QA Notice: Installing libtool files (.la) without corresponding libraries!"
+ eqatag -v libtool-la.unnecessary "${bad_files[@]#${D}}"
+ fi
+}
+
+libtool_la_check
+: # guarantee successful exit
+
+# vim:ft=sh