← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging ~cjwatson/launchpad-buildd:charmcraft-and-focal into launchpad-buildd:master with ~cjwatson/launchpad-buildd:drop-charm-resources as a prerequisite.

Commit message:
charm: Revamp build process and upgrade to focal

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/+git/launchpad-buildd/+merge/416673

`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.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-buildd:charmcraft-and-focal into launchpad-buildd:master.
diff --git a/.gitignore b/.gitignore
index 4a9f33a..37400f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,8 +2,7 @@
 *.pyc
 .pybuild
 buildd-slave-example.conf
-charm/dist
-charm/tmp
+charm/*.charm
 dist
 debian/debhelper-build-stamp
 debian/files
diff --git a/charm/Makefile b/charm/Makefile
index 73fc2bd..d992cd0 100644
--- a/charm/Makefile
+++ b/charm/Makefile
@@ -1,46 +1,23 @@
 NAME ?= launchpad-buildd
-TOPDIR ?= $(CURDIR)/..
-BUILDDIR ?= $(CURDIR)/dist
-TMPDIR ?= $(CURDIR)/tmp
-
-CHARM_SERIES ?= bionic
-CHARM_SRC ?= $(CURDIR)
-JUJU_REPOSITORY = $(BUILDDIR)
-CHARMDIR = $(BUILDDIR)/$(CHARM_SERIES)/$(NAME)
-CHARMREPODIR = $(BUILDDIR)/build
-CHARM = $(CHARMDIR)/.done
-LAYER_PATH = $(TMPDIR)/layer
-INTERFACE_PATH = $(TMPDIR)/interface
-EXTRA_CHARM_BUILD_ARGS ?=
-DEPLOY_ENV ?= devel
-CHARM_STORE_URL ?= cs:~launchpad/launchpad-buildd
-
-export INTERFACE_PATH
-export LAYER_PATH
-export JUJU_REPOSITORY
+CHARM_SERIES ?= 20.04
+ARCH := $(shell dpkg --print-architecture)
+CHARM = ./$(NAME)_ubuntu-$(CHARM_SERIES)-$(ARCH).charm
 
 
 build: $(CHARM)
 
-$(BUILDDIR):
-	mkdir -p $@
-
-$(CHARM): $(CHARM_SRC) | $(BUILDDIR)
-	rm -rf $(CHARMDIR)
-	charm build -o $(BUILDDIR) -s $(CHARM_SERIES) -n $(NAME) $(EXTRA_CHARM_BUILD_ARGS)
-	touch $@
+$(CHARM):
+	charmcraft pack
 
 clean:
-	rm -rf $(BUILDDIR) $(TMPDIR)
+	charmcraft clean
+	rm -rf $(CHARM)
 
 create-privileged-model:
 	juju add-model privileged localhost
 	lxc profile set juju-privileged security.privileged true
 
 deploy:
-	juju deploy $(CHARMDIR)
-
-push:
-	charm push $(CHARMDIR) $(CHARM_STORE_URL)
+	juju deploy $(CHARM)
 
-.PHONY: build clean create-privileged-model deploy push
+.PHONY: build clean create-privileged-model deploy
diff --git a/charm/charmcraft.yaml b/charm/charmcraft.yaml
new file mode 100644
index 0000000..644b524
--- /dev/null
+++ b/charm/charmcraft.yaml
@@ -0,0 +1,13 @@
+type: charm
+bases:
+  - build-on:
+      - name: ubuntu
+        channel: "20.04"
+    run-on:
+      - name: ubuntu
+        channel: "20.04"
+parts:
+  charm:
+    source: .
+    plugin: reactive
+    build-snaps: [charm]
diff --git a/charm/metadata.yaml b/charm/metadata.yaml
index 6a063b7..97f39f4 100644
--- a/charm/metadata.yaml
+++ b/charm/metadata.yaml
@@ -8,5 +8,5 @@ tags:
 maintainer: Colin Watson <cjwatson@xxxxxxxxxxxxx>
 subordinate: false
 series:
-    - bionic
+    - focal
 min-juju-version: 2.0.0