Marking program-generated packaging files
I'm working on a dpkg-specific add-on to the Distutils package used
to build and install Python modules, and have a few questions about
how I can mark certain packaging files (e.g. control, changelog) as
having been automatically generated.
Background: Distutils is a set of Python code used to implement a
setup.py file, a convention now followed by most Python software. To
build a Python package you run "python setup.py build", to install it
you do "python setup.py install", and so forth. The Distutils
includes a bdist_rpm command that builds an RPM package, so "python
setup.py bdist_rpm" builds an RPM and SRPM. I'm working on a
bdist_dpkg. (See the nondist/sandbox/Lib/bdist_dpkg.py file in the
Python CVS tree if you're interested.)
bdist_rpm generates an RPM .spec file from various information and
uses it to build the final package. For dpkg, I need to generate
control, copyright, changelog, postinst, prerm, and rules files.
A person packaging Python software for Debian might want to provide
their own versions of these files. I don't want bdist_dpkg to
overwrite such user-provided files, so it needs to recognize whether
these files were written by bdist_dpkg or not.
For the shell scripts and makefiles, it's easy; put a comment
containing a marker such as 'GENERATED BY BDIST_DPKG' in the file, and
look for the marker.
This isn't possible with copyright, control, and changelog, which
don't support comments. For copyright, I can just put in the marker
as a line appended to the copyright text; this is user-visible and
annoying, but certainly workable.
debian/changelog has a specified format, and I don't see how to insert
extra information in it; any suggestions? I could simply insert the
marker in the first changelog entry, and that's probably what I'll do.
I can't figure out how to put a marker in the control file. I tried
adding a 'X-Extra-Line' field, but this gets a warning from
dpkg-gencontrol while building. Is there a better way?
More generally, does this seem like a good approach for automatically
building .debs of Python software? These .debs may not be suitable
for inclusion in Debian proper, but they'll certainly ease the life of
sysadmins maintaining large Python installations on Debian.