LinuxCommandLibrary

gbp

Build Debian packages from Git repositories

TLDR

Convert an existing Debian package to gbp

$ gbp import-dsc [path/to/package.dsc]
copy

Build the package in the current directory using the default builder (debuild)
$ gbp buildpackage -jauto -us -uc
copy

Build a package in a pbuilder environment for Debian Bullseye
$ DIST=[bullseye] ARCH=[amd64] gbp buildpackage -jauto -us -uc --git-builder=[git-pbuilder]
copy

Specify a package to be a source-only upload in the .changes file (see )
$ gbp buildpackage -jauto -us -uc --changes-options=[-S]
copy

Import a new upstream release
$ gbp import-orig --pristine-tar [path/to/package.tar.gz]
copy

SYNOPSIS

gbp command [options] [arguments]

The most common command is gbp buildpackage:
gbp buildpackage [options]

PARAMETERS

--git-debian-branch=branch
    Specifies the Git branch that contains the Debian packaging files (e.g., 'debian/sid').

--git-upstream-branch=branch
    Specifies the Git branch that contains the original upstream source code.

--git-tag
    Creates a Git tag for the new package version after a successful build.

--no-sign
    Instructs dpkg-buildpackage not to sign the generated .dsc and .changes files.

--git-ignore-branch
    Allows building even if the current Git branch does not match the expected Debian branch name.

--git-builder=builder
    Defines the command to invoke dpkg-buildpackage with, typically 'debuild' or 'fakeroot debian/rules build'.

--git-export-dir=directory
    Exports the source tree to the specified temporary directory before building the package.

DESCRIPTION

The gbp command, primarily known as git-buildpackage, is a powerful suite of tools designed to streamline and automate the process of maintaining Debian packages within a Git repository. It integrates Git's version control capabilities with Debian's established packaging workflow.

git-buildpackage helps developers manage various aspects of a Debian package, including importing new upstream versions, generating upstream tarballs (often using pristine-tar), applying packaging-specific changes, updating changelogs, and ultimately building source and binary Debian packages. It enforces a specific Git branching model (e.g., a 'debian' branch for packaging, an 'upstream' branch for original sources) to ensure consistency and reproducibility.

By automating common tasks like generating .dsc, .deb, and .changes files, gbp significantly reduces manual effort and potential errors, making it a cornerstone tool for many Debian developers and maintainers who leverage Git for their packaging efforts.

CAVEATS

gbp requires a specific and consistent Git repository layout to function correctly, typically involving 'debian', 'upstream', and 'pristine-tar' branches. Initial setup can be complex for newcomers. It heavily relies on other Debian packaging tools being correctly installed and configured.

CONFIGURATION FILES

gbp is highly configurable. Settings can be defined in a hierarchy of configuration files: project-specific settings in .git/gbp.conf, user-specific settings in ~/.gbp.conf, and system-wide defaults in /etc/git-buildpackage/gbp.conf. This allows for flexible customization of its behavior.

BRANCHING MODEL

A core concept of gbp is its reliance on a specific Git branching model. Common branches include:
upstream: The original (often untouched) upstream source.
debian/: (e.g., debian/sid) Contains the Debian packaging files and changes.
pristine-tar: Used by pristine-tar to store a delta of the upstream tarball, allowing for verifiable and reproducible tarball generation.

HISTORY

git-buildpackage emerged from the Debian community's ongoing efforts to enhance and streamline package maintenance through better integration with Git. It consolidated various scripts and best practices, evolving into a robust, widely adopted tool that provides a structured and reproducible workflow for Debian package development using Git repositories. Its development has been driven by the need for more efficient and collaborative packaging processes.

SEE ALSO

dpkg-buildpackage(1), debuild(1), dch(1), git(1), pristine-tar(1)

Copied to clipboard