bfd: fix unnecessary bfd.info regen

Message ID 20241002195808.2441317-1-izbyshev@ispras.ru
State New
Headers
Series bfd: fix unnecessary bfd.info regen |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm fail Patch failed to apply

Commit Message

Alexey Izbyshev Oct. 2, 2024, 7:58 p.m. UTC
  When building from an unmodified release tarball, a REGEN_TEXI
invocation is supposed to create a symlink to the .texi file
in the source directory and discard the newly generated .tmp file.
However, after commit bd32be01c997 ("bfd: merge doc subdir up a level")
it creates the symlink at the wrong level, and then a .texi with
a fresh timestamp, which in turn forces bfd.info regeneration.
This breaks builds in environments without makeinfo program.

Fix this by creating the symlink at the level of the target stamp.

Fixes: bd32be01c997 ("bfd: merge doc subdir up a level")
Signed-off-by: Alexey Izbyshev <izbyshev@ispras.ru>
---
 bfd/Makefile.in  | 2 +-
 bfd/doc/local.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Alan Modra Oct. 3, 2024, 4:41 a.m. UTC | #1
On Wed, Oct 02, 2024 at 10:58:08PM +0300, Alexey Izbyshev wrote:
> When building from an unmodified release tarball, a REGEN_TEXI
> invocation is supposed to create a symlink to the .texi file
> in the source directory and discard the newly generated .tmp file.
> However, after commit bd32be01c997 ("bfd: merge doc subdir up a level")
> it creates the symlink at the wrong level, and then a .texi with
> a fresh timestamp, which in turn forces bfd.info regeneration.
> This breaks builds in environments without makeinfo program.
> 
> Fix this by creating the symlink at the level of the target stamp.

Thanks for finding and fixing this problem.  I've committed your patch
with a small tweak, using $$texi in place of $(@D).

> 
> Fixes: bd32be01c997 ("bfd: merge doc subdir up a level")
> Signed-off-by: Alexey Izbyshev <izbyshev@ispras.ru>
> ---
>  bfd/Makefile.in  | 2 +-
>  bfd/doc/local.mk | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/bfd/Makefile.in b/bfd/Makefile.in
> index b3d97d478eac..b2329c524c78 100644
> --- a/bfd/Makefile.in
> +++ b/bfd/Makefile.in
> @@ -1322,7 +1322,7 @@ REGEN_TEXI = \
>  	$(MKDOC) -f $(srcdir)/doc/doc.str < $< > $@.tmp; \
>  	texi=$@; \
>  	texi=$${texi%.stamp}.texi; \
> -	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi .; \
> +	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $(@D); \
>  	$(SHELL) $(srcdir)/../move-if-change $@.tmp $$texi; \
>  	touch $@; \
>  	)
> diff --git a/bfd/doc/local.mk b/bfd/doc/local.mk
> index 5e8f486f200f..bd7b2cde5385 100644
> --- a/bfd/doc/local.mk
> +++ b/bfd/doc/local.mk
> @@ -101,7 +101,7 @@ REGEN_TEXI = \
>  	$(MKDOC) -f $(srcdir)/%D%/doc.str < $< > $@.tmp; \
>  	texi=$@; \
>  	texi=$${texi%.stamp}.texi; \
> -	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi .; \
> +	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $(@D); \
>  	$(SHELL) $(srcdir)/../move-if-change $@.tmp $$texi; \
>  	touch $@; \
>  	)
> -- 
> 2.46.0
  

Patch

diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index b3d97d478eac..b2329c524c78 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -1322,7 +1322,7 @@  REGEN_TEXI = \
 	$(MKDOC) -f $(srcdir)/doc/doc.str < $< > $@.tmp; \
 	texi=$@; \
 	texi=$${texi%.stamp}.texi; \
-	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi .; \
+	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $(@D); \
 	$(SHELL) $(srcdir)/../move-if-change $@.tmp $$texi; \
 	touch $@; \
 	)
diff --git a/bfd/doc/local.mk b/bfd/doc/local.mk
index 5e8f486f200f..bd7b2cde5385 100644
--- a/bfd/doc/local.mk
+++ b/bfd/doc/local.mk
@@ -101,7 +101,7 @@  REGEN_TEXI = \
 	$(MKDOC) -f $(srcdir)/%D%/doc.str < $< > $@.tmp; \
 	texi=$@; \
 	texi=$${texi%.stamp}.texi; \
-	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi .; \
+	test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $(@D); \
 	$(SHELL) $(srcdir)/../move-if-change $@.tmp $$texi; \
 	touch $@; \
 	)