gbp-buildpackage(1)
π gbp-buildpackage π
okay bestie, so this is gbp-buildpackage(1), and it's a page straight out of the git-buildpackage Manual. It's long, it's iconic, it's giving main character energy, and we're doing part 1 right now. Strap in. π
β¨ NAME β¨
gbp-buildpackage β build Debian source and binary packages from a Git repository π¦
β¨ SYNOPSIS β¨
gbp buildpackage [--git-[no-]ignore-new] [--git-tag] [--git-verbose]
[--git-color=[auto|on|off]] [--git-color-scheme=
COLOR_SCHEME] [--git-notify=[auto|on|off]]
[--git-upstream-branch= TREEISH] [--git-debian-branch=
BRANCH_NAME] [--git-ignore-branch]
[--git-[no-]submodules] [--git-builder= BUILD_CMD]
[--git-cleaner= CLEAN_CMD] [--git-[no-]overlay]
[--git-[no-]pbuilder] [--git-[no-]qemubuilder]
[--git-dist= DIST] [--git-arch= ARCH]
[--git-[no-]pbuilder-autoconf] [--git-pbuilder-options=
PBUILDER_OPTIONS] [--git-[no-]sign-tags] [--git-keyid=
GPG-KEYID] [--git-preexport= COMMAND]
[--git-postexport= COMMAND] [--git-prebuild= COMMAND]
[--git-postbuild= COMMAND] [--git-posttag= COMMAND]
[--git-[no-]hooks] [--git-debian-tag= tag-format]
[--git-debian-tag-msg= tag-msg-format]
[--git-upstream-tag= tag-format] [--git-force-create]
[--git-no-create-orig]
[--git-upstream-signatures=[auto|on|off]]
[--git-upstream-tree= [BRANCH|SLOPPY|TAG|TREEISH]]
[--git-tarball-dir= DIRECTORY] [--git-compression=
TYPE] [--git-compression-level= LEVEL]
[--git-component= component]... [--git-export-dir=
DIRECTORY] [--git-export= TREEISH]
[--git-[no-]pristine-tar]
[--git-[no-]pristine-tar-commit] [--git-[no-]-purge]
[--git-tag-only] [--git-retag]
[OPTION_PASSED_TO_BUILD_CMD]...
like. look at all of those. slay. π
β¨ DESCRIPTION β¨
so <hotpink>gbp buildpackage</hotpink> is the whole vibe: it builds Debian source packages and .deb packages straight out of a Git repo, no cap. π«Ά
and if you want the full lore β concepts, how the git repo should be laid out, the recommended workflows, all of it β the online manual lives at https://gbp.sigxcpu.org/manual/. go read it, iykyk.
here's the thing: gbp buildpackage is very much a girl with a plan. she does all of this, in this exact order, every time:
- verifies she's being run from the right place β vibe check on the location, basically. β
- verifies the repository has no uncommitted source changes (messy working tree? not in this house). π«
- verifies she's on the correct branch (yes, the right one). πΏ
- optionally runs a clean command, if you gave her one via
--git-cleaner. - optionally exports the source tree to a separate build area.
- builds an orig tarball if one doesn't already exist β and optionally she'll do it using pristine-tar.
- optionally calls a pre build hook.
- calls
debuild(1)β or Cowbuilder (via--git-pbuilder) β or literally any application you specify with--git-builder, and passes along all the arguments you gave togbp buildpackageon the command line that don't start with--git-. - optionally tags the current commit after a successful build π·οΈ
- optionally calls a post build hook β like, say, to run lintian.
- optionally calls a post tag hook β e.g. to push the results to a remote repository once the tag is created. π
β¨ OPTIONS β¨
okay so every single option is prefixed with git-, and that's on purpose: it's how we tell gbp buildpackage's options apart from the options you're passing through to the BUILD_CMD. genius, honestly.
πΈ UPSTREAM TARBALL CREATION OPTIONS πΈ
when gbp buildpackage can't find a suitable upstream tarball, she will simply make one β either using pristine-tar or git archive. these options decide how that tarball gets made:
--git-pristine-tarβ use pristine-tar when generating the upstream tarball, if it doesn't already exist. heads up bestie: if this mode is enabled, the--git-upstream-tagand--git-upstream-treeoptions have no effect when creating tarballs. π--git-upstream-tag=TAG-FORMATβ use this tag format when looking for tags of upstream versions, so she can build the upstream tarballs. default isupstream/%(version)s. you must set this correctly if you don't want to pass any other options. the default matches whatgbp import-origuses to create tags, so it all lines up. β¨--git-upstream-tree=[BRANCH|SLOPPY|TAG|TREEISH]β how to find the upstream sources used to generate the tarball.TAG(the default) looks at a tag corresponding to the version in the changelog.BRANCHlooks at the upstream branch you gave via the--git-upstream-branchoption.SLOPPYlooks at the debian branch given via--git-debian-branchand drops thedebian/dir. any other values are interpreted as treeishs. this has no effect at all if--git-pristine-taris being used. π€·--git-upstream-branch=BRANCH_NAMEβ the branch to build the orig tarball from, when--git-upstream-treeis set toBRANCH. default isupstream. πΏ--git-tarball-dir=DIRECTORYβ search for upstream tarballs in DIRECTORY instead of generating them. and if a tarball isn't found there? she generates it anyway, she's flexible like that. DIRECTORY can contain a version format substitution pattern, eg:foo-%(version)s. π--git-component=COMPONENTβ when generating tarballs, create an additional upstream tarball of directory COMPONENT in the source tree. using additional upstream tarballs is a feature of the3.0 (quilt)source format β see the dpkg-source manpage for the details. note that the--git-pristine-tar-commitoption is currently incompatible with this one. π this is considered an experimental feature and might change incompatibly. proceed accordingly.--git-pristine-tar-commitβ commit the pristine-tar delta to the pristine-tar branch, if a new tarball was generated and the pristine-tar data isn't already there.--git-force-createβ force creation of an upstream tarball, overwriting a pre-existing one if there is one. (yes, she'll just. do it.) π₯--git-no-create-origβ don't try to create any upstream tarballs, and don't create symlinks to existing tarballs in tarball-dir. just no. π--git-upstream-signatures=[auto|on|off]β whether to export the upstream tarball with signatures.--git-[no-]submodulesβ include Git submodules in the orig tarball, if present. π§--git-compression=TYPEβ specifies the upstream tarball compression type. this gets used to locate and build the upstream tarball if necessary. the default isauto, which derives the compression type from the pristine-tar branch if available, and falls back to gzip otherwise. other options aregzip,bzip2,lzmaandxz.--git-compression-level=LEVELβ specifies the upstream tarball compression level, if an upstream tarball needs to be built.
π PACKAGE BUILD OPTIONS π
gbp buildpackage can invoke different types of builders to produce the source and binary packages. these options decide which builder gets summoned and how:
--git-builder=BUILD_CMDβ use BUILD_CMD instead ofdebuild -i -I. wanna use Cowbuilder or Pbuilder? see--git-pbuilder. π--git-cleaner=CLEAN_CMDβ use CLEAN_CMD to clean the source tree before the build. the default is/bin/true(which is to say: no cleaning at all, she's not gonna pretend).--git-pbuilderβ build the package usinggit-pbuilder(which uses cowbuilder by default). β οΈ note that this overwrites any--git-builderand--git-cleaneroptions.--git-qemubuilderβ build the package usinggit-pbuilderwith qemubuilder. β οΈ note that this overwrites any--git-builderand--git-cleaneroptions too.--git-dist=DISTβ build for distribution DIST when using git-pbuilder (whether via--git-pbuilder,--git-qemubuilder, or the corresponding configuration file options). if it's unset, she builds for theunstabledistribution. the special valueDEP-14sets the distribution to build for from the branch name β so if you start the build from a branch nameddebian/wheezy-backports, the distribution is set towheezy-backports. if the branch is nameddebian/12-bookworm, the distribution is set tobookworm(the numeric prefix gets stripped βοΈ). and if the branch is nameddownstream/sid, the distribution is set todownstream_sid. she's clever like that.--git-arch=ARCHβ build for architecture ARCH when using git-pbuilder (again: via--git-pbuilder,--git-qemubuilder, or the corresponding configuration file options). if unset, no architecture gets passed to git-pbuilder at all.--git-pbuilder-autoconfβ whether to try to autoconfigure git-pbuilder, or to rely on the settings in.pbuilderrc. see the git-pbuilder manpage for details. only takes effect when using git-pbuilder (via--git-pbuilder,--git-qemubuilder, or the corresponding configuration file options).--git-pbuilder-optionsβ options to pass to pbuilder when building via git-pbuilder (via--git-pbuilder,--git-qemubuilder, or the corresponding configuration file options). it does this by using theGIT_PBUILDER_OPTIONSenvironment variable to pass options on to git-pbuilder.
as an example, to tell pbuilder to use an alternate .pbuilderrc file, you may run gbp buildpackage with --git-pbuilder-options="--configfile /tmp/my/pbuilderrc". see pbuilder(8) for more options you can pass through here.
if unset, the GIT_PBUILDER_OPTIONS environment variable will be left untouched. π«Ά
--git-notify=[auto|on|off]β whether to send a desktop notification after the build. π this one needspython3-notify2installed.
π HOOK OPTIONS π
hooks let you run arbitrary commands at different stages of the build β like little side quests. these options configure what gets run:
--git-preexport=COMMANDβ execute COMMAND before exporting the source tree. only valid if--git-export-dirhas been specified.
the exported environment variables are: GBP_GIT_DIR (the repository the package is being built from), and GBP_BUILD_DIR (the build dir). β¨
--git-postexport=COMMANDβ execute COMMAND after exporting the source tree. only valid if--git-export-dirhas been specified. the working directory of this hook is the toplevel directory of the exported source tree.
the exported environment variables are: GBP_GIT_DIR (the repository the package is being built from), and GBP_TMP_DIR (the temporary directory where the sources have been initially exported). π
--git-prebuild=COMMANDβ execute COMMAND from the build directory, before calling debuild or the application specified via--git-builder.
the exported environment variables are: GBP_GIT_DIR (the repository the package is being built from), and GBP_BUILD_DIR (the build dir). π
--git-postbuild=COMMANDβ runsCOMMANDonce the build has succeeded π. This hook's working directory is the directory the package was actually built in.
The environment variables it exports for you are: GBP_CHANGES_FILE (the name of the generated changes file) and GBP_BUILD_DIR (the build dir).
--git-posttag=COMMANDβ runsCOMMANDright after a new version gets tagged π. This hook's working directory is the toplevel directory of the Git repository.
The environment variables it exports are: GBP_TAG (the name of the generated tag), GBP_BRANCH (the branch the package was built from) and GBP_SHA1 (the sha1 of the commit the tag was created at).
--git-[no-]hooksβ turns on running all the hooks:cleaner,preexport,postexport,prebuild,postbuild, andposttag. Heads up though β the--git-buildercommand is not affected by this option, bestie, so don't go thinking it is.
π·οΈ TAGGING OPTIONS π·οΈ
--git-tagβ adds a git tag after a successful build β¨. It tags the currently checked out commit, except when you're on a patch-queue branch β in that case the corresponding debian branch gets tagged instead.
This is a command line only option that cannot be specified via gbp.conf π.
--git-[no-]sign-tagsβ GPG sign all created tags π.--git-keyid=GPG-KEYIDβ use this keyid for gpg signing tags.--git-debian-tag=TAG-FORMATβ use this tag format when tagging Debian versions. The default isdebian/%(version)sπ .--git-debian-tag-msg=tag-msg-formatβ use this tag message format when signing Debian versions. The default is%(pkg)s Debian release %(version)s.--git-retagβ doesn't fail tag operations if a tag with the same version already exists π. This is a command line only option that cannot be specified viagbp.conf.--git-tag-onlyβ don't build at all, only tag and run post-tag hooks π·οΈ. This is a command line only option that cannot be specified viagbp.conf.
π¦ BUILD AREA OPTIONS π¦
gbp buildpackage can export the source tree to a different build-area before it does the actual build. These options specify if and how that happens:
--git-export-dir=DIRECTORYβ export the current branch head (or the treeish object you gave via--git-export) toDIRECTORYbefore building πΈ. If you leave it unset, the source will not be exported before the build starts.--git-export=TREEISHβ instead of exporting the current branch head, export the treeish objectTREEISH. The special nameINDEXexports the current index, while the special nameWCexports the current working copy as is π.
Ok so important note: using WC also enables the --git-ignore-branch and --git-ignore-new options, because when you're exporting the working copy there's literally no point in enforcing any branch or modification checks π.
--git[-no]-purgeβ purge (remove) the temporary build area after the build. This is the default π§Ή, but you can turn it off for stuff like debugging purposes.--git-[no-]overlayβ extract the upstream tarball from tarball-dir when using the export-dir option (in analogy tomergeWithUpstreamin svn-bp). It also removesdebian/if that's contained in the upstream tarball, in the case of 2.0 and 3.0 source formats.
This option lets you keep only the debian/ dir in the version control system β¨.
π SAFETY OPTIONS π
To make sure that what you build is what you upload, gbp buildpackage performs several safety checks π. These options let you configure them and disable them:
--git-debian-branch=BRANCH_NAMEβ if you're not on this branch when you invokegbp buildpackage, it will fail. Default ismaster. This exists so you don't accidentally release from a topic branch π. Not being on this branch will be ignored when using--git-ignore-new.--git-ignore-branchβ don't check if the current branch matchesDEBIAN-BRANCH.--git-[no-]ignore-newβ don't abort if there are uncommitted changes in the source tree, or if the current branch doesn't match theDEBIAN-BRANCHπ .
π COLOR AND VERBOSITY OPTIONS π
--git-verboseβ verbose execution. Lowkey useful for debugging and bug reports π.--git-color=[auto|on|off]β whether to use colored output π.--git-color-scheme=COLOR_SCHEMEβ the colors to use in output (when color is enabled). The format forCOLOR_SCHEMEis'<debug>:<info>:<warning>:<error>'. Numerical values and color names are both accepted, and empty fields imply the default color. For example,--git-color-scheme='cyan:34::'would show debug messages in cyan, info messages in blue and other messages in default β i.e. warning and error messages in red π₯.
π EXAMPLES π
Build a package without passing any arguments, simply using package specific options from debian/gbp.conf and user scpecific options from ~/.gbp.conf (if any). By default this will run debuild in the current directory:
gbp buildpackage
Build a source-only package that can be signed and uploaded to Debian:
gbp buildpackage -S -d
Build a Debian package using git-pbuilder, which in turn invokes cowbuilder. Instruct cowbuilder to build within a Wheezy chroot for i386:
gbp buildpackage --git-pbuilder --git-arch=i386 --git-dist=wheezy
Note that the above needs a cowbuilder chroot already π. This can be created using:
DIST=wheezy ARCH=i386 git-pbuilder create
To export the source tree without performing any build you can use:
gbp buildpackage --git-export-dir=/where/to/export --git-builder=/bin/true --git-no-pbuilder --git-no-hooks --git-no-purge
π CONFIGURATION FILES π
Several gbp.conf files are parsed to set defaults for the above command-line arguments. See the gbp.conf(5) manpage for details π«Ά.
All options in the config files must be specified without the git- prefix, bestie. So for example, --git-debian-branch=debian/latest becomes in gbp.conf:
[buildpackage]
debian-branch = debian/latest
π SEE ALSO π
gbp-import-dsc(1), gbp-import-dscs(1), gbp-import-orig(1), gbp-dch(1), git-pbuilder(1), cowbuilder(8), dpkg-source(1), git-submodule(1), gbp.conf(5), debuild(1), git(1), pristine-tar(1), The Git-Buildpackage Manual file:///usr/share/doc/git-buildpackage/manual-html/index.html
π AUTHOR π
Guido GΓΌnther <agx@sigxcpu.org>
And that's the whole page, bestie!! π
This was gbp-buildpackage(1) from version 26 May 2026 β go forth and build, tag, and slay, no cap π¦β¨π
π¦ where this page comes from
- ubuntu stonking: git-buildpackage 0.9.43 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms