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=a66a453492b402d95d1415d5236352987defb8db commit a66a453492b402d95d1415d5236352987defb8db Author: Guillem Jover <[email protected]> AuthorDate: Fri Dec 2 19:30:13 2022 +0100 dpkg-buildapi: New tool to fetch the dpkg-build-api level --- debian/README.bug-usertags | 2 ++ debian/dpkg-dev.install | 1 + debian/dpkg-dev.manpages | 1 + man/Makefile.am | 2 ++ man/dpkg-buildapi.pod | 66 +++++++++++++++++++++++++++++++++++++++++ man/po/po4a.cfg | 1 + scripts/.gitignore | 1 + scripts/Makefile.am | 2 ++ scripts/dpkg-buildapi.pl | 73 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/po/POTFILES.in | 1 + t/pod-spell.t | 1 + 11 files changed, 151 insertions(+) diff --git a/debian/README.bug-usertags b/debian/README.bug-usertags index b767aca67..eee63cf30 100644 --- a/debian/README.bug-usertags +++ b/debian/README.bug-usertags @@ -49,6 +49,7 @@ usertag description dpkg dpkg-architecture +dpkg-buildapi dpkg-buildflags dpkg-buildpackage dpkg-checkbuilddeps @@ -115,6 +116,7 @@ usercategory dpkg-program [hidden] + start-stop-daemon [tag=s-s-d] + libdpkg [package=libdpkg-dev] + dpkg-architecture [tag=dpkg-architecture] + + dpkg-buildapi [tag=dpkg-buildapi] + dpkg-buildflags [tag=dpkg-buildflags] + dpkg-buildpackage [tag=dpkg-buildpackage] + dpkg-checkbuilddeps [tag=dpkg-checkbuilddeps] diff --git a/debian/dpkg-dev.install b/debian/dpkg-dev.install index 500a9303c..aa95e5ae5 100644 --- a/debian/dpkg-dev.install +++ b/debian/dpkg-dev.install @@ -2,6 +2,7 @@ debian/shlibs.default etc/dpkg debian/shlibs.override etc/dpkg usr/bin/dpkg-architecture +usr/bin/dpkg-buildapi usr/bin/dpkg-buildflags usr/bin/dpkg-buildpackage usr/bin/dpkg-checkbuilddeps diff --git a/debian/dpkg-dev.manpages b/debian/dpkg-dev.manpages index fe2fe0dec..2c6241380 100644 --- a/debian/dpkg-dev.manpages +++ b/debian/dpkg-dev.manpages @@ -26,6 +26,7 @@ usr/share/man/{*,*/*}/deb.5 usr/share/man/{*,*/*}/deb822.5 usr/share/man/{*,*/*}/dpkg-architecture.1 usr/share/man/{*,*/*}/dpkg-build-api.7 +usr/share/man/{*,*/*}/dpkg-buildapi.1 usr/share/man/{*,*/*}/dpkg-buildflags.1 usr/share/man/{*,*/*}/dpkg-buildpackage.1 usr/share/man/{*,*/*}/dpkg-checkbuilddeps.1 diff --git a/man/Makefile.am b/man/Makefile.am index d9e9a2a4c..ffec41729 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -29,6 +29,7 @@ man_MANS = \ deb822.5 \ dpkg-architecture.1 \ dpkg-build-api.7 \ + dpkg-buildapi.1 \ dpkg-buildflags.1 \ dpkg-buildpackage.1 \ dpkg-checkbuilddeps.1 \ @@ -117,6 +118,7 @@ EXTRA_DIST += \ deb822.pod \ dpkg-architecture.pod \ dpkg-build-api.pod \ + dpkg-buildapi.pod \ dpkg-buildflags.pod \ dpkg-buildpackage.pod \ dpkg-checkbuilddeps.pod \ diff --git a/man/dpkg-buildapi.pod b/man/dpkg-buildapi.pod new file mode 100644 index 000000000..b1e56e8f5 --- /dev/null +++ b/man/dpkg-buildapi.pod @@ -0,0 +1,66 @@ +# dpkg manual page - dpkg-buildapi(1) +# +# Copyright © 2023 Guillem Jover <[email protected]> +# +# This is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +=encoding utf8 + +=head1 NAME + +dpkg-buildapi - returns the build API level to use during package build + +=head1 SYNOPSIS + +B<dpkg-buildapi> [I<option>...] [I<command>] + +=head1 DESCRIPTION + +B<dpkg-buildapi> is a tool to retrieve the L<dpkg-build-api(7)> level to +use during build of source Debian packages. + +This program was introduced in dpkg 1.22.0. + +=head1 COMMANDS + +=over + +=item B<-c>I<control-file> + +Specifies the main source control file to read information from. +The default is F<debian/control>. + +=item B<--help> + +Show the usage message and exit. + +=item B<--version> + +Show the version and exit. + +=back + +=head1 ENVIRONMENT + +=over + +=item B<DPKG_BUILD_API> + +The build API level to use. +This is intended to be used internally by the tools executed from +F<debian/rules> to avoid having to parse F<debian/control> multiple times, +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 diff --git a/man/po/po4a.cfg b/man/po/po4a.cfg index 49477b553..97c073b9c 100644 --- a/man/po/po4a.cfg +++ b/man/po/po4a.cfg @@ -32,6 +32,7 @@ [type:pod] deb822.pod $lang:$lang/deb822.pod [type:pod] dpkg-architecture.pod $lang:$lang/dpkg-architecture.pod [type:pod] dpkg-build-api.pod $lang:$lang/dpkg-build-api.pod +[type:pod] dpkg-buildapi.pod $lang:$lang/dpkg-buildapi.pod [type:pod] dpkg-buildflags.pod $lang:$lang/dpkg-buildflags.pod [type:pod] dpkg-buildpackage.pod $lang:$lang/dpkg-buildpackage.pod [type:pod] dpkg-checkbuilddeps.pod $lang:$lang/dpkg-checkbuilddeps.pod diff --git a/scripts/.gitignore b/scripts/.gitignore index dd547fbdc..b1c8335aa 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,6 +1,7 @@ Build.PL README.cpan dpkg-architecture +dpkg-buildapi dpkg-buildflags dpkg-buildpackage dpkg-checkbuilddeps diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 3bb6e1df0..b700a8e6c 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -9,6 +9,7 @@ sbin_SCRIPTS = \ bin_SCRIPTS = \ dpkg-architecture \ dpkg-buildflags \ + dpkg-buildapi \ dpkg-buildpackage \ dpkg-checkbuilddeps \ dpkg-distaddfile \ @@ -28,6 +29,7 @@ bin_SCRIPTS = \ EXTRA_DIST = \ dpkg-architecture.pl \ + dpkg-buildapi.pl \ dpkg-buildflags.pl \ dpkg-buildpackage.pl \ dpkg-checkbuilddeps.pl \ diff --git a/scripts/dpkg-buildapi.pl b/scripts/dpkg-buildapi.pl new file mode 100755 index 000000000..72d32629a --- /dev/null +++ b/scripts/dpkg-buildapi.pl @@ -0,0 +1,73 @@ +#!/usr/bin/perl +# +# dpkg-buildapi +# +# Copyright © 2022 Guillem Jover <[email protected]> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +use warnings; +use strict; + +use Dpkg (); +use Dpkg::Gettext; +use Dpkg::ErrorHandling; +use Dpkg::BuildAPI qw(get_build_api); +use Dpkg::Control::Info; + +textdomain('dpkg-dev'); + +sub version() +{ + printf(g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION); +} + +sub usage() +{ + printf(g_("Usage: %s [<option>...]\n"), $Dpkg::PROGNAME); + + print(g_(' +Options: + -c<control-file> get control info from this file. + -?, --help show this help message. + -v, --version show the version. +')); +} + +my $controlfile = 'debian/control'; + +while (@ARGV) { + $_ = shift(@ARGV); + if (m/^-\?|--help$/) { + usage(); + exit 0; + } elsif (m/^-v|--version$/) { + version(); + exit 0; + } elsif (m/-c(.*)$/) { + $controlfile = $1; + } elsif (m/^--$/) { + last; + } elsif (m/^-/) { + usageerr(g_("unknown option '%s'"), $_); + } else { + usageerr(g_('no arguments accepted')); + } +} + +my $ctrl = Dpkg::Control::Info->new($controlfile); + +print get_build_api($ctrl) . "\n"; + +0; diff --git a/scripts/po/POTFILES.in b/scripts/po/POTFILES.in index c535551fb..f382a3af8 100644 --- a/scripts/po/POTFILES.in +++ b/scripts/po/POTFILES.in @@ -1,6 +1,7 @@ # This is the list of all source files with translatable strings. scripts/dpkg-architecture.pl +scripts/dpkg-buildapi.pl scripts/dpkg-buildflags.pl scripts/dpkg-buildpackage.pl scripts/dpkg-checkbuilddeps.pl diff --git a/t/pod-spell.t b/t/pod-spell.t index 5f0d27a63..dfb2102c0 100644 --- a/t/pod-spell.t +++ b/t/pod-spell.t @@ -65,6 +65,7 @@ decompressor dep deps dpkg +dpkg-buildapi dpkg-buildflags dpkg-buildpackage dpkg-checkbuilddeps -- Dpkg.Org's dpkg

