We used to use reprepro (4.17) to manage our package repository. However, it did not support serving multiple versions of the same package. The Benjamin Drung version from GitHub/profitbricks/reprepro does. Here's our recipe to build it.

$ git clone -b 5.1.1-multiple-versions https://github.com/profitbricks/reprepro.git
$ cd reprepro

It lacks a couple of tags, so we'll add some lightweight ones.

$ git tag 4.17.1 2d93fa35dd917077e9248c7e564648da3a5f1fe3 &&
    git tag 4.17.1-1 0c9f0f44a84f67ee5f14bccf6507540d4f7f8e39 &&
    git tag 5.0.0 e7e4c1f1382d812c3759617d5f82b8a46ea0f096 &&
    git tag 5.0.0-1 297835acd73d1644bfee4544a0878a0c36c411a7 &&
    git tag 5.1.0 8db8e8af8fffe82ae46ca0ec776dfe357f329635 &&
    git tag 5.1.0-1 06adb356517ab3e3089706e29dfab43bba09f0a9 &&
    git tag 5.1.1-2.1 b6b28f04466851234b4a94aa33132082094e8780

Now git-describe works. With --tags because we didn't tag -a them.

$ git log -1 --format=oneline
b37d8daba6bfb4c20241cf623a24e64532dd8868 Accept .ddeb files as dbgsym packages

$ git describe
fatal: No annotated tags can describe 'b37d8daba6bfb4c20241cf623a24e64532dd8868'.
However, there were unannotated tags: try --tags.

$ git describe --tags
5.1.1-2.1-59-gb37d8da

Good enough for us. We'll need to alter that version a bit to make it debian-package friendly though. And since the tilde (~) means pre-relase, we'll make use of the plus (+), turning the above into: 5.1.1+2.1+59.gb37d8da (optionally suffixed with a build version, like -0osso1)

We amend the appropriate lines in the debian changelog with the chosen version. For Ubuntu/Xenial we additionally had to replace libgpgme-dev with libgpgme11-dev in debian/control.

Lastly, commit our update control file and changelog in a throwaway commit, so gbp(1) won't complain about untracked files. And then build, creating a source package of this exact build.

reprepro (5.1.1+2.1+59.gb37d8da-0osso1) stable; urgency=medium

  * OSSO build of b37d8daba6b (+59 since b6b28f0446)
  * gbp buildpackage --git-upstream-tree=HEAD \
      --git-debian-branch=5.1.1-multiple-versions [-us -uc] -sa

 -- Walter Doekes <wjdoekes+reprepro@osso.nl>  Thu, 30 Nov 2017 10:10:52 +0100

$ gbp buildpackage --git-upstream-tree=b37d8da
    --git-debian-branch=5.1.1-multiple-versions [-us -uc] -sa

Omit the -us -uc if you can sign the build with gpg. And if you use gpg-agent forwarding with gpg2, make sure gpg(1) references gpg2 and not gpg1.

You should end up with these files:

reprepro_5.1.1+2.1+59.gb37d8da-0osso1_amd64.build
reprepro_5.1.1+2.1+59.gb37d8da-0osso1_amd64.changes
reprepro_5.1.1+2.1+59.gb37d8da-0osso1_amd64.deb
reprepro_5.1.1+2.1+59.gb37d8da-0osso1.debian.tar.xz
reprepro_5.1.1+2.1+59.gb37d8da-0osso1.dsc
reprepro_5.1.1+2.1+59.gb37d8da.orig.tar.gz

build reprepro debian pkg