From 6e24ac7bb85e30df00b3d14853b049e3f06b6dec Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 25 Oct 2013 10:23:30 +0100 Subject: dgit build, by default, uses the archive to find out what the correct -v option is to pass to dpkg-genchanges. --- debian/changelog | 2 ++ dgit | 31 ++++++++++++++++++++++++++++--- dgit.1 | 17 ++++++++++++++++- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3ecbbdb..7acc8ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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). diff --git a/dgit b/dgit index 441114d..254e3fb 100755 --- 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"; + } + } + 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 931b831..c261300 100644 --- 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 -- cgit v1.2.3