Merge ~cjwatson/launchpad-buildd:charmcraft-and-focal into launchpad-buildd:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 8c1273731de865f71aa84f8e9c693c5cf7db0993
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad-buildd:charmcraft-and-focal
Merge into: launchpad-buildd:master
Prerequisite: ~cjwatson/launchpad-buildd:drop-charm-resources
Diff against target: 104 lines (+24/-35)
4 files modified
.gitignore (+1/-2)
charm/Makefile (+9/-32)
charm/charmcraft.yaml (+13/-0)
charm/metadata.yaml (+1/-1)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+416673@code.launchpad.net

Commit message

charm: Revamp build process and upgrade to focal

Description of the change

`charmcraft` works for reactive charms now, and seems to be simpler to set up once you have the necessary `charmcraft.yaml` incantations.

I dropped support for manually pushing to the charm store, since once this lands we should be able to set up a Launchpad recipe to push it to Charmhub for us.

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

LGTM

review: Approve
Revision history for this message
Colin Watson (cjwatson) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 4a9f33a..37400f5 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -2,8 +2,7 @@
6 *.pyc
7 .pybuild
8 buildd-slave-example.conf
9-charm/dist
10-charm/tmp
11+charm/*.charm
12 dist
13 debian/debhelper-build-stamp
14 debian/files
15diff --git a/charm/Makefile b/charm/Makefile
16index 73fc2bd..d992cd0 100644
17--- a/charm/Makefile
18+++ b/charm/Makefile
19@@ -1,46 +1,23 @@
20 NAME ?= launchpad-buildd
21-TOPDIR ?= $(CURDIR)/..
22-BUILDDIR ?= $(CURDIR)/dist
23-TMPDIR ?= $(CURDIR)/tmp
24-
25-CHARM_SERIES ?= bionic
26-CHARM_SRC ?= $(CURDIR)
27-JUJU_REPOSITORY = $(BUILDDIR)
28-CHARMDIR = $(BUILDDIR)/$(CHARM_SERIES)/$(NAME)
29-CHARMREPODIR = $(BUILDDIR)/build
30-CHARM = $(CHARMDIR)/.done
31-LAYER_PATH = $(TMPDIR)/layer
32-INTERFACE_PATH = $(TMPDIR)/interface
33-EXTRA_CHARM_BUILD_ARGS ?=
34-DEPLOY_ENV ?= devel
35-CHARM_STORE_URL ?= cs:~launchpad/launchpad-buildd
36-
37-export INTERFACE_PATH
38-export LAYER_PATH
39-export JUJU_REPOSITORY
40+CHARM_SERIES ?= 20.04
41+ARCH := $(shell dpkg --print-architecture)
42+CHARM = ./$(NAME)_ubuntu-$(CHARM_SERIES)-$(ARCH).charm
43
44
45 build: $(CHARM)
46
47-$(BUILDDIR):
48- mkdir -p $@
49-
50-$(CHARM): $(CHARM_SRC) | $(BUILDDIR)
51- rm -rf $(CHARMDIR)
52- charm build -o $(BUILDDIR) -s $(CHARM_SERIES) -n $(NAME) $(EXTRA_CHARM_BUILD_ARGS)
53- touch $@
54+$(CHARM):
55+ charmcraft pack
56
57 clean:
58- rm -rf $(BUILDDIR) $(TMPDIR)
59+ charmcraft clean
60+ rm -rf $(CHARM)
61
62 create-privileged-model:
63 juju add-model privileged localhost
64 lxc profile set juju-privileged security.privileged true
65
66 deploy:
67- juju deploy $(CHARMDIR)
68-
69-push:
70- charm push $(CHARMDIR) $(CHARM_STORE_URL)
71+ juju deploy $(CHARM)
72
73-.PHONY: build clean create-privileged-model deploy push
74+.PHONY: build clean create-privileged-model deploy
75diff --git a/charm/charmcraft.yaml b/charm/charmcraft.yaml
76new file mode 100644
77index 0000000..644b524
78--- /dev/null
79+++ b/charm/charmcraft.yaml
80@@ -0,0 +1,13 @@
81+type: charm
82+bases:
83+ - build-on:
84+ - name: ubuntu
85+ channel: "20.04"
86+ run-on:
87+ - name: ubuntu
88+ channel: "20.04"
89+parts:
90+ charm:
91+ source: .
92+ plugin: reactive
93+ build-snaps: [charm]
94diff --git a/charm/metadata.yaml b/charm/metadata.yaml
95index 6a063b7..97f39f4 100644
96--- a/charm/metadata.yaml
97+++ b/charm/metadata.yaml
98@@ -8,5 +8,5 @@ tags:
99 maintainer: Colin Watson <cjwatson@canonical.com>
100 subordinate: false
101 series:
102- - bionic
103+ - focal
104 min-juju-version: 2.0.0

Subscribers

People subscribed via source and target branches