diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:35:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:35:28 +0000 |
commit | ea314d2f45c40a006c0104157013ab4b857f665f (patch) | |
tree | 3ef2971cb3675c318b8d9effd987854ad3f6d3e8 /scripts/dpkg-buildtree.pl | |
parent | Initial commit. (diff) | |
download | dpkg-ea314d2f45c40a006c0104157013ab4b857f665f.tar.xz dpkg-ea314d2f45c40a006c0104157013ab4b857f665f.zip |
Adding upstream version 1.22.4.upstream/1.22.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/dpkg-buildtree.pl')
-rwxr-xr-x | scripts/dpkg-buildtree.pl | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/scripts/dpkg-buildtree.pl b/scripts/dpkg-buildtree.pl new file mode 100755 index 0000000..f250598 --- /dev/null +++ b/scripts/dpkg-buildtree.pl @@ -0,0 +1,75 @@ +#!/usr/bin/perl +# +# dpkg-buildtree +# +# Copyright © 2023 Guillem Jover <guillem@debian.org> +# +# 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 strict; +use warnings; + +use Dpkg (); +use Dpkg::Gettext; +use Dpkg::ErrorHandling; +use Dpkg::BuildTree; + +textdomain('dpkg-dev'); + +sub version { + printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION; + + printf g_(' +This is free software; see the GNU General Public License version 2 or +later for copying conditions. There is NO warranty. +'); +} + +sub usage { + printf g_( +'Usage: %s [<command>]') + . "\n\n" . g_( +'Commands: + clean clean dpkg generated artifacts from the build tree. + --help show this help message. + --version show the version. +'), $Dpkg::PROGNAME; +} + +my $action; + +while (@ARGV) { + my $arg = shift @ARGV; + if ($arg eq 'clean') { + usageerr(g_('two commands specified: %s and %s'), $1, $action) + if defined $action; + $action = $arg; + } elsif ($arg eq '-?' or $arg eq '--help') { + usage(); + exit 0; + } elsif ($arg eq '--version') { + version(); + exit 0; + } else { + usageerr(g_("unknown option '%s'"), $arg); + } +} + +usageerr(g_('missing action')) unless $action; + +my $bt = Dpkg::BuildTree->new(); + +if ($action eq 'clean') { + $bt->clean(); +} |