diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2018-06-03 16:02:02 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2018-06-03 16:02:02 +0900 |
commit | 7a9e73d31a930fd85e0c3768336d4b8963552582 (patch) | |
tree | 36d452b3bc5f77f3a3f3e6c026bf60fcd5a37d65 /debian/_buildscripts/local/scripts | |
parent | 57bbfc7e86b1466a2f6b6682e8511ae7bd8ee3be (diff) | |
download | tde-packaging-7a9e73d31a930fd85e0c3768336d4b8963552582.tar.gz tde-packaging-7a9e73d31a930fd85e0c3768336d4b8963552582.zip |
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>
Diffstat (limited to 'debian/_buildscripts/local/scripts')
-rw-r--r-- | debian/_buildscripts/local/scripts/README.txt | 34 | ||||
-rw-r--r-- | debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc | 6 | ||||
-rwxr-xr-x | debian/_buildscripts/local/scripts/additional files/user_home_folder/.pbuilder/hooks/__template_C10shell (renamed from debian/_buildscripts/local/scripts/additional files/usr/lib/pbuilder/hooks/__template_C10shell) | 0 | ||||
-rwxr-xr-x | debian/_buildscripts/local/scripts/additional files/usr/lib/pbuilder/hooks/D05deps | 3 | ||||
-rwxr-xr-x | debian/_buildscripts/local/scripts/build_module.sh | 42 | ||||
-rwxr-xr-x | debian/_buildscripts/local/scripts/create_repo.sh | 2 |
6 files changed, 49 insertions, 38 deletions
diff --git a/debian/_buildscripts/local/scripts/README.txt b/debian/_buildscripts/local/scripts/README.txt index f409076be..244b323c3 100644 --- a/debian/_buildscripts/local/scripts/README.txt +++ b/debian/_buildscripts/local/scripts/README.txt @@ -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 diff --git a/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc b/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc index 467a29ad1..04869a03b 100644 --- a/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc +++ b/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc @@ -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' diff --git a/debian/_buildscripts/local/scripts/additional files/usr/lib/pbuilder/hooks/__template_C10shell b/debian/_buildscripts/local/scripts/additional files/user_home_folder/.pbuilder/hooks/__template_C10shell index 3e2f1c865..3e2f1c865 100755 --- a/debian/_buildscripts/local/scripts/additional files/usr/lib/pbuilder/hooks/__template_C10shell +++ b/debian/_buildscripts/local/scripts/additional files/user_home_folder/.pbuilder/hooks/__template_C10shell diff --git a/debian/_buildscripts/local/scripts/additional files/usr/lib/pbuilder/hooks/D05deps b/debian/_buildscripts/local/scripts/additional files/usr/lib/pbuilder/hooks/D05deps deleted file mode 100755 index a42f5bef0..000000000 --- a/debian/_buildscripts/local/scripts/additional files/usr/lib/pbuilder/hooks/D05deps +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -(cd /var/cache/pbuilder/repo; apt-ftparchive packages . > Packages && gzip -c Packages >Packages.gz) -apt-get update diff --git a/debian/_buildscripts/local/scripts/build_module.sh b/debian/_buildscripts/local/scripts/build_module.sh index 586501c0e..3961123fe 100755 --- a/debian/_buildscripts/local/scripts/build_module.sh +++ b/debian/_buildscripts/local/scripts/build_module.sh @@ -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 diff --git a/debian/_buildscripts/local/scripts/create_repo.sh b/debian/_buildscripts/local/scripts/create_repo.sh index 5f64c7032..d374e41c7 100755 --- a/debian/_buildscripts/local/scripts/create_repo.sh +++ b/debian/_buildscripts/local/scripts/create_repo.sh @@ -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}" |