Merge ~ballot/content-cache-charm/+git/content-cache-charm:update_makefile into content-cache-charm:master

Proposed by Benjamin Allot
Status: Merged
Approved by: Benjamin Allot
Approved revision: 5710e7226f3e08ad88a17eeca96f105ef646b1a4
Merged at revision: 230c2e3fa814dc25a6ff5a61ec93c7f43bb4d1a6
Proposed branch: ~ballot/content-cache-charm/+git/content-cache-charm:update_makefile
Merge into: content-cache-charm:master
Diff against target: 43 lines (+23/-5)
1 file modified
Makefile (+23/-5)
Reviewer Review Type Date Requested Status
Joel Sing (community) +1 Approve
Nick Moffitt (community) Approve
Canonical IS Reviewers Pending
Review via email: mp+372044@code.launchpad.net

Commit message

Update "make build" target

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Benjamin Allot (ballot) wrote :

This allow a cleaner charm build, inspired by ngfw target

Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

seems legit

review: Approve
Revision history for this message
Joel Sing (jsing) wrote :

LGTM

review: Approve (+1)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 230c2e3fa814dc25a6ff5a61ec93c7f43bb4d1a6

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 170a4bf..8190269 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -1,3 +1,11 @@
6+CHARM_REPO = git+ssh://git.launchpad.net/content-cache-charm
7+CHARM_NAME = $(shell awk '/^name:/ { print $$2 }' metadata.yaml)
8+CHARM_BUILD_DIR ?= ~/tmp
9+CHARM_DEST_DIR ?= $(CHARM_BUILD_DIR)/$(CHARM_NAME)
10+
11+$(CHARM_BUILD_DIR):
12+ mkdir -p $@
13+
14 help:
15 @echo "This project supports the following targets"
16 @echo ""
17@@ -24,11 +32,21 @@ unittest:
18 functional: build
19 @tox -e functional
20
21-build: clean
22- @echo "Building charm to base directory $(JUJU_REPOSITORY)"
23- @-git describe --always --dirty --tags > ./repo-info
24- @LAYER_PATH=./layers INTERFACE_PATH=./interfaces TERM=linux \
25- JUJU_REPOSITORY=$(JUJU_REPOSITORY) charm build . --force
26+build: clean | $(CHARM_BUILD_DIR)
27+ $(eval TMP_CHARM_BUILD_DIR = $(shell mktemp -d -p $(CHARM_BUILD_DIR) charm-build.$(CHARM_NAME).XXXXXXXX))
28+ @if [ -z $(CHARM_NAME) ]; then \
29+ echo "Unable to work out charm name from metadata.yaml"; \
30+ exit 1; \
31+ fi
32+ charm build -o $(TMP_CHARM_BUILD_DIR)
33+ if [ -d $(CHARM_DEST_DIR)/ ]; then \
34+ git -C $(CHARM_DEST_DIR)/ pull; \
35+ else \
36+ git clone -- $(CHARM_REPO) $(CHARM_DEST_DIR)/; \
37+ fi
38+ rsync -a --exclude .git --delete -- $(TMP_CHARM_BUILD_DIR)/builds/$(CHARM_NAME)/ $(CHARM_DEST_DIR)/
39+ @echo "Built charm in $(CHARM_DEST_DIR)"
40+ rm -rf -- $(TMP_CHARM_BUILD_DIR)
41
42 clean:
43 @echo "Cleaning files"

Subscribers

People subscribed via source and target branches