[git-buildpackage] Questions on packaging a native package using gbp

Otto Kekäläinen otto at debian.org
Thu Mar 6 21:58:34 CET 2025


Hi!

> I am new to Debian packaging and am trying to use `git-buildpackage` to
> create packages for a relatively simple piece of code. My structure
> looks like this:
> - my code resides in a git repository
> - the (only) branch is 'main'
> - the repository includes a `debian/`-dir which contains the meta
> information for packaging
> - my versions are tagged `vX.Y.Z`.
>
>  From what I understand, this represents a "native" package. I have
> tried creating the relevant files, but have trouble piecing the workflow
> for my use-case together. From what I assume it should look something
> like this:
>
> ```
> # Finish work
> git tag vX.Y.Z
> gbp dch --commit --release
> gbp buildpackage # --git-tag?
> # Push to origin
> # Publish package
> ```
>
> Is this workflow roughly correct? I have struggled to get it to work, in
> particular I have a few specific questions:
> - Can I configure 'debian-branch' in 'debian/gbp.conf'? It doesn't seem
> to be picked up from the '[DEFAULT]' section and I have to pass it to
> both `gbp dch` and `gbp buildpackage`.

Yes. As git-buildpackage uses branch 'master' by default you should
create a file debian/gbp.conf with the contents:

[DEFAULT}
debian-branch = main

> - How can I convince `gbp dch` to pick up the version? I have tried
> passing `--git-upstream-tag=v%(version)s` as documented in the man-page,
> but the option is not known to the tool. Likewise, configuring it in
> 'debian/gbp.conf' changes nothing.

You have no upstream as it is a native package. The version would come
directly from debian/changelog.

If you share the URL to your git repo I can check it out.

> - Does the changelog have to be tracked in the repository or is it
> possible to regenerate it from scratch on every release?

For Debian packages a debian/changelog is mandatory, so to not
maintain one you need to do extra hacks instead or in addition to
running git-buildpackage. You could for example generate it right
before running the Debian build and then do a binary-only build that
does not care about uncommitted changes.


More information about the git-buildpackage mailing list