[dh-make-perl] 01/02: If I can't parse pkgname or version, quit with a useful error message

Dima Kogan dkogan-guest at alioth.debian.org
Thu Oct 31 17:58:47 UTC 2013


This is an automated email from the git hooks/post-receive script.

dkogan-guest pushed a commit to branch master
in repository dh-make-perl.

commit 55c6cbee7517d047cf4409a2377783c4b1ddad76
Author: Dima Kogan <dima at secretsauce.net>
Date:   Wed Oct 30 21:56:03 2013 -0700

    If I can't parse pkgname or version, quit with a useful error message
    
    Before this patch, perl would throw up errors about trying to do stuff with
    uninitialized variables. Now it says things like
    
    "Unable to determine dist name. Please use --packagename"
---
 lib/DhMakePerl/Command/Packaging.pm |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/lib/DhMakePerl/Command/Packaging.pm b/lib/DhMakePerl/Command/Packaging.pm
index 08f9fde..7f544e0 100644
--- a/lib/DhMakePerl/Command/Packaging.pm
+++ b/lib/DhMakePerl/Command/Packaging.pm
@@ -354,20 +354,15 @@ sub extract_name_ver {
     $ver = $self->cfg->version
         if $self->cfg->version;
 
-    defined($ver) and $ver ne ''
-        or die "Unable to determine dist version\. Please use --version.\n";
-
     # final sanitazing of name and version
-    $name =~ s/::/-/g;
-    $ver = $self->sanitize_version($ver) unless $self->cfg->version;
+    $name =~ s/::/-/g if defined $name;
+    $ver = $self->sanitize_version($ver) if defined $ver && !$self->cfg->version;
 
-    $name
-        or $ver
-        or die
-        "Unable to determine distribution name and version. Aborting.\n";
+    defined($ver) and $ver ne ''
+        or die "Unable to determine dist version\. Please use --version.\n";
 
-    $name or die "Unable to determine distribution name. Aborting.\n";
-    $ver  or die "Unable to determine distribution version. Aborting.\n";
+    defined($name) and $name ne ''
+        or die "Unable to determine dist name\. Please use --packagename.\n";
 
     $self->perlname($name);
     $self->version($ver);
@@ -416,6 +411,7 @@ sub extract_name_ver_from_build {
         $vfrom =~s{::}{/}g;
         $vfrom = "lib/$vfrom.pm";
     }
+    return unless defined $name;
     $name =~ s/,.*$//;
 
     # band aid: need to find a solution also for build in directories
@@ -550,6 +546,7 @@ sub extract_name_ver_from_makefile {
         # Module::Install syntax
         $name = $self->unquote($1);
     }
+    return unless defined $name;
     $name =~ s/,.*$//;
 
     # band aid: need to find a solution also for build in directories

-- 
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