← Back to team overview

sts-sponsors team mailing list archive

Re: [Merge] ~troyanov/maas:fix-parallel-make into maas:master

 


Diff comments:

> diff --git a/src/maasagent/Makefile b/src/maasagent/Makefile
> index 5c8f97b..dbd102a 100644
> --- a/src/maasagent/Makefile
> +++ b/src/maasagent/Makefile
> @@ -20,7 +20,9 @@ $(BIN_DIR): ; mkdir -p $@
>  ARTIFACTS := $(subst /,,$(subst cmd/,,$(wildcard cmd/*/)))
>  
>  .PHONY: build
> -build: vendor $(addprefix $(BUILD_DIR)/,$(ARTIFACTS))
> +build:
> +	$(MAKE) vendor

I was assuming `vendor` do be a prerequisite for `build`, but I didn't realise that `snapcraft` will call it using `make -j4` meaning that there will be a race between two prerequisites.

This change makes an explicit call of `make vendor` before doing a call of a target that executes `go build`.
So it should guarantee that things are done in a sequential order.

But I just pushed a different commit, having `vendor` as a prerequisite.

> +	$(MAKE) $(addprefix $(BUILD_DIR)/,$(ARTIFACTS))
>  
>  $(BUILD_DIR)/%:
>  	CGO_ENABLED=0 $(GO) build -o $(BUILD_DIR)/$(OUT_PREFIX)$* $(LDFLAGS) cmd/$*/*.go


-- 
https://code.launchpad.net/~troyanov/maas/+git/maas/+merge/442360
Your team MAAS Committers is subscribed to branch maas:master.



References