Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 347274 Details for
Bug 468380
eutils.eclass: prune_libtool_files() remove *.la files, which are NOT libtool archives
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Suggested patch
0001-prune_libtool_files-do-not-remove-non-libtool-.la-fi.patch (text/plain), 5.29 KB, created by
Michał Górny
on 2013-05-03 15:10:17 UTC
(
hide
)
Description:
Suggested patch
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2013-05-03 15:10:17 UTC
Size:
5.29 KB
patch
obsolete
>From 36201371c477e5c7f1524ef1723a3a28d7b81425 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> >Date: Fri, 3 May 2013 17:06:36 +0200 >Subject: [PATCH] prune_libtool_files: do not remove non-libtool .la files. > >Let's assume that all libtool files have a consistent format and contain >a line stating 'shouldnotlink=(yes|no)'. We use that to distinguish >modules from libraries, so we can as well use it to validate the .la >file to avoid removing non-libtool .la files. > >This should also make the big 'if' a bit more readable. > >Fixes: https://bugs.gentoo.org/show_bug.cgi?id=468380 >--- > gx86/eclass/eutils.eclass | 117 +++++++++++++++++++++++++--------------------- > 1 file changed, 63 insertions(+), 54 deletions(-) > >diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass >index 04e99e3..db5aa18 100644 >--- a/gx86/eclass/eutils.eclass >+++ b/gx86/eclass/eutils.eclass >@@ -1458,11 +1458,12 @@ prune_libtool_files() { > local archivefile=${f/%.la/.a} > > [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed' >- > local reason pkgconfig_scanned >+ local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}") >+ >+ if [[ ${snotlink} == yes ]]; then > >- # Remove static libs we're not supposed to link against. >- if grep -q '^shouldnotlink=yes$' "${f}"; then >+ # Remove static libs we're not supposed to link against. > if [[ -f ${archivefile} ]]; then > einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)" > queue+=( "${archivefile}" ) >@@ -1474,62 +1475,70 @@ prune_libtool_files() { > reason='module' > fi > >- # Remove .la files when: >- # - user explicitly wants us to remove all .la files, >- # - respective static archive doesn't exist, >- # - they are covered by a .pc file already, >- # - they don't provide any new information (no libs & no flags). >- >- elif [[ ${removing_all} ]]; then >- reason='requested' >- elif [[ ! -f ${archivefile} ]]; then >- reason='no static archive' >- elif [[ ! $(sed -nre \ >- "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \ >- "${f}") ]]; then >- reason='no libs & flags' >- else >- if [[ ! ${pkgconfig_scanned} ]]; then >- # Create a list of all .pc-covered libs. >- local pc_libs=() >- if [[ ! ${removing_all} ]]; then >- local pc >- local tf=${T}/prune-lt-files.pc >- local pkgconf=$(tc-getPKG_CONFIG) >- >- while IFS= read -r -d '' pc; do # for all .pc files >- local arg libs >- >- # Use pkg-config if available (and works), >- # fallback to sed. >- if ${pkgconf} --exists "${pc}" &>/dev/null; then >- sed -e '/^Requires:/d' "${pc}" > "${tf}" >- libs=$(${pkgconf} --libs "${tf}") >- else >- libs=$(sed -ne 's/^Libs://p' "${pc}") >- fi >- >- for arg in ${libs}; do >- if [[ ${arg} == -l* ]]; then >- if [[ ${arg} == '*$*' ]]; then >- eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}" >- eqawarn "(arg: ${arg})" >- eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND." >+ elif [[ ${snotlink} == no ]]; then >+ >+ # A valid .la file must have a valid 'shouldnotlink='. >+ # That assumption helps us avoid removing random files >+ # which match '*.la', see bug #468380. >+ >+ # Remove .la files when: >+ # - user explicitly wants us to remove all .la files, >+ # - respective static archive doesn't exist, >+ # - they are covered by a .pc file already, >+ # - they don't provide any new information (no libs & no flags). >+ >+ if [[ ${removing_all} ]]; then >+ reason='requested' >+ elif [[ ! -f ${archivefile} ]]; then >+ reason='no static archive' >+ elif [[ ! $(sed -nre \ >+ "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \ >+ "${f}") ]]; then >+ reason='no libs & flags' >+ else >+ if [[ ! ${pkgconfig_scanned} ]]; then >+ # Create a list of all .pc-covered libs. >+ local pc_libs=() >+ if [[ ! ${removing_all} ]]; then >+ local pc >+ local tf=${T}/prune-lt-files.pc >+ local pkgconf=$(tc-getPKG_CONFIG) >+ >+ while IFS= read -r -d '' pc; do # for all .pc files >+ local arg libs >+ >+ # Use pkg-config if available (and works), >+ # fallback to sed. >+ if ${pkgconf} --exists "${pc}" &>/dev/null; then >+ sed -e '/^Requires:/d' "${pc}" > "${tf}" >+ libs=$(${pkgconf} --libs "${tf}") >+ else >+ libs=$(sed -ne 's/^Libs://p' "${pc}") >+ fi >+ >+ for arg in ${libs}; do >+ if [[ ${arg} == -l* ]]; then >+ if [[ ${arg} == '*$*' ]]; then >+ eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}" >+ eqawarn "(arg: ${arg})" >+ eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND." >+ fi >+ >+ pc_libs+=( lib${arg#-l}.la ) > fi >+ done >+ done < <(find "${D}" -type f -name '*.pc' -print0) > >- pc_libs+=( lib${arg#-l}.la ) >- fi >- done >- done < <(find "${D}" -type f -name '*.pc' -print0) >+ rm -f "${tf}" >+ fi > >- rm -f "${tf}" >- fi >+ pkgconfig_scanned=1 >+ fi # pkgconfig_scanned > >- pkgconfig_scanned=1 >- fi >+ has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' >+ fi # removal due to .pc > >- has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' >- fi >+ fi # shouldnotlink==no > > if [[ ${reason} ]]; then > einfo "Removing unnecessary ${f#${D%/}} (${reason})" >-- >1.8.2.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 468380
: 347274