@@ -60,7 +60,6 @@ import (
6060)
6161
6262func cmdBuild () * cobra.Command {
63- var jobs int
6463 var traceFile string
6564 var anns []string // string list annotations
6665
@@ -109,11 +108,11 @@ func cmdBuild() *cobra.Command {
109108 ctx = tctx
110109 }
111110
112- if jobs == 0 {
113- jobs = runtime .GOMAXPROCS (0 )
111+ if cfg . Jobs == 0 {
112+ cfg . Jobs = runtime .GOMAXPROCS (0 )
114113 }
115- cfg .jobch = make (chan struct {}, jobs )
116- cfg .donech = make (chan * task , jobs )
114+ cfg .jobch = make (chan struct {}, cfg . Jobs )
115+ cfg .donech = make (chan * task , cfg . Jobs )
117116
118117 if cfg .signingKey == "" {
119118 cfg .signingKey = filepath .Join (cfg .Dir , "local-melange.rsa" )
@@ -165,7 +164,7 @@ func cmdBuild() *cobra.Command {
165164 cmd .Flags ().StringVar (& cfg .Bundle , "bundle" , "" , "bundle of work to do (experimental)" )
166165 cmd .Flags ().StringVar (& cfg .StagingBucket , "bucket" , "" , "gcs bucket to upload results (experimental)" )
167166
168- cmd .Flags ().IntVarP (& jobs , "jobs" , "j" , 0 , "number of jobs to run concurrently (default is GOMAXPROCS)" )
167+ cmd .Flags ().IntVarP (& cfg . Jobs , "jobs" , "j" , 0 , "number of jobs to run concurrently (default is GOMAXPROCS)" )
169168 cmd .Flags ().StringVar (& traceFile , "trace" , "" , "where to write trace output" )
170169
171170 cmd .Flags ().StringVar (& cfg .K8sNamespace , "k8s-namespace" , "default" , "namespace to deploy pods into for builds." )
@@ -357,9 +356,11 @@ func BuildBundles(ctx context.Context, cfg *Global) error {
357356 cfg .OutDir = filepath .Join (cfg .Dir , "packages" )
358357 }
359358
360- jobs := runtime .GOMAXPROCS (0 )
361- cfg .jobch = make (chan struct {}, jobs )
362- cfg .donech = make (chan * task , jobs )
359+ if cfg .Jobs == 0 {
360+ cfg .Jobs = runtime .GOMAXPROCS (0 )
361+ }
362+ cfg .jobch = make (chan struct {}, cfg .Jobs )
363+ cfg .donech = make (chan * task , cfg .Jobs )
363364
364365 var mu sync.Mutex
365366 cfg .exists = map [string ]map [string ]struct {}{}
@@ -685,6 +686,7 @@ type Global struct {
685686
686687 dryrun bool
687688
689+ Jobs int
688690 jobch chan struct {}
689691 donech chan * task
690692
0 commit comments