Merge ~cgrabowski/maas:revert_vendoring_and_backport_master_vendoring into maas:3.2

Proposed by Christian Grabowski
Status: Merged
Approved by: Christian Grabowski
Approved revision: 8d1ed20716d6fc60c0cdb261dcacf082da2d9402
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~cgrabowski/maas:revert_vendoring_and_backport_master_vendoring
Merge into: maas:3.2
Diff against target: 85 lines (+16/-11)
3 files modified
Makefile (+4/-8)
debian/rules (+2/-1)
src/host-info/Makefile (+10/-2)
Reviewer Review Type Date Requested Status
Diego Mascialino (community) Approve
MAAS Lander Approve
Review via email: mp+428870@code.launchpad.net

Commit message

fix go build in the snap (first vendor dependencies, then build binaries)
(cherry picked from commit 02cde9449e00b90929cd97b91f8d88ec96d9e105)

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b revert_vendoring_and_backport_master_vendoring lp:~cgrabowski/maas/+git/maas into -b 3.2 lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 23b90a9a555c626a58e2b19f97ae89298b62ab82

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b revert_vendoring_and_backport_master_vendoring lp:~cgrabowski/maas/+git/maas into -b 3.2 lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 8d1ed20716d6fc60c0cdb261dcacf082da2d9402

review: Approve
Revision history for this message
Diego Mascialino (dmascialino) wrote :

looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 428458c..2826aba 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -117,12 +117,8 @@ $(UI_BUILD):
6 $(OFFLINE_DOCS):
7 $(MAKE) -C src/maas-offline-docs
8
9-go-bin-vendor:
10- $(MAKE) -C src/host-info vendor
11-.PHONY: go-bin-vendor
12-
13-go-bins: go-bin-vendor
14- $(MAKE) -C src/host-info build
15+go-bins:
16+ $(MAKE) -j -C src/host-info build
17 .PHONY: go-bins
18
19 test: test-missing-migrations test-py
20@@ -324,7 +320,7 @@ go_bins_vendor := src/host-info/vendor
21 -o $(packaging-build-area)/$(packaging-orig-tar) HEAD
22 tar -rf $(packaging-build-area)/$(packaging-orig-tar) $(UI_BUILD) $(OFFLINE_DOCS) \
23 --transform 's,^,$(packaging-dir)/,'
24- $(MAKE) go-bin-vendor
25+ $(MAKE) -C src/host-info vendor
26 tar -rf $(packaging-build-area)/$(packaging-orig-tar) $(go_bins_vendor) \
27 --transform 's,^,$(packaging-dir)/,'
28 gzip -f $(packaging-build-area)/$(packaging-orig-tar)
29@@ -335,7 +331,7 @@ go_bins_vendor := src/host-info/vendor
30 xargs tar --transform 's,^,$(packaging-dir)/,' -cf $(packaging-build-area)/$(packaging-orig-tar)
31 tar -rf $(packaging-build-area)/$(packaging-orig-tar) $(UI_BUILD) $(OFFLINE_DOCS) \
32 --transform 's,^,$(packaging-dir)/,'
33- $(MAKE) go-bin-vendor
34+ $(MAKE) -C src/host-info vendor
35 tar -rf $(packaging-build-area)/$(packaging-orig-tar) $(go_bins_vendor) \
36 --transform 's,^,$(packaging-dir)/,'
37 gzip -f $(packaging-build-area)/$(packaging-orig-tar)
38diff --git a/debian/rules b/debian/rules
39index 968519a..33b52bd 100755
40--- a/debian/rules
41+++ b/debian/rules
42@@ -38,7 +38,8 @@ override_dh_auto_install:
43
44 # Build and move lxd commissioning binaries
45 install -d -m 755 $(CURDIR)/debian/tmp/usr/share/maas/machine-resources
46- make -C $(CURDIR)/src/host-info build
47+ # dependencies are already vendored, skip vendoring
48+ make -C $(CURDIR)/src/host-info build-no-vendor
49 mv $(CURDIR)/src/host-info/bin/machine-resources/* \
50 $(CURDIR)/debian/tmp/usr/share/maas/machine-resources/
51
52diff --git a/src/host-info/Makefile b/src/host-info/Makefile
53index 167f12a..9655b27 100644
54--- a/src/host-info/Makefile
55+++ b/src/host-info/Makefile
56@@ -32,12 +32,19 @@ GO_BUILD := CGO_ENABLED=0 go build -mod=vendor -ldflags '-s -w -extldflags "-sta
57
58 $(MACHINE_RESOURCES_BINARIES): TARGET_DIR=$(PACKAGE_DIR)
59 $(HARDWARE_SYNC_BINARIES): TARGET_DIR=$(HARDWARE_SYNC_DIR)
60-$(HARDWARE_SYNC_BINARIES) $(MACHINE_RESOURCES_BINARIES): vendor
61+$(HARDWARE_SYNC_BINARIES) $(MACHINE_RESOURCES_BINARIES):
62 GOARCH=$(DEB_GO_ARCH_$(notdir $@)) $(GO_BUILD) -o $@ $(TARGET_DIR)
63
64-build: $(MACHINE_RESOURCES_BINARIES)
65+build:
66+# call targets separately to work with parallel builds
67+ $(MAKE) vendor/modules.txt
68+ $(MAKE) $(MACHINE_RESOURCES_BINARIES) $(HARDWARE_SYNC_BINARIES)
69 .PHONY: build
70
71+# don't vendor dependencies before building binaries
72+build-no-vendor: $(MACHINE_RESOURCES_BINARIES) $(HARDWARE_SYNC_BINARIES)
73+.PHONY: build-no-vendor
74+
75 clean:
76 rm -rf $(BINDIR) $(VENDOR_DIR)
77 .PHONY: clean
78@@ -51,6 +58,7 @@ install: $(MACHINE_RESOURCES_BINARIES)
79 .PHONY: install
80
81 vendor: vendor/modules.txt
82+.PHONY: vendor
83
84 vendor/modules.txt: go.mod
85 go mod vendor

Subscribers

People subscribed via source and target branches