chiark / gitweb /
dgit gbp-build will arrange to let gbp buildpackage generate .orig tarballs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 19:48:43 +0000 (19:48 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 22:18:48 +0000 (22:18 +0000)
if it seems applicable.  Closes:#841094.

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

index 24f2ea6afbc7bffa57de1c744ed9979ab2c2a42c..a288558e840dbf225da4dce8b56c8a6833770142 100644 (file)
@@ -16,6 +16,8 @@ dgit (2.9~) unstable; urgency=low
     timestamp-dependent FTBFS bugs (eg #842452).
   * Support dgit --delayed= push (with a warning in the manpage
     about possible skew).
+  * dgit gbp-build will arrange to let gbp buildpackage generate
+    .orig tarballs if it seems applicable.  Closes:#841094.
 
  --
 
diff --git a/dgit b/dgit
index ca907f3f8af2394aa450fdea52fb6a5b3100709b..fa713fa5c5d8b4aff2070f132c5342ed9f5dab7c 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -5176,6 +5176,24 @@ sub pre_gbp_build {
 }
 
 sub cmd_gbp_build {
+    build_prep_early();
+
+    # gbp can make .origs out of thin air.  In my tests it does this
+    # even for a 1.0 format package, with no origs present.  So I
+    # guess it keys off just the version number.  We don't know
+    # exactly what .origs ought to exist, but let's assume that we
+    # should run gbp if: the version has an upstream part and the main
+    # orig is absent.
+    my $upstreamversion = upstreamversion $version;
+    my $origfnpat = srcfn $upstreamversion, '.orig.tar.*';
+    my $gbp_make_orig = $version =~ m/-/ && !(() = glob "../$origfnpat");
+
+    if ($gbp_make_orig) {
+       clean_tree();
+       $cleanmode = 'none'; # don't do it again
+       $need_split_build_invocation = 1;
+    }
+
     my @dbp = @dpkgbuildpackage;
 
     my $wantsrc = massage_dbp_args \@dbp, \@ARGV;
@@ -5191,6 +5209,24 @@ sub cmd_gbp_build {
 
     push @cmd, (qw(-us -uc --git-no-sign-tags), "--git-builder=@dbp");
 
+    if ($gbp_make_orig) {
+       ensuredir '.git/dgit';
+       my $ok = '.git/dgit/origs-gen-ok';
+       unlink $ok or $!==&ENOENT or die $!;
+       my @origs_cmd = @cmd;
+       push @origs_cmd, qw(--git-cleaner=true);
+       push @origs_cmd, "--git-prebuild=touch $ok .git/dgit/no-such-dir/ok";
+       push @origs_cmd, @ARGV;
+       if (act_local()) {
+           debugcmd @origs_cmd;
+           system @origs_cmd;
+           do { local $!; stat_exists $ok; }
+               or failedcmd @origs_cmd;
+       } else {
+           dryrun_report @origs_cmd;
+       }
+    }
+
     if ($wantsrc > 0) {
        build_source();
        midbuild_checkchanges_vanilla $wantsrc;