Explorar o código

Dpkg::Source::Package: Do not return an error message if we can build

Guillem Jover %!s(int64=13) %!d(string=hai) anos
pai
achega
e83599bd2b

+ 4 - 2
scripts/Dpkg/Source/Package/V1.pm

@@ -163,10 +163,12 @@ sub do_extract {
 
 
 sub can_build {
 sub can_build {
     my ($self, $dir) = @_;
     my ($self, $dir) = @_;
+
     # As long as we can use gzip, we can do it as we have
     # As long as we can use gzip, we can do it as we have
     # native packages as fallback
     # native packages as fallback
-    return ($self->{options}{compression} eq 'gzip',
-            _g('only supports gzip compression'));
+    return (0, _g('only supports gzip compression'))
+        unless $self->{options}{compression} eq 'gzip';
+    return 1;
 }
 }
 
 
 sub do_build {
 sub do_build {

+ 3 - 1
scripts/Dpkg/Source/Package/V3/Bzr.pm

@@ -81,7 +81,9 @@ sub sanity_check {
 
 
 sub can_build {
 sub can_build {
     my ($self, $dir) = @_;
     my ($self, $dir) = @_;
-    return (-d "$dir/.bzr", _g("doesn't contain a bzr repository"));
+
+    return (0, _g("doesn't contain a bzr repository")) unless -d "$dir/.bzr";
+    return 1;
 }
 }
 
 
 sub do_build {
 sub do_build {

+ 4 - 2
scripts/Dpkg/Source/Package/V3/Custom.pm

@@ -42,8 +42,10 @@ sub do_extract {
 
 
 sub can_build {
 sub can_build {
     my ($self, $dir) = @_;
     my ($self, $dir) = @_;
-    return (scalar(@{$self->{options}{ARGV}}),
-            _g('no files indicated on command line'));
+
+    return (0, _g('no files indicated on command line'))
+        unless scalar(@{$self->{options}{ARGV}});
+    return 1;
 }
 }
 
 
 sub do_build {
 sub do_build {

+ 3 - 1
scripts/Dpkg/Source/Package/V3/Git.pm

@@ -87,7 +87,9 @@ sub parse_cmdline_option {
 
 
 sub can_build {
 sub can_build {
     my ($self, $dir) = @_;
     my ($self, $dir) = @_;
-    return (-d "$dir/.git", _g("doesn't contain a git repository"));
+
+    return (0, _g("doesn't contain a git repository")) unless -d "$dir/.git";
+    return 1;
 }
 }
 
 
 sub do_build {
 sub do_build {

+ 1 - 1
scripts/Dpkg/Source/Package/V3/Quilt.pm

@@ -80,7 +80,7 @@ sub can_build {
     my $quilt = $self->build_quilt_object($dir);
     my $quilt = $self->build_quilt_object($dir);
     $msg = $quilt->find_problems();
     $msg = $quilt->find_problems();
     return (0, $msg) if $msg;
     return (0, $msg) if $msg;
-    return (1, '');
+    return 1;
 }
 }
 
 
 sub get_autopatch_name {
 sub get_autopatch_name {