← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~cjwatson/lp-archive:charm into lp-archive:main

 

LGTM 👍

Diff comments:

> diff --git a/charm/Makefile b/charm/Makefile
> new file mode 100644
> index 0000000..20dec9c
> --- /dev/null
> +++ b/charm/Makefile
> @@ -0,0 +1,96 @@
> +# The charmcraft tool is shipped as a snap, so make sure it's on $PATH.
> +export PATH := $(PATH):/snap/bin
> +
> +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)
> +charm_file = $(1)_ubuntu-$(CHARM_SERIES)-$(ARCH).charm
> +
> +BUILD_LABEL = $(shell git rev-parse HEAD)
> +TARBALL = $(APP_NAME).tar.gz
> +ASSET = ../build/$(BUILD_LABEL)/$(TARBALL)
> +
> +CHARMS := lp-archive
> +
> +all: ## alias to build
> +all: build
> +
> +help: ## display this help message
> +	@echo "Please use \`make <target>' where <target> is one of"
> +	@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | sort | awk -F ':.*?## ' 'NF==2 {printf "\033[36m  %-25s\033[0m %s\n", $$1, $$2}'
> +
> +$(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.

It has been a while since we checked with the snap store team on the open sourcing of the `ols-charm-deps` repository. I will ask them about it.

> +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)
> +	echo "Building $*..."
> +	rm -rf $*/tmp
> +	cp -a tmp $*/tmp
> +	cd $* && charmcraft pack
> +	cp -a $*/$(call charm_file,$*) dist/
> +	rm -rf $*/tmp
> +
> +clean: ## clean the build environment
> +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-%:
> +	@echo "Cleaning $*..."
> +	@cd $* && charmcraft clean
> +	@rm -f dist/$(call charm_file,$*)
> +
> +bundle.yaml: ## create the bundle.yaml file from the bundle.yaml.in template
> +bundle.yaml: bundle.yaml.in
> +	sed \
> +	    -e 's/%BUILD_LABEL%/$(BUILD_LABEL)/g' \
> +	    bundle.yaml.in >bundle.yaml
> +
> +deploy: ## deploy the built charm
> +deploy: build bundle.yaml
> +	@echo "Deploying $(APP_NAME)..."
> +	@juju deploy ./bundle.yaml
> +
> +payload: ## build an lp-archive tarball
> +payload: $(ASSET)
> +$(ASSET):
> +	@echo "Building asset for $(BUILD_LABEL)..."
> +	@$(MAKE) -C .. build-tarball
> +
> +
> +setup-jenkaas: ## prepare a Jenkins-as-a-service container for charm building
> +setup-jenkaas:
> +	sudo systemctl stop snapd.socket
> +	sudo systemctl stop snapd
> +	echo SNAPPY_STORE_NO_CDN=1 | sudo tee -a /etc/environment >/dev/null
> +	echo SNAPPY_TESTING=1 | sudo tee -a /etc/environment >/dev/null
> +	sudo systemctl start snapd.socket
> +	sudo snap install --classic charm
> +
> +.PHONY: $(foreach charm,$(CHARMS),build-$(charm))
> +.PHONY: all build clean deploy payload setup-jenkaas


-- 
https://code.launchpad.net/~cjwatson/lp-archive/+git/lp-archive/+merge/437090
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lp-archive:charm into lp-archive:main.



References