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. --- dgit | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'dgit') 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, $_; $_ = ''; -- cgit v1.2.3