chiark / gitweb /
dgit: Introduce upstreamversion
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 19:44:36 +0000 (19:44 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 19:50:48 +0000 (19:50 +0000)
And many call sites.  No functional change.

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

diff --git a/dgit b/dgit
index 5f923aaaef02234c9d17cfe4425e38bfdcbf20fa..af62eb503534920cea40a43ee3c10743026f6aca 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -222,6 +222,12 @@ sub changespat ($;$) {
     return "${package}_".(stripepoch $vsn)."_".($arch//'*').".changes";
 }
 
     return "${package}_".(stripepoch $vsn)."_".($arch//'*').".changes";
 }
 
+sub upstreamversion ($) {
+    my ($vsn) = @_;
+    $vsn =~ s/-[^-]+$//;
+    return $vsn;
+}
+
 our $us = 'dgit';
 initdebug('');
 
 our $us = 'dgit';
 initdebug('');
 
@@ -1855,8 +1861,7 @@ sub generate_commits_from_dsc () {
     # from the debian/changelog, so we record the tree objects now and
     # make them into commits later.
     my @tartrees;
     # from the debian/changelog, so we record the tree objects now and
     # make them into commits later.
     my @tartrees;
-    my $upstreamv = $dsc->{version};
-    $upstreamv =~ s/-[^-]+$//;
+    my $upstreamv = upstreamversion $dsc->{version};
     my $orig_f_base = srcfn $upstreamv, '';
 
     foreach my $fi (@dfi) {
     my $orig_f_base = srcfn $upstreamv, '';
 
     foreach my $fi (@dfi) {
@@ -3389,8 +3394,7 @@ END
     my $dgithead = $actualhead;
     my $maintviewhead = undef;
 
     my $dgithead = $actualhead;
     my $maintviewhead = undef;
 
-    my $upstreamversion = $clogp->{Version};
-    $upstreamversion =~ s/-[^-]*$//;
+    my $upstreamversion = upstreamversion $clogp->{Version};
 
     if (madformat_wantfixup($format)) {
        # user might have not used dgit build, so maybe do this now:
 
     if (madformat_wantfixup($format)) {
        # user might have not used dgit build, so maybe do this now:
@@ -4481,8 +4485,7 @@ END
     prep_ud();
     changedir $ud;
 
     prep_ud();
     changedir $ud;
 
-    my $upstreamversion=$version;
-    $upstreamversion =~ s/-[^-]*$//;
+    my $upstreamversion = upstreamversion $version;
 
     if ($fopts->{'single-debian-patch'}) {
        quilt_fixup_singlepatch($clogp, $headref, $upstreamversion);
 
     if ($fopts->{'single-debian-patch'}) {
        quilt_fixup_singlepatch($clogp, $headref, $upstreamversion);