I've got Debian packaging for a piece of software I've written. This software probably is too specialized to be part of Debian. In any case, for now I have no plans to try to include it in Debian. However, I'd like to follow best practices to the extent possible.

Currently the Debian packaging is part of the same Mercurial repository as the software, in the subdirectory debian/. I'm wondering if I should put it in a separate repository. Also, currently the package is being built as a Debian native package, which isn't really appropriate. I guess I could add a get-orig-source target for building the orig tarball to rules, but is it Ok to build a orig.tar.gz file from a local repository, or is it necessary to get it from remote? If the former, are there any recommended approaches for, for example, passing the location of the repository to the get-orig-source target?

It was suggested to me that perhaps I could put the debian directory in a separate (presumably named) branch from the actual software, and merge them together when building. That still leaves the question of how to get the orig.tar.gz with get-orig-source.

1 Answer 1


As you mentioned, it is good practice to have debian/ in a separate branch (not necessarily repository). If other people want to package your software for another distribution or in another way as you do, it is annoying for them if they get your debian/ folder by default.

In general, get-orig-source is recommended, if there are no upstream tarballs available or if you need to modify them for any reason (copyright, unused files etc.). So if you publish tarballs for your software, you do not need get-orig-source.

As there is no general solution for the get-orig-source target, I recommend you to have a look at existing solutions (e.g. on github).

Often they use something like hg archive -X ".hg* ../packagename_$VERSION.orig.tar.gz to build the tarball and dpkg-parsechangelog to extract the current upstream version from debian/changelog.

For packaging, I recommend you mercurial-buildpackage. Its tools allow to maintain orig-tarballs in a separate branch for example.

  • Thanks for the comments. Since some of the time the debian packaging will be in a mercurial repos, i was wondering if it made sense to try hg archive on the assumption that the source is available locally, i.e. without a local clone, and if that failed, clone the repository from remote. Is this done? The examples on github I looked at don't seem to do this. Commented Jul 29, 2013 at 19:07
  • @FaheemMitha Yes, this is totally fine. In first place, get-orig-source is for you as the maintainer, and secondly for others, who wants to re-create the orig-tarball.
    – jofel
    Commented Jul 29, 2013 at 19:31
  • I had initially thought of just having the debian packaging in a separate branch, and merging the code and the packaging in a third temporary branch, but the opinion seemed to be that this was too many branches. Thoughts? Commented Jul 29, 2013 at 22:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .