chiark / gitweb /
Import: orig files: Fix .orig-comp pattern match
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Oct 2016 16:43:51 +0000 (17:43 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Oct 2016 18:26:31 +0000 (19:26 +0100)
Fix up .orig detection to correctly allow exactly the right .orig-comp
components accorging to dpkg-source(1).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
dgit

index 9082aad752f3c5611dfc3188821f2335d89eb479..a55ee20d547ad4d7ff05e00a13175af35a97ad31 100644 (file)
@@ -56,6 +56,8 @@ dgit (1.5~~) unstable; urgency=medium
   * Fix two calls to chdir without proper error checking.
   * Fix a couple of bugs in error reporting.
   * Fix up .orig detection to be less trustful of (ambiguous) filenames.
+  * Fix up .orig detection to correctly allow exactly the right
+    .orig-comp components accorging to dpkg-source(1).
 
   Test suite:
   * When sbuild fails, do not crash due to sed not finding the log
diff --git a/dgit b/dgit
index b4b6d9cd4ea79467a9d86cb9b3df7e5d5f997af8..e11d2fb5b8014c885474e5badb18d8a857cfb593 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -77,6 +77,8 @@ our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
 
 our $suite_re = '[-+.0-9a-z]+';
 our $cleanmode_re = 'dpkg-source(?:-d)?|git|git-ff|check|none';
+our $orig_f_comp_re = 'orig(?:-[-0-9a-z]+)?';
+our $orig_f_tail_re = "$orig_f_comp_re\\.tar(?:\\.\\w+)?";
 
 our $git_authline_re = '^([^<>]+) \<(\S+)\> (\d+ [-+]\d+)$';
 our $splitbraincache = 'dgit-intern/quilt-cache';
@@ -1434,14 +1436,14 @@ sub is_orig_file_in_dsc ($$) {
     return 0 if @$dsc_files_info <= 1;
     # One file means no origs, and the filename doesn't have a "what
     # part of dsc" component.  (Consider versions ending `.orig'.)
-    return 0 unless $f =~ m/\.orig(?:-\w+)?\.tar(?:\.\w+)?$/;
+    return 0 unless $f =~ m/\.$orig_f_tail_re$/o;
     return 1;
 }
 
 sub is_orig_file_of_vsn ($$) {
     my ($f, $upstreamvsn) = @_;
     my $base = srcfn $upstreamvsn, '';
-    return 0 unless $f =~ m/^\Q$base\E\.orig(?:-\w+)?\.tar(?:\.\w+)?$/;
+    return 0 unless $f =~ m/^\Q$base\E\.$orig_f_tail_re$/;
     return 1;
 }