From 90169463f86997737ed5b9c0ea2b311cd3b056b7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 9 Apr 2024 14:53:53 +0200 Subject: Adding upstream version 13.15.3. Signed-off-by: Daniel Baumann --- dh_bugfiles | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100755 dh_bugfiles (limited to 'dh_bugfiles') diff --git a/dh_bugfiles b/dh_bugfiles new file mode 100755 index 0000000..6222922 --- /dev/null +++ b/dh_bugfiles @@ -0,0 +1,145 @@ +#!/usr/bin/perl + +=head1 NAME + +dh_bugfiles - install bug reporting customization files into package build directories + +=cut + +use strict; +use warnings; +use Debian::Debhelper::Dh_Lib; + +our $VERSION = DH_BUILTIN_VERSION; + +=head1 SYNOPSIS + +B [B<-A>] [S>] + +=head1 DESCRIPTION + +B is a debhelper program that is responsible for installing +bug reporting customization files (bug scripts and/or bug control files +and/or presubj files) into package build directories. + +=head1 FILES + +=over 4 + +=item debian/I.bug-script + +This is the script to be run by the bug reporting program for generating a bug +report template. This file is installed as F in the +package build directory if no other types of bug reporting customization +files are going to be installed for the package in question. Otherwise, +this file is installed as F. Finally, the +installed script is given execute permissions. + +=item debian/I.bug-control + +It is the bug control file containing some directions for the bug reporting +tool. This file is installed as F in the +package build directory. + +=item debian/I.bug-presubj + +The contents of this file are displayed to the user by the bug reporting +tool before allowing the user to write a bug report on the package to the +Debian Bug Tracking System. This file is installed as +F in the package build directory. + +=back + +=head1 OPTIONS + +=over 4 + +=item B<-A>, B<--all> + +Install F files to ALL packages acted on when respective +F files do not exist. Normally, F will +be installed to the first package only. + +=back + +=cut + +init(); + +# Types of bug files this debhelper program handles. +# Hash value is the name of the pkgfile of the respective +# type. +my %bugfile_types = ( + "script" => "bug-script", + "control" => "bug-control", + "presubj" => "bug-presubj", +); +# PROMISE: DH NOOP WITHOUT bug-script bug-control bug-presubj cli-options() + +foreach my $package (@{$dh{DOPACKAGES}}) { + next if is_udeb($package); + + my $tmp=tmpdir($package); + my $p_dir="${tmp}/usr/share/bug"; + my $dir="${p_dir}/$package"; + + # Gather information which bug files are available for the + # package in question + my %bugfiles=(); + while (my ($type, $pkgfilename) = each(%bugfile_types)) { + my $file=pkgfile($package,$pkgfilename); + if ($file) { + $bugfiles{$type}=$file; + } + elsif (-f "debian/$pkgfilename" && $dh{PARAMS_ALL}) { + $bugfiles{$type}="debian/$pkgfilename"; + } + } + + # If there is only a bug script to install, install it as + # usr/share/bug/$package (unless this path is a directory) + if (! -d $dir && scalar(keys(%bugfiles)) == 1 && exists $bugfiles{script}) { + install_dir($p_dir); + install_prog($bugfiles{script}, $dir); + } + elsif (scalar(keys(%bugfiles)) > 0) { + if (-f $dir) { + # Move usr/share/bug/$package to usr/share/bug/$package/script + rename_path($dir, "${dir}.tmp"); + install_dir($dir); + rename_path("${dir}.tmp", "$dir/script"); + } + else { + install_dir($dir); + } + while (my ($type, $srcfile) = each(%bugfiles)) { + if ($type eq 'script') { + install_prog($srcfile, "$dir/$type"); + } else { + install_file($srcfile, "$dir/$type"); + } + } + } + + # Ensure that the bug script is executable + if (-f $dir) { + reset_perm_and_owner(0755, $dir); + } + elsif (-f "$dir/script") { + reset_perm_and_owner(0755, "$dir/script"); + } +} + +=head1 SEE ALSO + +F + +L + +This program is a part of debhelper. + +=head1 AUTHOR + +Modestas Vainius + +=cut -- cgit v1.2.3