diff mbox series

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

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

Commit Message

Federico Pellegrin Aug. 29, 2024, 7:50 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:
Upstream: https://github.com/netsniff-ng/netsniff-ng/commit/36f5b55b2aabe16e8c17b8e95a5b69327d3266f4

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

Comments

Federico Pellegrin Sept. 14, 2024, 12:59 p.m. UTC | #1
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 <
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:
> Upstream:
> https://github.com/netsniff-ng/netsniff-ng/commit/36f5b55b2aabe16e8c17b8e95a5b69327d3266f4
>
> Signed-off-by: Federico Pellegrin <fede@evolware.org>
> ---
>  .../0002-Fix_post_install_deps.patch          | 49 +++++++++++++++++++
>  1 file changed, 49 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..e34fa2229c
> --- /dev/null
> +++ b/package/netsniff-ng/0002-Fix_post_install_deps.patch
> @@ -0,0 +1,49 @@
> +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!).
> +
> +Signed-off-by: Federico Pellegrin <fede@evolware.org>
> +
> +---
> + 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
>
>
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..e34fa2229c
--- /dev/null
+++ b/package/netsniff-ng/0002-Fix_post_install_deps.patch
@@ -0,0 +1,49 @@ 
+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!).
+
+Signed-off-by: Federico Pellegrin <fede@evolware.org>
+
+---
+ 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))