From f7fed43409d307ee2606ddc32c6e5cab3caf4ef8 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 10 Feb 2018 13:01:36 +0900 Subject: DEB build script: user is now required to copy the build scripts to a local folder Signed-off-by: Michele Calgaro --- debian/_buildscripts/local/scripts/README.txt | 16 ++++--- .../_buildscripts/local/scripts/_build_common.sh | 53 +++++++++++++--------- .../local/scripts/_build_config_template.sh | 2 + 3 files changed, 43 insertions(+), 28 deletions(-) (limited to 'debian/_buildscripts/local') diff --git a/debian/_buildscripts/local/scripts/README.txt b/debian/_buildscripts/local/scripts/README.txt index 6f57d3abc..e96065232 100644 --- a/debian/_buildscripts/local/scripts/README.txt +++ b/debian/_buildscripts/local/scripts/README.txt @@ -12,9 +12,7 @@ C) How to use the scripts * 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" - * Create base package with the command: - DIST= pbuilder --create -2) copy files from "additional files" folder to respective folder. +2) copy files from "additional files" folder to respectivily named folder. "user_home_folder" is the user home folder path. 3) Create base package with the command: DIST= pbuilder --create @@ -24,6 +22,7 @@ C) How to use the scripts 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 @@ -52,9 +51,12 @@ C) How to use the scripts TDE_SRC/2_build/debs/edeps// == TEMPORARILY ONLY END == -7) cd "TDE_SRC/1_git/tde-packaging/debian/_buildscripts/local/scripts/" - ./update_git_repository.sh -> the very first time this will create the TDE_SRC/build_config.sh file. - Edit the file to match your preferences. +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. B) Notes about scripts @@ -145,7 +147,7 @@ To use a hook, just create an executable pre_build.sh and/or post_build.sh scrip C) How to use the scripts --------------------------- 1) Follow the steps in section "A) Environment preparation" (only required the first time) -2) cd "TDE_SRC/1_git/tde-packaging/debian/_buildscripts/local/scripts/" +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 diff --git a/debian/_buildscripts/local/scripts/_build_common.sh b/debian/_buildscripts/local/scripts/_build_common.sh index 41ca19cf9..72649dc89 100755 --- a/debian/_buildscripts/local/scripts/_build_common.sh +++ b/debian/_buildscripts/local/scripts/_build_common.sh @@ -37,28 +37,9 @@ function init_common() { # Check script folder SCRIPT_DIR=$(dirname $(readlink -f "$0")) - cd $SCRIPT_DIR - BASE_DIR=${PWD##*/} - if [ "$BASE_DIR" != "scripts" ]; then - echo "This script can only be run from the script directory." - exit 1 - fi - - #---------------------------- - # TDE source folder - cd `git rev-parse --show-toplevel` - CURR_DIR=${PWD##*/} - if [ "$CURR_DIR" != "tde-packaging" ]; then - echo "Something wrong with folder structure.\nThis script should be located in the tde-packaging directory." - exit 1 - fi - cd ../.. - TDE_DIR=$PWD - cd $SCRIPT_DIR - #---------------------------- # Read config settings - CFG_FILE=$TDE_DIR/build_config.sh + CFG_FILE=$SCRIPT_DIR/build_config.sh if [ -f "$CFG_FILE" ]; then . "$CFG_FILE" else @@ -66,8 +47,38 @@ function init_common() echo "Creating TDE build configuration file from template as $CFG_FILE." echo "Please check and modify as required, then rerun this script." cp "$SCRIPT_DIR/_build_config_template.sh" "$CFG_FILE" - exit 0 + exit 1 + fi + + # TDE root folder must exist + if [ ! -d "$TDE_DIR" ]; then + echo -e "${CYellow} --- ERROR ---${CNone}" + echo "A valid TDE root folder could not be located. Something is wrong with your configuration" + echo "in the config file $CFG_FILE" + echo "Please check and modify the TDE_DIR variable as required, then rerun this script." + exit 2 + fi + # Search for main TDE repo + cd "$TDE_DIR/$CFG_GIT_TDE_MAIN" &>/dev/null + CURR_DIR=$(git rev-parse --show-toplevel 2>/dev/null) + if [ -z "$CURR_DIR" ]; then + echo -e "${CYellow} --- ERROR ---${CNone}" + echo "Main TDE repo could not be located. Something is wrong with your configuration" + echo "in the config file $CFG_FILE" + echo "Please check and modify the TDE_DIR variable as required, then rerun this script." + exit 3 + fi + # Search for TDE packaging repo + cd "$TDE_DIR/$CFG_GIT_TDE_PACKAGING" &>/dev/null + CURR_DIR=$(git rev-parse --show-toplevel 2>/dev/null) + if [ -z "$CURR_DIR" ]; then + echo -e "${CYellow} --- ERROR ---${CNone}" + echo "TDE packaging repo could not be located. Something is wrong with your configuration" + echo "in the config file $CFG_FILE" + echo "Please check and modify the TDE_DIR variable as required, then rerun this script." + exit 4 fi + SCRIPT_LOG_DIR=$TDE_DIR/$CFG_SCRIPT_LOG_DIR LOG_RESULT_FILENAME="$SCRIPT_LOG_DIR/build_result.log" # Log result into the common build logfile diff --git a/debian/_buildscripts/local/scripts/_build_config_template.sh b/debian/_buildscripts/local/scripts/_build_config_template.sh index 5a465acb2..589278eba 100644 --- a/debian/_buildscripts/local/scripts/_build_config_template.sh +++ b/debian/_buildscripts/local/scripts/_build_config_template.sh @@ -16,6 +16,8 @@ BUILD_DEFAULT_OPTIONS="-g -lr" # default building options (pbuilder) #---------------------------- # Base directories #---------------------------- +# TDE root folder +TDE_DIR="" # Relative paths CFG_SCRIPT_LOG_DIR="0_logs" CFG_GIT_DIR="1_git" -- cgit v1.2.1