Skip to main content

Simple program to manage gbp-docker container lifecycle.

Project description

dbp

PyPI version Build status

dbp is used to manage the persistence of the gbp-docker container, enabling compiler and dependency caches for faster builds. dbp requires Python (>= 3.5).

Installation

Fetch the latest release.

pip3 install dbp

Usage

  • 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

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 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 file
  4. ~/.extra_sources file

For example, fill ~/.extra_sources 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

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

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.

Build multiple repositories

dbp will build all repositories in the order specified.

dbp build src new-src amazing-src

Supply a build dependency graph on stdin for automatic dependency resolution.

bd | dbp build

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.5.4.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

dbp-0.5.4-py3-none-any.whl (16.5 kB view hashes)

Uploaded Python 3

Supported by

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