summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2013-11-08 05:09:52 +0100
committerGuillem Jover <guillem@debian.org>2013-11-24 05:48:17 +0100
commit5ae4ce9c2dfddbb36e2e0fc24dde3a27196f00f1 (patch)
treec14f42031004268315ccbe75c1b117c8aae8a828
parent16f9bd122b8a1e0ed8d6ce88cc57bd73ae829a03 (diff)
downloaddpkg-5ae4ce9c2dfddbb36e2e0fc24dde3a27196f00f1.tar.gz
Consistently use regex instead of regexp when possible
All changed instances are documentation or private code interfaces. The only remaining variable instance with a regexp name is a publicly exposed variable, which will eventually disappear once it has gone through the deprecation process.
-rw-r--r--dselect/methods/Dselect/Ftp.pm2
-rw-r--r--man/dpkg-buildpackage.12
-rw-r--r--man/dpkg-source.114
-rw-r--r--scripts/Dpkg/Index.pm2
-rw-r--r--scripts/Dpkg/Source/Package.pm15
-rw-r--r--scripts/Dpkg/Source/Package/V1.pm10
-rw-r--r--scripts/Dpkg/Source/Package/V2.pm4
-rw-r--r--scripts/Dpkg/Source/Package/V3/Bzr.pm6
-rw-r--r--scripts/Dpkg/Source/Package/V3/Git.pm6
-rw-r--r--scripts/Dpkg/Source/Package/V3/Quilt.pm2
-rw-r--r--scripts/Dpkg/Source/Patch.pm4
-rwxr-xr-xscripts/dpkg-source.pl10
-rw-r--r--scripts/t/550_Dpkg_Util.t6
13 files changed, 43 insertions, 40 deletions
diff --git a/dselect/methods/Dselect/Ftp.pm b/dselect/methods/Dselect/Ftp.pm
index b77d10f03..ed2d283f1 100644
--- a/dselect/methods/Dselect/Ftp.pm
+++ b/dselect/methods/Dselect/Ftp.pm
@@ -375,7 +375,7 @@ sub do_mdtm {
# build a system time
$time = Time::Local::timegm(0, $minutes, $hours, $day, $month, $year);
} else {
- die 'regexp match failed on LIST output';
+ die 'regex match failed on LIST output';
}
}
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index db6fd2bc8..bd54c1051 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -215,7 +215,7 @@ Do not sign the \fB.changes\fP file.
Force the signing of the resulting files (since dpkg 1.17.0),
regardless of \fB\-us\fP or \fB\-uc\fP or other internal heuristics.
.TP
-.BR \-i [\fIregexp\fP]
+.BR \-i [\fIregex\fP]
.TQ
.BR \-I [\fIpattern\fP]
.TQ
diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index 7412ba05e..0316bf19a 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -176,32 +176,32 @@ files. Supported values are:
.IR 1 " to " 9 ", " best ", and " fast .
The default is \fI9\fP for gzip and bzip2, \fI6\fP for xz and lzma.
.TP
-.BR \-i "[\fIregexp\fP], " \-\-diff\-ignore [=\fIregexp\fP]
+.BR \-i "[\fIregex\fP], " \-\-diff\-ignore [=\fIregex\fP]
You may specify a perl regular expression to match files you want
filtered out of the list of files for the diff. (This list is
generated by a find command.) (If the source package is being built as a
version 3 source package using a VCS, this can be used to ignore
uncommited changes on specific files. Using \-i.* will ignore all of them.)
-\fB\-i\fP by itself enables the option, with a default regexp that will
+\fB\-i\fP by itself enables the option, with a default regex that will
filter out control files and directories of the most common revision
control systems, backup and swap files and Libtool build output
-directories. There can only be one active regexp, of multiple
+directories. There can only be one active regex, of multiple
\fB\-i\fP options only the last one will take effect.
This is very helpful in cutting out extraneous files that get included
in the diff, e.g. if you maintain your source in a revision control
system and want to use a checkout to build a source package without
including the additional files and directories that it will usually
-contain (e.g. CVS/, .cvsignore, .svn/). The default regexp is already
+contain (e.g. CVS/, .cvsignore, .svn/). The default regex is already
very exhaustive, but if you need to replace it, please note that by
default it can match any part of a path, so if you want to match the
begin of a filename or only full filenames, you will need to provide
the necessary anchors (e.g. '(^|/)', '($|/)') yourself.
.TP
-.BR \-\-extend\-diff\-ignore =\fIregexp\fP
+.BR \-\-extend\-diff\-ignore =\fIregex\fP
The perl regular expression specified will extend the default value
of \fB\-\-diff\-ignore\fP and its current value (if set). It does this
-by concatenating "\fB|\fP\fIregexp\fP" to the existing value.
+by concatenating "\fB|\fP\fIregex\fP" to the existing value.
This option is convenient to use in \fBdebian/source/options\fP to exclude
some auto-generated files from the automatic patch generation.
.TP
@@ -231,7 +231,7 @@ to each part of the path individually. The exact semantic of tar's
http://www.gnu.org/software/tar/manual/tar.html#wildcards for a full
documentation.
-The default regexp and patterns for both options can be seen
+The default regex and patterns for both options can be seen
in the output of the \fB\-\-help\fP command.
.SS Generic extract options
.TP
diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm
index a0a82a5b1..715be6a7b 100644
--- a/scripts/Dpkg/Index.pm
+++ b/scripts/Dpkg/Index.pm
@@ -208,7 +208,7 @@ sub get_by_key {
=item my @keys = $index->get_keys(%criteria)
Returns the keys of items that matches all the criteria. The key of the
-%criteria hash is a field name and the value is either a regexp that needs
+%criteria hash is a field name and the value is either a regex that needs
to match the field value, or a reference to a function that must return
true and that receives the field value as single parameter, or a scalar
that must be equal to the field value.
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 6d2b27c5c..f2fef8bdf 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -51,8 +51,7 @@ use Dpkg::Vendor qw(run_vendor_hook);
use POSIX qw(:errno_h :sys_wait_h);
use File::Basename;
-# Public variables
-our $diff_ignore_default_regexp = '
+my $diff_ignore_default_regex = '
# Ignore general backup files
(?:^|/).*~$|
# Ignore emacs recovery files
@@ -69,8 +68,12 @@ our $diff_ignore_default_regexp = '
\.shelf|_MTN|\.be|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
';
# Take out comments and newlines
-$diff_ignore_default_regexp =~ s/^#.*$//mg;
-$diff_ignore_default_regexp =~ s/\n//sg;
+$diff_ignore_default_regex =~ s/^#.*$//mg;
+$diff_ignore_default_regex =~ s/\n//sg;
+
+# Public variables
+our $diff_ignore_default_regexp = $diff_ignore_default_regex;
+
no warnings 'qw'; ## no critic (TestingAndDebugging::ProhibitNoWarnings)
our @tar_ignore_default_pattern = qw(
*.a
@@ -167,8 +170,8 @@ sub init_options {
my ($self) = @_;
# Use full ignore list by default
# note: this function is not called by V1 packages
- $self->{options}{diff_ignore_regexp} ||= $diff_ignore_default_regexp;
- $self->{options}{diff_ignore_regexp} .= '|(?:^|/)debian/source/local-.*$';
+ $self->{options}{diff_ignore_regex} ||= $diff_ignore_default_regex;
+ $self->{options}{diff_ignore_regex} .= '|(?:^|/)debian/source/local-.*$';
if (defined $self->{options}{tar_ignore}) {
$self->{options}{tar_ignore} = [ @tar_ignore_default_pattern ]
unless @{$self->{options}{tar_ignore}};
diff --git a/scripts/Dpkg/Source/Package/V1.pm b/scripts/Dpkg/Source/Package/V1.pm
index 229f824e5..f63d987ef 100644
--- a/scripts/Dpkg/Source/Package/V1.pm
+++ b/scripts/Dpkg/Source/Package/V1.pm
@@ -44,10 +44,10 @@ sub init_options {
my ($self) = @_;
# Don't call $self->SUPER::init_options() on purpose, V1.0 has no
# ignore by default
- if ($self->{options}{diff_ignore_regexp}) {
- $self->{options}{diff_ignore_regexp} .= '|(?:^|/)debian/source/local-.*$';
+ if ($self->{options}{diff_ignore_regex}) {
+ $self->{options}{diff_ignore_regex} .= '|(?:^|/)debian/source/local-.*$';
} else {
- $self->{options}{diff_ignore_regexp} = '(?:^|/)debian/source/local-.*$';
+ $self->{options}{diff_ignore_regex} = '(?:^|/)debian/source/local-.*$';
}
push @{$self->{options}{tar_ignore}}, 'debian/source/local-options',
'debian/source/local-patch-header';
@@ -176,7 +176,7 @@ sub do_build {
my $sourcestyle = $self->{options}{sourcestyle};
my @argv = @{$self->{options}{ARGV}};
my @tar_ignore = map { "--exclude=$_" } @{$self->{options}{tar_ignore}};
- my $diff_ignore_regexp = $self->{options}{diff_ignore_regexp};
+ my $diff_ignore_regex = $self->{options}{diff_ignore_regex};
if (scalar(@argv) > 1) {
usageerr(_g('-b takes at most a directory and an orig source ' .
@@ -356,7 +356,7 @@ sub do_build {
$diff->create();
$diff->add_diff_directory($origdir, $dir,
basedirname => $basedirname,
- diff_ignore_regexp => $diff_ignore_regexp,
+ diff_ignore_regex => $diff_ignore_regex,
options => []); # Force empty set of options to drop the
# default -p option
$diff->finish() || $ur++;
diff --git a/scripts/Dpkg/Source/Package/V2.pm b/scripts/Dpkg/Source/Package/V2.pm
index 9a5ec22a4..700bf2d37 100644
--- a/scripts/Dpkg/Source/Package/V2.pm
+++ b/scripts/Dpkg/Source/Package/V2.pm
@@ -295,8 +295,8 @@ sub after_build {
sub prepare_build {
my ($self, $dir) = @_;
$self->{diff_options} = {
- diff_ignore_regexp => $self->{options}{diff_ignore_regexp} .
- '|(^|/)debian/patches/.dpkg-source-applied$',
+ diff_ignore_regex => $self->{options}{diff_ignore_regex} .
+ '|(^|/)debian/patches/.dpkg-source-applied$',
include_removal => $self->{options}{include_removal},
include_timestamp => $self->{options}{include_timestamp},
use_dev_null => 1,
diff --git a/scripts/Dpkg/Source/Package/V3/Bzr.pm b/scripts/Dpkg/Source/Package/V3/Bzr.pm
index 28e6bbf43..86ca1826d 100644
--- a/scripts/Dpkg/Source/Package/V3/Bzr.pm
+++ b/scripts/Dpkg/Source/Package/V3/Bzr.pm
@@ -91,7 +91,7 @@ sub do_build {
my @argv = @{$self->{options}{ARGV}};
# TODO: warn here?
#my @tar_ignore = map { "--exclude=$_" } @{$self->{options}{tar_ignore}};
- my $diff_ignore_regexp = $self->{options}{diff_ignore_regexp};
+ my $diff_ignore_regex = $self->{options}{diff_ignore_regex};
$dir =~ s{/+$}{}; # Strip trailing /
my ($dirname, $updir) = fileparse($dir);
@@ -122,8 +122,8 @@ sub do_build {
while (<$bzr_status_fh>) {
chomp;
next unless s/^ +//;
- if (! length $diff_ignore_regexp ||
- ! m/$diff_ignore_regexp/o) {
+ if (! length $diff_ignore_regex ||
+ ! m/$diff_ignore_regex/o) {
push @files, $_;
}
}
diff --git a/scripts/Dpkg/Source/Package/V3/Git.pm b/scripts/Dpkg/Source/Package/V3/Git.pm
index bd58b2106..3ac6384d4 100644
--- a/scripts/Dpkg/Source/Package/V3/Git.pm
+++ b/scripts/Dpkg/Source/Package/V3/Git.pm
@@ -94,7 +94,7 @@ sub can_build {
sub do_build {
my ($self, $dir) = @_;
- my $diff_ignore_regexp = $self->{options}{diff_ignore_regexp};
+ my $diff_ignore_regex = $self->{options}{diff_ignore_regex};
$dir =~ s{/+$}{}; # Strip trailing /
my ($dirname, $updir) = fileparse($dir);
@@ -124,8 +124,8 @@ sub do_build {
{ local $/ = "\0";
while (<$git_ls_files_fh>) {
chomp;
- if (! length $diff_ignore_regexp ||
- ! m/$diff_ignore_regexp/o) {
+ if (! length $diff_ignore_regex ||
+ ! m/$diff_ignore_regex/o) {
push @files, $_;
}
}
diff --git a/scripts/Dpkg/Source/Package/V3/Quilt.pm b/scripts/Dpkg/Source/Package/V3/Quilt.pm
index 6c597d0f3..1ae5f9cf8 100644
--- a/scripts/Dpkg/Source/Package/V3/Quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/Quilt.pm
@@ -170,7 +170,7 @@ sub prepare_build {
my $func = sub {
return 1 if $_[0] =~ m{^debian/patches/series$} and -l $_[0];
return 1 if $_[0] =~ /^\.pc(\/|$)/;
- return 1 if $_[0] =~ /$self->{options}{diff_ignore_regexp}/;
+ return 1 if $_[0] =~ /$self->{options}{diff_ignore_regex}/;
return 0;
};
$self->{diff_options}{diff_ignore_func} = $func;
diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm
index 4b66d2d64..4f61ad10f 100644
--- a/scripts/Dpkg/Source/Patch.pm
+++ b/scripts/Dpkg/Source/Patch.pm
@@ -149,8 +149,8 @@ sub add_diff_directory {
my $diff_ignore;
if ($opts{diff_ignore_func}) {
$diff_ignore = $opts{diff_ignore_func};
- } elsif ($opts{diff_ignore_regexp}) {
- $diff_ignore = sub { return $_[0] =~ /$opts{diff_ignore_regexp}/o };
+ } elsif ($opts{diff_ignore_regex}) {
+ $diff_ignore = sub { return $_[0] =~ /$opts{diff_ignore_regex}/o };
} else {
$diff_ignore = sub { return 0 };
}
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 62eeef23b..2ce30046c 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -63,7 +63,7 @@ my %options = (
comp_ext => compression_get_property(compression_get_default(), 'file_ext'),
# Ignore files
tar_ignore => [],
- diff_ignore_regexp => '',
+ diff_ignore_regex => '',
# Misc options
copy_orig_tarballs => 1,
no_check => 0,
@@ -167,11 +167,11 @@ while (@options) {
} elsif (m/^-U([^\=:]+)$/) {
$remove{$1} = 1;
} elsif (m/^-(?:i|-diff-ignore(?:$|=))(.*)$/) {
- $options{diff_ignore_regexp} = $1 ? $1 : $Dpkg::Source::Package::diff_ignore_default_regexp;
+ $options{diff_ignore_regex} = $1 ? $1 : $Dpkg::Source::Package::diff_ignore_default_regexp;
} elsif (m/^--extend-diff-ignore=(.+)$/) {
$Dpkg::Source::Package::diff_ignore_default_regexp .= "|$1";
- if ($options{diff_ignore_regexp}) {
- $options{diff_ignore_regexp} .= "|$1";
+ if ($options{diff_ignore_regex}) {
+ $options{diff_ignore_regex} .= "|$1";
}
} elsif (m/^-(?:I|-tar-ignore=)(.+)$/) {
push @{$options{tar_ignore}}, $1;
@@ -495,7 +495,7 @@ sub usage {
-D<field>=<value> override or add a .dsc field and value.
-U<field> remove a field.
-q quiet mode.
- -i[<regexp>] filter out files to ignore diffs of
+ -i[<regex>] filter out files to ignore diffs of
(defaults to: '%s').
-I[<pattern>] filter out files when building tarballs
(defaults to: %s).
diff --git a/scripts/t/550_Dpkg_Util.t b/scripts/t/550_Dpkg_Util.t
index 0aebb293e..f700bff1b 100644
--- a/scripts/t/550_Dpkg_Util.t
+++ b/scripts/t/550_Dpkg_Util.t
@@ -30,9 +30,9 @@ ok(any { 'bar' eq $_ } @array, 'array has item');
ok(!any { 'notfound' eq $_ } @array, 'array does not have item');
ok(none { 'notfound' eq $_ } @array, 'array lacks item');
-ok(any { m/^quu/ } @array, 'array has item matching regexp');
-ok(none { m/^notfound/ } @array, 'array lacks item matching regexp');
+ok(any { m/^quu/ } @array, 'array has item matching regex');
+ok(none { m/^notfound/ } @array, 'array lacks item matching regex');
-ok(any { m/^quu/ } keys %hash, 'hash has item matching regexp');
+ok(any { m/^quu/ } keys %hash, 'hash has item matching regex');
1;