Skip to contentSkip to conversation

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

PATCH In review Federico Pellegrin 1 participant 2 messages Aug 29, 2024 – Sep 14, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 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:
Upstream: https://github.com/netsniff-ng/netsniff-ng/commit/36f5b55b2aabe16e8c17b8e95a5b69327d3266f4

---
 .../0002-Fix_post_install_deps.patch          | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 package/netsniff-ng/0002-Fix_post_install_deps.patch
package/netsniff-ng/0002-Fix_post_install_deps.patch new file +49 -0
new file mode 100644
index 0000000000..e34fa2229c
@@ -0,0 +1,49 @@
+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!).
+
+Signed-off-by: Federico Pellegrin <[email protected]>
+
+---
+ 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,
Just a friendly ping on this as I see you are very active today :-) (sadly will arrive to Vienna just tomorrow)

Thanks and cheers,
F.

Il giorno gio 29 ago 2024 alle ore 09:50 Federico Pellegrin < [email protected]> ha scritto:

Quoted 72 lines

When building in parallel, the package will randomly fail in install phase due to a missing make dependency.

Already submitted and merged upstream:
Upstream:
https://github.com/netsniff-ng/netsniff-ng/commit/36f5b55b2aabe16e8c17b8e95a5b69327d3266f4

---
 .../0002-Fix_post_install_deps.patch          | 49 +++++++++++++++++++
 1 file changed, 49 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..e34fa2229c
@@ -0,0 +1,49 @@
+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 +31 -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!).
+
+Signed-off-by: Federico Pellegrin <[email protected]>
+
+---
+ 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