From 0115487be47a59e6258d316e42117ccb9d96928c Mon Sep 17 00:00:00 2001 From: John Morris Date: Thu, 9 Apr 2015 00:40:17 -0500 Subject: [PATCH] Add suffix to package version Add a suffix to package version; by default, e.g. `~1jessie~1mk.dbuild`. This allows distribution packagers to give unique versions to their packages, as well as combine packages for different upstream distros into one `pool` directory (fixes #6). - Build new changelog entry for source packages - Read upstream version from `changelog` file (fixes #8) - Remove `$RELEASE` from pkg configs - Add default suffix `~1mk.dbuild` to packages - Unpack debianization first in order to get data from changelog early - Set default pkg format to reduce verbosity - Merge files formerly separated along upstream distro lines - `build/PACKAGE` dir; `repo/pool` dir Also: - Misc bug fixes - Install `sbuild.conf` from template (will address issues in #9) --- scripts/base-config.sh | 6 +- scripts/debian-binary-package.sh | 7 +- scripts/debian-debzn.sh | 68 +- scripts/debian-orig-tarball.sh | 12 +- scripts/debian-pkg-repo.sh | 5 +- scripts/debian-source-package.sh | 35 +- scripts/package/czmq.sh | 2 - scripts/package/dovetail-automata-keyring.sh | 2 - scripts/package/linux-latest.sh | 1 - scripts/package/linux-tools.sh | 2 - scripts/package/linux.sh | 4 +- scripts/package/python-pyftpdlib.sh | 2 - scripts/package/pyzmq.sh | 2 - scripts/package/rtai.sh | 3 - scripts/package/xenomai.sh | 2 - scripts/sbuild.conf | 679 +++++++++++++++++++ scripts/sbuild.sh | 14 + 17 files changed, 799 insertions(+), 47 deletions(-) create mode 100644 scripts/sbuild.conf diff --git a/scripts/base-config.sh b/scripts/base-config.sh index 2337ef6..114fb42 100644 --- a/scripts/base-config.sh +++ b/scripts/base-config.sh @@ -26,10 +26,10 @@ SOURCE_PKG_DIR=$BUILD_BASE_DIR DEBZN_GIT_DIR=$BUILD_BASE_DIR/debzn-git # Build directory for a distro codename -BUILD_DIR=$BUILD_BASE_DIR/$CODENAME +BUILD_DIR=$BUILD_BASE_DIR # Where sources are built -BUILD_SRC_DIR=$BUILD_DIR/tree +BUILD_SRC_DIR=$BUILD_DIR/tree-$CODENAME # Where the Apt package repo is built REPO_DIR=repo @@ -59,6 +59,8 @@ SCRIPTS_DIR=scripts DISTRO_CONFIG_DIR=$SCRIPTS_DIR/distro PACKAGE_CONFIG_DIR=$SCRIPTS_DIR/package +# Suffix for package version +PACKAGE_VERSION_SUFFIX=~1mk.dbuild # TCL default version; override in distro config TCL_VER=8.6 diff --git a/scripts/debian-binary-package.sh b/scripts/debian-binary-package.sh index ae9a697..754a9a0 100644 --- a/scripts/debian-binary-package.sh +++ b/scripts/debian-binary-package.sh @@ -2,14 +2,9 @@ debug " Sourcing debian-binary-package.sh" # # These routines handle building the package. -binary_package_init() { - test -n "$DSC_FILE" || \ - DSC_FILE=${PACKAGE}_${VERSION}${RELEASE:+-$RELEASE}.dsc -} - binary_package_build() { msg "Building binary package '$PACKAGE'" - binary_package_init + source_package_init sbuild_build_package } diff --git a/scripts/debian-debzn.sh b/scripts/debian-debzn.sh index ff979c7..65fff7b 100644 --- a/scripts/debian-debzn.sh +++ b/scripts/debian-debzn.sh @@ -2,6 +2,40 @@ # Debianization git tree operations debug " Sourcing debian-debzn.sh" +parse_changelog() { + dpkg-parsechangelog --file $BUILD_DIR/changelog.orig --show-field $1 +} + +debianization_init() { + test -z "$PACKAGE_VERSION" || return + + PACKAGE_VERSION=$(parse_changelog version) + debug " Upstream package version-release: $PACKAGE_VERSION" + PACKAGE_VER=$(echo $PACKAGE_VERSION | sed 's/\(.*\)-.*/\1/') + debug " Package version: $PACKAGE_VER" + PACKAGE_RELEASE=$(echo $PACKAGE_VERSION | \ + sed -e 's/^\([^-]*\)$/\1-/' -e 's/[^-]*-//') + debug " Upstream package release: $PACKAGE_RELEASE" + PACKAGE_DISTRIBUTION=$(parse_changelog distribution) + debug " Package distribution: $PACKAGE_DISTRIBUTION" + PACKAGE_URGENCY=$(parse_changelog urgency) + debug " Package urgency: $PACKAGE_URGENCY" + PACKAGE_NEW_VERSION_SUFFIX="~1${CODENAME}${PACKAGE_VERSION_SUFFIX}" + PACKAGE_NEW_VERSION="${PACKAGE_VERSION}${PACKAGE_NEW_VERSION_SUFFIX}" + debug " New package version-release: $PACKAGE_NEW_VERSION" + DSC_FILE=${PACKAGE}_${PACKAGE_NEW_VERSION}.dsc + debug " .dsc file name: $DSC_FILE" + CHANGELOG=/tmp/changelog-$PACKAGE-$CODENAME + + if test -z "$MAINTAINER"; then + MAINTAINER="$(git config user.name)" || MAINTAINER="mk-dbuild user" + fi + if test -z "$EMAIL"; then + EMAIL="$(git config user.email)" || EMAIL="mk-dbuild@example.com" + fi + debug " Maintainer : $MAINTAINER <$EMAIL>" +} + debianization_git_tree_update() { if test -z "$GIT_URL"; then debug " (No GIT_URL defined; not handling debianization git tree)" @@ -22,6 +56,35 @@ debianization_git_tree_update() { run_user git --git-dir=$DEBZN_GIT_DIR/.git --work-tree=$DEBZN_GIT_DIR \ pull --ff-only dbuild ${GIT_BRANCH:-master} fi + + debug " Saving original changelog" + run_user cp $DEBZN_GIT_DIR/changelog $BUILD_DIR/changelog.orig +} + +debianization_add_changelog() { + # https://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog + msg " Adding new changelog entry" + + # Calculate first line of changelog entry + PACKAGE_CHANGELOG_HEAD="$(echo "${PACKAGE}" "(${PACKAGE_NEW_VERSION})" \ + "${PACKAGE_DISTRIBUTION};" "urgency=${PACKAGE_URGENCY}")" + + # Calculate trailer line of changelog entry + PACKAGE_CHANGELOG_TRAILER=" -- $MAINTAINER <$EMAIL> $(date -R)" + + # Write changelog entry + ( + echo "$PACKAGE_CHANGELOG_HEAD" + echo " * Rebuilt in mk-debuild" + echo " - See https://github.com/zultron/mk-dbuild" + echo "$PACKAGE_CHANGELOG_TRAILER" + echo + ) > $CHANGELOG + + debug " Full changelog:" + run_debug cat $CHANGELOG + run bash -c "cat $BUILD_DIR/changelog.orig >> $CHANGELOG" + run_user cp $CHANGELOG $BUILD_SRC_DIR/debian/changelog } debianization_git_tree_unpack() { @@ -30,10 +93,9 @@ debianization_git_tree_unpack() { debug " Debzn git dir: $DEBZN_GIT_DIR" debug " Dest dir: $BUILD_SRC_DIR/debian" debug " Git branch: ${GIT_BRANCH:-master}" - run_user mkdir -p $BUILD_SRC_DIR/debian run_user git --git-dir=$DEBZN_GIT_DIR/.git archive \ - --prefix=./ ${GIT_BRANCH:-master} | \ - run_user tar xCf $BUILD_SRC_DIR/debian - + --prefix=debian/ ${GIT_BRANCH:-master} | \ + run_user tar xCf $BUILD_SRC_DIR - else debug " (No GIT_URL defined; not unpacking debianization from git)" fi diff --git a/scripts/debian-orig-tarball.sh b/scripts/debian-orig-tarball.sh index 019d4e9..cd4225e 100644 --- a/scripts/debian-orig-tarball.sh +++ b/scripts/debian-orig-tarball.sh @@ -17,12 +17,13 @@ source_tarball_init() { ;; esac + local BASENAME=${PACKAGE}_${PACKAGE_VER} case "$DEBIAN_PACKAGE_FORMAT" in '3.0 (quilt)') - DEBIAN_TARBALL=${PACKAGE}_${VERSION}.orig.tar.${DEBIAN_PACKAGE_COMP} + DEBIAN_TARBALL=${BASENAME}.orig.tar.${DEBIAN_PACKAGE_COMP} ;; '3.0 (native)') - DEBIAN_TARBALL=${PACKAGE}_${VERSION}.tar.${DEBIAN_PACKAGE_COMP} + DEBIAN_TARBALL=${BASENAME}.tar.${DEBIAN_PACKAGE_COMP} ;; *) error "Package ${PACKAGE}:" \ @@ -54,13 +55,6 @@ source_tarball_unpack() { fi msg " Unpacking source tarball" - debug " Tarball path: $SOURCE_PKG_DIR/$DEBIAN_TARBALL" - debug " Build dir: $BUILD_DIR" - debug " Linking original tarball to $BUILD_DIR" - run_user mkdir -p $BUILD_DIR - run_user ln -f $SOURCE_PKG_DIR/$DEBIAN_TARBALL $BUILD_DIR - debug " Unpacking tarball into $BUILD_SRC_DIR" - run_user rm -rf $BUILD_SRC_DIR; run_user mkdir -p $BUILD_SRC_DIR run_user tar xCf $BUILD_SRC_DIR $SOURCE_PKG_DIR/$DEBIAN_TARBALL \ --strip-components=1 } diff --git a/scripts/debian-pkg-repo.sh b/scripts/debian-pkg-repo.sh index 8ddb602..c343a6f 100644 --- a/scripts/debian-pkg-repo.sh +++ b/scripts/debian-pkg-repo.sh @@ -1,7 +1,7 @@ debug " Sourcing debian-pkg-repo.sh" deb_repo_init() { - test -z "$SIGNING_KEY" || return + test -z "$SIGNING_KEY" || return 0 REPO_DIR_ABS=$(readlink -f $REPO_DIR) debug " Apt repo dir: $REPO_DIR_ABS" debug " GPG key dir: $GNUPGHOME" @@ -18,7 +18,6 @@ deb_repo_init() { REPREPRO="run_user reprepro -VV -b ${REPO_DIR_ABS} \ --confdir +b/conf-${CODENAME} --dbdir +b/db-${CODENAME} \ - --outdir +b/${CODENAME} \ --gnupghome $GNUPGHOME" } @@ -49,7 +48,7 @@ deb_repo_build() { msg "Updating Debian Apt package repository" deb_repo_init # repo config deb_repo_setup # set up repo, if needed - binary_package_init # source pkg config + source_package_init # source pkg config # add source pkg msg " Removing all packages for '$PACKAGE'" diff --git a/scripts/debian-source-package.sh b/scripts/debian-source-package.sh index 78d124d..3fd7a0c 100644 --- a/scripts/debian-source-package.sh +++ b/scripts/debian-source-package.sh @@ -8,6 +8,22 @@ debug " Sourcing debian-source-package.sh" # Routines for cloning/copying the Debianization files . $SCRIPTS_DIR/debian-debzn.sh +######################################## +# Source package init vars +source_package_init() { + debianization_init # Init vars after unpacking + + debug " Package format: ${DEBIAN_PACKAGE_FORMAT:=3.0 (quilt)}" +} + +######################################## +# Source package setup +source_package_setup() { + msg " Preparing source directory $BUILD_SRC_DIR" + run_user rm -rf $BUILD_SRC_DIR + run_user mkdir -p $BUILD_SRC_DIR/debian +} + ######################################## # Source package configuration @@ -30,7 +46,7 @@ source_package_build_from_tree() { ( cd $BUILD_SRC_DIR run_user dpkg-source -b \ - --format="'${DEBIAN_PACKAGE_FORMAT:-3.0 (quilt)}'" . + --format="'${DEBIAN_PACKAGE_FORMAT}'" . ) } @@ -45,18 +61,27 @@ source_package_cleanup() { # Source package build source_package_build() { msg "Building source package '$PACKAGE'" - # Download source tarball and unpack - source_tarball_init - source_tarball_download - source_tarball_unpack + # Initialize directories + source_package_setup # Update debianization git tree and copy to source tree debianization_git_tree_update debianization_git_tree_unpack + # Init variables + source_package_init + + # Download source tarball and unpack + source_tarball_init + source_tarball_download + source_tarball_unpack + # Some packages may define a configuration step configure_package_wrapper + # Add new changelog + debianization_add_changelog + # Build the source package and clean up source_package_build_from_tree source_package_cleanup diff --git a/scripts/package/czmq.sh b/scripts/package/czmq.sh index 28350cb..2bf4d49 100644 --- a/scripts/package/czmq.sh +++ b/scripts/package/czmq.sh @@ -1,6 +1,4 @@ VERSION=2.2.0 -RELEASE=0.4 TARBALL_URL=http://download.zeromq.org/czmq-${VERSION}.tar.gz GIT_URL=https://github.com/zultron/czmq-deb.git -DEBIAN_PACKAGE_FORMAT='3.0 (quilt)' DEBIAN_PACKAGE_COMP=gz diff --git a/scripts/package/dovetail-automata-keyring.sh b/scripts/package/dovetail-automata-keyring.sh index 5de75b9..76eced2 100644 --- a/scripts/package/dovetail-automata-keyring.sh +++ b/scripts/package/dovetail-automata-keyring.sh @@ -1,5 +1,3 @@ -VERSION=0.1 -RELEASE=2 GIT_URL=https://github.com/zultron/dovetail-automata-keyring-deb.git DEBIAN_PACKAGE_FORMAT='3.0 (native)' DEBIAN_PACKAGE_COMP=gz diff --git a/scripts/package/linux-latest.sh b/scripts/package/linux-latest.sh index cb14d17..0f917e8 100644 --- a/scripts/package/linux-latest.sh +++ b/scripts/package/linux-latest.sh @@ -1,4 +1,3 @@ -VERSION=60 GIT_URL=https://github.com/zultron/linux-latest-deb.git DEBIAN_PACKAGE_FORMAT='3.0 (native)' DEBIAN_PACKAGE_COMP=xz diff --git a/scripts/package/linux-tools.sh b/scripts/package/linux-tools.sh index 425a2b3..e2de0ee 100644 --- a/scripts/package/linux-tools.sh +++ b/scripts/package/linux-tools.sh @@ -1,8 +1,6 @@ VERSION=3.8.13 -RELEASE=3da TARBALL_URL=http://www.kernel.org/pub/linux/kernel/v3.0/linux-${VERSION}.tar.xz GIT_URL=https://github.com/zultron/linux-tools-deb.git -DEBIAN_PACKAGE_FORMAT='3.0 (quilt)' DEBIAN_PACKAGE_COMP=xz # 'apt' resolver chokes on libperl-dev:armhf -> perl:armhf # 'aptitude' resolver installs a bunch of amd64-arch pkgs diff --git a/scripts/package/linux.sh b/scripts/package/linux.sh index ec43ff6..867d6da 100644 --- a/scripts/package/linux.sh +++ b/scripts/package/linux.sh @@ -1,9 +1,7 @@ VERSION=3.8.13 -RELEASE=11 TARBALL_URL=http://www.kernel.org/pub/linux/kernel/v3.0/linux-${VERSION}.tar.xz GIT_URL=https://github.com/zultron/linux-ipipe-deb.git -GIT_BRANCH=3.8.13 -DEBIAN_PACKAGE_FORMAT='3.0 (quilt)' +GIT_BRANCH=${VERSION} DEBIAN_PACKAGE_COMP=xz NATIVE_BUILD_ONLY=true # Build-Depends: gcc-4.9 diff --git a/scripts/package/python-pyftpdlib.sh b/scripts/package/python-pyftpdlib.sh index ee45dde..9fead25 100644 --- a/scripts/package/python-pyftpdlib.sh +++ b/scripts/package/python-pyftpdlib.sh @@ -1,6 +1,4 @@ VERSION=1.2.0 -RELEASE=4 TARBALL_URL=https://github.com/giampaolo/pyftpdlib/archive/release-$VERSION.tar.gz GIT_URL=https://github.com/zultron/python-pyftpdlib-deb.git -DEBIAN_PACKAGE_FORMAT='3.0 (quilt)' DEBIAN_PACKAGE_COMP=gz diff --git a/scripts/package/pyzmq.sh b/scripts/package/pyzmq.sh index 789d2c7..4d0af1c 100644 --- a/scripts/package/pyzmq.sh +++ b/scripts/package/pyzmq.sh @@ -1,8 +1,6 @@ VERSION=14.3.0 -RELEASE=4 TARBALL_URL=https://github.com/zeromq/pyzmq/archive/v${VERSION}.tar.gz GIT_URL=https://github.com/zultron/pyzmq-deb.git -DEBIAN_PACKAGE_FORMAT='3.0 (quilt)' DEBIAN_PACKAGE_COMP=gz # 'apt' resolver: 'Build-Depends dependency for # sbuild-build-depends-pyzmq-dummy cannot be satisfied because the diff --git a/scripts/package/rtai.sh b/scripts/package/rtai.sh index a25cb66..7bced1c 100644 --- a/scripts/package/rtai.sh +++ b/scripts/package/rtai.sh @@ -1,9 +1,6 @@ GIT_REV=a416758 -VERSION=4.0.5.${GIT_REV} -RELEASE=1 TARBALL_URL=https://github.com/ShabbyX/RTAI/archive/${GIT_REV}.tar.gz GIT_URL=https://github.com/zultron/rtai-deb.git GIT_REPO=rtai-deb -DEBIAN_PACKAGE_FORMAT='3.0 (quilt)' DEBIAN_PACKAGE_COMP=gz EXCLUDE_ARCHES=armhf diff --git a/scripts/package/xenomai.sh b/scripts/package/xenomai.sh index 49e46d5..d32bd03 100644 --- a/scripts/package/xenomai.sh +++ b/scripts/package/xenomai.sh @@ -1,6 +1,4 @@ VERSION=2.6.4 -RELEASE=1 TARBALL_URL=http://download.gna.org/xenomai/stable/xenomai-$VERSION.tar.bz2 GIT_URL=https://github.com/zultron/xenomai-deb.git -DEBIAN_PACKAGE_FORMAT='3.0 (quilt)' DEBIAN_PACKAGE_COMP=bz2 diff --git a/scripts/sbuild.conf b/scripts/sbuild.conf new file mode 100644 index 0000000..afa80a9 --- /dev/null +++ b/scripts/sbuild.conf @@ -0,0 +1,679 @@ +# sbuild.conf: sbuild settings. -*- Perl -*- +# Default settings are commented out. +# Note that all possible settings are listed here. Many may be set on +# the command-line, and do not normally need setting here, +# e.g. $verbose. Others need setting by each individual user in their +# ~/.sbuildrc, but are listed here for completeness. + + +## +## Build environment +## + +# LD_LIBRARY_PATH +# Type: STRING +# Library search path to use inside the chroot. +#$ld_library_path = undef; + +# PATH +# Type: STRING +# PATH to set when running dpkg-buildpackage. +#$path = +#'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games'; + + + +## +## Build options +## + +# APPEND_TO_VERSION +# Type: STRING +# Suffix to append to version number. May be useful for derivative +# distributions. +#$append_to_version = undef; +#$append_to_version = "@PACKAGE_NEW_VERSION_SUFFIX@"; + +# BUILD_ARCH +# Type: STRING +# Build architecture (Arch we are building on). +#$build_arch = 'i386'; + +# BUILD_ARCH_ALL +# Type: BOOL +# Build architecture: all packages by default +#$build_arch_all = 0; + +# BUILD_ARCH_ANY +# Type: BOOL +# Build architecture: any packages by default +#$build_arch_any = 1; + +# BUILD_ENV_CMND +# Type: STRING +# This command is run with the dpkg-buildpackage command line passed to it +# (in the chroot, if doing a chrooted build). It is used by the sparc +# buildd (which is sparc64) to call the wrapper script that sets the +# environment to sparc (32-bit). It could be used for other build +# environment setup scripts. Note that this is superceded by schroot's +# 'command-prefix' option +#$build_env_cmnd = ''; + +# BUILD_SOURCE +# Type: BOOL +# By default, do not build a source package (binary only build). Set to 1 +# to force creation of a source package, but note that this is +# inappropriate for binary NMUs, where the option will always be disabled. +#$build_source = 0; + +# CHECK_SPACE +# Type: BOOL +# Check free disk space prior to starting a build. sbuild requires the +# free space to be at least twice the size of the unpacked sources to allow +# a build to proceed. Can be disabled to allow building if space is very +# limited, but the threshold to abort a build has been exceeded despite +# there being sufficient space for the build to complete. +#$check_space = 1; + +# DISTRIBUTION +# Type: STRING +# Default distribution. By default, no distribution is defined, and the +# user must specify it with the -d option. However, a default may be +# configured here if desired. Users must take care not to upload to the +# wrong distribution when this option is set, for example experimental +# packages will be built for upload to unstable when this is not what is +# required. +#$distribution = undef; + +# FORCE_ORIG_SOURCE +# Type: BOOL +# By default, the -s option only includes the .orig.tar.gz when needed +# (i.e. when the Debian revision is 0 or 1). By setting this option to 1, +# the .orig.tar.gz will always be included when -s is used. This is +# equivalent to --force-orig-source. +#$force_orig_source = 0; + +# GCC_SNAPSHOT +# Type: BOOL +# Build using current GCC snapshot? +#$gcc_snapshot = 0; + +# HOST_ARCH +# Type: STRING +# Host architecture (Arch we are building for) +#$host_arch = 'i386'; + +# PGP_OPTIONS +# Type: ARRAY:STRING +# Additional signing options for dpkg-buildpackage +#$pgp_options = [ +# '-us', +# '-uc' +# ]; + +# TOOLCHAIN_REGEX +# Type: ARRAY:STRING +# Regular expressions identifying toolchain packages. Note that for +# backward compatibility, this is also settable using the array +# @toolchain_regex (deprecated), rather than an array reference. +#$toolchain_regex = [ +# 'binutils$', +# 'dpkg-dev$', +# 'gcc-[\\d.]+$', +# 'g\\+\\+-[\\d.]+$', +# 'libstdc\\+\\+', +# 'libc[\\d.]+-dev$', +# 'linux-kernel-headers$', +# 'linux-libc-dev$', +# 'gnumach-dev$', +# 'hurd-dev$', +# 'kfreebsd-kernel-headers$' +# ]; + + + +## +## Build timeouts +## + +# INDIVIDUAL_STALLED_PKG_TIMEOUT +# Type: HASH:NUMERIC +# Some packages may exceed the general timeout (e.g. redirecting output to +# a file) and need a different timeout. This has is a mapping between +# source package name and timeout. Note that for backward compatibility, +# this is also settable using the hash %individual_stalled_pkg_timeout +# (deprecated) , rather than a hash reference. +# %individual_stalled_pkg_timeout = (smalleiffel => 300, +# jade => 300, +# atlas => 300, +# glibc => 1000, +# 'gcc-3.3' => 300, +# kwave => 600); +#$individual_stalled_pkg_timeout = {}; + +# LOCK_INTERVAL +# Type: NUMERIC +# Lock wait interval (seconds). Maximum wait time is (max_lock_trys × +# lock_interval). +#$lock_interval = 5; + +# MAX_LOCK_TRYS +# Type: NUMERIC +# Number of times to try waiting for a lock. +#$max_lock_trys = 120; + +# STALLED_PKG_TIMEOUT +# Type: NUMERIC +# Time (in minutes) of inactivity after which a build is terminated. +# Activity is measured by output to the log file. +#$stalled_pkg_timeout = 150; + + + +## +## Build validation +## + +# LINTIAN +# Type: STRING +# Path to lintian binary +#$lintian = 'lintian'; + +# LINTIAN_OPTIONS +# Type: ARRAY:STRING +# Options to pass to lintian. Each option is a separate arrayref element. +# For example, ['-i', '-v'] to add -i and -v. +#$lintian_opts = []; + +# PIUPARTS +# Type: STRING +# Path to piuparts binary +#$piuparts = 'piuparts'; + +# PIUPARTS_OPTIONS +# Type: ARRAY:STRING +# Options to pass to piuparts. Each option is a separate arrayref element. +# For example, ['-b', ''] to add -b and . +#$piuparts_opts = []; + +# PIUPARTS_ROOT_ARGS +# Type: ARRAY:STRING +# Preceding arguments to launch piuparts as root. If no arguments are +# specified, piuparts will be launched via sudo. +#$piuparts_root_args = []; + +# RUN_LINTIAN +# Type: BOOL +# Run lintian? +#$run_lintian = 0; + +# RUN_PIUPARTS +# Type: BOOL +# Run piuparts +#$run_piuparts = 0; + + + +## +## Chroot options +## + +# APT_ALLOW_UNAUTHENTICATED +# Type: BOOL +# Force APT to accept unauthenticated packages. By default, +# unauthenticated packages are not allowed. This is to keep the build +# environment secure, using apt-secure(8). By setting this to 1, +# APT::Get::AllowUnauthenticated is set to "true" when running apt-get. +# This is disabled by default: only enable it if you know what you are +# doing. +#$apt_allow_unauthenticated = 0; + +# APT_CLEAN +# Type: BOOL +# APT clean. 1 to enable running "apt-get clean" at the start of each +# build, or 0 to disable. +#$apt_clean = 0; + +# APT_DISTUPGRADE +# Type: BOOL +# APT distupgrade. 1 to enable running "apt-get dist-upgrade" at the start +# of each build, or 0 to disable. +#$apt_distupgrade = 1; + +# APT_UPDATE +# Type: BOOL +# APT update. 1 to enable running "apt-get update" at the start of each +# build, or 0 to disable. +#$apt_update = 1; + +# APT_UPDATE_ARCHIVE_ONLY +# Type: BOOL +# Update local temporary APT archive directly (1, the default) or set to 0 +# to disable and do a full apt update (not recommended in case the mirror +# content has changed since the build started). +#$apt_update_archive_only = 1; + +# APT_UPGRADE +# Type: BOOL +# APT upgrade. 1 to enable running "apt-get upgrade" at the start of each +# build, or 0 to disable. +#$apt_upgrade = 0; + +# CHROOT +# Type: STRING +# Default chroot (defaults to distribution[-arch][-sbuild]) +#$chroot = undef; + +# CHROOT_MODE +# Type: STRING +# Mechanism to use for chroot virtualisation. Possible value are "schroot" +# (default) and "sudo". +#$chroot_mode = 'schroot'; + +# CHROOT_SETUP_SCRIPT +# Type: STRING +# Script to run to perform custom setup tasks in the chroot. +#$chroot_setup_script = undef; + +# CHROOT_SPLIT +# Type: BOOL +# Run in split mode? In split mode, apt-get and dpkg are run on the host +# system, rather than inside the chroot. +#$chroot_split = 0; + +# EXTERNAL_COMMANDS +# Type: HASH:ARRAY:ARRAY:STRING +# External commands to run at various stages of a build. Commands are held +# in a hash of arrays of arrays data structure. +# $external_commands = { +# "pre-build-commands" => [ +# ['foo', 'arg1', 'arg2'], +# ['bar', 'arg1', 'arg2', 'arg3'], +# ], +# "chroot-setup-commands" => [ +# ['foo', 'arg1', 'arg2'], +# ['bar', 'arg1', 'arg2', 'arg3'], +# ], +# "chroot-cleanup-commands" => [ +# ['foo', 'arg1', 'arg2'], +# ['bar', 'arg1', 'arg2', 'arg3'], +# ], +# "post-build-commands" => [ +# ['foo', 'arg1', 'arg2'], +# ['bar', 'arg1', 'arg2', 'arg3'], +# ], +# }; +#$external_commands = { +# 'chroot-setup-commands' => [], +# 'chroot-cleanup-commands' => [], +# 'post-build-commands' => [], +# 'pre-build-commands' => [] +# }; + +# LOG_EXTERNAL_COMMAND_ERROR +# Type: BOOL +# Log standard error of commands run by sbuild? +#$log_external_command_error = 1; + +# LOG_EXTERNAL_COMMAND_OUTPUT +# Type: BOOL +# Log standard output of commands run by sbuild? +#$log_external_command_output = 1; + +# PACKAGE_CHECKLIST +# Type: STRING +# Where to store list currently installed packages inside chroot +#$package_checklist = '/var/lib/sbuild/package-checklist'; + +# PURGE_BUILD_DEPS +# Type: STRING +# When to purge the build dependencies after a build; possible values are +# "never", "successful", and "always" +#$purge_build_deps = 'always'; +$purge_build_deps = 'successful'; + +# PURGE_BUILD_DIRECTORY +# Type: STRING +# When to purge the build directory after a build; possible values are +# "never", "successful", and "always" +#$purge_build_directory = 'always'; +$purge_build_directory = 'successful'; + +# PURGE_SESSION +# Type: STRING +# Purge the schroot session following a build. This is useful in +# conjunction with the --purge and --purge-deps options when using snapshot +# chroots, since by default the snapshot will be deleted. Possible values +# are "always" (default), "never", and "successful" +#$purge_session = 'always'; +$purge_session = 'successful'; + + + +## +## Core options +## + +# ARCHIVE +# Type: STRING +# Archive being built. Only set in build log. This might be useful for +# derivative distributions. +#$archive = undef; + +# BUILD_DIR +# Type: STRING +# This option is deprecated. Directory for chroot symlinks and sbuild +# logs. Defaults to the current directory if unspecified. It is used as +# the location of chroot symlinks (obsolete) and for current build log +# symlinks and some build logs. There is no default; if unset, it defaults +# to the current working directory. $HOME/build is another common +# configuration. +# $build_dir = '/home/pete/build'; + +# BUILD_ENVIRONMENT +# Type: HASH:STRING +# Environment to set during the build. Defaults to setting PATH and +# LD_LIBRARY_PATH only. Note that these environment variables are not +# subject to filtering with ENVIRONMENT_FILTER. Example: +# $build_environment = { +# 'CCACHE_DIR' => '/build/cache' +# }; +#$build_environment = {}; +$build_environment = { + 'CCACHE_DIR' => '/srv/ccache' +}; + +# CORE_DEPENDS +# Type: ARRAY:STRING +# Packages which must be installed in the chroot for all builds. +#$core_depends = [ +# 'build-essential', +# 'fakeroot' +# ]; + +# ENVIRONMENT_FILTER +# Type: ARRAY:STRING +# Only environment variables matching one of the regular expressions in +# this arrayref will be passed to dpkg-buildpackage and other programs run +# by sbuild. +#$environment_filter = [ +# '^PATH$', +# '^DEB(IAN|SIGN)?_[A-Z_]+$', +# '^(C(PP|XX)?|LD|F)FLAGS(_APPEND)?$', +# '^USER(NAME)?$', +# '^LOGNAME$', +# '^HOME$', +# '^TERM$', +# '^SHELL$' +# ]; + +# JOB_FILE +# Type: STRING +# Job status file (only used in batch mode) +#$job_file = 'build-progress'; + +# SBUILD_MODE +# Type: STRING +# sbuild behaviour; possible values are "user" (exit status reports build +# failures) and "buildd" (exit status does not report build failures) for +# use in a buildd setup. "buildd" also currently implies enabling of +# "legacy features" such as chroot symlinks in the build directory and the +# creation of current symlinks in the build directory. +#$sbuild_mode = 'user'; + + + +## +## Dependency resolution +## + +# BUILD_DEP_RESOLVER +# Type: STRING +# Build dependency resolver. The 'apt' resolver is currently the default, +# and recommended for most users. This resolver uses apt-get to resolve +# dependencies. Alternative resolvers are 'apt' and 'aptitude', which use +# a built-in resolver module and aptitude to resolve build dependencies, +# respectively. The aptitude resolver is similar to apt, but is useful in +# more complex situations, such as where multiple distributions are +# required, for example when building from experimental, where packages are +# needed from both unstable and experimental, but defaulting to unstable. +#$build_dep_resolver = 'apt'; + +# RESOLVE_ALTERNATIVES +# Type: BOOL +# Should the dependency resolver use alternatives in Build-Depends, +# Build-Depends-Arch and Build-Depends-Indep? By default, using 'apt' +# resolver, only the first alternative will be used; all other alternatives +# will be removed. When using the 'aptitude' resolver, it will default to +# using all alternatives. Note that this does not include +# architecture-specific alternatives, which are reduced to the build +# architecture prior to alternatives removal. This should be left disabled +# when building for unstable; it may be useful when building for +# experimental or backports. Set to undef to use the default, 1 to enable, +# or 0 to disable. +# $resolve_alternatives = 0; +#$resolve_alternatives = undef; +$resolve_alternatives = 1; + +# SBUILD_BUILD_DEPENDS_PUBLIC_KEY +# Type: STRING +# GPG public key for temporary local apt archive. +#$sbuild_build_depends_public_key = +#'/var/lib/sbuild/apt-keys/sbuild-key.pub'; + +# SBUILD_BUILD_DEPENDS_SECRET_KEY +# Type: STRING +# GPG secret key for temporary local apt archive. +#$sbuild_build_depends_secret_key = +#'/var/lib/sbuild/apt-keys/sbuild-key.sec'; + + + +## +## Logging options +## + +# COMPRESS_BUILD_LOG_MAILS +# Type: BOOL +# Should build log mails be compressed? +#$compress_build_log_mails = 1; + +# DEBUG +# Type: NUMERIC +# Debug logging level +#$debug = 0; + +# LOG_COLOUR +# Type: BOOL +# Colour log messages such as critical failures, warnings and success +#$log_colour = 1; + +# LOG_DIR +# Type: STRING +# Directory for storing build logs. This defaults to '.' when SBUILD_MODE +# is set to 'user' (the default), and to '$HOME/logs' when SBUILD_MODE is +# set to 'buildd'. +#$log_dir = undef; +$log_dir = "/srv/repo/logs"; + +# LOG_FILTER +# Type: BOOL +# Filter variable strings from log messages such as the chroot name and +# build directory +#$log_filter = 1; + +# MAILFROM +# Type: STRING +# email address set in the From line of build logs +#$mailfrom = 'Source Builder '; + +# MAILTO +# Type: STRING +# email address to mail build logs to +#$mailto = ''; + +# MAILTO_HASH +# Type: HASH:STRING +# Like MAILTO, but per-distribution. This is a hashref mapping +# distribution name to MAILTO. Note that for backward compatibility, this +# is also settable using the hash %mailto (deprecated), rather than a hash +# reference. +#$mailto_hash = {}; + +# MIME_BUILD_LOG_MAILS +# Type: BOOL +# Should build log mails be MIME encoded? +#$mime_build_log_mails = 1; + +# VERBOSE +# Type: NUMERIC +# Verbose logging level +#$verbose = 0; + + + +## +## Maintainer options +## + +# KEY_ID +# Type: STRING +# Key ID to use in .changes for the current upload. It overrides both +# $maintainer_name and $uploader_name. +#$key_id = undef; + +# MAINTAINER_NAME +# Type: STRING +# Name to use as override in .changes files for the Maintainer field. The +# Maintainer field will not be overridden unless set here. +#$maintainer_name = undef; +# $maintainer_name = "@MAINTAINER@ <@EMAIL@>"; +$maintainer_name = "@MAINTAINER@ <@EMAIL@>"; + +# UPLOADER_NAME +# Type: STRING +# Name to use as override in .changes file for the Changed-By: field. +#$uploader_name = undef; +#$uploader_name = "@MAINTAINER@ <@EMAIL@>"; + + + +## +## Multiarch support (transitional) +## + +# CROSSBUILD_CORE_DEPENDS +# Type: HASH:ARRAY:STRING +# Per-architecture dependencies required for cross-building. +#$crossbuild_core_depends = { +# 'sparc' => [ +# 'crossbuild-essential-sparc' +# ], +# 'mipsel' => [ +# 'crossbuild-essential-mipsel' +# ], +# 'arm64' => [ +# 'crossbuild-essential-arm64' +# ], +# 'armhf' => [ +# 'crossbuild-essential-armhf' +# ], +# 'powerpc' => [ +# 'crossbuild-essential-powerpc' +# ], +# 'ia64' => [ +# 'crossbuild-essential-ia64' +# ], +# 'mips' => [ +# 'crossbuild-essential-mips' +# ], +# 'armel' => [ +# 'crossbuild-essential-armel' +# ] +# }; + + + +## +## Programs +## + +# APTITUDE +# Type: STRING +# Path to aptitude binary +#$aptitude = 'aptitude'; + +# APT_CACHE +# Type: STRING +# Path to apt-cache binary +#$apt_cache = 'apt-cache'; + +# APT_GET +# Type: STRING +# Path to apt-get binary +#$apt_get = 'apt-get'; + +# DCMD +# Type: STRING +# Path to dcmd binary +#$dcmd = 'dcmd'; + +# DPKG_SOURCE +# Type: STRING +# Path to dpkg-source binary +#$dpkg_source = 'dpkg-source'; + +# DPKG_SOURCE_OPTIONS +# Type: ARRAY:STRING +# Additional command-line options for dpkg-source +#$dpkg_source_opts = []; + +# FAKEROOT +# Type: STRING +# Path to fakeroot binary +#$fakeroot = 'fakeroot'; + +# MAILPROG +# Type: STRING +# Program to use to send mail +#$mailprog = '/usr/sbin/sendmail'; + +# MD5SUM +# Type: STRING +# Path to md5sum binary +#$md5sum = 'md5sum'; + +# SCHROOT_OPTIONS +# Type: ARRAY:STRING +# Additional command-line options for schroot +#$schroot_options = [ +# '-q' +# ]; + +# SU +# Type: STRING +# Path to su binary +#$su = 'su'; + +# SUDO +# Type: STRING +# Path to sudo binary +#$sudo = 'sudo'; + +# XAPT +# Type: STRING +#$xapt = 'xapt'; + + + +## +## Statistics +## + +# STATS_DIR +# Type: STRING +# Directory for writing build statistics to +#$stats_dir = '/home/buildd/stats'; +$stats_dir = "/srv/repo/logs"; + +1; diff --git a/scripts/sbuild.sh b/scripts/sbuild.sh index e45a2ca..7c016e9 100644 --- a/scripts/sbuild.sh +++ b/scripts/sbuild.sh @@ -39,6 +39,18 @@ sbuild_chroot_init() { fi } +sbuild_chroot_save_sbuild_conf() { + debug " Installing sbuild.conf into /etc/sbuild/sbuild.conf" + run cp $SCRIPTS_DIR/sbuild.conf /etc/sbuild + run sed -i /etc/sbuild/sbuild.conf \ + -e "s/@CODENAME@/$CODENAME/" \ + -e "s/@MAINTAINER@/$MAINTAINER/" \ + -e "s/@EMAIL@/$EMAIL/" \ + -e "s/@PACKAGE_NEW_VERSION_SUFFIX@/$PACKAGE_NEW_VERSION_SUFFIX/" \ + -e "s/@/\\\\@/g" + run_debug grep -v -e '^$' -e '^#' /etc/sbuild/sbuild.conf +} + sbuild_chroot_save_keys() { debug " Saving signing keys from sbuild into $GNUPGHOME" debug " Sbuild key dir: $SBUILD_KEY_DIR" @@ -120,6 +132,7 @@ sbuild_chroot_setup() { # If the chroot config already exists, restore it sbuild_restore_config + sbuild_chroot_save_sbuild_conf sbuild_chroot_install_keys if $FOREIGN && test $BUILD_ARCH=armhf; then @@ -182,6 +195,7 @@ sbuild_build_package() { test -f $BUILD_DIR/$DSC_FILE || error "No .dsc file '$DSC_FILE'" sbuild_chroot_init + sbuild_chroot_save_sbuild_conf sbuild_chroot_install_keys sbuild_restore_config