Package: dh-golang
Version: 1.18
Severity: wishlist
Tags: patch

Currently build is always parallel even in compat <= 9 mode because 
dh-golang ignores "--parallel" and "--max-parallel" options.

Lack of support for parallel options is a practical problem because by
default "go build" aggressively uses all CPU cores which can overuse
resources on heavy packages. For example Kubernetes FTBFS on
workstation with 8 cores and 32+ GiB of RAM due to lack of memory or
(when there is enough RAM) it causes so much swapping during build
that the whole system becomes nearly unusable.

With Kubernetes and other packages it would be quite useful to be able
to limit build to certain number of cores by using debhelper's 
"--max-parallel=N" option. The following patch does that:

~~~~
--- lib/Debian/Debhelper/Buildsystem/golang.pm
+++ lib/Debian/Debhelper/Buildsystem/golang.pm
@@ -178,8 +178,9 @@
     $this->_set_gopath();
     if (exists($ENV{DH_GOLANG_GO_GENERATE}) && $ENV{DH_GOLANG_GO_GENERATE} == 
1) {
         $this->doit_in_builddir("go", "generate", "-v", @_, get_targets());
     }
+    unshift @_, ('-p',$this->get_parallel());
     $this->doit_in_builddir("go", "install", "-v", @_, get_targets());
 }
~~~~

as well as it makes build respect "--parallel" option for DH consistency.

-- 
Best wishes,
 Dmitry Smirnov
 GPG key : 4096R/53968D1B

---

What can be asserted without proof can be dismissed without proof.
        -- Christopher Hitchens, 2004

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Pkg-go-maintainers mailing list
Pkg-go-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers

Reply via email to