chiark / gitweb /
dgit: Dgit parsing: tolerate newlines etc. not just one space
[dgit.git] / dgit
diff --git a/dgit b/dgit
index ee1101da23a4521f3d9d5ac33e59b0b2c37cd248..1fdc26c13b0d3a379f8950460df11783665a3521 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -78,7 +78,7 @@ our $patches_applied_dirtily = 00;
 our $tagformat_want;
 our $tagformat;
 our $tagformatfn;
-our $chase_dsc_distro=1; #xxx configurable
+our $chase_dsc_distro=1;
 
 our %forceopts = map { $_=>0 }
     qw(unrepresentable unsupported-source-format
@@ -565,6 +565,7 @@ sub cmd_help () {
 our $td = $ENV{DGIT_TEST_DUMMY_DIR} || "DGIT_TEST_DUMMY_DIR-unset";
 
 our %defcfg = ('dgit.default.distro' => 'debian',
+              'dgit.default.old-dsc-distro' => 'debian',
               'dgit-suite.*-security.distro' => 'debian-security',
               'dgit.default.username' => '',
               'dgit.default.archive-query-default-component' => 'main',
@@ -2757,12 +2758,13 @@ sub parse_dsc_field ($$) {
     if (!defined $f) {
        progress "$what: NO git hash";
     } elsif (($dsc_hash, $dsc_distro, $dsc_hint_tag, $dsc_hint_url)
-            = $f =~ m/^(\w+) ($distro_re) ($versiontag_re) (\S+)(?:\s|$)/) {
+            = $f =~ m/^(\w+)\s+($distro_re)\s+($versiontag_re)\s+(\S+)(?:\s|$)/) {
        progress "$what: specified git info ($dsc_distro)";
        $dsc_hint_tag = [ $dsc_hint_tag ];
     } elsif ($f =~ m/^\w+\s*$/) {
        $dsc_hash = $&;
-       $dsc_distro //= 'debian';
+       $dsc_distro //= cfg qw(dgit.default.old-dsc-distro
+                              dgit.default.distro);
        $dsc_hint_tag = [ debiantags +(getfield $dsc, 'Version'),
                          $dsc_distro ];
        progress "$what: specified git hash";
@@ -2823,8 +2825,12 @@ END
        return $lrf;
     };
 
-    if (parse_cfg_bool 'rewrite-map-enable', 'true',
-           access_cfg('rewrite-map-enable', 'RETURN-UNDEF')) {
+    my $rewrite_enable = do {
+       local $idistro = $dsc_distro;
+       access_cfg('rewrite-map-enable', 'RETURN-UNDEF');
+    };
+
+    if (parse_cfg_bool 'rewrite-map-enable', 'true', $rewrite_enable) {
        my $lrf = $do_fetch->("rewrite map", $rewritemap) or return;
        $mapref = $lrf.'/'.$rewritemap;
        my $rewritemapdata = git_cat_file $mapref.':map';
@@ -6277,6 +6283,9 @@ sub parseopts () {
            } elsif (m/^--no-rm-on-error$/s) {
                push @ropts, $_;
                $rmonerror = 0;
+           } elsif (m/^--no-chase-dsc-distro$/s) {
+               push @ropts, $_;
+               $chase_dsc_distro = 0;
            } elsif (m/^--overwrite$/s) {
                push @ropts, $_;
                $overwrite_version = '';