[pkg-go] Bug#829302: dh-golang: Respect "--parallel" and "--max-parallel" options

Dmitry Smirnov onlyjob at debian.org
Sat Jul 2 10:37:19 UTC 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.alioth.debian.org/pipermail/pkg-go-maintainers/attachments/20160702/9370d671/attachment-0001.sig>


More information about the Pkg-go-maintainers mailing list