From: Noah Meyerhans Date: Mon, 15 Mar 2021 17:15:35 +0000 (-0700) Subject: packaging: templatize debian/control X-Git-Tag: v1.4~4^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3828ce9748177bca4386a18fbc42bc3f93710bb7;p=pidgin-chime.git packaging: templatize debian/control Perform substitution of Build-Depends and Depends per Debian/Ubuntu release. Build and binary dependencies for several releases are provided; additional releases are simple to add. In order to generate the .deb packaging metadata, a workflow such as the following can be used (note that this assumes apt >= 2.0, which introduced the 'satisfy' subcommand; on earlier releases, use a combination of dpkg-checkbuilddeps and manual apt invocations or pbuilder(8)): $ make -f debian/rules.maint debian/changelog $ sudo apt satisfy --no-install-recommends build-essential \ "$(grep-dctrl -n -s Build-Depends . debian/control)" $ dpkg-buildpackage -uc -us This should generate proper Debian binary and source packages targeting the current distribution provided the following conditions are met: 1. The build is happening within the target distribution 2. The make, git, lsb-release, and dctrl-tools are installed debian/control is generated with Build-Depends and binary Depends substitute from the appropriate debian/deps/build-* and debian/deps/bin-* files, respectively. debian/changelog is generated based on git tag data with various release and version fields substituded with the appropriate values for the current distribution environment (e.g. Ubuntu focal or Debian buster). Signed-off-by: Noah Meyerhans --- diff --git a/.gitignore b/.gitignore index dbd58c3..0436f8d 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ missing protobuf/*.pb-c.c protobuf/*.pb-c.h /m4/ +debian/changelog +debian/control diff --git a/Makefile.am b/Makefile.am index 4a10d9b..3a25fea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -84,14 +84,14 @@ chime/chime-call-transport.c chime/chime-call-audio.c chime/chime-call.c: chime/ EXTRA_DIST = LICENSE README.md pidgin-chime.spec pidgin-chime.spec.in $(certs_DATA) +MAINTAINERCLEANFILES=debian/changelog debian/control + +debian/changelog: + debian/rules.maint debian/changelog + deb-%: debian/changelog fakeroot debian/rules $(patsubst deb-%,%,$@) -debian/changelog: debian/changelog.in configure.ac Makefile.am - @COMMITDESC=$$(git describe --tags | sed -e 's/$$/-0/' -e 's/v\([^-]\+-[^-]\+\)\(-g[0-9a-f-]\+\|\)/\1/') \ - COMMITDATE=$$(git show -s --format=%cD); \ - sed -e "s/%COMMITDESC%/$$COMMITDESC/" -e "s/%COMMITDATE%/$$COMMITDATE/" $< > $@ - tmp-dist: uncommitted-check $(MAKE) $(AM_MAKEFLAGS) VERSION=$(patsubst v%,%,$(shell git describe --tags)) DISTHOOK=0 dist diff --git a/debian/changelog.in b/debian/changelog.in index f099cee..0fcbdec 100644 --- a/debian/changelog.in +++ b/debian/changelog.in @@ -1,4 +1,4 @@ -pidgin-chime (%COMMITDESC%) xenial; urgency=low +pidgin-chime (%COMMITDESC%) %DIST%; urgency=low * Build from git snapshot diff --git a/debian/control b/debian/control.in similarity index 58% rename from debian/control rename to debian/control.in index ac8f988..ea67fe6 100644 --- a/debian/control +++ b/debian/control.in @@ -6,31 +6,11 @@ Homepage: https://github.com/awslabs/pidgin-chime Vcs-Git: https://github.com/awslabs/pidgin-chime.git Vcs-Browser: https://github.com/awslabs/pidgin-chime Standards-Version: 3.9.7 -Build-Depends: debhelper (>= 9), - autoconf, - automake, - libtool, - libpurple-dev, - pidgin-dev, - autotools-dev, - libsoup2.4-dev, - libjson-glib-dev, - libopus-dev, - libfarstream-0.2-dev, - libgstreamer-plugins-base1.0-dev, - libprotobuf-c-dev, - protobuf-c-compiler, - libmarkdown2-dev, - evolution-dev, - libebook1.2-dev, - libecal1.2-dev, - evolution-data-server-dev, - graphicsmagick-imagemagick-compat, - libgnutls28-dev +Build-Depends: %BUILDDEPS% Package: pidgin-chime Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libfarstream-0.2-5 (>= 0.2.7), gstreamer1.0-plugins-bad, fonts-symbola +Depends: ${shlibs:Depends}, ${misc:Depends}, %BINDEPS% Description: Pidgin plugin for AWS Chime communication platform This package provides the libpurple plugin that implements the protocols to connect with the Chime communication services provided by diff --git a/debian/deps/bin-bionic b/debian/deps/bin-bionic new file mode 100644 index 0000000..e0b0a21 --- /dev/null +++ b/debian/deps/bin-bionic @@ -0,0 +1,3 @@ +libfarstream-0.2-5 (>= 0.2.7), +gstreamer1.0-plugins-bad, +fonts-symbola diff --git a/debian/deps/bin-bullseye b/debian/deps/bin-bullseye new file mode 100644 index 0000000..e0b0a21 --- /dev/null +++ b/debian/deps/bin-bullseye @@ -0,0 +1,3 @@ +libfarstream-0.2-5 (>= 0.2.7), +gstreamer1.0-plugins-bad, +fonts-symbola diff --git a/debian/deps/bin-buster b/debian/deps/bin-buster new file mode 100644 index 0000000..e0b0a21 --- /dev/null +++ b/debian/deps/bin-buster @@ -0,0 +1,3 @@ +libfarstream-0.2-5 (>= 0.2.7), +gstreamer1.0-plugins-bad, +fonts-symbola diff --git a/debian/deps/bin-focal b/debian/deps/bin-focal new file mode 100644 index 0000000..e0b0a21 --- /dev/null +++ b/debian/deps/bin-focal @@ -0,0 +1,3 @@ +libfarstream-0.2-5 (>= 0.2.7), +gstreamer1.0-plugins-bad, +fonts-symbola diff --git a/debian/deps/bin-unstable b/debian/deps/bin-unstable new file mode 100644 index 0000000..e0b0a21 --- /dev/null +++ b/debian/deps/bin-unstable @@ -0,0 +1,3 @@ +libfarstream-0.2-5 (>= 0.2.7), +gstreamer1.0-plugins-bad, +fonts-symbola diff --git a/debian/deps/build-bionic b/debian/deps/build-bionic new file mode 100644 index 0000000..47af91c --- /dev/null +++ b/debian/deps/build-bionic @@ -0,0 +1,21 @@ +debhelper (>= 9), +autoconf, +automake, +libtool, +libpurple-dev, +pidgin-dev, +autotools-dev, +libsoup2.4-dev, +libjson-glib-dev, +libopus-dev, +libfarstream-0.2-dev, +libgstreamer-plugins-base1.0-dev, +libprotobuf-c-dev, +protobuf-c-compiler, +libmarkdown2-dev, +evolution-dev, +libebook1.2-dev, +libecal1.2-dev, +evolution-data-server-dev, +graphicsmagick-imagemagick-compat, +libgnutls28-dev diff --git a/debian/deps/build-bullseye b/debian/deps/build-bullseye new file mode 100644 index 0000000..cbc2176 --- /dev/null +++ b/debian/deps/build-bullseye @@ -0,0 +1,22 @@ +debhelper (>= 9), +autoconf, +automake, +libtool, +libpurple-dev, +pidgin-dev, +autotools-dev, +libsoup2.4-dev, +libjson-glib-dev, +libopus-dev, +libfarstream-0.2-dev, +libgstreamer-plugins-base1.0-dev, +libprotobuf-c-dev, +protobuf-c-compiler, +libmarkdown2-dev, +evolution-dev, +libebook1.2-dev, +libecal2.0-dev, +evolution-data-server-dev, +graphicsmagick-imagemagick-compat, +libgnutls28-dev, +libxcb-xfixes0-dev diff --git a/debian/deps/build-buster b/debian/deps/build-buster new file mode 100644 index 0000000..47af91c --- /dev/null +++ b/debian/deps/build-buster @@ -0,0 +1,21 @@ +debhelper (>= 9), +autoconf, +automake, +libtool, +libpurple-dev, +pidgin-dev, +autotools-dev, +libsoup2.4-dev, +libjson-glib-dev, +libopus-dev, +libfarstream-0.2-dev, +libgstreamer-plugins-base1.0-dev, +libprotobuf-c-dev, +protobuf-c-compiler, +libmarkdown2-dev, +evolution-dev, +libebook1.2-dev, +libecal1.2-dev, +evolution-data-server-dev, +graphicsmagick-imagemagick-compat, +libgnutls28-dev diff --git a/debian/deps/build-focal b/debian/deps/build-focal new file mode 100644 index 0000000..cbc2176 --- /dev/null +++ b/debian/deps/build-focal @@ -0,0 +1,22 @@ +debhelper (>= 9), +autoconf, +automake, +libtool, +libpurple-dev, +pidgin-dev, +autotools-dev, +libsoup2.4-dev, +libjson-glib-dev, +libopus-dev, +libfarstream-0.2-dev, +libgstreamer-plugins-base1.0-dev, +libprotobuf-c-dev, +protobuf-c-compiler, +libmarkdown2-dev, +evolution-dev, +libebook1.2-dev, +libecal2.0-dev, +evolution-data-server-dev, +graphicsmagick-imagemagick-compat, +libgnutls28-dev, +libxcb-xfixes0-dev diff --git a/debian/deps/build-unstable b/debian/deps/build-unstable new file mode 100644 index 0000000..cbc2176 --- /dev/null +++ b/debian/deps/build-unstable @@ -0,0 +1,22 @@ +debhelper (>= 9), +autoconf, +automake, +libtool, +libpurple-dev, +pidgin-dev, +autotools-dev, +libsoup2.4-dev, +libjson-glib-dev, +libopus-dev, +libfarstream-0.2-dev, +libgstreamer-plugins-base1.0-dev, +libprotobuf-c-dev, +protobuf-c-compiler, +libmarkdown2-dev, +evolution-dev, +libebook1.2-dev, +libecal2.0-dev, +evolution-data-server-dev, +graphicsmagick-imagemagick-compat, +libgnutls28-dev, +libxcb-xfixes0-dev diff --git a/debian/rules.maint b/debian/rules.maint new file mode 100644 index 0000000..912994a --- /dev/null +++ b/debian/rules.maint @@ -0,0 +1,38 @@ +# Makefile responsible for generation of debian/changelog and debian/control package files. +# git and lsb_release are required, and these rules must be run from within a git working copy + + +export DISTRIB_CODENAME=$(shell lsb_release -cs) + +ifeq ($(DISTRIB_CODENAME),) + DISTRIB_CODENAME=$(error Unable to identify distribution) +else ifeq ($(DISTRIB_CODENAME),sid) +# "unstable" doesn't need special handling of the package version + DISTRIB_CODENAME=unstable + PKGVERSIONSUFFIX= +else +# stable releases get a release-specific package version that is +# specifically lower than the same package build for a stable release. + PKGVERSIONSUFFIX=~${DISTRIB_CODENAME}+1 +endif + +debian/control: debian/control.in debian/deps/build-$(DISTRIB_CODENAME) debian/deps/bin-$(DISTRIB_CODENAME) + @BUILDDEPS=$$(egrep -v '^\s*(#|$$$$)' debian/deps/build-$(DISTRIB_CODENAME) | tr '\n' ' '); \ + BINDEPS=$$(egrep -v '^\s*(#|$$$$)' debian/deps/bin-$(DISTRIB_CODENAME) | tr '\n' ' '); \ + sed -e "s/%BUILDDEPS%/$$BUILDDEPS/" -e "s/%BINDEPS%/$$BINDEPS/" $< > $@ + +debian/changelog: debian/changelog.in debian/control + @COMMITDESC=$$(git describe --tags | sed -e 's/$$/-0/' -e 's/v\([^-]\+-[^-]\+\)\(-g[0-9a-f-]\+\|\)/\1/') \ + COMMITDATE=$$(git show -s --format=%cD) && \ + sed -e "s/%COMMITDESC%/$$COMMITDESC${PKGVERSIONSUFFIX}/" -e "s/%COMMITDATE%/$$COMMITDATE/" \ + -e "s/%DIST%/$$DISTRIB_CODENAME/" $< > $@ + +CLEANFILES=debian/changelog debian/control + +clean: + -rm -f $(CLEANFILES) + +# Local variables: +# mode: makefile +# end: +# vim: filetype=make