![]() | ![]() | Building Debian Packages with hg-buildpackage | ![]() |
---|
This chapter describes how to use hg-buildpackage to carry out regular, every-day development activities.
Before you start working on any source package with hg-buildpackage, make sure you have your directories set up. hg-buildpackage assumes you will have two Mercurial branches for your package, each in its own repository, both stored in the same directory. (You can use symlinks if you wish to store them elsewhere).
If you package is named hg-buildpackage, your repositories should be named hg-buildpackage and hg-buildpackage.upstream. Just "hg init" both of them to get going.
Once you have sources, imported from another Mercurial tree, or imported with hg-importdsc or hg-importorig, you can start hacking. As you work, you will use hg commit to commit your changes to the Debian repository. (If you just want to build an old package, there's no need to do this.)
When you're ready to build a package, just run hg-buildpackage to build it. The hg-buildpackage command takes the same arguments as debuild, and passes them on to debuild, so give it your usual set. hg-buildpackage will use your existing orig.tar.gz file for source generation, if it exists; otherwise, it will take care of automatically building it from the upstream sources if necessary.
Here's an example:
~/hg$ hg init bacula ~/hg$ hg init bacula.upstream ~/hg/bacula$ hg-importdsc ~/work/bacula_1.38.8-0.1.dsc *** Processing upstream file /home/jgoerzen/work/bacula_1.38.8.orig.tar.gz adding ABOUT-NLS adding COPYING adding ChangeLog ... /home/jgoerzen/hg/bacula/,,hg-importorigtargz-aNFzUc9794/bacula-1.38.8 imported into /home/jgoerzen/hg/bacula.upstream *** Upstream processing of /home/jgoerzen/work/bacula_1.38.8.orig.tar.gz done. *** Processing Debian source tree for /home/jgoerzen/work/bacula_1.38.8-0.1.dsc Pulling upstream into Debian tree pulling from /home/jgoerzen/hg/bacula.upstream requesting all changes ... dpkg-source: extracting bacula in bacula-1.38.8 dpkg-source: unpacking bacula_1.38.8.orig.tar.gz dpkg-source: applying /home/jgoerzen/work/bacula_1.38.8-0.1.diff.gz adding debian/Makefile adding debian/RATIONALE adding debian/README.Debian ... DSC successfully imported! ... now import some more versions ... ~/hg/bacula$ hg-buildpackage -rfakeroot
In this case, I had not checked out the upstream source and did not have my orig.tar.gz file handy. Therefore, hg-buildpackage checked out the upstream sources for me, generated the tar.gz file, and then called debuild to do the rest.
If you are building for Debian, you will want to keep your orig.tar.gz around so that future source uploads use the same MD5 sum in the .dsc file.
For more details, please see the manpage for hg-buildpackage(1).
A common scenario for a Debian developer to deal with is that of a new upstream release. The Debian patches from the most recent Debian release must be merged into the upstream one.
There have been a few tools to do that: uupdate is one. However, now that you are using Mercurial, you can use its built-in pull command to make this easier.
The first thing that you will do is to import the new upstream sources into your hg-buildpackage archive. Please see the Section called Importing Upstream Sources in the Chapter called Importing Packages for instructions.
Next, check out the latest Debian version if you don't already have it. cd into your Debian repo.
Now, you are ready to merge in the new upstream. Run hg fetch, giving it the path to your canonical upstream repository.
FIXME: add a sect3 demonstrating
Now, you will want to examine the merge, especially if Mercurial complained of any conflicts.
You'll also want to note the new version in debian/changelog and perhaps rename your directory based on the new version. I find it easy to run a command like debchange -v 0.13.3-1, then modify the changelog as appropriate. debchange will handle the rename for you.
Finally, you will want to commit the merge. If you want to just use a simple log message, a command like this will work:
$ hg commit -m "Merged in upstream 0.13.3" FIXME: show output
The string supplied after the -m is the log message.
If you want to add a more detailed log, try this, just run hg commit and it will prompt you for one.
You can see what happened by using hg log -vp:
$ hg log -vp FIXME: show output
Slick -- it shows exactly which upstream patches you used.
When you have uploaded a Debian package to the archive, you should ask Mercurial to note this for you. That way, you can request this specific version later. Just run this:
$ hg-markdeb FIXME: show output.
The reason for this is that you might make several commits during the course of hacking on a given Debian version. This command lets you note the final version, and to run it again, you must update the changelog.
Technically speaking, this creates the DEBIAN_ tag.
To find the versions available in your Mercurial archive, first cd to its top level and then run:
$ hg tags FIXME: show output
Use a command such as hg clone -rDEBIAN_package_1.3.5
<<< Importing Packages | Command Reference >>> |