Просмотр исходного кода

Uniformize @argv parsing in source package formats

* scripts/Dpkg/Source/Package/V2_0.pm: Improve error
message when we have too many arguments.
* scripts/Dpkg/Source/Package/V3_0/bzr.pm: Same here.
* scripts/Dpkg/Source/Package/V3_0/git.pm: Same here.
* scripts/Dpkg/Source/Package/V3_0/native.pm: Add check
of number of arguments.
* scripts/Dpkg/Source/Package/V1_0.pm: Make sure we're
not going to fail when we delegate to do_build() of
V3_0/native.pm.
Raphael Hertzog лет назад: 18
Родитель
Сommit
a1dedd5997

+ 1 - 0
scripts/Dpkg/Source/Package/V1_0.pm

@@ -268,6 +268,7 @@ sub do_build {
     }
 
     if ($sourcestyle eq "n") {
+        $self->{'options'}{'ARGV'} = []; # ensure we have no error
         Dpkg::Source::Package::V3_0::native::do_build($self, $dir);
     } elsif ($sourcestyle =~ m/[nurUR]/) {
         if (stat($tarname)) {

+ 2 - 1
scripts/Dpkg/Source/Package/V2_0.pm

@@ -178,7 +178,8 @@ sub do_build {
 
     my ($dirname, $updir) = fileparse($dir);
     if (scalar(@argv)) {
-        usageerr(_g("-b takes only one parameter with v2.0 source packages"));
+        usageerr(_g("-b takes only one parameter with format `%s'"),
+                 $self->{'fields'}{'Format'});
     }
     $self->prepare_build($dir);
 

+ 2 - 1
scripts/Dpkg/Source/Package/V3_0/bzr.pm

@@ -92,7 +92,8 @@ sub do_build {
 	my ($dirname, $updir) = fileparse($dir);
 
 	if (scalar(@argv)) {
-		usageerr(_g("-b takes only one parameter with v3.0 source packages"));
+            usageerr(_g("-b takes only one parameter with format `%s'"),
+                     $self->{'fields'}{'Format'});
 	}
 
 	my $sourcepackage = $self->{'fields'}{'Source'};

+ 2 - 1
scripts/Dpkg/Source/Package/V3_0/git.pm

@@ -120,7 +120,8 @@ sub do_build {
     my ($dirname, $updir) = fileparse($dir);
 
     if (scalar(@argv)) {
-	usageerr(_g("-b takes only one parameter with v3.0 source packages"));
+        usageerr(_g("-b takes only one parameter with format `%s'"),
+                 $self->{'fields'}{'Format'});
     }
 
     my $sourcepackage = $self->{'fields'}{'Source'};

+ 6 - 0
scripts/Dpkg/Source/Package/V3_0/native.pm

@@ -66,6 +66,12 @@ sub can_build {
 sub do_build {
     my ($self, $dir) = @_;
     my @tar_ignore = map { "--exclude=$_" } @{$self->{'options'}{'tar_ignore'}};
+    my @argv = $self->{'options'}{'ARGV'};
+
+    if (scalar(@argv)) {
+        usageerr(_g("-b takes only one parameter with format `%s'"),
+                 $self->{'fields'}{'Format'});
+    }
 
     my $sourcepackage = $self->{'fields'}{'Source'};
     my $basenamerev = $self->get_basename(1);