From 1e8772a04041dd512e9ee1ff922758db6b3a6116 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 8 Mar 2021 01:34:50 +0300 Subject: debian: more one-liners in Makefile --- debian/Makefile | 83 ++++++++++++++++++++++++++++++++++++++++++++++++--------- debian/gbp.conf | 1 - 2 files changed, 70 insertions(+), 14 deletions(-) diff --git a/debian/Makefile b/debian/Makefile index 74a8a18..254b9df 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -7,22 +7,79 @@ SHELL := bash escape = $(subst ','\'',$(1)) -makefile_dir := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) -repo_dir := $(makefile_dir)/.. -build_area_dir := $(makefile_dir)/build-area +# Don't expand parameters: +define escape_arg +ifeq ($$(origin $(1)),environment) + $(1) := $$(value $(1)) +endif +ifeq ($$(origin $(1)),environment override) + $(1) := $$(value $(1)) +endif +ifeq ($$(origin $(1)),command line) + override $(1) := $$(value $(1)) +endif +endef -.PHONY: build/src -build/src: - pushd '$(call escape,$(repo_dir))' && gbp buildpackage -S +PPA_OWNER ?= egor-tensin +PPA_NAME ?= linux-status +GPG_KEY ?= 3B3EF1235420917E0DB0723991D679FB92B036CB +DIST ?= focal -.PHONY: build/bin -build/bin: - pushd '$(call escape,$(repo_dir))' && gbp buildpackage +$(eval $(call escape_arg,PPA_OWNER)) +$(eval $(call escape_arg,PPA_NAME)) +$(eval $(call escape_arg,GPG_KEY)) +$(eval $(call escape_arg,DIST)) -.PHONY: build/pbuilder -build/pbuilder: - pushd '$(call escape,$(repo_dir))' && gbp buildpackage --git-pbuilder --git-dist=focal --git-arch=amd64 +this_dir := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) +root := $(this_dir)/.. +build_area := $(this_dir)/build-area + +.PHONY: DO +DO: + +.PHONY: src/test +src/test: + pushd '$(call escape,$(root))' && gbp buildpackage --git-ignore-new -S -us -uc + +.PHONY: src +src: + pushd '$(call escape,$(root))' && gbp buildpackage -S '-k0x$(call escape,$(GPG_KEY))' + +.PHONY: bin/test +bin/test: + pushd '$(call escape,$(root))' && gbp buildpackage --git-ignore-new -b -us -uc + +.PHONY: bin +bin: + pushd '$(call escape,$(root))' && gbp buildpackage -b '-k0x$(call escape,$(GPG_KEY))' + +.PHONY: dist/create +dist/create: + pushd '$(call escape,$(root))' && env 'DIST=$(call escape,$(DIST))' git-pbuilder create + +.PHONY: dist/update +dist/update: + pushd '$(call escape,$(root))' && env 'DIST=$(call escape,$(DIST))' git-pbuilder update + +.PHONY: dist/test +dist/test: + pushd '$(call escape,$(root))' && gbp buildpackage --git-ignore-new --git-pbuilder '--git-dist=$(call escape,$(DIST))' + +.PHONY: dist +dist: + pushd '$(call escape,$(root))' && gbp buildpackage --git-pbuilder '--git-dist=$(call escape,$(DIST))' + pushd '$(call escape,$(root))' && debsign '-k0x$(call escape,$(GPG_KEY))' --debs-dir '$(call escape,$(build_area))' + +.PHONY: upload +upload: + find '$(call escape,$(build_area))' -type f -name '*.changes' -exec dput 'ppa:$(call escape,$(PPA_OWNER))/$(call escape,$(PPA_NAME))/ubuntu/$(DIST)' {} ';' + +upload/%: DO + find '$(call escape,$(build_area))' -type f -name '*.changes' -exec dput 'ppa:$(call escape,$(PPA_OWNER))/$(call escape,$(PPA_NAME))/ubuntu/$*' {} ';' + +.PHONY: upload-all +upload-all: upload/bionic upload/focal upload/groovy .PHONY: clean clean: - rm -rf -- '$(call escape,$(build_area_dir))' + rm -rf -- '$(call escape,$(build_area))' diff --git a/debian/gbp.conf b/debian/gbp.conf index 51b688e..a32554f 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -4,4 +4,3 @@ debian-branch = debian debian-tag = debian/v%(version)s pristine-tar = False export-dir = debian/build-area/ -builder = debuild -i -I -k3B3EF1235420917E0DB0723991D679FB92B036CB -- cgit v1.2.3