DEB build scripts: various fixes to allow normal user to build packages.

- removed need to mount/unmount TDE_DEBS_DIR folder into pbuilder repo folder
- removed need to create "/var/cache/pbuilder/repo" folder
- moved pbuilder hook folder to a subfolder of the user home folder
- updated readme file

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 6 years ago
parent 57bbfc7e86
commit 7a9e73d31a

@ -13,19 +13,17 @@ C) How to use the scripts
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.
- make sure to make the files in "usr/lib/pbuilder/hooks" executable
- make sure to make the files in "user home folder/.pbuilder/hooks" executable
3) Create base package with the command:
pbuilder --create
pbuilder --create
If you wish to build for a different distro, use the command:
DIST=<target distro> pbuilder --create
DIST=<target distro> pbuilder --create
4) Create a base folder for TDE, hereafter referred to as TDE_SRC (for example ~/tde_src)
4) Create a base folder for TDE, hereafter referred to as TDE_SRC (for example $HOME/tde_src)
5) Create the following folders [ see NOTE at point 0) about folder names ]
- in TDE_SRC: 0_logs : contains log files for repo update and global builds (more on this later)
@ -40,14 +38,19 @@ C) How to use the scripts
6) Clone TDE git repositories and extra dependency modules:
- cd "TDE_SRC/1_git"
- clone tde repo : git clone http://scm.trinitydesktop.org/scm/git/tde
- clone tde packaging repo: git clone http://scm.trinitydesktop.org/scm/git/tde-packaging
- download the source code for extra dependency modules from the official PPA:
https://quickbuild.pearsoncomputing.net/~trinity/+archive/trinity-nightly-build-dependencies/+packages
or from Slavek's PPA (usually more recently updated):
- clone tde repo : git clone https://mirror.git.trinitydesktop.org/gitea/TDE/tde
- clone tde packaging repo: git clone https://mirror.git.trinitydesktop.org/gitea/TDE/tde-packaging
- using a browser, download the source code for extra dependency modules from Slavek's PPA
(usually more recently updated):
https://quickbuild.pearsoncomputing.net/~slavek-banko/+archive/deps-r14/+packages
Make sure you select the correct modules for your distribution and copy them to TDE_SRC/1_git/edeps/<MODULE NAME>.
Do not download the .deb packages, since those will be rebuilt when building TDE.
or from the official PPA:
https://quickbuild.pearsoncomputing.net/~trinity/+archive/trinity-nightly-build-dependencies/+packages
NOTES:
* Once the page open in your browser, select your distro in the combobox and click the "Filter" button.
You should get a list of 10-15 modules, depending on the distro
* Click on one module at a time, it will expand and show a list of .deb and other files below.
* Save those files (exclude .deb files. Only .orig.tar.xz, .dsc, .debian.tar.xz are required) and store
them to TDE_SRC/1_git/edeps/<MODULE NAME> folder (one folder per module)
7) Setup the build scripts locally:
- copy build scripts from "TDE_SRC/1_git/tde-packaging/debian/_buildscripts/local/scripts" to "TDE_SRC/buildscripts"
@ -55,6 +58,9 @@ C) How to use the scripts
- cp _build_config_template.sh build_config.sh
- edit "build_config.sh" to set your preferences and check that the various folder names match the structure on your disk.
8) Add your user to the sudoers group (not required if you are root):
sudo adduser <your user> sudo
------------------------------
@ -65,7 +71,7 @@ Modules are built using the build_module.sh script. After the build is completed
The source code can be either the git repo or a local copy in TDE_SRC/2_build/build/<MODULE NAME>.
A module can be built in a clean chroot environment using pbuilder (default option) or locally using dpkg-buildpackage (useful for quick debugging/developing).
When using pbuilder, a hook can be used to invoke a shell when the build fails (see also "known issues").
When using pbuilder, a hook can be used to invoke a shell when the build fails.
Build logs are automatically stored to files, but can also be displayed during the build process.
The default location of a module build log is TDE_SRC/2_build/debs/<MODULE NAME>/src/__build__.log

@ -6,13 +6,11 @@
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=""
@ -39,10 +37,6 @@ APTCONFDIR=""
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'

@ -1,3 +0,0 @@
#!/bin/sh
(cd /var/cache/pbuilder/repo; apt-ftparchive packages . > Packages && gzip -c Packages >Packages.gz)
apt-get update

@ -99,11 +99,11 @@ if [ "bool_BUILD_LOCALLY" = "y" ]; then
fi
# pbuilder absolute paths
PBUILDER_REPO="/var/cache/pbuilder/repo"
PBUILDER_HOOK_DIR="/usr/lib/pbuilder/hooks"
PBUILDER_HOOK_DIR="$HOME/.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
PBUILDER_DEPS_HOOK="$PBUILDER_HOOK_DIR/D05deps"
PBUILDER_DEPS_HOOK_SAVE="$PBUILDER_HOOK_DIR/__saved_D05deps"
# Local option variables
# - internal pbuilder
@ -140,7 +140,7 @@ GIT_EXTRA_DEPENDENCIES="$TDE_DIR/$CFG_GIT_EXTRA_DEPENDENCIES"
HOOK_DIR="$TDE_DIR/$CFG_HOOK_DIR"
# This folders must exists
BASE_DIRS=("GIT_DIR" "BUILD_DIR" "SCRIPT_DIR" "GIT_TDE_MAIN" "GIT_TDE_PACKAGING" "GIT_EXTRA_DEPENDENCIES" "HOOK_DIR" "PBUILDER_REPO")
BASE_DIRS=("GIT_DIR" "BUILD_DIR" "SCRIPT_DIR" "GIT_TDE_MAIN" "GIT_TDE_PACKAGING" "GIT_EXTRA_DEPENDENCIES" "HOOK_DIR")
for var_name in ${BASE_DIRS[@]}; do
if [ ! -d "${!var_name}" ]; then
@ -413,20 +413,34 @@ else
rm "$PBUILDER_SHELL_HOOK" &>/dev/null
fi
fi
# Build
mount --bind "$TDE_DEBS_DIR" "$PBUILDER_REPO"
if [ $? -ne 0 ]; then
echo "Unable to mount folder \"$TDE_DEBS_DIR\" to \"$PBUILDER_REPO\". Can not proceed :("
do_exit 11
fi
#
# Build using pbuilder
echo -e "${CYellow}> Building using pbuilder${CNone}"
# Create pbuilder hook to make sure all available packages are scanned
# Store any existing D05 hook as a temporary file, this will be reinstated at the end
if [ -x "$PBUILDER_DEPS_HOOK" ]; then
mv "$PBUILDER_DEPS_HOOK" "$PBUILDER_DEPS_HOOK_SAVE"
fi
cat <<END_D05 > "$PBUILDER_DEPS_HOOK"
#!/bin/sh
(cd "$TDE_DEBS_DIR"; apt-ftparchive packages . > Packages)
echo "deb [trusted=yes] file://$TDE_DEBS_DIR ./" >> /etc/apt/sources.list
apt-get update
END_D05
chmod a+x "$PBUILDER_DEPS_HOOK"
# Build
eval pdebuild $OPT_INTERNAL_PBUILDER $OPT_SIGN_PKG_PBUILDER \
--architecture $ARCHITECTURE --buildresult \"$MOD_DEB_PATH\" \
--architecture $ARCHITECTURE \
--buildresult \"$MOD_DEB_PATH\" \
--pbuilderroot \"sudo DIST=$DISTRO_NAME ARCH=$ARCHITECTURE\" \
--logfile \"$BUILDING_LOG_FILE\" $OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\"
--logfile \"$BUILDING_LOG_FILE\" \
-- \
--bindmounts \"$TDE_DEBS_DIR\" \
--hookdir \"$PBUILDER_HOOK_DIR\" \
$OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\"
build_retval=$?
umount "$PBUILDER_REPO"
if [ -x "$PBUILDER_DEPS_HOOK" ]; then
mv "$PBUILDER_DEPS_HOOK_SAVE" "$PBUILDER_DEPS_HOOK"
fi
fi
if [ $build_retval -eq 0 ]; then

@ -40,7 +40,7 @@ if [ -d "$REPO_DIR" ]; then
rm -R "$REPO_DIR" &>/dev/null
fi
mkdir -p "$REPO_PKG_DIR"
rsync -aHS --exclude="*/src/*.xz" --exclude="*/src/*.dsc" --exclude="*/src/*.changes" --exclude="Packages*" "$TDE_DEBS_DIR/" "$REPO_PKG_DIR/"
rsync -aHS --exclude="*/src/*.xz" --exclude="*/src/*.dsc" --exclude="*/src/*.changes" --exclude="*/src/*.buildinfo" --exclude="Packages*" "$TDE_DEBS_DIR/" "$REPO_PKG_DIR/"
# Create package index file
echo -e "${CYellow}> Creating package index file${CNone}"

Loading…
Cancel
Save