[dh-make-perl] 03/09: rework --only internal representation to be a hash
Damyan Ivanov
dmn at alioth.debian.org
Fri Aug 16 12:32:50 UTC 2013
This is an automated email from the git hooks/post-receive script.
dmn pushed a commit to branch master
in repository dh-make-perl.
commit 96a12c38ac93ca7370a05e057c6a2764ff6546f9
Author: Damyan Ivanov <dmn at debian.org>
Date: Fri Aug 16 12:47:55 2013 +0200
rework --only internal representation to be a hash
this allows going away from experimental smartmatch
---
lib/DhMakePerl/Command/refresh.pm | 14 +++++++-------
lib/DhMakePerl/Config.pm | 12 +++++++++---
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/lib/DhMakePerl/Command/refresh.pm b/lib/DhMakePerl/Command/refresh.pm
index a296706..09e17d4 100644
--- a/lib/DhMakePerl/Command/refresh.pm
+++ b/lib/DhMakePerl/Command/refresh.pm
@@ -57,32 +57,32 @@ sub execute {
$self->process_meta;
$self->extract_basic(); # also detects arch-dep package
- $self->extract_docs if 'docs' ~~ $self->cfg->only;
- $self->extract_examples if 'examples' ~~ $self->cfg->only;
+ $self->extract_docs if $self->cfg->only->{docs};
+ $self->extract_examples if $self->cfg->only->{examples};
print "Found docs: @{ $self->docs }\n"
if @{ $self->docs } and $self->cfg->verbose;
print "Found examples: @{ $self->examples }\n"
if @{ $self->examples } and $self->cfg->verbose;
- if ( 'rules' ~~ $self->cfg->only ) {
+ if ( $self->cfg->only->{only} ) {
$self->create_rules;
$self->create_compat( $self->debian_file('compat') );
}
- if ( 'examples' ~~ $self->cfg->only ) {
+ if ( $self->cfg->only->{examples} ) {
$self->update_file_list( examples => $self->examples );
}
- if ( 'docs' ~~ $self->cfg->only ) {
+ if ( $self->cfg->only->{docs} ) {
$self->update_file_list( docs => $self->docs );
}
- if ( 'copyright' ~~ $self->cfg->only ) {
+ if ( $self->cfg->only->{copyright} ) {
$self->backup_file( $self->debian_file('copyright') );
$self->create_copyright( $self->debian_file('copyright') );
}
- if ( 'control' ~~ $self->cfg->only ) {
+ if ( $self->cfg->only->{control} ) {
my $control = $self->control;
if ( -e catfile( $self->debian_file('patches'), 'series' )
and $self->cfg->source_format ne '3.0 (quilt)' )
diff --git a/lib/DhMakePerl/Config.pm b/lib/DhMakePerl/Config.pm
index 6537211..57fa7ba 100644
--- a/lib/DhMakePerl/Config.pm
+++ b/lib/DhMakePerl/Config.pm
@@ -74,7 +74,12 @@ use constant DEFAULTS => {
exclude => qr/$Dpkg::Source::Package::diff_ignore_default_regexp/,
home_dir => "$ENV{HOME}/.dh-make-perl",
network => 1,
- only => [ 'control', 'copyright', 'docs', 'examples', 'rules' ],
+ only => {
+ map (
+ ( $_ => 1 ),
+ qw(control copyright docs examples rules)
+ ),
+ },
source_format => '3.0 (quilt)',
vcs => 'git',
verbose => 1,
@@ -153,8 +158,9 @@ sub parse_command_line_options {
# back to defaults
# handle comma-separated multiple values in --only
- $opts{only} = [ split( /,/, join( ',', @{ $opts{only} } ) ) ]
- if exists $opts{only};
+ $opts{only}
+ = { map ( ( $_ => 1 ), split( /,/, join( ',', @{ $opts{only} } ) ) ) }
+ if $opts{only};
while ( my ( $k, $v ) = each %opts ) {
my $field = $k;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/dh-make-perl.git
More information about the Pkg-perl-cvs-commits
mailing list