chiark / gitweb /
Infrastructure: Improve an error message in dgit-repos-policy-debian.
[dgit.git] / dgit
diff --git a/dgit b/dgit
index b06e0782aca0dbc1671f107b33e6568f6583018c..60b39e4ae66d7be7f9f4a07eb736daf36ce2336a 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1382,7 +1382,7 @@ sub generate_commit_from_dsc () {
        my $f = $fi->{Filename};
        die "$f ?" if $f =~ m#/|^\.|\.dsc$|\.tmp$#;
 
-       link "../../../$f", $f
+       link_ltarget "../../../$f", $f
            or $!==&ENOENT
            or die "$f $!";
 
@@ -1481,7 +1481,7 @@ sub complete_file_from_dsc ($$) {
        my $furl = $dscurl;
        $furl =~ s{/[^/]+$}{};
        $furl .= "/$f";
-       die "$f ?" unless $f =~ m/^${package}_/;
+       die "$f ?" unless $f =~ m/^\Q${package}\E_/;
        die "$f ?" if $f =~ m#/#;
        runcmd_ordryrun_local @curl,qw(-o),$tf,'--',"$furl";
        next if !act_local();
@@ -2794,7 +2794,7 @@ END
     foreach my $f (<../../../../*>) { #/){
        my $b=$f; $b =~ s{.*/}{};
        next unless is_orig_file $b, srcfn $upstreamversion,'';
-       link $f, $b or die "$b $!";
+       link_ltarget $f, $b or die "$b $!";
         $dscaddfile->($b);
     }
 
@@ -3124,9 +3124,20 @@ sub defvalopt ($$$$) {
 
 defvalopt '--since-version', '-v', '[^_]+|_', \$changes_since_version;
 defvalopt '--distro',        '-d', '.+',      \$idistro;
+defvalopt '',                '-k', '.+',      \$keyid;
 defvalopt '--existing-package','', '.*',      \$existing_package;
 defvalopt '--build-products-dir','','.*',     \$buildproductsdir;
 defvalopt '--clean',       '', $cleanmode_re, \$cleanmode;
+defvalopt '--quilt',     '', $quilt_modes_re, \$quilt_mode;
+
+defvalopt '', '-c', '.*=.*', sub { push @git, '-c', @_; };
+
+defvalopt '', '-C', '.+', sub {
+    ($changesfile) = (@_);
+    if ($changesfile =~ s#^(.*)/##) {
+       $buildproductsdir = $1;
+    }
+};
 
 defvalopt '--initiator-tempdir','','.*', sub {
     ($initiator_tempdir) = (@_);
@@ -3150,7 +3161,7 @@ sub parseopts () {
        my ($what) = @_;
        @rvalopts = ($_);
        if (!defined $val) {
-           badusage "$what needs a value" unless length @ARGV;
+           badusage "$what needs a value" unless @ARGV;
            $val = shift @ARGV;
            push @rvalopts, $val;
        }
@@ -3196,11 +3207,6 @@ sub parseopts () {
                     ($om = $opts_opt_map{$1})) {
                push @ropts, $_;
                push @$om, $2;
-           } elsif (m/^--quilt=($quilt_modes_re)$/s) {
-               push @ropts, $_;
-               $quilt_mode = $1;
-           } elsif (m/^--quilt=(.*)$/s) {
-               badusage "unknown quilt fixup mode \`$1'";
            } elsif (m/^--ignore-dirty$/s) {
                push @ropts, $_;
                $ignoredirty = 1;
@@ -3240,20 +3246,6 @@ sub parseopts () {
                    push @ropts, $&;
                    push @changesopts, $_;
                    $_ = '';
-               } elsif (s/^-c(.*=.*)//s) {
-                   push @ropts, $&;
-                   push @git, '-c', $1;
-               } elsif (s/^-C(.+)//s) {
-                   push @ropts, $&;
-                   $changesfile = $1;
-                   if ($changesfile =~ s#^(.*)/##) {
-                       $buildproductsdir = $1;
-                   }
-               } elsif (s/^-k(.+)//s) {
-                   $keyid=$1;
-               } elsif (m/^-[dCk]$/) {
-                   badusage
- "option \`$_' requires an argument (and no space before the argument)";
                } elsif (s/^-wn$//s) {
                    push @ropts, $&;
                    $cleanmode = 'none';