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

Michael Hudson-Doyle michael.hudson at canonical.com
Fri Jul 8 03:39:54 UTC 2016


I haven't tried it properly, but does this not limit the parallelism
and slow builds by default? (I don't know how this works and
apparently have not got around to reading up on it in the week since
the bug was filed, so I'll ask a potentially silly question)

On 2 July 2016 at 22:37, Dmitry Smirnov <onlyjob at debian.org> wrote:
> 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



More information about the Pkg-go-maintainers mailing list