Skip to main content

Simple program to manage gbp-docker container lifecycle.

Project description

dbp

PyPI version Build status

docker-buildpackage

dbp runs git-buildpackage in managed gbp-docker containers, enabling compiler and dependency caches. dbp requires Python >=3.5.

Installation

Fetch the latest release.

pip3 install dbp

Usage

By default, dbp includes OPX apt sources.

  • dbp build src/ runs an out-of-tree build and stores build artifacts in ./pool/ for easy publishing
  • dbp shell launches an interactive bash shell in the development environment container
  • dbp run starts a persistent container in the background
  • dbp rm removes the persistent container from the background

Both dbp build and dbp shell use temporary containers if no container exists.

Advanced usage

Here are some fun things you can do with dbp.

Build a single package in a non-persistent container

dbp build src
  • Builds artifacts for the default Debian distribution
  • Uses packages found in ./pool/stretch-amd64 as build dependencies
  • Deposits artifacts in ./pool/stretch-amd64/src/
  • If workspace container does not exist, a container is created for this build and destroyed after
  • If the workspace container already exists, it is used for the build and not destroyed after
dbp --dist buster build src
  • Builds the package against Buster
  • Deposits artifacts in ./pool/buster-amd64/src/
EXTRA_SOURCES="deb http://deb.openswitch.net/stretch 3.0.0 opx opx-non-free"
dbp build src
  • Adds EXTRA_SOURCES to sources.list

Build multiple repositories

With no directories specified, dbp will build in build dependency order.

dbp build

Otherwise, directories can be manually specified.

dbp build src new-src amazing-src

Build against an OPX release

dbp --release 3.0.0 build

Build against a Debian distribution

dbp --dist bionic build

Build against extra apt sources

dbp will read from the following list of inputs for extra apt sources. These sources must be in standard sources.list format.

  1. --extra-sources argument
  2. EXTRA_SOURCES environment variable
  3. ./.extra_sources.list file
  4. ~/.extra_sources.list file

For example, fill ~/.extra_sources.list with

deb     http://deb.openswitch.net/stretch stable opx opx-non-free
deb-src http://deb.openswitch.net/stretch stable opx

and dbp build will search OpenSwitch for build dependencies.

$ dbp -v build src
INFO:dbp:Loaded extra sources:
deb     http://deb.openswitch.net/stretch stable opx opx-non-free
deb-src http://deb.openswitch.net/stretch stable opx

If no sources are fouhd, the default OPX sources are used.

Exclude custom apt sources

Also excludes default OPX sources.

dbp --no-extra-sources build

Develop inside a persistent development container

Using the run subcommand launches a persistent development container. This container will only be explicitly removed when dbp rm is run in the same directory. Then use dbp shell to enter this container.

dbp run
dbp shell

# Now we are inside the container (denoted by $ prompt)
$ cd src/

# Install build dependencies and build the package
$ gbp buildpackage

# Only install build dependencies
$ install-build-deps

# On failed builds, avoid the long gbp build time by quickly rebuilding
$ fakeroot debian/rules build

# Manually clean up
$ fakeroot debian/rules clean

# Add a new source for build dependencies by appending to the env var
$ export EXTRA_SOURCES="$EXTRA_SOURCES
deb http://deb.openswitch.net/stretch 3.0.0 opx opx-non-free"

# Run gbp buildpackage again to do a clean build, but this time skip installing build deps
$ gbp buildpackage --git-prebuild=':'

# Run an "official" build (what the CI runs)
$ cd /mnt
$ build src

# Build an unstripped, unoptimized binary (this also works with gbp and debian/rules)
$ DEB_BUILD_OPTIONS='nostrip noopt debug' build src

# Exit the container
$ exit

# Remove the container when finished (or use `dbp shell/build` again to re-enter the same container)
dbp rm

Important: Packages are only indexed for build dependencies in pool/${DIST}-${ARCH}/. Building with build ./src automatically deposits build artifacts into the correct directory for indexing. You can also simply copy .deb files into the directory.

Pass additional git-buildpackage options

For example, skip building when tagging by passing the correct flag.

dbp build src --gbp="--git-tag-only"

Pull any Docker image updates

dbp pull
dbp -d buster pull

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbp-0.7.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

dbp-0.7.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file dbp-0.7.1.tar.gz.

File metadata

  • Download URL: dbp-0.7.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.19.1

File hashes

Hashes for dbp-0.7.1.tar.gz
Algorithm Hash digest
SHA256 6678376e3e6fccf19b961055f431626818999d074d9bc799e118cc62e977f85f
MD5 91a7dbf18b19570eec18ea12c315c92f
BLAKE2b-256 490ac77cad791244ad585481cabf5d808e1e289cf5a5e97c1848f0d6866989be

See more details on using hashes here.

File details

Details for the file dbp-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: dbp-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.19.1

File hashes

Hashes for dbp-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 876fd26a86d74f996250a55eb8d5944187f32b415f46277a09c5a7fa96990ed0
MD5 56922557cd1387643c24069b572079e3
BLAKE2b-256 fc6db8de2b7c962e290c8f00aca9f53eae2e84547065c2d09a71bce0bc80f51f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page