chiark / gitweb /
dgit: dsc Dgit field handling: Parse additional data
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Jan 2017 00:03:53 +0000 (00:03 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Jan 2017 22:14:48 +0000 (22:14 +0000)
So far we don't do much with it, so this akes no change except to
messages.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Debian/Dgit.pm
dgit

index 5a7b59d750e65893212d40c32f5a3a783604c7ad..62945874883a5d507441f52eca31cac16ae489a6 100644 (file)
@@ -50,7 +50,7 @@ BEGIN {
                      git_get_ref git_for_each_ref
                       git_for_each_tag_referring is_fast_fwd
                       $package_re $component_re $deliberately_re
                      git_get_ref git_for_each_ref
                       git_for_each_tag_referring is_fast_fwd
                       $package_re $component_re $deliberately_re
-                     $distro_re
+                     $distro_re $versiontag_re
                       $branchprefix
                       initdebug enabledebug enabledebuglevel
                       printdebug debugcmd
                       $branchprefix
                       initdebug enabledebug enabledebuglevel
                       printdebug debugcmd
@@ -67,6 +67,7 @@ our $package_re = '[0-9a-z][-+.0-9a-z]*';
 our $component_re = '[0-9a-zA-Z][-+.0-9a-zA-Z]*';
 our $deliberately_re = "(?:TEST-)?$package_re";
 our $distro_re = $component_re;
 our $component_re = '[0-9a-zA-Z][-+.0-9a-zA-Z]*';
 our $deliberately_re = "(?:TEST-)?$package_re";
 our $distro_re = $component_re;
+our $versiontag_re = qr{[-+.\%_0-9a-zA-Z/]+};
 our $branchprefix = 'dgit';
 
 # policy hook exit status bits
 our $branchprefix = 'dgit';
 
 # policy hook exit status bits
diff --git a/dgit b/dgit
index eb6fb9cd5970169854b0a5f85551b746c03c23d9..7d2dd8516386285f22afa0da28f162bc825b457e 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1683,6 +1683,7 @@ sub create_remote_git_repo () {
 }
 
 our ($dsc_hash,$lastpush_mergeinput);
 }
 
 our ($dsc_hash,$lastpush_mergeinput);
+our ($dsc_distro, $dsc_hint_tag, $dsc_hint_url);
 
 our $ud = '.git/dgit/unpack';
 
 
 our $ud = '.git/dgit/unpack';
 
@@ -2712,8 +2713,15 @@ sub parse_dsc_field ($$) {
     }
     if (!defined $f) {
        progress "$what: NO git hash";
     }
     if (!defined $f) {
        progress "$what: NO git hash";
-    } elsif ($f =~ m/^\w+/) {
+    } elsif (($dsc_hash, $dsc_distro, $dsc_hint_tag, $dsc_hint_url)
+            = $f =~ m/^(\w+) ($distro_re) ($versiontag_re) (\S+)(?:\s|$)/) {
+       progress "$what: specified git info ($dsc_distro)";
+       $dsc_hint_tag = [ $dsc_hint_tag ];
+    } elsif ($f =~ m/^\w+\s*$/) {
        $dsc_hash = $&;
        $dsc_hash = $&;
+       $dsc_distro //= 'debian';
+       $dsc_hint_tag = [ debiantags +(getfield $dsc, 'Version'),
+                         $dsc_distro ];
        progress "$what: specified git hash";
     } else {
        fail "$what: invalid Dgit info";
        progress "$what: specified git hash";
     } else {
        fail "$what: invalid Dgit info";