Package: python-defaults
Version: 2.5.4-9
Severity: minor
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch lucid
Hi
dpkg-dev allows declaring information to copy in the source package
control file (.dsc, Sources.gz) such as XS-Python-Version in any
paragraph of debian/control, and similarly allows declaring information
to copy in the binary package control file (DEBIAN/control,
Packages.gz) in any paragraph of debian/control. That is, this
debian/control file:
Source: foo
Build-Depends: bar
XB-Python-Version: baz
Package: coin
XS-Python-Version: pouet
would actually output a X-Python-Version field in source and binary
package files.
In the Debian Policy, the paragraphs of debian/control files are
described individually:
http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
So for instance Build-Depends might only appear in the first paragraph,
and wont be taken into account if these appear in a later paragraph.
I realize this request might seem overly pedantic, but I need this in
policy to implement the proper behavior in tools such as dh_pysupport
and dh_pycentral. One thing these typically are debian/control files
starting with newlines. For instance, we got this bug in Ubuntu:
https://bugs.launchpad.net/ubuntu/+source/python-central/+bug/507842
and the diff of the fix looks as follows:
- local $/ = ""; # Grab until empty line
open(CONTROL, "debian/control"); # Can't fail, dh_testdir has already
been called
- my $source = <CONTROL>;
- close(CONTROL);
- if ($source =~ m/^XS-Python-Version: \s*(.*)$/m) {
+ while (my $source = <CONTROL>) {
+ if ($source =~ m/^XS-Python-Version: \s*(.*)$/m) {
$python_header = $1;
chomp($python_header);
$pyversions_field = convert_python_header($python_header);
+ }
}
+ close(CONTROL);
}
this means that dh_pycentral will correctly skip newlines at the
beginning of the debian/control files, but might pickup a
XS-Python-Version: anywhere in debian/control.
I would like to fix dh_pycentral and dh_pysupport (and perhaps other
tools) to handle newlines at the beginning of debian/control and to
read XS-PV from the first paragraph and from nowhere else and to read
XB-PV from binary package paragraphs and from nowhere else. However I
think this should be in policy first.
I'm attaching a patch against latest python-defaults package.
Thanks,
--
Loïc Minier
>From 7fc9a00bec0ce36f8473650adf65bd8d0c3c5a1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Minier?= <[email protected]>
Date: Mon, 1 Feb 2010 11:58:06 +0100
Subject: [PATCH] Clarify the control paragraphs of XS- and XB-PV
---
debian/python-policy.sgml | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/debian/python-policy.sgml b/debian/python-policy.sgml
index 2676bf7..43b8cf5 100644
--- a/debian/python-policy.sgml
+++ b/debian/python-policy.sgml
@@ -421,9 +421,10 @@ import foo
<heading>Specifying Supported Versions</heading>
<p>
The optional <tt>XS-Python-Version</tt> field
- in <file>debian/control</file> specifies the versions of
- Python supported by the source package. When not specified, it
- defaults to all currently supported Python versions.
+ in the general paragraph (the first one, for the source package) of
+ <file>debian/control</file> specifies the versions of Python
+ supported by the source package. When not specified, it defaults to
+ all currently supported Python versions.
It is notably used to track packages during Python transitions,
and is also used by some packaging scripts to automatically
@@ -445,7 +446,8 @@ XS-Python-Version: all
across default version changes).
</p>
<p>
- Your control file should also have a line:
+ The binary package paragraphs of your debian/control file should
+ also have a line:
<example>
XB-Python-Version: ${python:Versions}
</example>
--
1.6.5