From 6821bf1de1e0a6b9e8c58c579642e20346cdbcc5 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 12 Mar 2018 00:08:16 +0900 Subject: [PATCH] DEB build scripts: improved support for pbuilder and fixed problem with apt-ftparchive in hook scripts. Signed-off-by: Michele Calgaro --- debian/_buildscripts/local/scripts/README.txt | 6 +- .../local/scripts/_build_config_template.sh | 5 -- .../scripts/additional files/etc/pbuilderrc | 59 +++++++++++++++++++ .../user_home_folder/.pbuilderrc | 3 + .../local/scripts/build_module.sh | 7 +++ 5 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc diff --git a/debian/_buildscripts/local/scripts/README.txt b/debian/_buildscripts/local/scripts/README.txt index 636507385..f409076be 100644 --- a/debian/_buildscripts/local/scripts/README.txt +++ b/debian/_buildscripts/local/scripts/README.txt @@ -10,13 +10,15 @@ C) How to use the scripts ------------------------------ 0) * NOTE *: you can change folder names, as long as you update the "build_config.sh" file accordingly. -1) Install pbuilder and configure it (see https://wiki.ubuntu.com/PbuilderHowto for a detailed tutorial) +1) Install pbuilder and configure it + (see https://wiki.ubuntu.com/PbuilderHowto and https://wiki.debian.org/PbuilderTricks for a detailed tutorial) - You can use the file ".pbuilderrc" from following point 2) - Create the folder "/var/cache/pbuilder/repo" - cd into "/var/cache/pbuilder/repo" and execute "touch Packages" to create an empty file "Packages" 2) Copy files from "additional files" folder to respectivily named folder. - "user_home_folder" refers to the user home folder. + - "user_home_folder" refers to the user home folder. + - make sure to make the files in "usr/lib/pbuilder/hooks" executable 3) Create base package with the command: pbuilder --create diff --git a/debian/_buildscripts/local/scripts/_build_config_template.sh b/debian/_buildscripts/local/scripts/_build_config_template.sh index 7db11f84a..19cfeff5e 100644 --- a/debian/_buildscripts/local/scripts/_build_config_template.sh +++ b/debian/_buildscripts/local/scripts/_build_config_template.sh @@ -30,11 +30,6 @@ CFG_GIT_TDE_MAIN="$CFG_GIT_DIR/tde/main" CFG_GIT_TDE_PACKAGING="$CFG_GIT_DIR/tde-packaging/$DISTRO/$DISTRO_NAME" CFG_GIT_EXTRA_DEPENDENCIES="$CFG_GIT_DIR/$CFG_EXTRA_DEPS_DIR" CFG_HOOK_DIR="$CFG_GIT_DIR/$CFG_HOOKS_DIR" -#Absolute paths -PBUILDER_REPO="/var/cache/pbuilder/repo" -PBUILDER_HOOK_DIR="/usr/lib/pbuilder/hooks" -PBUILDER_SHELL_HOOK="$PBUILDER_HOOK_DIR/C10shell" -PBUILDER_SHELL_HOOK_TEMPLATE="$PBUILDER_HOOK_DIR/__template_C10shell" #---------------------------- # Build output directories diff --git a/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc b/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc new file mode 100644 index 000000000..467a29ad1 --- /dev/null +++ b/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc @@ -0,0 +1,59 @@ +# this is your configuration file for pbuilder. +# the file in /usr/share/pbuilder/pbuilderrc is the default template. +# /etc/pbuilderrc is the one meant for editing. +# +# read pbuilderrc.5 document for notes on specific options. + +BASETGZ=/var/cache/pbuilder/base.tgz +BUILDPLACE=/var/cache/pbuilder/build/ +OTHERMIRROR="deb [trusted=yes] file:///var/cache/pbuilder/repo ./" +USEPROC=yes +USEDEVPTS=yes +USEDEVFS=no +BUILDRESULT=/var/cache/pbuilder/result/ + +HOOKDIR="/usr/lib/pbuilder/hooks" +# make debconf not interact with user +export DEBIAN_FRONTEND="noninteractive" +DEBEMAIL="" +# for pbuilder debuild (sudo -E keeps the environment as-is) +BUILDSOURCEROOTCMD="fakeroot" +PBUILDERROOTCMD="sudo -E" + +# command to satisfy build-dependencies; the default is an internal shell +# implementation which is relatively slow; there are two alternate +# implementations, the "experimental" implementation, +# "pbuilder-satisfydepends-experimental", which might be useful to pull +# packages from experimental or from repositories with a low APT Pin Priority, +# and the "aptitude" implementation, which will resolve build-dependencies and +# build-conflicts with aptitude which helps dealing with complex cases but does +# not support unsigned APT repositories +PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends" + +#Command-line option passed on to dpkg-buildpackage. +DEBBUILDOPTS="" + +#APT configuration files directory +APTCONFDIR="" +# the username and ID used by pbuilder, inside chroot. Needs fakeroot, really +BUILDUSERID=1234 +BUILDUSERNAME=pbuilder + +# BINDMOUNTS is a space separated list of things to mount +# inside the chroot. +BINDMOUNTS="/var/cache/pbuilder/repo" + +# Set the debootstrap variant to 'buildd' type. +DEBOOTSTRAPOPTS[0]='--variant=buildd' + +# Set the PATH I am going to use inside pbuilder: default is "/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin" +export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin" + +# SHELL variable is used inside pbuilder by commands like 'su'; and they need sane values +export SHELL=/bin/bash + +# The name of debootstrap command. +DEBOOTSTRAP="debootstrap" + +# default PKGNAME_LOGFILE +PKGNAME_LOGFILE="__build__.log" diff --git a/debian/_buildscripts/local/scripts/additional files/user_home_folder/.pbuilderrc b/debian/_buildscripts/local/scripts/additional files/user_home_folder/.pbuilderrc index cb58cb895..d6662085c 100644 --- a/debian/_buildscripts/local/scripts/additional files/user_home_folder/.pbuilderrc +++ b/debian/_buildscripts/local/scripts/additional files/user_home_folder/.pbuilderrc @@ -1,5 +1,8 @@ #!/bin/bash +#-- this is necessary for running 'apt-ftparchive' in a hook script if required +EXTRAPACKAGES="$EXTRAPACKAGES apt-utils" + #-- get desired distribution and architecture if [ "$DIST" = "" ]; then DIST=$(lsb_release -cs) diff --git a/debian/_buildscripts/local/scripts/build_module.sh b/debian/_buildscripts/local/scripts/build_module.sh index 63d2a4574..586501c0e 100755 --- a/debian/_buildscripts/local/scripts/build_module.sh +++ b/debian/_buildscripts/local/scripts/build_module.sh @@ -98,6 +98,13 @@ if [ "bool_BUILD_LOCALLY" = "y" ]; then bool_INTERNAL_PBUILDER="n" fi +# pbuilder absolute paths +PBUILDER_REPO="/var/cache/pbuilder/repo" +PBUILDER_HOOK_DIR="/usr/lib/pbuilder/hooks" +PBUILDER_SHELL_HOOK="$PBUILDER_HOOK_DIR/C10shell" +PBUILDER_SHELL_HOOK_TEMPLATE="$PBUILDER_HOOK_DIR/__template_C10shell" +HOOKDIR="$PBUILDER_HOOK_DIR" # real pbuilder hook dir setting + # Local option variables # - internal pbuilder OPT_INTERNAL_PBUILDER=""