Skip to contentSkip to conversation

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

PATCH Superseded Federico Pellegrin 2 participants 3 messages Aug 29, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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

---
 .../0002-Fix_post_install_deps.patch          | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 package/netsniff-ng/0002-Fix_post_install_deps.patch
package/netsniff-ng/0002-Fix_post_install_deps.patch new file +46 -0
new file mode 100644
index 0000000000..9ed0744491
@@ -0,0 +1,46 @@
+From 18e111e06f5eaf074f1c1e0cff79a0e72dce7590 Mon Sep 17 00:00:00 2001
+From: Federico Pellegrin <[email protected]>
+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))
Signature · 6 lines
2.46.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

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 < [email protected]> ha scritto:

Quoted 68 lines

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

---
 .../0002-Fix_post_install_deps.patch          | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 package/netsniff-ng/0002-Fix_post_install_deps.patch
package/netsniff-ng/0002-Fix_post_install_deps.patch new file +14 -0
new file mode 100644
index 0000000000..9ed0744491
@@ -0,0 +1,46 @@
+From 18e111e06f5eaf074f1c1e0cff79a0e72dce7590 Mon Sep 17 00:00:00 2001
+From: Federico Pellegrin <[email protected]>
+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

package/netsniff-ng/0002-Fix_post_install_deps.patch new file +28 -0
+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

package/netsniff-ng/0002-Fix_post_install_deps.patch new file +3 -1
+   $(1)_install: $(1)_do_install $(1)_post_install
+   $(1)_uninstall: $(1)_uninstall_custom
+       $(Q)$$(call RM,$$(DESTDIR)$$(SBINDIR)/$(1))
--
Quoted 3 lines

2.46.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Federico Pellegrin

Hi,
Federico Pellegrin wrote,

Quoted 7 lines

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

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
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot