* extra/dh_bash-completion:

- updated to support a list of files in debian/<package>.bash-completion
    (Closes: #512917)
This commit is contained in:
David Paleino 2009-01-29 14:51:48 +01:00
parent 6a2ff139a0
commit 34ff7bfe8c
3 changed files with 84 additions and 23 deletions

5
debian/changelog vendored
View File

@ -79,6 +79,9 @@ bash-completion (200811xx) UNRELEASED; urgency=low
- added Vcs-* fields
* debian/install:
- correctly install contrib/* under /etc/bash_completion.d/
* extra/dh_bash-completion:
- updated to support a list of files in debian/<package>.bash-completion
(Closes: #512917)
[ Ville Skyttä ]
* Added JPEG 2000 files to display completion, thanks to Bastien Nocera
@ -103,7 +106,7 @@ bash-completion (200811xx) UNRELEASED; urgency=low
* Remove duplicate cpio completion, thanks to Freddy Vulto (Closes: #512823)
* Fix awk error in "modprobe -r /" completion (Closes: #512556).
-- David Paleino <d.paleino@gmail.com> Sat, 17 Jan 2009 19:01:16 +0100
-- David Paleino <d.paleino@gmail.com> Thu, 29 Jan 2009 14:49:19 +0100
bash-completion (20080705) unstable; urgency=low

View File

@ -7,6 +7,7 @@ dh_bash-completion - install bash completions for package
=cut
use strict;
use File::Find;
use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
@ -18,15 +19,25 @@ B<dh_bash-completion> [S<I<debhelper options>>]
dh_bash-completion is a debhelper program that is responsible for installing
completions for bash, usable installing the "bash-completion" package.
If a file named debian/package.bash-completion exists, then it is
installed into etc/bash_completion.d in the package build directory.
This file is used to provide the user with proper completion for available
commands.
If a file named debian/package.bash-completion exists, then different actions
are performed, depending on its format.
It can be a proper completion snippet, and in that case it would be installed
in the completion directory, and no other actions would be performed.
It can also be a list of files, with an optionally specified name to call the
completion snippet after. The file format is as follows:
my/path/to/foo-completion # this would be installed as "foo-completion"
my/path/to/bar-completion baz # this would be installed as "baz"
=cut
init();
my $srcdir = '.';
$srcdir = $dh{SOURCEDIR}."/" if defined $dh{SOURCEDIR};
foreach my $package (@{$dh{DOPACKAGES}}) {
next if is_udeb($package);
@ -34,11 +45,57 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
my $bc_dir = "$tmp/etc/bash_completion.d";
my $completions = pkgfile($package,"bash-completion");
if ($completions ne '') {
my @install;
my $name;
if ($completions) {
if (! -d "$bc_dir") {
doit("install", "-d", "$bc_dir");
doit("install", "-d", "$bc_dir");
}
# try parsing a list of files
@install = filedoublearray($completions);
foreach my $set (@install) {
my @filelist;
my @tmp = @$set;
if (@$set > 1) {
$name = pop @$set;
}
else {
$name = basename($tmp[0]);
}
verbose_print "installing $tmp[0] as $name";
my @found;
foreach my $glob (@$set) {
@found = glob "$srcdir/$glob";
if (!compat(6)) {
# Fall back to looking into debian/tmp
if (!@found || !-e $found[0]) {
@found = glob "debian/tmp/$glob";
}
}
if (!@found || !-e $found[0]) {
warning "file-list parsing failed, installing as proper snippet";
doit("install", "-p", "-m644", $completions, "$bc_dir/$package");
exit 0
}
push @filelist, @found;
}
if (! compat(4)) { # check added in v5
# glob now, relative to srcdir
if (!@filelist) {
error("$package missing files (@$set), aborting");
}
}
foreach my $src (@filelist) {
doit("install", "-p", $src, "$bc_dir/$name");
}
}
doit("install", "-p", "-m644", $completions, "$bc_dir/$package");
}
}

View File

@ -1,15 +1,7 @@
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
@ -53,7 +45,7 @@
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
@ -132,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "DH_BASH-COMPLETION 1"
.TH DH_BASH-COMPLETION 1 "2008-06-22" "20080617.1" "Bash-Completion Debhelper"
.TH DH_BASH-COMPLETION 1 "2009-01-29" "200811xx" "Bash-Completion Debhelper"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@ -147,10 +139,19 @@ dh_bash\-completion \- install bash completions for package
dh_bash\-completion is a debhelper program that is responsible for installing
completions for bash, usable installing the \*(L"bash-completion\*(R" package.
.PP
If a file named debian/package.bash\-completion exists, then it is
installed into etc/bash_completion.d in the package build directory.
This file is used to provide the user with proper completion for available
commands.
If a file named debian/package.bash\-completion exists, then different actions
are performed, depending on its format.
.PP
It can be a proper completion snippet, and in that case it would be installed
in the completion directory, and no other actions would be performed.
.PP
It can also be a list of files, with an optionally specified name to call the
completion snippet after. The file format is as follows:
.PP
.Vb 2
\& my/path/to/foo\-completion # this would be installed as "foo\-completion"
\& my/path/to/bar\-completion baz # this would be installed as "baz"
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIdebhelper\fR\|(1)