Colin Watson has proposed merging 
~cjwatson/lp-archive:charmcraft-fetch-dependencies into lp-archive:main.

Commit message:
charm: Fetch dependencies using charmcraft

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lp-archive/+git/lp-archive/+merge/438231

Now that `ols-layers` is open-source, we can fetch it directly using 
`charmcraft`, which is much simpler and should let us use Launchpad charm 
recipes.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/lp-archive:charmcraft-fetch-dependencies into lp-archive:main.
diff --git a/charm/Makefile b/charm/Makefile
index 3867936..a01f303 100644
--- a/charm/Makefile
+++ b/charm/Makefile
@@ -5,8 +5,6 @@ APP_NAME := lp-archive
 
 BUILDDIR := $(CURDIR)/dist
 TMPDIR := $(CURDIR)/tmp
-CHARM_LAYERS_DIR := $(TMPDIR)/deps/ols-layers/layer
-CHARM_INTERFACES_DIR := $(TMPDIR)/deps/ols-layers/interface
 
 CHARM_SERIES ?= 22.04
 ARCH := $(shell dpkg --print-architecture)
@@ -28,23 +26,13 @@ help: ## display this help message
 $(BUILDDIR) $(TMPDIR):
 	@mkdir -p $@
 
-# We have to clone our dependencies by hand rather than letting charmcraft
-# do it, since some of them are in private repositories and charmcraft
-# doesn't have suitable credentials.
-CHARM_DEPS := $(CHARM_LAYERS_DIR)/.done $(CHARM_INTERFACES_DIR)/.done
-$(CHARM_DEPS): $(CURDIR)/dependencies.txt | $(TMPDIR)
-	@echo "Fetching dependencies..."
-	@mkdir -p $(TMPDIR)/deps
-	@cd $(TMPDIR)/deps && codetree $<
-	@touch $(CHARM_DEPS)
-
 build: ## build all the charms
 build: $(foreach charm,$(CHARMS),build-$(charm))
 
 build-lp-archive: ## build the lp-archive charm
 build-lp-archive: dist/$(call charm_file,lp-archive)
 
-dist/%_ubuntu-$(CHARM_SERIES)-$(ARCH).charm: $(CHARM_DEPS) | $(BUILDDIR)
+dist/%_ubuntu-$(CHARM_SERIES)-$(ARCH).charm: $(BUILDDIR)
 	echo "Building $*..."
 	rm -rf $*/tmp
 	cp -a tmp $*/tmp
@@ -57,7 +45,6 @@ clean: $(foreach charm,$(CHARMS),clean-$(charm))
 	@find . -name \*.pyc -delete
 	@find . -depth -name '__pycache__' -exec rm -rf '{}' \;
 	@rm -f bundle.yaml
-	@rm -f layer/*/codetree-collect-info.yaml
 	@rm -rf $(BUILDDIR) $(TMPDIR)
 
 clean-%:
@@ -92,7 +79,6 @@ setup-jenkaas:
 	sudo systemctl start snapd.socket
 	sudo snap install --classic charm
 	sudo snap install --classic charmcraft
-	sudo snap install --classic codetree
 	sudo lxd init --auto
 
 .PHONY: $(foreach charm,$(CHARMS),build-$(charm))
diff --git a/charm/dependencies.txt b/charm/dependencies.txt
deleted file mode 100644
index a0a0973..0000000
--- a/charm/dependencies.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-ols-layers		git+ssh://git.launchpad.net/~ubuntuone-pqm-team/ols-charm-deps/+git/ols-layers;revno=e5787897
-charm-wheels		git+ssh://git.launchpad.net/~ubuntuone-hackers/ols-charm-deps/+git/wheels;revno=fbf2c56c
diff --git a/charm/lp-archive/charmcraft.yaml b/charm/lp-archive/charmcraft.yaml
index 76b6fae..24e39dd 100644
--- a/charm/lp-archive/charmcraft.yaml
+++ b/charm/lp-archive/charmcraft.yaml
@@ -7,14 +7,36 @@ bases:
     - name: ubuntu
       channel: "22.04"
 parts:
+  charm-wheels:
+    source: https://git.launchpad.net/~ubuntuone-hackers/ols-charm-deps/+git/wheels
+    source-commit: "fbf2c56c51ef7b2e346cd09e9f3b11871106073f"
+    source-depth: 1
+    source-submodules: []
+    source-type: git
+    plugin: dump
+    organize:
+      "*": charm-wheels/
+    prime:
+      - "-charm-wheels"
+  ols-layers:
+    source: https://git.launchpad.net/~ubuntuone-pqm-team/ols-charm-deps/+git/ols-layers
+    source-commit: "09bba50d815106beafdfb3ac38ba764f2bdf5771"
+    source-submodules: []
+    source-type: git
+    plugin: dump
+    organize:
+      "*": ols-layers/
+    prime:
+      - "-ols-layers"
   lp-archive:
+    after:
+      - charm-wheels
+      - ols-layers
     source: .
     plugin: reactive
     build-snaps: [charm/2.x/stable]
     build-environment:
-      - CHARM_LAYERS_DIR: tmp/deps/ols-layers/layer
-      - CHARM_INTERFACES_DIR: tmp/deps/ols-layers/interface
+      - CHARM_LAYERS_DIR: $CRAFT_STAGE/ols-layers/layer
+      - CHARM_INTERFACES_DIR: $CRAFT_STAGE/ols-layers/interface
       - PIP_NO_INDEX: "true"
-      - PIP_FIND_LINKS: tmp/deps/charm-wheels
-    stage:
-      - -tmp
+      - PIP_FIND_LINKS: $CRAFT_STAGE/charm-wheels
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to