Skip to content

Commit d78bb0a

Browse files
committed
dh_configpackage: Add command line options for actions
Add support for the --displace, --hide, --undisplace, --unhide, and --transform options to dh_configpackage, which take arguments of the same form as a line in the corresponding file in debian/. This can be used to implement conditional actions based on a test in debian/rules, as will be documented in an example in a later commit.
1 parent 8d36c76 commit d78bb0a

1 file changed

Lines changed: 34 additions & 13 deletions

File tree

dh_configpackage

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,20 @@ Do not modify maintainer scripts.
5252
5353
=cut
5454

55-
init();
55+
my (@arg_displace, @arg_hide, @arg_undisplace, @arg_unhide, @arg_transform);
56+
my $args_present = 0;
57+
58+
init(options => {
59+
"displace=s" => \@arg_displace,
60+
"hide=s" => \@arg_hide,
61+
"undisplace=s" => \@arg_undisplace,
62+
"unhide=s" => \@arg_unhide,
63+
"transform=s" => \@arg_transform,
64+
});
65+
66+
if (@arg_displace or @arg_hide or @arg_undisplace or @arg_unhide or @arg_transform) {
67+
$args_present = 1;
68+
}
5669

5770
# We default the displace extension to a period followed by the first
5871
# word of the package name, on the assumption that it is probably the
@@ -170,18 +183,26 @@ sub check_file {
170183
}
171184

172185
foreach my $package (@{$dh{DOPACKAGES}}) {
173-
my (@displacefiles, @hidefiles, @undisplacefiles, @unhidefiles);
174-
175-
my $displacefile = pkgfile($package, "displace");
176-
@displacefiles = filearray($displacefile) if $displacefile;
177-
my $hidefile = pkgfile($package, "hide");
178-
@hidefiles = filearray($hidefile) if $hidefile;
179-
my $undisplacefile = pkgfile($package, "undisplace");
180-
@undisplacefiles = filearray($undisplacefile) if $undisplacefile;
181-
my $unhidefile = pkgfile($package, "unhide");
182-
@unhidefiles = filearray($unhidefile) if $unhidefile;
183-
my $transformfile = pkgfile($package, "transform");
184-
@transformfiles = filedoublearray($transformfile) if $transformfile;
186+
my (@displacefiles, @hidefiles, @undisplacefiles, @unhidefiles, @transformfiles);
187+
188+
if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && $args_present) {
189+
@displacefiles = @arg_displace;
190+
@hidefiles = @arg_hide;
191+
@undisplacefiles = @arg_undisplace;
192+
@unhidefiles = @arg_unhide;
193+
@transformfiles = map {[split]} @arg_transform;
194+
} else {
195+
my $displacefile = pkgfile($package, "displace");
196+
@displacefiles = filearray($displacefile) if $displacefile;
197+
my $hidefile = pkgfile($package, "hide");
198+
@hidefiles = filearray($hidefile) if $hidefile;
199+
my $undisplacefile = pkgfile($package, "undisplace");
200+
@undisplacefiles = filearray($undisplacefile) if $undisplacefile;
201+
my $unhidefile = pkgfile($package, "unhide");
202+
@unhidefiles = filearray($unhidefile) if $unhidefile;
203+
my $transformfile = pkgfile($package, "transform");
204+
@transformfiles = filedoublearray($transformfile) if $transformfile;
205+
}
185206

186207
my $tmp = tmpdir($package);
187208
my $extension = displace_extension($package);

0 commit comments

Comments
 (0)