1

I would like to rebuild the Debian package 'postfix'. Without anything fancy, so no local patches and unsigned packages are fine.

Here's what I tried:

  1. Install some dependencies:

    $ apt install fakeroot git-buildpackage
    $ apt build-dep postfix
    

    (Postfix on my build machine is the same/similar available as version I'm trying to build, so this should install most of the build dependencies just fine. I don't have any build dependency issue as well.)

  2. Clone the Debian sources:

    $ git clone https://salsa.debian.org/postfix-team/postfix-dev.git
    

    At the time of writing this points to c21140525af28be0e1bacd932e85b96babe6ca98 (tag: v3.3.2-4).

  3. cd into the clone:

    $ cd postfix-dev
    
  4. IIUC, I should now be able to build the package with a command like

    $ gbp buildpackage -uc -us
    

    (With the two options to make unsigned packages.)

However, the last step results in the error:

gbp:error: upstream/3.3.2 is not a valid treeish

1 Answer 1

1

This piece of software (Postfix) seems not to be sourced from an upstream git, but manually imported in tags in that repository. The tag v3.3.2 seems to reflect the upstream sources (it does not contain a debian/ directory).

It seems that this repository does not conform to the default tag name in the upstream/<version> format, which is probably a bug or personal preference by the maintainers.

Please refer to the manpage of git-buildpackage for the below two options:

--git-upstream-tree=[BRANCH|SLOPPY|TAG|TREEISH]
    How to find the upstream sources used to generate the tarball.
    TAG (the default) [...]

--git-upstream-tag=TAG-FORMAT
    Use this tag format when looking for tags of upstream versions to build the
    upstream tarballs. Default is upstream/%(version)s. [...]

This means that you can manually point to any head in git to what the upstream branch is. The command

$ gbp buildpackage --git-upstream-tag='v%(version)s' -us -uc

will build the Postfix packages just fine!

Important! You may need to completely clean the git repository or else you might run into failures regarding checks on locally modified files even if git status tells you everything is clean.


For a little bit more efficient fetching for automated builds, here's a recipe to build Postfix by only fetching what's necessary:

# Fetch Debian-version tag (notice the -<digit> suffix).
$ git clone -b v3.3.2-4 --depth 1 https://salsa.debian.org/postfix-team/postfix-dev.git
$ cd postfix-dev

# Fetch the upstream tag
$ git fetch --depth 1 origin refs/tags/v3.3.2:refs/tags/v3.3.2

# Because we're not on 'master' (not on any branch actually), we need to add
# the --git-ignore-branch option.
$ gbp buildpackage --git-upstream-tag='v%(version)s' --git-ignore-branch -us -uc

You must log in to answer this question.

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