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 fiels were isntalled by a package (that is an instrumetnation hook, and comes after the mangling), we use a trick (like is done in libtool?): we do mangle all files, each in into a temporary location; if the result is identical to the input, we remove the temporary, while if the resiult differes from the output, we move the temporary to the input.
--- 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 \ + $(Q)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 "$${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
Hi Yann,
El dom., 10 feb. 2019 a las 9:48, Yann E. MORIN
(<[email protected]>) escribi?:
Quoted 9 lines
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 fiels were isntalled by a package (that
files
installed
Quoted 1 line
is an instrumetnation hook, and comes after the mangling), we use a
instrumentation
Quoted 1 line
trick (like is done in libtool?): we do mangle all files, each in into a
/in/d
Quoted 2 lines
temporary location; if the result is identical to the input, we remove the temporary, while if the resiult differes from the output, we move
result differs
Quoted 28 lines
the temporary to 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]>--- package/pkg-generic.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)package/pkg-generic.mk +2
-1@@ -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 \ + $(Q)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),\
package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_staging_installed: · line 307
Quoted 5 lines
package/pkg-generic.mk +1
-1@@ -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"; \
The semicolon shouldn't be here, right? I.e. the "$${la}.fixed" below is the argument to the sed command, no?
package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_staging_installed: · line 317
Quoted 10 lines
package/pkg-generic.mk +7
-0+ "$${la}.fixed" && \ + if cmp "$${la}" "$${la}.fixed"; then \ + rm -f "$${la}.fixed"; \ + else \ + mv "$${la}.fixed" "$${la}"; \ + fi || exit 1; \ + done @$(call step_end,install-staging) $(Q)touch $@
I did not test it but it looks a valid approach.
Best regards,
Thomas
PATCH 1/1 core/pkg-infra: tweak only .la files that need it
Thomas, All,
On 2019-02-10 20:23 +0100, Thomas De Schampheleire spake thusly:
Quoted 19 lines
El dom., 10 feb. 2019 a las 9:48, Yann E. MORIN
(<[email protected]>) escribi?:Quoted 9 lines
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 fiels were isntalled by a package (that
files
installedQuoted 1 line
is an instrumetnation hook, and comes after the mangling), we use a
instrumentation
Quoted 8 lines
Quoted 1 line
trick (like is done in libtool?): we do mangle all files, each in into a
/in/d
Quoted 2 lines
temporary location; if the result is identical to the input, we remove the temporary, while if the resiult differes from the output, we move
result differs
OK, so it looks like my new glasses are not up to the task of fixing my eyesight, since I could not spot any of those mistakes when proof-reading myself...
Or maybe it is not my eyes that are deffective, in fact?
Quoted 13 lines
Quoted 13 lines
the temporary to 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]>--- package/pkg-generic.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
Quoted 10 lines
package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_staging_installed: · line 297
Quoted 10 lines
package/pkg-generic.mk +1
-1@@ -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 \ + $(Q)for la in $(find $(STAGING_DIR)/usr/lib* -name "*.la"); do \
Meh... The real culp[rit for the borked patch is that $(find ...) is not the same as $$(find ...) here... So the loop is never, ever entered, and the issue below...
Quoted 5 lines
Quoted 5 lines
package/pkg-generic.mk +1
-0+ 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:
Quoted 8 lines
package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_staging_installed: · line 307
Quoted 5 lines
package/pkg-generic.mk +1
-1$(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"; \The semicolon shouldn't be here, right? I.e. the "$${la}.fixed" below is the argument to the sed command, no?
... is not noticed.
Regards,
Yann E. MORIN.
Quoted 15 lines
package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_staging_installed: · line 317
Quoted 10 lines
package/pkg-generic.mk +7
-0+ "$${la}.fixed" && \ + if cmp "$${la}" "$${la}.fixed"; then \ + rm -f "$${la}.fixed"; \ + else \ + mv "$${la}.fixed" "$${la}"; \ + fi || exit 1; \ + done @$(call step_end,install-staging) $(Q)touch $@I did not test it but it looks a valid approach.
Best regards,
Thomas
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'