prune_libtool_files: run pkg-config code only if necessary.
Right now, the .pc file parsing takes place each time
prune_libtool_files() is called, even when there are no .la files installed. After this commit, the .pc files will be parsed only when it is necessary, i.e. no other criteria allow removal of a particular .la file. --- gx86/eclass/eutils.eclass | 48 +++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass index 1017243..c4cf3c9 100644 --- a/gx86/eclass/eutils.eclass +++ b/gx86/eclass/eutils.eclass @@ -1436,25 +1436,6 @@ prune_libtool_files() { esac done - # Create a list of all .pc-covered libs. - local pc_libs=() - if [[ ! ${removing_all} ]]; then - local f - local tf=${T}/prune-lt-files.pc - local pkgconf=$(tc-getPKG_CONFIG) - - while IFS= read -r -d ' f; do # for all .pc files - local arg - - sed -e '/^Requires:/d' "${f}" > "${tf}" - for arg in $("${pkgconf}" --libs "${tf}"); do - [[ ${arg} == -l* ]] && pc_libs+=( lib${arg#-l}.la ) - done - done < <(find "${D}" -type f -name '*.pc' -print0) - - rm -f "${tf}" - fi - local f while IFS= read -r -d ' f; do # for all .la files local archivefile=${f/%.la/.a} @@ -1478,17 +1459,40 @@ prune_libtool_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). - local reason + local reason pkgconfig_scanned if [[ ${removing_all} ]]; then reason='requested' elif [[ ! -f ${archivefile} ]]; then reason='no static archive' - elif has "${f##*/}" "${pc_libs[@]}"; then - reason='covered by .pc' 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 f + local tf=${T}/prune-lt-files.pc + local pkgconf=$(tc-getPKG_CONFIG) + + while IFS= read -r -d ' f; do # for all .pc files + local arg + + sed -e '/^Requires:/d' "${f}" > "${tf}" + for arg in $("${pkgconf}" --libs "${tf}"); do + [[ ${arg} == -l* ]] && pc_libs+=( lib${arg#-l}.la ) + done + done < <(find "${D}" -type f -name '*.pc' -print0) + + rm -f "${tf}" + fi + + pkgconfig_scanned=1 + fi + + has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' fi if [[ ${reason} ]]; then -- 1.7.12 |
prune_libtool_files: run pkg-config code only if necessary.
On 25/08/2012 12:32, Michał Górny wrote:
> + local pkgconf=$(tc-getPKG_CONFIG) I'd say you should add a warning before using this if the virtual is not in DEPEND. And don't assume transitive dependencies (they are never nice). You can take a peek to ruby-ng_rspec to have an idea how to implement that kind of warning. -- Diego Elio Pettenò — Flameeyes flameeyes@flameeyes.eu — http://blog.flameeyes.eu/ |
prune_libtool_files: run pkg-config code only if necessary.
On Sat, 25 Aug 2012 12:58:19 -0700
Diego Elio Pettenò <flameeyes@flameeyes.eu> wrote: > On 25/08/2012 12:32, Michał Górny wrote: > > + local > > pkgconf=$(tc-getPKG_CONFIG) > > I'd say you should add a warning before using this if the virtual is > not in DEPEND. And don't assume transitive dependencies (they are > never nice). > > You can take a peek to ruby-ng_rspec to have an idea how to implement > that kind of warning. That's not PMS-compliant, sir. -- Best regards, Michał Górny |
prune_libtool_files: run pkg-config code only if necessary.
On 25/08/2012 13:09, Michał Górny wrote:
> That's not PMS-compliant, sir. But it's terribly useful. (I have expressed before my contempt for PMS, I'm sure.) I'm not expecting the ebuild to die, just to send a warning so that the developer knows when they fail to meet non-obvious requirements. -- Diego Elio Pettenò — Flameeyes flameeyes@flameeyes.eu — http://blog.flameeyes.eu/ |
prune_libtool_files: run pkg-config code only if necessary.
On Sat, 25 Aug 2012 13:10:05 -0700
Diego Elio Pettenò <flameeyes@flameeyes.eu> wrote: > On 25/08/2012 13:09, Michał Górny wrote: > > That's not PMS-compliant, sir. > > But it's terribly useful. (I have expressed before my contempt for > PMS, I'm sure.) Didn't you get upset when it was Mike who was ignoring everyone else and just doing whatever he wanted regardless of the consequences? -- Ciaran McCreesh |
| All times are GMT. The time now is 07:15 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.