diff mbox series

[1/1] package/netsniff-ng: fix install when building in parallel

Message ID 20240829023115.8437-1-fede@evolware.org
State Superseded
Headers show
Series [1/1] package/netsniff-ng: fix install when building in parallel | expand

Commit Message

Federico Pellegrin Aug. 29, 2024, 2:31 a.m. UTC
When building in parallel, the package will randomly fail in
install phase due to a missing make dependency.

Already submitted and merged upstream:
https://github.com/netsniff-ng/netsniff-ng/pull/239

Signed-off-by: Federico Pellegrin <fede@evolware.org>
---
 .../0002-Fix_post_install_deps.patch          | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 package/netsniff-ng/0002-Fix_post_install_deps.patch

Comments

Federico Pellegrin Aug. 29, 2024, 2:34 a.m. UTC | #1
Hi!
If it is not a big hassle (the netsniff-ng version is the same and so the
receipe and so on, so it shouldn't be hopefully) would be great if applied
also to LTS 2024.02.x branch.
Not sure if I'd need to do another request, let me know if so!

Thanks!
Federico


Il giorno gio 29 ago 2024 alle ore 04:31 Federico Pellegrin <
fede@evolware.org> ha scritto:

> When building in parallel, the package will randomly fail in
> install phase due to a missing make dependency.
>
> Already submitted and merged upstream:
> https://github.com/netsniff-ng/netsniff-ng/pull/239
>
> Signed-off-by: Federico Pellegrin <fede@evolware.org>
> ---
>  .../0002-Fix_post_install_deps.patch          | 46 +++++++++++++++++++
>  1 file changed, 46 insertions(+)
>  create mode 100644 package/netsniff-ng/0002-Fix_post_install_deps.patch
>
> diff --git a/package/netsniff-ng/0002-Fix_post_install_deps.patch
> b/package/netsniff-ng/0002-Fix_post_install_deps.patch
> new file mode 100644
> index 0000000000..9ed0744491
> --- /dev/null
> +++ b/package/netsniff-ng/0002-Fix_post_install_deps.patch
> @@ -0,0 +1,46 @@
> +From 18e111e06f5eaf074f1c1e0cff79a0e72dce7590 Mon Sep 17 00:00:00 2001
> +From: Federico Pellegrin <fede@evolware.org>
> +Date: Wed, 28 Aug 2024 06:23:35 +0200
> +Subject: [PATCH] build: fix install dependencies in Makefile template
> +
> +post_install should execute after do_install otherwise when building
> +in parallel (-j) this leads to sporadic failures of trafgen stddef
> +header, since it is installed in do_install but then post_install
> +does a mv supposing it is already there, for example:
> +
> +```
> +  INST netsniff-ng/netsniff-ng
> +  INST trafgen/trafgen
> +mv: cannot stat '/tmp/a/pref/etc/netsniff-ng/trafgen_stddef.h': No such
> file or directory
> +make: *** [trafgen/Makefile:57: trafgen_post_install] Error 1
> +make: *** Waiting for unfinished jobs....
> +  INST netsniff-ng/netsniff-ng.8.gz
> +  INST trafgen/trafgen.8.gz
> +  INST ether.conf
> +  INST tcp.conf
> +  INST trafgen_stddef.h
> +```
> +
> +(it is visible above that the stddef.h is installed later than the post
> +is trying to move it away)
> +
> +Forcing the order of post after do will guarantee that it will be there
> +when it needs to be moved and it will be safe to do a parallel install.
> +Just relying on the ordering of the $(1)_install definition is wrong and
> +dependant on make version (and luck!).
> +---
> + Template | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/Template b/Template
> +index 056f594a2..54b597291 100644
> +--- a/Template
> ++++ b/Template
> +@@ -12,6 +12,7 @@ define TOOL_templ
> +       $(Q)eval GZIP= gzip $(GZIP_ENV) $(1).8 > $(1)/$(1).8.gz
> +       $(Q)$$(call INST,$(1)/$(1).8.gz,$$(DESTDIR)$$(MAN8DIR))
> +       $(Q)$$(foreach file,$$($(1)-confs),$$(call
> INST,$$(file),$$(DESTDIR)$$(ETCDIRE));)
> ++  $(1)_post_install: $(1)_do_install
> +   $(1)_install: $(1)_do_install $(1)_post_install
> +   $(1)_uninstall: $(1)_uninstall_custom
> +       $(Q)$$(call RM,$$(DESTDIR)$$(SBINDIR)/$(1))
> --
> 2.46.0
>
>
Waldemar Brodkorb Aug. 29, 2024, 6:41 a.m. UTC | #2
Hi,
Federico Pellegrin wrote,

> When building in parallel, the package will randomly fail in
> install phase due to a missing make dependency.
> 
> Already submitted and merged upstream:
> https://github.com/netsniff-ng/netsniff-ng/pull/239
> 
> Signed-off-by: Federico Pellegrin <fede@evolware.org>

You also need a SoB ine in the patch, and a Upstream tag.
See the documentation here:
https://nightly.buildroot.org/manual.html#_additional_patch_documentation

best regards
 Waldemar
diff mbox series

Patch

diff --git a/package/netsniff-ng/0002-Fix_post_install_deps.patch b/package/netsniff-ng/0002-Fix_post_install_deps.patch
new file mode 100644
index 0000000000..9ed0744491
--- /dev/null
+++ b/package/netsniff-ng/0002-Fix_post_install_deps.patch
@@ -0,0 +1,46 @@ 
+From 18e111e06f5eaf074f1c1e0cff79a0e72dce7590 Mon Sep 17 00:00:00 2001
+From: Federico Pellegrin <fede@evolware.org>
+Date: Wed, 28 Aug 2024 06:23:35 +0200
+Subject: [PATCH] build: fix install dependencies in Makefile template
+
+post_install should execute after do_install otherwise when building
+in parallel (-j) this leads to sporadic failures of trafgen stddef
+header, since it is installed in do_install but then post_install
+does a mv supposing it is already there, for example:
+
+```
+  INST	netsniff-ng/netsniff-ng
+  INST	trafgen/trafgen
+mv: cannot stat '/tmp/a/pref/etc/netsniff-ng/trafgen_stddef.h': No such file or directory
+make: *** [trafgen/Makefile:57: trafgen_post_install] Error 1
+make: *** Waiting for unfinished jobs....
+  INST	netsniff-ng/netsniff-ng.8.gz
+  INST	trafgen/trafgen.8.gz
+  INST	ether.conf
+  INST	tcp.conf
+  INST	trafgen_stddef.h
+```
+
+(it is visible above that the stddef.h is installed later than the post
+is trying to move it away)
+
+Forcing the order of post after do will guarantee that it will be there
+when it needs to be moved and it will be safe to do a parallel install.
+Just relying on the ordering of the $(1)_install definition is wrong and
+dependant on make version (and luck!).
+---
+ Template | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Template b/Template
+index 056f594a2..54b597291 100644
+--- a/Template
++++ b/Template
+@@ -12,6 +12,7 @@ define TOOL_templ
+ 	$(Q)eval GZIP= gzip $(GZIP_ENV) $(1).8 > $(1)/$(1).8.gz
+ 	$(Q)$$(call INST,$(1)/$(1).8.gz,$$(DESTDIR)$$(MAN8DIR))
+ 	$(Q)$$(foreach file,$$($(1)-confs),$$(call INST,$$(file),$$(DESTDIR)$$(ETCDIRE));)
++  $(1)_post_install: $(1)_do_install
+   $(1)_install: $(1)_do_install $(1)_post_install
+   $(1)_uninstall: $(1)_uninstall_custom
+ 	$(Q)$$(call RM,$$(DESTDIR)$$(SBINDIR)/$(1))