The following commit has been merged in the master branch:
commit 62783ea26c4cfcf5507390739dac056a2db3b7a8
Author: Guillem Jover <[email protected]>
Date: Wed Jan 9 20:25:45 2013 +0100
Dpkg::Source::Package: Capitalize variant module names
Lowercase module names are reserved by convention for pragmas, and
there's really no need to diverge here from the general dpkg project
naming convention. Also make sure source package format variant names
are always in lowercase, to not allow names that would not work with
previous dpkg-source versions.
Fixes NamingConventions::Capitalization.
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 3b543af..6187db4 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -223,9 +223,15 @@ sub upgrade_object_type {
if ($format =~ /^([\d\.]+)(?:\s+\((.*)\))?$/) {
my ($version, $variant, $major, $minor) = ($1, $2, $1, undef);
+
+ if (defined $variant and $variant ne lc $variant) {
+ error(_g("source package format '%s' is not supported: %s"),
+ $format, _g('format variant must be in lowercase'));
+ }
+
$major =~ s/\.[\d\.]+$//;
my $module = "Dpkg::Source::Package::V$major";
- $module .= "::$variant" if defined $variant;
+ $module .= '::' . ucfirst $variant if defined $variant;
eval "require $module; \$minor = \$${module}::CURRENT_MINOR_VERSION;";
$minor //= 0;
if ($update_format) {
diff --git a/scripts/Dpkg/Source/Package/V1.pm
b/scripts/Dpkg/Source/Package/V1.pm
index 596c44e..61a9f74 100644
--- a/scripts/Dpkg/Source/Package/V1.pm
+++ b/scripts/Dpkg/Source/Package/V1.pm
@@ -30,7 +30,7 @@ use Dpkg::Source::Archive;
use Dpkg::Source::Patch;
use Dpkg::Exit;
use Dpkg::Source::Functions qw(erasedir);
-use Dpkg::Source::Package::V3::native;
+use Dpkg::Source::Package::V3::Native;
use POSIX qw(:errno_h);
use Cwd;
@@ -108,11 +108,11 @@ sub do_extract {
my $native = $difffile ? 0 : 1;
if ($native and ($tarfile =~ /\.orig\.tar\.gz$/)) {
warning(_g('native package with .orig.tar'));
- $native = 0; # V3::native doesn't handle orig.tar
+ $native = 0; # V3::Native doesn't handle orig.tar
}
if ($native) {
- Dpkg::Source::Package::V3::native::do_extract($self, $newdirectory);
+ Dpkg::Source::Package::V3::Native::do_extract($self, $newdirectory);
} else {
my $expectprefix = $newdirectory;
$expectprefix .= '.orig';
@@ -288,7 +288,7 @@ sub do_build {
if ($sourcestyle eq 'n') {
$self->{options}{ARGV} = []; # ensure we have no error
- Dpkg::Source::Package::V3::native::do_build($self, $dir);
+ Dpkg::Source::Package::V3::Native::do_build($self, $dir);
} elsif ($sourcestyle =~ m/[nurUR]/) {
if (stat($tarname)) {
unless ($sourcestyle =~ m/[nUR]/) {
diff --git a/scripts/Dpkg/Source/Package/V3/bzr.pm
b/scripts/Dpkg/Source/Package/V3/Bzr.pm
similarity index 99%
rename from scripts/Dpkg/Source/Package/V3/bzr.pm
rename to scripts/Dpkg/Source/Package/V3/Bzr.pm
index 9bc69f2..7fb9112 100644
--- a/scripts/Dpkg/Source/Package/V3/bzr.pm
+++ b/scripts/Dpkg/Source/Package/V3/Bzr.pm
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-package Dpkg::Source::Package::V3::bzr;
+package Dpkg::Source::Package::V3::Bzr;
use strict;
use warnings;
diff --git a/scripts/Dpkg/Source/Package/V3/custom.pm
b/scripts/Dpkg/Source/Package/V3/Custom.pm
similarity index 97%
rename from scripts/Dpkg/Source/Package/V3/custom.pm
rename to scripts/Dpkg/Source/Package/V3/Custom.pm
index 475a7cf..09d4f5c 100644
--- a/scripts/Dpkg/Source/Package/V3/custom.pm
+++ b/scripts/Dpkg/Source/Package/V3/Custom.pm
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-package Dpkg::Source::Package::V3::custom;
+package Dpkg::Source::Package::V3::Custom;
use strict;
use warnings;
diff --git a/scripts/Dpkg/Source/Package/V3/git.pm
b/scripts/Dpkg/Source/Package/V3/Git.pm
similarity index 99%
rename from scripts/Dpkg/Source/Package/V3/git.pm
rename to scripts/Dpkg/Source/Package/V3/Git.pm
index 5bb83ed..db69f50 100644
--- a/scripts/Dpkg/Source/Package/V3/git.pm
+++ b/scripts/Dpkg/Source/Package/V3/Git.pm
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-package Dpkg::Source::Package::V3::git;
+package Dpkg::Source::Package::V3::Git;
use strict;
use warnings;
diff --git a/scripts/Dpkg/Source/Package/V3/native.pm
b/scripts/Dpkg/Source/Package/V3/Native.pm
similarity index 98%
rename from scripts/Dpkg/Source/Package/V3/native.pm
rename to scripts/Dpkg/Source/Package/V3/Native.pm
index de706f3..8dcd386 100644
--- a/scripts/Dpkg/Source/Package/V3/native.pm
+++ b/scripts/Dpkg/Source/Package/V3/Native.pm
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-package Dpkg::Source::Package::V3::native;
+package Dpkg::Source::Package::V3::Native;
use strict;
use warnings;
diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm
b/scripts/Dpkg/Source/Package/V3/Quilt.pm
similarity index 99%
rename from scripts/Dpkg/Source/Package/V3/quilt.pm
rename to scripts/Dpkg/Source/Package/V3/Quilt.pm
index a2843dd..6370ae7 100644
--- a/scripts/Dpkg/Source/Package/V3/quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/Quilt.pm
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-package Dpkg::Source::Package::V3::quilt;
+package Dpkg::Source::Package::V3::Quilt;
use strict;
use warnings;
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 9d1f3f2..0cec354 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -94,11 +94,11 @@ nobase_dist_perllib_DATA = \
Dpkg/Source/Package.pm \
Dpkg/Source/Package/V1.pm \
Dpkg/Source/Package/V2.pm \
- Dpkg/Source/Package/V3/bzr.pm \
- Dpkg/Source/Package/V3/custom.pm \
- Dpkg/Source/Package/V3/native.pm \
- Dpkg/Source/Package/V3/git.pm \
- Dpkg/Source/Package/V3/quilt.pm \
+ Dpkg/Source/Package/V3/Bzr.pm \
+ Dpkg/Source/Package/V3/Custom.pm \
+ Dpkg/Source/Package/V3/Native.pm \
+ Dpkg/Source/Package/V3/Git.pm \
+ Dpkg/Source/Package/V3/Quilt.pm \
Dpkg/Source/Patch.pm \
Dpkg/Source/Quilt.pm \
Dpkg/Substvars.pm \
diff --git a/scripts/po/POTFILES.in b/scripts/po/POTFILES.in
index b00cb52..3c1b6e0 100644
--- a/scripts/po/POTFILES.in
+++ b/scripts/po/POTFILES.in
@@ -55,11 +55,11 @@ scripts/Dpkg/Source/Patch.pm
scripts/Dpkg/Source/Package.pm
scripts/Dpkg/Source/Package/V1.pm
scripts/Dpkg/Source/Package/V2.pm
-scripts/Dpkg/Source/Package/V3/bzr.pm
-scripts/Dpkg/Source/Package/V3/custom.pm
-scripts/Dpkg/Source/Package/V3/native.pm
-scripts/Dpkg/Source/Package/V3/git.pm
-scripts/Dpkg/Source/Package/V3/quilt.pm
+scripts/Dpkg/Source/Package/V3/Bzr.pm
+scripts/Dpkg/Source/Package/V3/Custom.pm
+scripts/Dpkg/Source/Package/V3/Native.pm
+scripts/Dpkg/Source/Package/V3/Git.pm
+scripts/Dpkg/Source/Package/V3/Quilt.pm
scripts/Dpkg/Source/Quilt.pm
scripts/Dpkg/Substvars.pm
scripts/Dpkg/Vars.pm
diff --git a/test/100_critic.t b/test/100_critic.t
index 58ddeb8..bd98c5c 100644
--- a/test/100_critic.t
+++ b/test/100_critic.t
@@ -68,6 +68,7 @@ my @policies = qw(
Modules::RequireEndWithOne
Modules::RequireExplicitPackage
Modules::RequireFilenameMatchesPackage
+ NamingConventions::Capitalization
Objects::ProhibitIndirectSyntax
RegularExpressions::ProhibitUnusualDelimiters
RegularExpressions::RequireBracesForMultiline
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]