From 4da401f0e8154dcb3e4afdd7c02f7288fa1e0ec5 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 25 Feb 2018 15:09:48 +0900 Subject: [PATCH] DEB build scripts: fixed support for extra dependency modules. Signed-off-by: Michele Calgaro --- .../local/scripts/00_extradeps.sh | 21 +++ .../_buildscripts/local/scripts/01_base_01.sh | 2 - .../local/scripts/10_others_02.sh | 6 + .../local/scripts/91_build_base.sh | 1 + debian/_buildscripts/local/scripts/README.txt | 149 +++++++++--------- .../local/scripts/_build_config_template.sh | 7 +- .../local/scripts/build_module.sh | 35 ++-- 7 files changed, 126 insertions(+), 95 deletions(-) create mode 100755 debian/_buildscripts/local/scripts/00_extradeps.sh diff --git a/debian/_buildscripts/local/scripts/00_extradeps.sh b/debian/_buildscripts/local/scripts/00_extradeps.sh new file mode 100755 index 000000000..46c56e73c --- /dev/null +++ b/debian/_buildscripts/local/scripts/00_extradeps.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +. ./_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "dependencies/libr" +build_module "edeps/gettext-kde" +build_module "dependencies/akode" +build_module "edeps/fireflies" +build_module "edeps/imlib" +build_module "edeps/opensync" +build_module "edeps/libbeagle" +build_module "edeps/pcsc-lite-nodbus" +build_module "edeps/lcms" +build_module "edeps/wv2" +build_module "edeps/jasper" +build_module "edeps/openslp-dfsg" + +set_log_end diff --git a/debian/_buildscripts/local/scripts/01_base_01.sh b/debian/_buildscripts/local/scripts/01_base_01.sh index b8c00a6a1..f1aed100b 100755 --- a/debian/_buildscripts/local/scripts/01_base_01.sh +++ b/debian/_buildscripts/local/scripts/01_base_01.sh @@ -5,8 +5,6 @@ #---------------------------- set_log_start -build_module "dependencies/libr" -build_module "dependencies/akode" build_module "dependencies/tqt3" build_module "dependencies/tqtinterface" build_module "dependencies/arts" diff --git a/debian/_buildscripts/local/scripts/10_others_02.sh b/debian/_buildscripts/local/scripts/10_others_02.sh index ea1d403bd..62f07f286 100755 --- a/debian/_buildscripts/local/scripts/10_others_02.sh +++ b/debian/_buildscripts/local/scripts/10_others_02.sh @@ -6,6 +6,12 @@ set_log_start build_module "tde-i18n" +build_module "edeps/compiz-trinity" +build_module "edeps/libcompizconfig-trinity" +build_module "edeps/compiz-fusion-bcop-trinity" +build_module "edeps/compiz-fusion-plugins-main-trinity" +build_module "edeps/compiz-fusion-plugins-extra-trinity" +build_module "edeps/compizconfig-python-trinity" build_module "applications/compizconfig-backend-tdeconfig" set_log_end diff --git a/debian/_buildscripts/local/scripts/91_build_base.sh b/debian/_buildscripts/local/scripts/91_build_base.sh index 42056ce41..a631a814f 100755 --- a/debian/_buildscripts/local/scripts/91_build_base.sh +++ b/debian/_buildscripts/local/scripts/91_build_base.sh @@ -1,5 +1,6 @@ #!/bin/bash +./00_extradeps.sh ./01_base_01.sh ./02_base_02.sh ./03_base_03.sh diff --git a/debian/_buildscripts/local/scripts/README.txt b/debian/_buildscripts/local/scripts/README.txt index e96065232..636507385 100644 --- a/debian/_buildscripts/local/scripts/README.txt +++ b/debian/_buildscripts/local/scripts/README.txt @@ -5,97 +5,101 @@ B) Notes about scripts C) How to use the scripts - A) Environment preparation ----------------------------- -0) * NOTE *: you can change folder names, as long as you update the "build_config.sh" file accordingly after the first run. +------------------------------ + A) Environment preparation +------------------------------ +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) - * You can use the file ".pbuilderrc" from following point 2) - it is recommended to update the mirror to use - with one near you. - * Create the folder "/var/cache/pbuilder/repo" -2) copy files from "additional files" folder to respectivily named folder. - "user_home_folder" is the user home folder path. + - 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. + 3) Create base package with the command: - DIST= pbuilder --create -4) create a base folder for TDE, hereafter referred to as TDE_SRC (for example ~/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) - 1_git : contains the git repo clones and build hook scripts - 2_build: folder used for build preparation and for local builds - 3_repo : local repo for package installation (to be configured in /etc/apt/sources.list) - buildscripts: contains a local copy of the build scripts, which can be modified as required -- in TDE_SRC/1_git: -== SKIP TEMPORARILY == - edeps : contains extra dependency modules necessary to build TDE -== SKIP END == - hooks : contains build hook scripts to execute ad-hoc code before and after the building process. - Mainly used to apply patches automatically during the building process -6) clone TDE git repositories: + pbuilder --create + If you wish to build for a different distro, use the command: + DIST= pbuilder --create + +4) Create a base folder for TDE, hereafter referred to as TDE_SRC (for example ~/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) + 1_git : contains the git repo clones and build hook scripts + 2_build: folder used for build preparation and for local builds + 3_repo : local repo for package installation (to be configured in /etc/apt/sources.list) + buildscripts: contains a local copy of the build scripts, which can be modified as required + - in TDE_SRC/1_git: + edeps : contains extra dependency modules necessary to build TDE + hooks : contains build hook scripts to execute ad-hoc code before and after the building process. + Mainly used to apply patches automatically during the building process + +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 -== SKIP TEMPORARILY == - - download dependency modules from the official PPA: - https://quickbuild.pearsoncomputing.net/~trinity/+archive/trinity-nightly-build-dependencies/+packages - or from Slavek 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/extra-dependencies/ - Examples: TDE_SRC/1_git/extra-dependencies/libr, TDE_SRC/1_git/extra-dependencies/imlib, ... -== SKIP END == -== TEMPORARILY ONLY == - >>> @Slavek: if you have a better path for download, please let me know <<< - - download extra dependency .deb modules from the official PPA: + - 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 PPA (usually more recently updated): + or from Slavek's PPA (usually more recently updated): https://quickbuild.pearsoncomputing.net/~slavek-banko/+archive/deps-r14/+packages - and save them inside the folders - TDE_SRC/2_build/debs/edeps// -== TEMPORARILY ONLY END == + Make sure you select the correct modules for your distribution and copy them to TDE_SRC/1_git/edeps/. + Do not download the .deb packages, since those will be rebuilt when building TDE. -7) - copy build scripts from "TDE_SRC/1_git/tde-packaging/debian/_buildscripts/local/scripts" to - "TDE_SRC/buildscripts" - - cd "TDE_SRC/buildscripts" - - ./update_git_repository.sh - -> the very first time this will create the TDE_SRC/buildscripts/build_config.sh file. - Edit the file to match your preferences and make sure to set TDE_DIR to your TDE_SRC folder. +7) Setup the build scripts locally: + - copy build scripts from "TDE_SRC/1_git/tde-packaging/debian/_buildscripts/local/scripts" to "TDE_SRC/buildscripts" + - cd "TDE_SRC/buildscripts" + - 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. - B) Notes about scripts ------------------------- + +------------------------------ + B) Notes about scripts +------------------------------ 1) * Notes * -Modules are built using the build_module.sh script. After the build is completed, the installation .deb files are located in TDE_SRC/2_build/debs// and the source code in TDE_SRC/2_build/debs//src/ +Modules are built using the build_module.sh script. After the build is completed, the installation .deb files are located in TDE_SRC/2_build/debs// and the source code and build reports in TDE_SRC/2_build/debs//src/ -The source can be either the git repo or a local copy in TDE_SRC/2_build/build/. -A module can be built in a clean chroot environment using pbuilder (default option) or locally using dpkg-buildpackage (useful for debugging/developing). +The source code can be either the git repo or a local copy in TDE_SRC/2_build/build/. +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"). Build logs are automatically stored to files, but can also be displayed during the build process. -The location of a module build log is TDE_SRC/2_build/debs//src/__build__.log +The default location of a module build log is TDE_SRC/2_build/debs//src/__build__.log When building sets of modules or the whole TDE, a global build summary is automatically stored to TDE_SRC/0_logs/build_result.log to quickly check what built and what failed. It is recommended to delete that file before starting a new TDE build (if not, build results will be appended at the end of the file). + 2) * Scripts description * +- update_git_repository.sh: +Scripts used to update the local clone of the git repositories. + Usage: + update_git_repository.sh + - build_module.sh: build a single module Usage: build_module.sh [options] module_name Options: -g (Git) : build from git repo sources. If missing, build from the local copy in build folder. -l (Local) : build the module locally. If missing, build in a clean chroot environment - -sl (Show Log) : output the building logs to terminal + -sl (Show Log) : output the building logs to terminal while the build is ongoing -lr (Log Result) : log (append) build result (OK, FAILED) to TDE_SRC/0_logs/build_result.log file -sh (Shell Hook) : use a shell hook for failing builds, only valid if building using pbuilder (clean chroot environment) -po (Prepare Only): only prepare the source folder but do not build the module. Useful to prepare the source code before doing local changes/development. The module can then be built from the modified local folder -d (Debug) : enable debug symbols if possible (debian/rules file must contain "RelWithDebInfo" for this to work) - -ip (Internal Pbuilder): build using internal pbuilder mode + -ip (Internal Pbuilder): build using internal pbuilder mode (experimental) - _build_config_template.sh -Template file for building configuration. Will be copied into TDE_SRC/build_config.sh upon first execution +Template file for building configuration. Will be copied into TDE_SRC/build_config.sh upon first execution, if not already +done when the environment was set up. - _build_common.sh -Utility script containing common code. No need for invoking it directly. +Utility script containing common code. No need for invoking this directly. - _build_set_common.sh -Utility script used to build sets of modules. No need for invoking it directly. +Utility script used to build sets of modules. No need for invoking this directly. -
_.sh A number of scripts used to build sets of modules. Each script builds an individual set. @@ -107,15 +111,13 @@ TDE_SRC/0_logs/build_result.log. -s N: if specified, skip first N modules from the set of modules The sets are logically grouped as "base system", "applications" and "others" -== SKIP TEMPORARILY == - 00_extradeps.sh : dependencies modules -== SKIP END == + 00_extradeps.sh : extra dependencies modules 01_base_01.sh - 03_base_03.sh : TDE base system 04_application_01.sh - 08_application_05.sh : application modules 09_others_01.sh - 10_others_02.sh : other modules that either fail to build/install or that are somehow less used 91_build_base.sh : whole TDE base system 92_build_applications.sh : all TDE applications in 04_application_01.sh - 08_application_05.sh - 93_build_base.sh : all modules in 09_others_01.sh - 10_others_02.sh + 93_build_others.sh : all modules in 09_others_01.sh - 10_others_02.sh - build_TDE.sh Script used to build the whole TDE at once. Calls the dd_setname.sh set scripts in order. @@ -124,34 +126,33 @@ Script used to build the whole TDE at once. Calls the dd_setname.sh set scripts Options: -s N: if specified, skip first N sets from the list of sets -== SKIP TEMPORARILY: not yet provided == - create_repo.sh Creates a local repository from the .deb files currently stored in TDE_SRC/2_build/debs. This repo can be used as installation repository, just add the following lines to /etc/apt/sources.list # --- LOCAL TDE REPOSITORY --- - deb [arch=##your arch here (ex. amd64)## trusted=yes] file:TDE_SRC(full path, ex:/home/tde_src)/3_repo/dists/testing/main/binary-##your arch here (ex. amd64)## ./ -== SKIP END == - -- update_git_repository.sh: -Scripts used to update the local clone of the git repositories. - Usage: - update_git_repository.sh + deb [arch= trusted=yes] file:TDE_SRC/3_repo main + For example: + deb [arch=amd64 trusted=yes] file:/home/tde_src/3_repo/ buster main + 3) * Building hooks * Hooks are available to execute ad-hoc code before and after the build process. For example this is very useful to automatically apply patches. -Currently there are two type of hooks: -- pre_build : applied just before switching the module to quilt format and build -- post_build: applied just after the build (dpkg-buildpackage or pbuilder) has terminated -To use a hook, just create an executable pre_build.sh and/or post_build.sh script in the TDE_SRC/1_git/hooks/ folder. The scripts are executed in the build_module.sh environment, so have access to all the variable defined in that file. See the files in the "hook examples" folder for real usage samples. +There are two type of hooks: +- pre_build : applied before switching the module to quilt format and build +- post_build: applied after the build (dpkg-buildpackage or pbuilder) has terminated +To use a hook, create an executable script (pre_build.sh and/or post_build.sh) in the TDE_SRC/1_git/hooks/ folder. The scripts are executed in the build_module.sh environment, so have access to all the variables defined in that file. See the files in the "hook examples" folder for real usage samples. + - C) How to use the scripts ---------------------------- +------------------------------ + C) How to use the scripts +------------------------------ 1) Follow the steps in section "A) Environment preparation" (only required the first time) 2) cd "TDE_SRC/buildscripts" 3) ./update_git_repository.sh -> update git repository, wait until "Update completed" is printed out. Check log in TDE_SRC/0_logs/ if you wish 4) Run "pbuilder update" at the beginning of the day to update the base package to the latest version. This will speed up the process when building several modules in sequence. +5) build modules as per your needs. Examples of real usage: @@ -169,7 +170,7 @@ Examples of real usage: 4.2) build a single set (optional) delete the TDE_SRC/0_logs/build_result.log file ./01_base_01.sh : build this set. - ./03_base_03.sh -s 3 : build this set but skip the first 3 modules (tdeartwork, tdegames, tdetoys) + ./03_base_03.sh -s 3 : build this set but skip the first 3 modules of the set. 4.3) build all TDE ./build_TDE.sh : build all TDE diff --git a/debian/_buildscripts/local/scripts/_build_config_template.sh b/debian/_buildscripts/local/scripts/_build_config_template.sh index 51aac00fe..7db11f84a 100644 --- a/debian/_buildscripts/local/scripts/_build_config_template.sh +++ b/debian/_buildscripts/local/scripts/_build_config_template.sh @@ -23,10 +23,13 @@ CFG_SCRIPT_LOG_DIR="0_logs" CFG_GIT_DIR="1_git" CFG_BUILD_DIR="2_build" CFG_REPO_DIR="3_repo" +CFG_EXTRA_DEPS_DIR="edeps" # Relative to CFG_GIT_DIR folder +CFG_HOOKS_DIR="hooks" # Relative to CFG_GIT_DIR folder +# Composite paths 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/edeps" -CFG_HOOK_DIR="$CFG_GIT_DIR/hooks" +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" diff --git a/debian/_buildscripts/local/scripts/build_module.sh b/debian/_buildscripts/local/scripts/build_module.sh index 7862e5fe9..63d2a4574 100755 --- a/debian/_buildscripts/local/scripts/build_module.sh +++ b/debian/_buildscripts/local/scripts/build_module.sh @@ -74,7 +74,7 @@ for arg in $@; do bool_PREPARE_ONLY="y" elif [ "$arg" = "-d" ]; then # build with Debug symbols (used in hook scripts) bool_DEBUG_MODE="y" - elif [ "$arg" = "-ip" ]; then # build using Internal Pbuilder + elif [ "$arg" = "-ip" ]; then # build using Internal Pbuilder (experimental) bool_INTERNAL_PBUILDER="y" elif [ "$MOD_NAME" = "" ]; then # module to be built MOD_NAME="$arg" @@ -86,8 +86,8 @@ if [ "$MOD_NAME" = "" ]; then do_exit 3 fi -# Check if module is an extra dependency (i.e. from the nightly build dependency PPA) -if [[ $MOD_NAME =~ ^edeps/ ]]; then +# Check if module is an extra dependency +if [[ $MOD_NAME =~ ^$CFG_EXTRA_DEPS_DIR/ ]]; then bool_EXTRADEP_MOD="y" fi @@ -111,6 +111,11 @@ if [ ! -z "$GPG_SIGN_KEYID" ]; then OPT_SIGN_PKG_LOCAL="-k$GPG_SIGN_KEYID" OPT_SIGN_PKG_PBUILDER="--auto-debsign --debsign-k $GPG_SIGN_KEYID" fi +# - show logs +OPT_SHOW_LOGS="&>" +if [ "$bool_SHOW_BUILD_LOGS" = "y" ]; then + OPT_SHOW_LOGS=" | tee " +fi # Log start @@ -239,10 +244,11 @@ if [ "$bool_COPY_MOD_SRC" = "y" ]; then if [ -d "$MOD_BUILD_PATH" ]; then rm -R "$MOD_BUILD_PATH" fi - if [ "$bool_SHOW_BUILD_LOGS" = "y" ]; then - dpkg-source --no-copy --no-check -x `find "$MOD_GIT_PATH" -name '*.dsc'` "$MOD_BUILD_PATH" - else - dpkg-source --no-copy --no-check -x `find "$MOD_GIT_PATH" -name '*.dsc'` "$MOD_BUILD_PATH" &>/dev/null + eval dpkg-source --no-copy --no-check -x `find "$MOD_GIT_PATH" -name '*.dsc'` \ + \"$MOD_BUILD_PATH\" $OPT_SHOW_LOGS/dev/null + # Make sure patches are not reapplied in future local builds. This could stop pdebuild from working. + if [ -f "$MOD_BUILD_PATH/debian/patches/series" ]; then + cp /dev/null "$MOD_BUILD_PATH/debian/patches/series" fi else echo "There must be one and only one .dsc file in \"$MOD_GIT_PATH\"" @@ -383,11 +389,7 @@ cd "$MOD_BUILD_PATH" if [ "$bool_BUILD_LOCALLY" = "y" ]; then ## Build module locally echo -e "${CYellow}> Building locally${CNone}" - if [ "$bool_SHOW_BUILD_LOGS" = "y" ]; then - dpkg-buildpackage $OPT_SIGN_PKG_LOCAL | tee "$BUILDING_LOG_FILE" - else - dpkg-buildpackage $OPT_SIGN_PKG_LOCAL &>"$BUILDING_LOG_FILE" - fi + eval dpkg-buildpackage $OPT_SIGN_PKG_LOCAL $OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\" build_retval=$? # else @@ -412,11 +414,10 @@ else fi # echo -e "${CYellow}> Building using pbuilder${CNone}" - if [ "$bool_SHOW_BUILD_LOGS" = "y" ]; then - pdebuild $OPT_INTERNAL_PBUILDER $OPT_SIGN_PKG_PBUILDER --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$DISTRO_NAME ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" - else - pdebuild $OPT_INTERNAL_PBUILDER $OPT_SIGN_PKG_PBUILDER --architecture $ARCHITECTURE --buildresult "$MOD_DEB_PATH" --pbuilderroot "sudo DIST=$DISTRO_NAME ARCH=$ARCHITECTURE" --logfile "$BUILDING_LOG_FILE" &>"$BUILDING_LOG_FILE" - fi + eval pdebuild $OPT_INTERNAL_PBUILDER $OPT_SIGN_PKG_PBUILDER \ + --architecture $ARCHITECTURE --buildresult \"$MOD_DEB_PATH\" \ + --pbuilderroot \"sudo DIST=$DISTRO_NAME ARCH=$ARCHITECTURE\" \ + --logfile \"$BUILDING_LOG_FILE\" $OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\" build_retval=$? umount "$PBUILDER_REPO" fi