chiark / gitweb /
dgit build, by default, uses the archive to find out what the correct -v<version...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 25 Oct 2013 09:23:30 +0000 (10:23 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 25 Oct 2013 09:23:30 +0000 (10:23 +0100)
debian/changelog
dgit
dgit.1

index 3ecbbdbe323ab52cad2d07eeea187497a10f233b..7acc8ed3e85447bd9cd738ca10d691d0e2ad47d2 100644 (file)
@@ -1,5 +1,7 @@
 dgit (0.17~experimental4) experimental; urgency=low
 
+  * dgit build, by default, uses the archive to find out what the correct
+    -v<version> option is to pass to dpkg-genchanges.
   * When using sbuild, pass the arguments to mergechanges in the right
     order so that we use the correct Description (the _source one,
     not the one from sbuild which didn't get e.g. -v<version>).
diff --git a/dgit b/dgit
index 441114db404124b179c7aac9f5cf914bd96e5acb..254e3fbf5f588bc1f1bc6a7c20f41492cdd09ab2 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -45,6 +45,7 @@ our $ignoredirty = 0;
 our $noquilt = 0;
 our $existing_package = 'dpkg';
 our $cleanmode = 'dpkg-source';
+our $changes_since_version;
 our $we_are_responder;
 our $initiator_tempdir;
 
@@ -113,8 +114,6 @@ sub dscfn ($) {
     return "${package}_".(stripepoch $vsn).".dsc";
 }
 
-sub changesopts () { return @changesopts[1..$#changesopts]; }
-
 our $us = 'dgit';
 our $debugprefix = '';
 
@@ -1690,6 +1689,26 @@ sub build_prep () {
     build_maybe_quilt_fixup();
 }
 
+sub changesopts () {
+    my @opts =@changesopts[1..$#changesopts];
+    if (!defined $changes_since_version) {
+       my @vsns = archive_query('archive_query');
+       if (@vsns) {
+           @vsns = map { $_->[0] } @vsns;
+           @vsns = sort { version_compare_string($a, $b) } @vsns;
+           $changes_since_version = $vsns[0];
+           progress "changelog will contain changes since $vsns[0]";
+       } else {
+           $changes_since_version = '_';
+           progress "package seems new, not specifying -v<version>";
+       }
+    }
+    if ($changes_since_version ne '_') {
+       unshift @opts, "-v$changes_since_version";
+    }
+    return @opts;
+}
+
 sub cmd_build {
     badusage "dgit build implies --clean=dpkg-source"
        if $cleanmode ne 'dpkg-source';
@@ -1818,6 +1837,9 @@ sub parseopts () {
            } elsif (m/^--new$/) {
                push @ropts, $_;
                $new_package=1;
+           } elsif (m/^--since-version=([^_]+|_)$/) {
+               push @ropts, $_;
+               $changes_since_version = $1;
            } elsif (m/^--(\w+)=(.*)/s &&
                     ($om = $opts_opt_map{$1}) &&
                     length $om->[0]) {
@@ -1871,7 +1893,10 @@ sub parseopts () {
                } elsif (s/^-N/-/) {
                    push @ropts, $&;
                    $new_package=1;
-               } elsif (m/^-[vm]/) {
+               } elsif (s/^-v([^_]+|_)$//s) {
+                   push @ropts, $&;
+                   $changes_since_version = $1;
+               } elsif (m/^-m/) {
                    push @ropts, $&;
                    push @changesopts, $_;
                    $_ = '';
diff --git a/dgit.1 b/dgit.1
index 931b8310823c4a3d9d13e7e821f629cfd96581af..c261300f555bd92a3a5c53184edd66ed9a7f28bb 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -248,7 +248,22 @@ more output (currently, up to -DD is meaningfully different).
 Specifies a git configuration option.  dgit itself is also controlled
 by git configuration options.
 .TP
-.RI \fB-v\fR version |\fB-m\fR maintaineraddress
+.RI \fB-v\fR version "|\fB_\fR | " \fB--since-version=\fR version |\fB_\fR
+Specifies the
+.BI -v version
+option to pass to dpkg-genchanges, during builds.  Changes (from
+debian/changelog) since this version will be included in the built
+changes file, and hence in the upload.  If this option is not
+specified, dgit will query the archive and use the latest version
+uploaded to the intended suite.
+
+Specifying
+.B _
+inhibits this, so that no -v option will be passed to dpkg-genchanges
+(and as a result, only the last stanza from debian/changelog will
+be used for the build and upload).
+.TP
+.RI \fB-m\fR maintaineraddress
 Passed to dpkg-genchanges (eventually).
 .TP
 .RI \fB--ch:\fR option