HG-BUILDPACKAGE(1)
==================
Michael Gebetsroither <michael.geb@gmx.at>


NAME
----
hg-buildpackage - helper program to maintain Debian packages with mercurial


SYNOPSIS
--------
*hg-buildpackage* [ -mq / -mqd / tag ] [ <options_for_dpkg-buildpackage> ]


DESCRIPTION
-----------
This manual page documents briefly the *hg-buildpackage* command.

*hg-buildpackage* is a simple wrapper script to maintain Debian packages with mercurial (AKA hg).

OPTIONS
-------
*-mq*::
If upstream sources are not found in upstream directory, try to get it out of the repos itself (version must been tagged).

*-mqd*::
Additionally to -mq use the available mercurial patch queue (from the default location .hg/patches) for the package and convert it to dpatch for easier package contributions for external developers.

*tag*::
This tags the repos, increments the changelog by 1 and sets distribution to unreleased.

USAGE WITH MQ
-------------
The options -mq and -mqd are intended for non nativ debian package which have a tracking repos and a versioned mercurial patch queue.

Prerequisites
~~~~~~~~~~~~~
To keep hg-buildpackage as simple as possiblr there is a number of prerequisites in this build mode.

The first patch in the queue should be the debian patch, and it should be applied before execution of hg-buildpackage.

If commandline option -mpd is given, all patches in the queue which are not allready applied are converted to the dpatch system. The necessarry infrastructure for dpatch should allready be available (best from the allready applied debian patch).

All patches touching files from upstream should be handled through dpatch (thats the reason why the debian patch should be the first patch in the queue).


Semi-Automatic tagging
----------------------
If you use *hg-buildpackage* tag some things will happen:

  - Tag the repository with the package version from the changelog
  - Increase debian release by 1
  - Set distribution to unreleased


FILES
-----
*~/.hgbuildpackage*

When executing hg-buildpackage it sources the file ~/.hgbuildpackage if it exists. You can overwrite all environment variables used inside
hg-buildpackage and used for BUILD_COMMAND this way. What you might want to set and adjust are the variables UPSTREAM and BUILD_COMMAND.

You can use pbuilder or cowbuilder for building packages. If you set
BUILD_MODE to "pbuilder" or "cowbuilder" the one you choosed will be used, if
set to "local" dpkg-buildpackage will be used. Per default sudo will be used
to call pbuilder and cowbuilder, if you don't like this set ROOT_COMMAND
to the one you like.

Example for ~/.hg-buildpackage:

-------------------------------
  # where the upstream sources are
  UPSTREAM=/home/mika/grml/hg/upstream/

  # define the build command
  BUILD_COMMAND="dpkg-buildpackage -k37E272E8 -sa -rfakeroot"

  # use cowbuilder
  BUILD_MODE="cowbuilder"

  # use sudo for getting root (this is the default)
  ROOT_COMMAND="sudo"
-------------------------------


EXAMPLES WITH MQ
----------------
Short command sequence to modify a patch from a package (eg. zzuf)

-------------------------------
  hg clone http://hg.grml.org/zzuf
  hg clone http://hg.grml.org/zzuf zzuf/.hg/patches
  cd zzuf
  hg qpush
  vi debian/rules
  [make some changes]
  hg qrefresh
  hg qcommit -m 'made some modifications to debian/rules'
  cd .hg/patches
  hg push
-------------------------------


SEE ALSO
--------
hg(1), hgmergevim(1), hgr(1), hg-mirror(1), hg-cleantree(1)


AUTHOR
------
hg-buildpackage was written by Alexander Wirt <formorer@grml.org>, with mq support from Michael Gebetsroither <gebi@grml.org>

This manual page was original written by Michael Prokop <mika@grml.org> and converted to asciidoc from Michael Gebetsroither <gebi@grml.org>
