]> www.infradead.org Git - pidgin-chime.git/commitdiff
packaging: templatize debian/control
authorNoah Meyerhans <nmeyerha@amazon.com>
Mon, 15 Mar 2021 17:15:35 +0000 (10:15 -0700)
committerNoah Meyerhans <nmeyerha@amazon.com>
Fri, 9 Apr 2021 22:43:26 +0000 (15:43 -0700)
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 <nmeyerha@amazon.com>
15 files changed:
.gitignore
Makefile.am
debian/changelog.in
debian/control.in [moved from debian/control with 58% similarity]
debian/deps/bin-bionic [new file with mode: 0644]
debian/deps/bin-bullseye [new file with mode: 0644]
debian/deps/bin-buster [new file with mode: 0644]
debian/deps/bin-focal [new file with mode: 0644]
debian/deps/bin-unstable [new file with mode: 0644]
debian/deps/build-bionic [new file with mode: 0644]
debian/deps/build-bullseye [new file with mode: 0644]
debian/deps/build-buster [new file with mode: 0644]
debian/deps/build-focal [new file with mode: 0644]
debian/deps/build-unstable [new file with mode: 0644]
debian/rules.maint [new file with mode: 0644]

index dbd58c30e56e4d46f9c9f624ced901e14cefb451..0436f8d20bd7437293bdc5304b0bac2d89b1a07f 100644 (file)
@@ -26,3 +26,5 @@ missing
 protobuf/*.pb-c.c
 protobuf/*.pb-c.h
 /m4/
+debian/changelog
+debian/control
index 4a10d9bcf154ed2df980e2268aa2224ea12ca547..3a25fea450f97290c2efd9eedb09ef1073fdd4b0 100644 (file)
@@ -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
 
index f099ceeccb7f900a3bc6684b1df3a0cacfe0e825..0fcbdec85e2008ce37b731e5eecbd798760d32e5 100644 (file)
@@ -1,4 +1,4 @@
-pidgin-chime (%COMMITDESC%) xenial; urgency=low
+pidgin-chime (%COMMITDESC%) %DIST%; urgency=low
 
   * Build from git snapshot
 
similarity index 58%
rename from debian/control
rename to debian/control.in
index ac8f988e85a343662902fff84c50bfaea5208dfc..ea67fe6b38cc39b8f8d23ccdcde11460ca263361 100644 (file)
@@ -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 (file)
index 0000000..e0b0a21
--- /dev/null
@@ -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 (file)
index 0000000..e0b0a21
--- /dev/null
@@ -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 (file)
index 0000000..e0b0a21
--- /dev/null
@@ -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 (file)
index 0000000..e0b0a21
--- /dev/null
@@ -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 (file)
index 0000000..e0b0a21
--- /dev/null
@@ -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 (file)
index 0000000..47af91c
--- /dev/null
@@ -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 (file)
index 0000000..cbc2176
--- /dev/null
@@ -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 (file)
index 0000000..47af91c
--- /dev/null
@@ -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 (file)
index 0000000..cbc2176
--- /dev/null
@@ -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 (file)
index 0000000..cbc2176
--- /dev/null
@@ -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 (file)
index 0000000..912994a
--- /dev/null
@@ -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