core/pkg-infra: tweak only .la files that need it
PATCH 1/1 core/pkg-infra: tweak only .la files that need it
Currently, when we tweak the .la files, we do so unconditionally on all .la files, even those we already fixed in a previous run.
This has the nasty side effect that each .la file will be reported as being touched by all packages that are installed after the package that actually installed said .la file.
Since we can't easily know what files were installed by a package (that is an instrumentation hook, and comes after the mangling), we use a trick (like is done in libtool?): we do mangle all files, each into a temporary location; if the result is identical to the input, we remove the temporary, while if the result differs from the output, we move the temporary to replace the input.
---
Changes v1 -> v2:
- drop spurious trailing semicolon on sed command line (Thomas DS.)
- use $$(find ...) instead of $(find ...), as we don't want it to be evaluated by the Makefile, but by the shell
- silence the output of cmp
- typoes in commit log (Thomas DS.)
--- package/pkg-generic.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
package/pkg-generic.mk +10 -2
@@ -294,7 +294,8 @@ $(BUILD_DIR)/%/.stamp_staging_installed: $(addprefix $(STAGING_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ;\ fi @$(call MESSAGE,"Fixing libtool files") - $(Q)find $(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \ + for la in $$(find $(STAGING_DIR)/usr/lib* -name "*.la"); do \ + cp -a "$${la}" "$${la}.fixed" && \ $(SED) "s:$(BASE_DIR):@BASE_DIR@:g" \ -e "s:$(STAGING_DIR):@STAGING_DIR@:g" \ $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\
@@ -303,7 +304,14 @@ $(BUILD_DIR)/%/.stamp_staging_installed: $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\ -e "s:@TOOLCHAIN_EXTERNAL_INSTALL_DIR@:$(TOOLCHAIN_EXTERNAL_INSTALL_DIR):g") \ -e "s:@STAGING_DIR@:$(STAGING_DIR):g" \ - -e "s:@BASE_DIR@:$(BASE_DIR):g" + -e "s:@BASE_DIR@:$(BASE_DIR):g" \ + "$${la}.fixed" && \ + if cmp -s "$${la}" "$${la}.fixed"; then \ + rm -f "$${la}.fixed"; \ + else \ + mv "$${la}.fixed" "$${la}"; \ + fi || exit 1; \ + done @$(call step_end,install-staging) $(Q)touch $@
Signature · 1 line
2.14.1
PATCH 1/1 core/pkg-infra: tweak only .la files that need it
Hello,
Quoted 29 lines · On Sun, 10 Feb 2019 22:38:18 +0100 "Yann E. MORIN" <[email protected]>…
Currently, when we tweak the .la files, we do so unconditionally on all .la files, even those we already fixed in a previous run.
This has the nasty side effect that each .la file will be reported as being touched by all packages that are installed after the package that actually installed said .la file.
Since we can't easily know what files were installed by a package (that is an instrumentation hook, and comes after the mangling), we use a trick (like is done in libtool?): we do mangle all files, each into a temporary location; if the result is identical to the input, we remove the temporary, while if the result differs from the output, we move the temporary to replace the input.
Reported-by Nicolas Cavallari <[email protected]>Reported-by Thomas Petazzoni <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Nicolas Cavallari <[email protected]>Cc Thomas De Schampheleire <[email protected]>Cc Arnout Vandecappelle <[email protected]>---
Changes v1 -> v2:
- drop spurious trailing semicolon on sed command line (Thomas DS.)
- use $$(find ...) instead of $(find ...), as we don't want it to be evaluated by theMakefile, but by the shell
- silence the output of cmp
- typoes in commit log (Thomas DS.)
Quoted 3 lines
--- package/pkg-generic.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
Applied to master, thanks. Long term, it would be nicer if we could leverage the list of files installed by the package, in order to only tweak the files that really need to be tweaked. But that requires more work in the common infrastructure.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 core/pkg-infra: tweak only .la files that need it
In reply to Yann E. MORINQuoted 24 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Currently, when we tweak the .la files, we do so unconditionally on all .la files, even those we already fixed in a previous run.
This has the nasty side effect that each .la file will be reported as being touched by all packages that are installed after the package that actually installed said .la file.
Since we can't easily know what files were installed by a package (that is an instrumentation hook, and comes after the mangling), we use a trick (like is done in libtool?): we do mangle all files, each into a temporary location; if the result is identical to the input, we remove the temporary, while if the result differs from the output, we move the temporary to replace the input.
Reported-by Nicolas Cavallari <[email protected]>Reported-by Thomas Petazzoni <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Nicolas Cavallari <[email protected]>Cc Thomas De Schampheleire <[email protected]>Cc Arnout Vandecappelle <[email protected]>
Quoted 7 lines
---
Changes v1 -> v2:
- drop spurious trailing semicolon on sed command line (Thomas DS.)
- use $$(find ...) instead of $(find ...), as we don't want it to be evaluated by theMakefile, but by the shell
- silence the output of cmp
- typoes in commit log (Thomas DS.)
Committed to 2019.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard