Using version-info data with multi-branch packaging workflow

John Arbash Meinel john at arbash-meinel.com
Fri Sep 12 20:44:20 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

...

> How should I automatically trigger the generation of the
> 'foo/version_info.py' file? It will be used in many places throughout
> the code base, including in 'setup.py', so it needs to be generated
> ideally on every commit.

You *could* do this with a "post-branch-tip-changed" hook. Also realize
that not just commit, but also pull and uncommit probably need to
regenerate this file.

You *could* have 'make' always build the file, but then it always has to
re-link the final output (because a build product changed). I guess you
could do:

.PHONY: build_version_tobe

build_version_tobe:
  bzr version-info --format-py > version_to_be.py
  if `diff version_to_be.py version.py >/dev/null` ; then \
    cp version_to_be.py version.py; \
  fi

That will have make always check the version information, and *if*
something has changed, it will trigger a rebuild.

> 
> Should I add the generated 'foo/version_info.py' file to the VCS
> branch? It's an auto-generated file, which argues "no"; but the
> process of building the Debian package requires that the command 'bzr
> export ../foo.devel/' must get the upstream source working tree, which
> argues "yes".

Generally, I would go with no.

> 
> How can I ensure that the generated 'foo/version_info.py' file is
> *not* generated in a branch such as 'foo.debian/'? That branch should
> use the "upstream" version-info output, not the info relating to the
> Debian-packaging-specific branch.


For packaging Bazaar, we just went with using tarballs. bzr-builddeb can
handle packaging a tarball just fine (you just don't use --export-upstream).

This allows us to include a few extra files into the release tarball.
(Namely all of the auto-generated .c files).

Alternatively, you could work with James Westby to consider how to get
bzr-builddeb to allow extra files to be included in the final exported
tarball. (It may mean hacking bzr itself to change how the 'bzr export'
command works.)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjKxpQACgkQJdeBCYSNAAPXvACdFvLC2yqxtGDMgKE+0kmpUo2M
NiMAn2SjV1VoFRYdFJDxJ5RxsV8ShIMv
=JR/S
-----END PGP SIGNATURE-----



More information about the bazaar mailing list