[Bash-completion-commits] ./current r1291: * extra/dh_bash-completion:
David Paleino
d.paleino at gmail.com
Thu Jan 29 13:51:48 UTC 2009
------------------------------------------------------------
revno: 1291
committer: David Paleino <d.paleino at gmail.com>
branch nick: current
timestamp: Thu 2009-01-29 14:51:48 +0100
message:
* extra/dh_bash-completion:
- updated to support a list of files in debian/<package>.bash-completion
(Closes: #512917)
modified:
debian/changelog
extra/dh_bash-completion
extra/dh_bash-completion.1
-------------- next part --------------
=== modified file 'debian/changelog'
--- a/debian/changelog 2009-01-25 21:40:44 +0000
+++ b/debian/changelog 2009-01-29 13:51:48 +0000
@@ -79,6 +79,9 @@
- 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 @@
* Remove duplicate cpio completion, thanks to Freddy Vulto (Closes: #512823)
* Fix awk error in "modprobe -r /" completion (Closes: #512556).
- -- David Paleino <d.paleino at gmail.com> Sat, 17 Jan 2009 19:01:16 +0100
+ -- David Paleino <d.paleino at gmail.com> Thu, 29 Jan 2009 14:49:19 +0100
bash-completion (20080705) unstable; urgency=low
=== modified file 'extra/dh_bash-completion'
--- a/extra/dh_bash-completion 2008-06-21 22:31:22 +0000
+++ b/extra/dh_bash-completion 2009-01-29 13:51:48 +0000
@@ -7,6 +7,7 @@
=cut
use strict;
+use File::Find;
use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
@@ -18,15 +19,25 @@
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 @@
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", "-p", "-m644", $completions, "$bc_dir/$package");
+ 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");
+ }
+ }
}
}
=== modified file 'extra/dh_bash-completion.1'
--- a/extra/dh_bash-completion.1 2008-06-21 22:33:00 +0000
+++ b/extra/dh_bash-completion.1 2009-01-29 13:51:48 +0000
@@ -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 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)
More information about the Bash-completion-commits
mailing list