This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=f9bff737ae4cdabd9c9cf4f597fbf41c67142083 commit f9bff737ae4cdabd9c9cf4f597fbf41c67142083 Author: Guillem Jover <guil...@debian.org> AuthorDate: Tue Sep 13 23:41:55 2022 +0200 scripts/mk: Add new buildapi.mk support This makes it possible to switch default behavior for build API levels > 0. --- man/dpkg-buildapi.pod | 12 ++++++++++++ scripts/Makefile.am | 2 ++ scripts/mk/Makefile.am | 1 + scripts/mk/buildapi.mk | 9 +++++++++ scripts/mk/default.mk | 1 + scripts/t/mk.t | 4 +++- scripts/t/mk/buildapi.mk | 4 ++++ .../t/{Dpkg_BuildAPI/ctrl-api-explicit => mk/debian/control} | 4 ++-- 8 files changed, 34 insertions(+), 3 deletions(-) diff --git a/man/dpkg-buildapi.pod b/man/dpkg-buildapi.pod index b1e56e8f5..de2670183 100644 --- a/man/dpkg-buildapi.pod +++ b/man/dpkg-buildapi.pod @@ -64,3 +64,15 @@ and not to set the global build API level from F<debian/rules>, otherwise build drivers (such as L<dpkg-buildpackage(1)>) cannot access it. =back + +=head1 FILES + +=head2 Packaging support + +=over + +=item B<%PKGDATADIR%/buildapi.mk> + +Makefile snippet that will parse the build API level. + +=back diff --git a/scripts/Makefile.am b/scripts/Makefile.am index b700a8e6c..1132a1d88 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -399,10 +399,12 @@ test_data = \ t/dpkg_source/testsuite_2.dsc \ t/dpkg_source/testsuite_3.dsc \ t/mk/architecture.mk \ + t/mk/buildapi.mk \ t/mk/buildflags.mk \ t/mk/buildopts.mk \ t/mk/buildtools.mk \ t/mk/debian/changelog \ + t/mk/debian/control \ t/mk/pkg-info.mk \ t/mk/vendor-v0.mk \ t/mk/vendor-v1.mk \ diff --git a/scripts/mk/Makefile.am b/scripts/mk/Makefile.am index a82e409d6..6fa328717 100644 --- a/scripts/mk/Makefile.am +++ b/scripts/mk/Makefile.am @@ -2,6 +2,7 @@ dist_pkgdata_DATA = \ architecture.mk \ + buildapi.mk \ buildflags.mk \ buildopts.mk \ buildtools.mk \ diff --git a/scripts/mk/buildapi.mk b/scripts/mk/buildapi.mk new file mode 100644 index 000000000..668e325c8 --- /dev/null +++ b/scripts/mk/buildapi.mk @@ -0,0 +1,9 @@ +# This Makefile fragment (since dpkg 1.22.0) handles the build API. + +# Default API level when not set. +DPKG_BUILD_API ?= $(shell dpkg-buildapi) + +# We could use only built-in GNU make functions, but that seems too much +# complexity given no integer operators, given that we currently have to +# fetch the build API level anyway. +dpkg_build_api_ge = $(shell test "$(DPKG_BUILD_API)" -ge "$(1)" && echo yes) diff --git a/scripts/mk/default.mk b/scripts/mk/default.mk index 3916a0c24..ad2ef5de3 100644 --- a/scripts/mk/default.mk +++ b/scripts/mk/default.mk @@ -3,6 +3,7 @@ dpkg_datadir = $(srcdir)/mk include $(dpkg_datadir)/architecture.mk +include $(dpkg_datadir)/buildapi.mk include $(dpkg_datadir)/buildflags.mk include $(dpkg_datadir)/buildopts.mk include $(dpkg_datadir)/pkg-info.mk diff --git a/scripts/t/mk.t b/scripts/t/mk.t index 6f9920100..abf1a75bb 100644 --- a/scripts/t/mk.t +++ b/scripts/t/mk.t @@ -16,7 +16,7 @@ use strict; use warnings; -use Test::More tests => 11; +use Test::More tests => 12; use Test::Dpkg qw(:paths); use File::Spec::Functions qw(rel2abs); @@ -84,6 +84,8 @@ while (my ($k, $v) = each %arch) { } test_makefile('architecture.mk', 'with envvars'); +test_makefile('buildapi.mk'); + $ENV{DEB_BUILD_OPTIONS} = 'parallel=16'; $ENV{TEST_DEB_BUILD_OPTION_PARALLEL} = '16'; test_makefile('buildopts.mk'); diff --git a/scripts/t/mk/buildapi.mk b/scripts/t/mk/buildapi.mk new file mode 100644 index 000000000..96269bcff --- /dev/null +++ b/scripts/t/mk/buildapi.mk @@ -0,0 +1,4 @@ +include $(srcdir)/mk/buildapi.mk + +test: + test "$(DPKG_BUILD_API)" = "0" diff --git a/scripts/t/Dpkg_BuildAPI/ctrl-api-explicit b/scripts/t/mk/debian/control similarity index 59% copy from scripts/t/Dpkg_BuildAPI/ctrl-api-explicit copy to scripts/t/mk/debian/control index 1efb10681..43b35d30d 100644 --- a/scripts/t/Dpkg_BuildAPI/ctrl-api-explicit +++ b/scripts/t/mk/debian/control @@ -1,6 +1,6 @@ -Source: pkg-source +Source: source Build-Depends: dpkg-build-api (= 0), -Package: pkg-binary +Package: binary Architecture: all -- Dpkg.Org's dpkg