Package: dpkg-dev
Version: 1.14.5
Severity: wishlist
Tags: patch

Hi,

when backporting, the version number needs to be adapted to sort lower
than the current version, and ideally, to encode information on the
targetted distribution; however, the source version should point to the
actual source package used.

If multiple backports (for different target distributions) can be built
from the same source version, it would be preferrable to only keep one
copy of the sources, for that to work, the binary packages need to point
to an explicit source version number that cannot be deduced from the
changelog.

The attached patches add support for an environment variable
DEB_SOURCE_VERSION that specifies the version that should be encoded in
the binary package, and forbid "dpkg-source -b" to be run with this
variable set (that would be nonsensical).

   Simon

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-1-amd64 (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages dpkg-dev depends on:
ii  binutils              2.18~cvs20070812-1 The GNU assembler, linker and bina
ii  cpio                  2.9-3              GNU cpio -- a program to manage ar
ii  dpkg                  1.14.5             package maintenance system for Deb
ii  make                  3.81-3             The GNU version of the "make" util
ii  patch                 2.5.9-4            Apply a diff file to an original
ii  perl [perl5]          5.8.8-7            Larry Wall's Practical Extraction 
ii  perl-modules          5.8.8-7            Core Perl modules

Versions of packages dpkg-dev recommends:
ii  bzip2                         1.0.3-7    high-quality block-sorting file co
ii  gcc [c-compiler]              4:4.1.2-3  The GNU C compiler
ii  gcc-4.1 [c-compiler]          4.1.2-15   The GNU C compiler

-- no debconf information
--- dpkg-1.14.5/scripts/controllib.pl.orig      2007-08-29 18:48:01.955126739 
+0200
+++ dpkg-1.14.5/scripts/controllib.pl   2007-08-29 18:53:56.411326046 +0200
@@ -543,14 +543,24 @@
     $substvar{'Space'} = " ";
     $substvar{'Tab'} = "\t";
 
-    # XXX: Source-Version is now deprecated, remove in the future.
-    $substvar{'Source-Version'}= $fi{"L Version"};
     $substvar{'binary:Version'} = $fi{"L Version"};
-    $substvar{'source:Version'} = $fi{"L Version"};
-    $substvar{'source:Version'} =~ s/\+b[0-9]+$//;
-    $substvar{'source:Upstream-Version'} = $fi{"L Version"};
+
+    if(defined($ENV{'DEB_SOURCE_VERSION'}))
+    {
+       $substvar{'source:Version'} = $ENV{'DEB_SOURCE_VERSION'};
+    }
+    else
+    {
+        $substvar{'source:Version'} = $substvar{'binary:Version'};
+        $substvar{'source:Version'} =~ s/\+b[0-9]+$//;
+    }
+
+    $substvar{'source:Upstream-Version'} = $substvar{'source:Version'};
     $substvar{'source:Upstream-Version'} =~ s/-[^-]*$//;
 
+    # XXX: Source-Version is now deprecated, remove in the future.
+    $substvar{'Source-Version'}= $substvar{'source:Version'};
+
     # FIXME: this needs all progs using controllib to set $version as 'our'.
     # We expect the calling program to set $version.
     $substvar{"dpkg:Version"} = $version;
--- dpkg-1.14.5/scripts/dpkg-source.pl.orig     2007-08-29 19:29:53.806268977 
+0200
+++ dpkg-1.14.5/scripts/dpkg-source.pl  2007-08-29 19:29:10.683811568 +0200
@@ -210,6 +210,11 @@
 
 if ($opmode eq 'build') {
 
+    if(defined($ENV{'DEB_SOURCE_VERSION'}))
+    {
+        &error(_g("DEB_SOURCE_VERSION cannot be used when building source 
packages"));
+    }
+
     $sourcestyle =~ y/X/A/;
     $sourcestyle =~ m/[akpursnAKPUR]/ ||
         &usageerr(sprintf(_g("source handling style -s%s not allowed with 
-b"), $sourcestyle));

Reply via email to