From a1dedd5997162bc0ef04a57871a677e6fe627c7c Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Sun, 16 Mar 2008 19:03:59 +0100 Subject: [PATCH] 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. --- scripts/Dpkg/Source/Package/V1_0.pm | 1 + scripts/Dpkg/Source/Package/V2_0.pm | 3 ++- scripts/Dpkg/Source/Package/V3_0/bzr.pm | 3 ++- scripts/Dpkg/Source/Package/V3_0/git.pm | 3 ++- scripts/Dpkg/Source/Package/V3_0/native.pm | 6 ++++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/Dpkg/Source/Package/V1_0.pm b/scripts/Dpkg/Source/Package/V1_0.pm index 3a4706cb..a3e69607 100644 --- a/scripts/Dpkg/Source/Package/V1_0.pm +++ b/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)) { diff --git a/scripts/Dpkg/Source/Package/V2_0.pm b/scripts/Dpkg/Source/Package/V2_0.pm index 8a3d1e3f..0d6ac112 100644 --- a/scripts/Dpkg/Source/Package/V2_0.pm +++ b/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); diff --git a/scripts/Dpkg/Source/Package/V3_0/bzr.pm b/scripts/Dpkg/Source/Package/V3_0/bzr.pm index a0e1974d..3e6bf1fe 100644 --- a/scripts/Dpkg/Source/Package/V3_0/bzr.pm +++ b/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'}; diff --git a/scripts/Dpkg/Source/Package/V3_0/git.pm b/scripts/Dpkg/Source/Package/V3_0/git.pm index 1b4bef86..4839dcc3 100644 --- a/scripts/Dpkg/Source/Package/V3_0/git.pm +++ b/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'}; diff --git a/scripts/Dpkg/Source/Package/V3_0/native.pm b/scripts/Dpkg/Source/Package/V3_0/native.pm index bbc03ed0..5efab3ef 100644 --- a/scripts/Dpkg/Source/Package/V3_0/native.pm +++ b/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); -- 2.39.5