From eeaccbeddbaa2974406eb20cbb7beca3fb4a59f0 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 11 Jul 2018 23:38:32 +0900 Subject: DEB build scripts: several enhancements as follow: - major rework of update_repositories.sh script, which now supports multiple branches and provide better feedback to user. - added support for pre-built extra dependency packages. A user can now use Slavek Banko's binary packages instead of building the extra dependency locally. This removes a quite tedious process during the setup of the building environment. - bug fixes and more user friendly folder names. - improved README to cover the complete process until TDE installation. Special thanks to Gregory Guy for testing and feedback done so far. Signed-off-by: Michele Calgaro --- debian/_buildscripts/local/00_extradeps.sh | 24 ++ debian/_buildscripts/local/01_base_01.sh | 24 ++ debian/_buildscripts/local/02_base_02.sh | 20 + debian/_buildscripts/local/03_base_03.sh | 19 + debian/_buildscripts/local/04_applications_01.sh | 23 ++ debian/_buildscripts/local/05_applications_02.sh | 29 ++ debian/_buildscripts/local/06_applications_03.sh | 29 ++ debian/_buildscripts/local/07_applications_04.sh | 19 + debian/_buildscripts/local/08_applications_05.sh | 31 ++ debian/_buildscripts/local/09_applications_06.sh | 29 ++ debian/_buildscripts/local/10_others_01.sh | 28 ++ debian/_buildscripts/local/11_others_02.sh | 19 + debian/_buildscripts/local/91_build_base.sh | 8 + .../_buildscripts/local/92_build_applications.sh | 9 + debian/_buildscripts/local/93_build_others.sh | 4 + debian/_buildscripts/local/99_build_TDE.sh | 54 +++ debian/_buildscripts/local/README.txt | 248 +++++++++++ .../local/additional_files/etc/pbuilderrc | 176 ++++++++ debian/_buildscripts/local/build_module.sh | 432 +++++++++++++++++++ debian/_buildscripts/local/create_repo.sh | 54 +++ .../applications/kaffeine/kaffeine-wizard.diff | 65 +++ .../applications/kaffeine/pre_build.sh | 13 + .../hook_examples/tdebase/018_kate_save_all.diff | 37 ++ .../local/hook_examples/tdebase/pre_build.sh | 16 + .../hook_examples/tdebase/tdebase-usesak.diff | 15 + .../hook_examples/tdelibs/038_placeholder.diff | 64 +++ .../local/hook_examples/tdelibs/pre_build.sh | 13 + debian/_buildscripts/local/internals/C10shell | 18 + .../_buildscripts/local/internals/_build_common.sh | 248 +++++++++++ .../local/internals/_build_set_common.sh | 75 ++++ .../local/internals/_config_template.sh | 34 ++ debian/_buildscripts/local/internals/_pbuilder.sh | 91 +++++ .../_buildscripts/local/internals/distro_list.txt | 31 ++ .../_buildscripts/local/internals/extra_deps.txt | 7 + debian/_buildscripts/local/scripts/00_extradeps.sh | 21 - debian/_buildscripts/local/scripts/01_base_01.sh | 22 - debian/_buildscripts/local/scripts/02_base_02.sh | 20 - debian/_buildscripts/local/scripts/03_base_03.sh | 19 - .../local/scripts/04_applications_01.sh | 23 -- .../local/scripts/05_applications_02.sh | 29 -- .../local/scripts/06_applications_03.sh | 29 -- .../local/scripts/07_applications_04.sh | 36 -- .../local/scripts/08_applications_05.sh | 34 -- debian/_buildscripts/local/scripts/09_others_01.sh | 28 -- debian/_buildscripts/local/scripts/10_others_02.sh | 17 - .../_buildscripts/local/scripts/91_build_base.sh | 6 - .../local/scripts/92_build_applications.sh | 8 - .../_buildscripts/local/scripts/93_build_others.sh | 4 - debian/_buildscripts/local/scripts/99_build_TDE.sh | 89 ---- debian/_buildscripts/local/scripts/README.txt | 207 ---------- .../local/scripts/additional files/etc/pbuilderrc | 179 -------- debian/_buildscripts/local/scripts/build_module.sh | 455 --------------------- debian/_buildscripts/local/scripts/create_repo.sh | 55 --- .../applications/kaffeine/kaffeine-wizard.diff | 65 --- .../applications/kaffeine/pre_build.sh | 13 - .../hook examples/tdebase/018_kate_save_all.diff | 37 -- .../scripts/hook examples/tdebase/pre_build.sh | 16 - .../hook examples/tdebase/tdebase-usesak.diff | 15 - .../hook examples/tdelibs/038_placeholder.diff | 64 --- .../scripts/hook examples/tdelibs/pre_build.sh | 13 - .../_buildscripts/local/scripts/internals/C10shell | 18 - .../local/scripts/internals/_build_common.sh | 162 -------- .../local/scripts/internals/_build_set_common.sh | 75 ---- .../local/scripts/internals/_config_template.sh | 42 -- .../local/scripts/internals/_pbuilder.sh | 75 ---- .../scripts/internals/_update_repositories.sh | 72 ---- .../local/scripts/internals/distro_list.txt | 31 -- .../local/scripts/update_repositories.sh | 16 - debian/_buildscripts/local/update_repositories.sh | 188 +++++++++ 69 files changed, 2194 insertions(+), 1995 deletions(-) create mode 100755 debian/_buildscripts/local/00_extradeps.sh create mode 100755 debian/_buildscripts/local/01_base_01.sh create mode 100755 debian/_buildscripts/local/02_base_02.sh create mode 100755 debian/_buildscripts/local/03_base_03.sh create mode 100755 debian/_buildscripts/local/04_applications_01.sh create mode 100755 debian/_buildscripts/local/05_applications_02.sh create mode 100755 debian/_buildscripts/local/06_applications_03.sh create mode 100755 debian/_buildscripts/local/07_applications_04.sh create mode 100755 debian/_buildscripts/local/08_applications_05.sh create mode 100755 debian/_buildscripts/local/09_applications_06.sh create mode 100755 debian/_buildscripts/local/10_others_01.sh create mode 100755 debian/_buildscripts/local/11_others_02.sh create mode 100755 debian/_buildscripts/local/91_build_base.sh create mode 100755 debian/_buildscripts/local/92_build_applications.sh create mode 100755 debian/_buildscripts/local/93_build_others.sh create mode 100755 debian/_buildscripts/local/99_build_TDE.sh create mode 100644 debian/_buildscripts/local/README.txt create mode 100644 debian/_buildscripts/local/additional_files/etc/pbuilderrc create mode 100755 debian/_buildscripts/local/build_module.sh create mode 100755 debian/_buildscripts/local/create_repo.sh create mode 100644 debian/_buildscripts/local/hook_examples/applications/kaffeine/kaffeine-wizard.diff create mode 100755 debian/_buildscripts/local/hook_examples/applications/kaffeine/pre_build.sh create mode 100644 debian/_buildscripts/local/hook_examples/tdebase/018_kate_save_all.diff create mode 100755 debian/_buildscripts/local/hook_examples/tdebase/pre_build.sh create mode 100644 debian/_buildscripts/local/hook_examples/tdebase/tdebase-usesak.diff create mode 100644 debian/_buildscripts/local/hook_examples/tdelibs/038_placeholder.diff create mode 100755 debian/_buildscripts/local/hook_examples/tdelibs/pre_build.sh create mode 100755 debian/_buildscripts/local/internals/C10shell create mode 100755 debian/_buildscripts/local/internals/_build_common.sh create mode 100755 debian/_buildscripts/local/internals/_build_set_common.sh create mode 100644 debian/_buildscripts/local/internals/_config_template.sh create mode 100755 debian/_buildscripts/local/internals/_pbuilder.sh create mode 100644 debian/_buildscripts/local/internals/distro_list.txt create mode 100644 debian/_buildscripts/local/internals/extra_deps.txt delete mode 100755 debian/_buildscripts/local/scripts/00_extradeps.sh delete mode 100755 debian/_buildscripts/local/scripts/01_base_01.sh delete mode 100755 debian/_buildscripts/local/scripts/02_base_02.sh delete mode 100755 debian/_buildscripts/local/scripts/03_base_03.sh delete mode 100755 debian/_buildscripts/local/scripts/04_applications_01.sh delete mode 100755 debian/_buildscripts/local/scripts/05_applications_02.sh delete mode 100755 debian/_buildscripts/local/scripts/06_applications_03.sh delete mode 100755 debian/_buildscripts/local/scripts/07_applications_04.sh delete mode 100755 debian/_buildscripts/local/scripts/08_applications_05.sh delete mode 100755 debian/_buildscripts/local/scripts/09_others_01.sh delete mode 100755 debian/_buildscripts/local/scripts/10_others_02.sh delete mode 100755 debian/_buildscripts/local/scripts/91_build_base.sh delete mode 100755 debian/_buildscripts/local/scripts/92_build_applications.sh delete mode 100755 debian/_buildscripts/local/scripts/93_build_others.sh delete mode 100755 debian/_buildscripts/local/scripts/99_build_TDE.sh delete mode 100644 debian/_buildscripts/local/scripts/README.txt delete mode 100644 debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc delete mode 100755 debian/_buildscripts/local/scripts/build_module.sh delete mode 100755 debian/_buildscripts/local/scripts/create_repo.sh delete mode 100644 debian/_buildscripts/local/scripts/hook examples/applications/kaffeine/kaffeine-wizard.diff delete mode 100755 debian/_buildscripts/local/scripts/hook examples/applications/kaffeine/pre_build.sh delete mode 100644 debian/_buildscripts/local/scripts/hook examples/tdebase/018_kate_save_all.diff delete mode 100755 debian/_buildscripts/local/scripts/hook examples/tdebase/pre_build.sh delete mode 100644 debian/_buildscripts/local/scripts/hook examples/tdebase/tdebase-usesak.diff delete mode 100644 debian/_buildscripts/local/scripts/hook examples/tdelibs/038_placeholder.diff delete mode 100755 debian/_buildscripts/local/scripts/hook examples/tdelibs/pre_build.sh delete mode 100755 debian/_buildscripts/local/scripts/internals/C10shell delete mode 100755 debian/_buildscripts/local/scripts/internals/_build_common.sh delete mode 100755 debian/_buildscripts/local/scripts/internals/_build_set_common.sh delete mode 100644 debian/_buildscripts/local/scripts/internals/_config_template.sh delete mode 100755 debian/_buildscripts/local/scripts/internals/_pbuilder.sh delete mode 100755 debian/_buildscripts/local/scripts/internals/_update_repositories.sh delete mode 100644 debian/_buildscripts/local/scripts/internals/distro_list.txt delete mode 100755 debian/_buildscripts/local/scripts/update_repositories.sh create mode 100755 debian/_buildscripts/local/update_repositories.sh (limited to 'debian/_buildscripts') diff --git a/debian/_buildscripts/local/00_extradeps.sh b/debian/_buildscripts/local/00_extradeps.sh new file mode 100755 index 000000000..3a101d049 --- /dev/null +++ b/debian/_buildscripts/local/00_extradeps.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +if [[ "$USE_PREBUILD_EXTRA_DEPS" = "y" ]]; then + echo -e "${CBrown}#### Use of pre-built extra dependency packages is currently configured. Nothing to do. ####\n${CNone}" + echo "Use of pre-built extra dependency packages is currently configured. Nothing to do." >>"$LOG_BUILD_RESULT_FILENAME" +else + build_module "edeps/gettext-kde" + 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" +fi + +set_log_end diff --git a/debian/_buildscripts/local/01_base_01.sh b/debian/_buildscripts/local/01_base_01.sh new file mode 100755 index 000000000..4b7979475 --- /dev/null +++ b/debian/_buildscripts/local/01_base_01.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "dependencies/libr" +build_module "dependencies/akode" +build_module "dependencies/tqt3" +build_module "dependencies/tqtinterface" +build_module "dependencies/arts" +build_module "dependencies/dbus-tqt" +build_module "dependencies/dbus-1-tqt" +build_module "dependencies/tqca-tls" +build_module "dependencies/libart-lgpl" +build_module "dependencies/avahi-tqt" +build_module "dependencies/libcaldav" +build_module "dependencies/libcarddav" +build_module "tdelibs" +build_module "libraries/libtdeldap" +build_module "tdebase" + +set_log_end diff --git a/debian/_buildscripts/local/02_base_02.sh b/debian/_buildscripts/local/02_base_02.sh new file mode 100755 index 000000000..f92cb7f17 --- /dev/null +++ b/debian/_buildscripts/local/02_base_02.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "dependencies/sip4-tqt" +build_module "dependencies/tqscintilla" +build_module "dependencies/python-tqt" +build_module "libraries/python-trinity" +build_module "libraries/pytdeextensions" +build_module "tdebindings" +build_module "tdeutils" +build_module "tdemultimedia" +build_module "tdeaccessibility" +build_module "tdenetwork" +build_module "tdeadmin" + +set_log_end diff --git a/debian/_buildscripts/local/03_base_03.sh b/debian/_buildscripts/local/03_base_03.sh new file mode 100755 index 000000000..11209ff55 --- /dev/null +++ b/debian/_buildscripts/local/03_base_03.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "tdeartwork" +build_module "tdegames" +build_module "tdetoys" +build_module "tdeedu" +build_module "tdegraphics" +build_module "tdepim" +build_module "tdeaddons" +build_module "tdesdk" +build_module "tdevelop" +build_module "tdewebdev" + +set_log_end diff --git a/debian/_buildscripts/local/04_applications_01.sh b/debian/_buildscripts/local/04_applications_01.sh new file mode 100755 index 000000000..4901f3d9e --- /dev/null +++ b/debian/_buildscripts/local/04_applications_01.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "libraries/libkipi" +build_module "libraries/libkdcraw" +build_module "libraries/libkexiv2" +build_module "libraries/kipi-plugins" +build_module "applications/abakus" +build_module "applications/amarok" +build_module "applications/basket" +build_module "applications/digikam" +build_module "applications/dolphin" +build_module "applications/filelight" +build_module "applications/gtk3-tqt-engine" +build_module "applications/gtk-qt-engine" +build_module "applications/gwenview" +build_module "applications/gwenview-i18n" + +set_log_end diff --git a/debian/_buildscripts/local/05_applications_02.sh b/debian/_buildscripts/local/05_applications_02.sh new file mode 100755 index 000000000..489f832d4 --- /dev/null +++ b/debian/_buildscripts/local/05_applications_02.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "applications/k3b" +build_module "applications/k3b-i18n" +build_module "applications/k9copy" +build_module "applications/kaffeine" +build_module "applications/kaffeine-mozilla" +build_module "applications/kasablanca" +build_module "applications/katapult" +build_module "applications/kbarcode" +build_module "applications/kbfx" +build_module "applications/kbibtex" +build_module "applications/kbiff" +build_module "applications/kbookreader" +build_module "applications/kchmviewer" +build_module "applications/kcmautostart" +# LDAP packages +build_module "libraries/libtdeldap" +build_module "applications/kcmldap" +build_module "applications/kcmldapcontroller" +build_module "applications/kcmldapmanager" +build_module "applications/kerberostray" + +set_log_end diff --git a/debian/_buildscripts/local/06_applications_03.sh b/debian/_buildscripts/local/06_applications_03.sh new file mode 100755 index 000000000..75a8a7e15 --- /dev/null +++ b/debian/_buildscripts/local/06_applications_03.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "applications/kcpuload" +build_module "applications/kdbg" +build_module "applications/kdbusnotification" +build_module "applications/kdiff3" +build_module "applications/kdirstat" +build_module "applications/keep" +build_module "applications/kftpgrabber" +build_module "applications/kile" +build_module "applications/kima" +build_module "applications/kkbswitch" +build_module "applications/klcddimmer" +build_module "applications/kmplayer" +build_module "applications/kmyfirewall" +build_module "applications/kmymoney" +build_module "applications/knemo" +build_module "applications/knetload" +build_module "applications/knetstats" +build_module "applications/knmap" +build_module "applications/knowit" +build_module "applications/knutclient" + +set_log_end diff --git a/debian/_buildscripts/local/07_applications_04.sh b/debian/_buildscripts/local/07_applications_04.sh new file mode 100755 index 000000000..2dda86fe4 --- /dev/null +++ b/debian/_buildscripts/local/07_applications_04.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "applications/koffice" +build_module "applications/koffice-i18n" +build_module "applications/keximdb" +build_module "applications/konversation" +build_module "applications/kooldock" +build_module "applications/kopete-otr" +build_module "applications/kpicosim" +build_module "applications/kpilot" +build_module "applications/kplayer" + +set_log_end + diff --git a/debian/_buildscripts/local/08_applications_05.sh b/debian/_buildscripts/local/08_applications_05.sh new file mode 100755 index 000000000..aae147370 --- /dev/null +++ b/debian/_buildscripts/local/08_applications_05.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "applications/krecipes" +build_module "applications/krename" +build_module "applications/krusader" +build_module "applications/kscope" +build_module "applications/ksensors" +build_module "applications/kshowmail" +build_module "applications/kshutdown" +build_module "applications/ksplash-engine-moodin" +build_module "applications/kstreamripper" +build_module "applications/ksystemlog" +build_module "applications/ktechlab" +build_module "applications/ktorrent" +build_module "applications/kuickshow" +build_module "applications/kvirc" +build_module "applications/kvkbd" +build_module "applications/kvpnc" +build_module "applications/kxmleditor" +build_module "applications/mplayerthumbs" +build_module "applications/qalculate-tde" +build_module "applications/piklab" +build_module "applications/potracegui" +build_module "applications/soundkonverter" + +set_log_end diff --git a/debian/_buildscripts/local/09_applications_06.sh b/debian/_buildscripts/local/09_applications_06.sh new file mode 100755 index 000000000..25ad95a60 --- /dev/null +++ b/debian/_buildscripts/local/09_applications_06.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "applications/tastymenu" +build_module "applications/tde-guidance" +build_module "applications/tdeio-apt" +build_module "applications/tdeio-ftps" +build_module "applications/tdeio-locate" +build_module "applications/tdeio-umountwrapper" +build_module "applications/tdenetworkmanager" +build_module "applications/tdepowersave" +build_module "applications/tderadio" +build_module "applications/tde-style-baghira" +build_module "applications/tde-style-domino" +build_module "applications/tde-style-ia-ora" +build_module "applications/tde-style-lipstik" +build_module "applications/tde-style-qtcurve" +build_module "applications/tde-systemsettings" +build_module "applications/tdmtheme" +build_module "applications/tork" +build_module "applications/twin-style-crystal" +build_module "applications/wlassistant" +build_module "applications/yakuake" + +set_log_end diff --git a/debian/_buildscripts/local/10_others_01.sh b/debian/_buildscripts/local/10_others_01.sh new file mode 100755 index 000000000..0d43fe983 --- /dev/null +++ b/debian/_buildscripts/local/10_others_01.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "applications/tdeio-sword" +build_module "applications/bibletime" +build_module "applications/desktop-effects-tde" +build_module "applications/fusion-icon" +build_module "metapackages/sudo-trinity" +build_module "applications/kdpkg" +build_module "applications/kerry" +build_module "applications/kgtk-qt3" +build_module "applications/tdesudo" +build_module "applications/kiosktool" +build_module "applications/knights" +build_module "libraries/libksquirrel" +build_module "applications/ksquirrel" +build_module "applications/qt4-tqt-theme-engine" +build_module "applications/rosegarden" +build_module "applications/smartcardauth" +build_module "applications/smb4k" +build_module "applications/tdesvn" +build_module "applications/tellico" + +set_log_end diff --git a/debian/_buildscripts/local/11_others_02.sh b/debian/_buildscripts/local/11_others_02.sh new file mode 100755 index 000000000..6c98710a5 --- /dev/null +++ b/debian/_buildscripts/local/11_others_02.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +. ./internals/_build_set_common.sh + +#---------------------------- +set_log_start + +build_module "tde-i18n" +if [[ "$USE_PREBUILD_EXTRA_DEPS" != "y" ]]; then + 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" +fi +build_module "applications/compizconfig-backend-tdeconfig" + +set_log_end diff --git a/debian/_buildscripts/local/91_build_base.sh b/debian/_buildscripts/local/91_build_base.sh new file mode 100755 index 000000000..7dbec8316 --- /dev/null +++ b/debian/_buildscripts/local/91_build_base.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ "$USE_PREBUILD_EXTRA_DEPS" != "y" ]]; then + ./00_extradeps.sh +fi +./01_base_01.sh +./02_base_02.sh +./03_base_03.sh diff --git a/debian/_buildscripts/local/92_build_applications.sh b/debian/_buildscripts/local/92_build_applications.sh new file mode 100755 index 000000000..45b26a5f1 --- /dev/null +++ b/debian/_buildscripts/local/92_build_applications.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +./04_applications_01.sh +./05_applications_02.sh +./06_applications_03.sh +./07_applications_04.sh +./08_applications_05.sh +./09_applications_06.sh + diff --git a/debian/_buildscripts/local/93_build_others.sh b/debian/_buildscripts/local/93_build_others.sh new file mode 100755 index 000000000..870f22a61 --- /dev/null +++ b/debian/_buildscripts/local/93_build_others.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +./10_others_01.sh +./11_others_02.sh \ No newline at end of file diff --git a/debian/_buildscripts/local/99_build_TDE.sh b/debian/_buildscripts/local/99_build_TDE.sh new file mode 100755 index 000000000..99b72ce05 --- /dev/null +++ b/debian/_buildscripts/local/99_build_TDE.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Load common code and initialization +. ./internals/_build_common.sh +init_common + +_BUILDALL_TIMER=2 +_BUILDALL_TIME="--/--:--:--:---" + + +#---------------------------- +# do_exit for set building +function do_exit() +{ + cd "$SCRIPT_DIR" + if [ $1 -eq 0 ]; then + echo -e "${CGray}#### Building process for TDE completed ####${CNone}" + else + echo -e "${CGray}#### Building process for TDE interrupted ($1) ####${CNone}" + fi + exit $1 +} + + +#---------------------------- +function set_log_start() +{ + echo -e "${CGray}#### Starting building process for TDE ####${CNone}" + echo + echo "********** TDE **********" >>"$LOG_BUILD_RESULT_FILENAME" + exec_time_start $_BUILDALL_TIMER +} + + +#---------------------------- +function set_log_end() +{ + exec_time_stop $_BUILDALL_TIMER "_BUILDALL_TIME" + echo " [$_BUILDALL_TIME] All TDE " >>"$LOG_BUILD_RESULT_FILENAME" + echo >>"$LOG_BUILD_RESULT_FILENAME" + do_exit 0 +} + + +#---------------------------- +# Build TDE +#---------------------------- +set_log_start + +./91_build_base.sh +./92_build_applications.sh +./93_build_others.sh + +set_log_end diff --git a/debian/_buildscripts/local/README.txt b/debian/_buildscripts/local/README.txt new file mode 100644 index 000000000..cbe44130a --- /dev/null +++ b/debian/_buildscripts/local/README.txt @@ -0,0 +1,248 @@ +----- +Index +----- +A) Environment preparation +B) Notes about scripts +C) How to use the scripts + + +-------------------------- +A) Environment preparation +-------------------------- +0) Initial notes + - this guide has been prepared based on a clean debian testing netinstall system without any other DE. + It should work for other debian/ubuntu distros as well, but eventually you may run into small differences + here and there. + - you can change folder names below, as long as you update the "_config.sh" file accordingly. + +1) Install following packages: bc, cdbs, git, pbuilder, rsync and required dependencies. + NOTE: sudo should already be installed. If not, install sudo as well. + +2) Create a base folder for TDE, hereafter referred to as TDE_DIR (for example $HOME/tde_src) + +3) Create the following folders [ see NOTE at point 0) about folder names ] + - in TDE_DIR: 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_DIR/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 + +4) Clone TDE git repositories + - TDE main repo + cd "TDE_DIR/1_git" + git clone https://mirror.git.trinitydesktop.org/gitea/TDE/tde + cd tde + git submodule init -- scripts + git submodule update -- scripts + ./scripts/switch_all_submodules_to_head_and_clean anonymous + - TDE packaging repo + cd "TDE_DIR/1_git" + git clone https://mirror.git.trinitydesktop.org/gitea/TDE/tde-packaging + +5) Add your user to the sudo group (not required if you are root) + su -c "adduser sudo" + Optionally, consider extending your sudo timeout interval to avoid having to type your password too often + (this could be quite painful especially during long builds, which would not be able to complete if unattended). + To do this, type "sudo visudo" and then add "Defaults timestamp_timeout=", where the value is in + minutes. Use a value of -1 to set an infinite timeout. + Logout and login again to make sure the new settings are applied. + +6) Copy the files from "TDE_DIR/1_git/tde-packaging/debian/_buildscripts/local/additional_files" folder + to the respectivily named folders. + +7) Create pbuilder base package with the command: + sudo pbuilder --create + If you wish to build for a different distro or architecture, use the command: + sudo DIST= ARCH= pbuilder --create + +8) Setup the build scripts locally: + - copy build scripts from "TDE_DIR/1_git/tde-packaging/debian/_buildscripts/local" to "TDE_DIR/buildscripts" + and make sure all shell scripts are executable + - cd "TDE_DIR/buildscripts" + - cp ./internals/_config_template.sh _config.sh + - edit "_config.sh" to set your preferences and check that the various folder names match the structure on your disk. + Make sure to set the following variables: + * TDE_DIR to the correct path. + * DISTRO, DISTRO_NAME and ARCHITECTURE to match the distro and architecture you want to build for. + * UPDATE_BRANCHES to the branches you want to keep updated from the main repositories. + * DEFAULT_REPO_BRANCH to the branch to check out at the end of the repositories update process. + +9) Some additional packages (referred to as extra dependencies) are required to build and install TDE in debian/ubuntu. + These modules can be built locally, but the procedure is a bit cumbersome. Alternatively, Slavek Banko's + pre-built binaries can be used. + + 9.1) Using pre-built extra dependencies (recommended option) + - open "_config.sh" and set the variable USE_PREBUILD_EXTRA_DEPS to "y" (this is the default initial setting) + - add the following lines to the /etc/apt/sources.list file. This will setup Slavek's repositories in apt for + installing the extra dependency packages when TDE is installed. + * For R14.1.x series (repository branch "master") + # --- SLAVEK BANKO'S EXTRA DEPENDENCIES REPOSITORY --- + deb http://mirror.xcer.cz/trinity-tb deps + * For R14.0.x series (repository branch "r14.0.x") + # --- SLAVEK BANKO'S EXTRA DEPENDENCIES REPOSITORY --- + deb http://mirror.xcer.cz/trinity-sb deps-r14 + For example: + deb http://mirror.xcer.cz/trinity-tb buster deps + - install package dirmngr if required + - import Slavek's GPG key into your apt keyring + sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A04BE668 + + 9.2) Building extra dependencies locally + - open "_config.sh" and set the variable USE_PREBUILD_EXTRA_DEPS to "n" + - install the following packages: links2 and required dependencies. + - using links2 (or another browser), download the source code for the extra dependency modules from + Slavek's PPA (usually more recently updated): + https://quickbuild.pearsoncomputing.net/~slavek-banko/+archive/deps-r14/+packages + 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 near the "Filter" button and click + the button to update. You should get a list of 10-15 modules, depending on the distro. + * Click on one module at a time, it will expand (or open another page) and show a list of .deb and other files. + * Save those files (exclude .deb files. Only .orig.tar.xz, .dsc, .debian.tar.xz are required) and store + them to TDE_DIR/1_git/edeps/ folder (one folder per module). + +10) Add the following lines to the /etc/apt/sources.list file. This will setup your local repo in apt. + # --- LOCAL TDE REPOSITORY --- + deb [trusted=yes] file:TDE_DIR/3_repo main + For example: + deb [trusted=yes] file:/home/tde_src/3_repo buster main + +---------------------- +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_DIR/2_build/debs// and the source code and build reports in TDE_DIR/2_build/debs//src/ + +The source code can be either the git repo or a local copy in TDE_DIR/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. + +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_DIR/2_build/debs//src/__build__.log + +When building sets of modules or the whole TDE, a global build summary is automatically stored to TDE_DIR/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 * +- scripts in 'internals' folder + Scripts used intenally by other scripts. No need for invoking these directly. + +- update_git_repository.sh: + Script used to update the local clone of the git repositories. + It is possible to update multiple branches as specified by the variable UPDATE_BRANCHES in the configuration + file. After the update is completed, the local repositories will be switched to the branch specified by the + DEFAULT_REPO_BRANCH variable. The default branch can be overridden by using OVERRIDE_DEFAULT_REPO_BRANCH when + invoking the script. + Usage: + [OVERRIDE_DEFAULT_REPO_BRANCH=""] update_git_repository.sh [options] + Options: + -i (Incremental) : in case the previous update was interrupted, continue from the last known updated module. + (useful on slow/unstable internet connections). If the previous update had completed, + this option is ignored. + -v (Verbose) : display and log more output. Useful for troubleshooting. + +- 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 while the build is ongoing + -lr (Log Result) : log (append) build result (OK, FAILED) to TDE_DIR/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 (experimental) + +-
_.sh + A number of scripts used to build sets of modules. Each script builds an individual set. + Modules are built from the git sources and the build result is automatically appended to + TDE_DIR/0_logs/build_result.log. + Usage: +
_.sh [options] set_name + Options: + -s N: if specified, skip first N modules from the set of modules + + The sets are logically grouped as "base system", "applications" and "others" + 00_extradeps.sh : extra dependencies modules + 01_base_01.sh - 03_base_03.sh : TDE base system + 04_application_01.sh - 09_application_06.sh : application modules + 10_others_01.sh - 11_others_02.sh : other modules that are somehow less used + 91_build_base.sh : whole TDE base system in 00_extradeps.sh - 03_base_03.sh + 92_build_applications.sh : all TDE applications in 04_application_01.sh - 09_application_06.sh + 93_build_others.sh : all modules in 10_others_01.sh - 11_others_02.sh + +- 99_build_TDE.sh + Script used to build the complete TDE at once. Calls the dd_setname.sh set scripts in order. + Usage: + build_TDE.sh + +- create_repo.sh + Creates a local repository from the .deb files currently stored in TDE_DIR/2_build/debs. + Usage: + [sudo] create_repo.sh [options] + Options: + -b (Backup) : create a backup of the existing repository in TDE_DIR/CFG_REPO_DIR.backup + + +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. +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_DIR/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 +------------------------- +1) Follow the steps in section "A) Environment preparation" (only required the first time). +2) cd "TDE_DIR/buildscripts" +3) Update to latest git repository using + ./update_repositories.sh +4) Run "sudo 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. You don't need to use "sudo" directly since the scripts will do that automatically if + required. Just type your sudo password when prompted to do so. +6) Create a local repository from the packages you have just built, to be used as installation repository. + [sudo] ./create_repo.sh +7) Install TDE as you usually do. For example as follow: + - sudo apt-get update + - sudo aptitude install tdebase-trinity (for a minimalistic TDE environment) + or + sudo aptitude install tde-trinity (for a standard TDE environment) + + + +Examples of real usage: + +1) build a single module + - ./build_module.sh -g -sl "dependencies/libr" -> build libr package. This is a good test to check + whether everything is working fine + - ./build_module.sh -g "tdelibs" -> build "tdelibs" from git sources in a clean chroot environment + - ./build_module.sh -g -l -sl "applications/amarok" -> build "amarok" locally from git sources and + display building logs during building + - ./build_module.sh -sh -lr "tdebase" -> build "tdebase" from the local sources (in TDE_DIR/2_build/build/tdebase) + in a clean chroot environment and launch a shell in case of building failure. + Append the build result (OK, FAILED) to TDE_DIR/scripts/logs/build_result.log + - ./build_module.sh -g -po "tdelibs" -> prepare "tdelibs" for building from git sources. Source code will be available + in TDE_DIR/2_build/build/tdelibs. After you have made changes to the source and + want to build the modified package, run './build_module.sh "tdelibs"' + +2) build a single set + (optional) delete the TDE_DIR/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 of the set. + +3) build all TDE + ./99_build_TDE.sh -> build all TDE + +4) [sudo] ./create_repo.sh -> build or update your local TDE repository \ No newline at end of file diff --git a/debian/_buildscripts/local/additional_files/etc/pbuilderrc b/debian/_buildscripts/local/additional_files/etc/pbuilderrc new file mode 100644 index 000000000..fde052b35 --- /dev/null +++ b/debian/_buildscripts/local/additional_files/etc/pbuilderrc @@ -0,0 +1,176 @@ +#!/bin/bash + +# general options +BUILDPLACE="/var/cache/pbuilder/build/" +USEPROC=yes +USEDEVPTS=yes +USEDEVFS=no + +# the username and ID used by pbuilder, inside chroot. Needs fakeroot, really +BUILDUSERID=1234 +BUILDUSERNAME=pbuilder + +# 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" + +# this is necessary for running 'apt-ftparchive' in a hook script if required +EXTRAPACKAGES="$EXTRAPACKAGES apt-utils" + +#APT configuration files directory +APTCONFDIR="" + +# Set the PATH to be used inside pbuilder +export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin" +# Shell to be used inside pbuilder by commands like 'su' +export SHELL=/bin/bash + +# default PKGNAME_LOGFILE +PKGNAME_LOGFILE="__build__.log" + +#-- get desired distribution and architecture +if [ "$DIST" = "" ]; then + DIST=$(lsb_release -cs) +fi +DISTRIBUTION=$DIST +if [ "$ARCH" = "" ]; then + ARCH=$(dpkg --print-architecture) +fi +ARCHITECTURE=$ARCH + +if [ -n "$T" ]; then + if [ "${T##*-}" = "vm" ]; then + BUILD_VM="qemu" + T=${T%-vm} + fi + if [ "${T#*@}" = "$T" ]; then + DISTRIBUTION=${T%-*} + ARCHITECTURE=${T##*-} + else + DISTRIBUTION=${T%@*} + ARCHITECTURE=${T##*@} + fi + if [ "${DISTRIBUTION##*-}" = "backports" ]; then + BACKPORTS="yes" + DISTRIBUTION=${DISTRIBUTION%-backports} + fi +fi + +BASETGZ="/var/cache/pbuilder/base-$DIST@$ARCH.tgz" + +#-- select apt components +case "$DISTRIBUTION" in + sid|buster|stretch|jessie|wheezy|squeeze|lenny|etch|sarge) + COMPONENTS="main contrib non-free" + ;; + + ceres|beowulf|ascii) + COMPONENTS="main" + DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg) + EXTRAPACKAGES="$EXTRAPACKAGES devuan-keyring" + ;; + + bionic|artful|zesty|yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick|lucid) + COMPONENTS="main restricted universe multiverse" + DEBOOTSTRAPOPTS=(--variant=buildd) + ;; + + raspbian-jessie|raspbian-wheezy) + COMPONENTS="main contrib non-free" + DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg) + ;; +esac +EXTRAPACKAGES="$EXTRAPACKAGES fakeroot apt-transport-https ca-certificates" + +#-- select base apt sources +case "$DISTRIBUTION" in + sid|buster|stretch|jessie|wheezy) + MIRRORSITE=http://deb.debian.org/debian + ;; + + squeeze|lenny|etch|sarge) + MIRRORSITE=http://archive.debian.org/debian + OTHERMIRROR="#deb http://archive.debian.org/backports.org $DISTRIBUTION-backports main contrib non-free" + ;; + + ceres|beowulf|ascii) + MIRRORSITE=http://auto.mirror.devuan.org/merged + ;; + + bionic|artful|zesty|yakkety|wily|vivid|trusty|precise) + if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then + MIRRORSITE=http://archive.ubuntu.com/ubuntu + else + MIRRORSITE=http://ports.ubuntu.com + fi + ;; + + xenial) + if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then + MIRRORSITE=http://archive.ubuntu.com/ubuntu + else + MIRRORSITE=http://ports.ubuntu.com + fi + OTHERMIRROR="deb $MIRRORSITE $DISTRIBUTION-updates $COMPONENTS" + ;; + + utopic|saucy|raring|quantal|oneiric|natty|maverick|lucid) + MIRRORSITE=http://old-releases.ubuntu.com/ubuntu + ;; + + raspbian-jessie|raspbian-wheezy) + MIRRORSITE=http://ftp.fi.muni.cz/pub/linux/raspbian/raspbian + ;; +esac + +if [ -n "${ARCH}" ]; then + NAME="$NAME-$ARCH" + DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}") +fi + +BUILDRESULT="/var/cache/pbuilder/$DISTRIBUTION/result/" + +APTCACHE="/var/cache/pbuilder/aptcache/$DISTRIBUTION/" +if [ -n "$APTCACHE" ] && [ ! -d "$APTCACHE" ]; then + mkdir $APTCACHE +fi +if [ -z "$(stat -L --print "%d\n" $APTCACHE/. /var/cache/pbuilder/build/. | uniq -d)" ]; then + # apt cache for build on tmpfs is managed by hook scripts + BINDMOUNTS="${BINDMOUNTS} ${APTCACHE}" + APTCACHEHARDLINK=no + APTCACHE="" +fi + +#-- extra options +DEBBUILDOPTS="-B" +if [ "$ARCHITECTURE" == "amd64" ]; then + DEBBUILDOPTS="-b" +fi +if [ "${DISTRIBUTION#raspbian}" != "$DISTRIBUTION" ] && [ "$ARCHITECTURE" == "armhf" ]; then + DEBBUILDOPTS="-b" + DISTRIBUTION=${DISTRIBUTION#raspbian-} +fi +if [ -z "$DEB_SIGN_KEYID" ]; then + AUTO_DEBSIGN=${AUTO_DEBSIGN:-no} +fi + +#-- choose dependency solver +#-- apt is better if target distribution contains apt >= 1.4~beta3 +#-- aptitude is better if target distribution contains apt < 1.4~beta3 +case "$DISTRIBUTION" in + sid|buster|stretch|\ + ceres|beowulf|ascii|\ + bionic|artful|zesty) + PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt" + ;; + + jessie|wheezy|squeeze|lenny|etch|sarge|\ + raspbian-jessie|raspbian-wheezy|\ + yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick|lucid) + PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-aptitude" + ;; +esac diff --git a/debian/_buildscripts/local/build_module.sh b/debian/_buildscripts/local/build_module.sh new file mode 100755 index 000000000..18d55d778 --- /dev/null +++ b/debian/_buildscripts/local/build_module.sh @@ -0,0 +1,432 @@ +#!/bin/bash +# +# Build a single TDE module +# + +# Load common code and initialization +. ./internals/_build_common.sh +init_common + + +# Timer settings +_BUILDMOD_TIMER_NUM=0 +_BUILDMOD_TIME="--/--:--:--:---" +exec_time_start $_BUILDMOD_TIMER_NUM + + +# Need sudo for non-root users +SUDO_CMD="" +if [ "`whoami`" != "root" ]; then + SUDO_CMD="sudo -E" +fi + + +#---------------------------- +# Parameters: +# $1 - error code +function do_exit() +{ + cd "$SCRIPT_DIR" + if [ $1 -eq 0 ]; then + echo -e "${CGreen}#### Processing module ${CLightGreen}\"$MOD_NAME\"${CGreen} succeeded ####${CNone}" + if [ "$bool_LOG_RESULT" = "y" ]; then + echo "[ OK ] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME" + fi + else + echo -e "${CRed}#### Processing module ${CLightRed}\"$MOD_NAME\"${CRed} failed ($1) ####${CNone}" + if [ "$bool_LOG_RESULT" = "y" ]; then + echo "[FAILED] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME" + fi + fi + exit $1 +} + + +#---------------------------- +# Parameters: +# $1 - folder name +function recreate_folder() +{ + if [ -d "$1" ]; then + $SUDO_CMD rm -R "$1" + fi + mkdir -p "$1" +} + + +#---------------------------- +# Check command line arguments and set options +#---------------------------- +MOD_NAME="" # the module to be built +bool_BUILD_FROM_GIT="n" +bool_EXTRADEP_MOD="n" +bool_SHOW_BUILD_LOGS="n" +bool_BUILD_LOCALLY="n" +bool_LOG_RESULT="n" +bool_SHELL_HOOK="n" +bool_PREPARE_ONLY="n" +bool_DEBUG_MODE="n" +bool_INTERNAL_PBUILDER="n" +for arg in $@; do + if [ "$arg" = "-g" ]; then # select code to build from Git repo (-g) or from local build copy + bool_BUILD_FROM_GIT="y" + elif [ "$arg" = "-l" ]; then # build module Locally instead of in a clean chroot environment + bool_BUILD_LOCALLY="y" + elif [ "$arg" = "-sl" ]; then # output the building logs to terminal (ShowLog) + bool_SHOW_BUILD_LOGS="y" + elif [ "$arg" = "-lr" ]; then # Log build Result to file + bool_LOG_RESULT="y" + elif [ "$arg" = "-sh" ]; then # install Shell Hook for failing builds (only valid if NOT building locally) + bool_SHELL_HOOK="y" + elif [ "$arg" = "-po" ]; then # Prepare build folder Only but do not build + 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 (experimental) + bool_INTERNAL_PBUILDER="y" + elif [ "$MOD_NAME" = "" ]; then # module to be built + MOD_NAME="$arg" + fi +done + +if [ "$MOD_NAME" = "" ]; then + echo "Please specify the module to build" + do_exit 3 +fi + +# Check if module is an extra dependency +if [[ $MOD_NAME =~ ^$CFG_EXTRA_DEPS_DIR/ ]]; then + bool_EXTRADEP_MOD="y" +fi + +# Shell hook is only valid if not building locally +# Internal pbuilder option has no meaning if we are building locally +if [ "bool_BUILD_LOCALLY" = "y" ]; then + bool_SHELL_HOOK="n" + bool_INTERNAL_PBUILDER="n" +fi +export bool_SHELL_HOOK +export bool_INTERNAL_PBUILDER + +# Local option variables +# - sign packages +OPT_SIGN_PKG_LOCAL="-uc -us" +# - show logs +OPT_SHOW_LOGS="&>" +if [ "$bool_SHOW_BUILD_LOGS" = "y" ]; then + OPT_SHOW_LOGS=" | tee " +fi +export OPT_SHOW_LOGS + +# Log start +echo -e "${CLightCyan}#### Processing module \"$MOD_NAME\" ####${CNone}" + +# This folders must exists +BASE_DIRS=("REPO_DIR" "BUILD_DIR" "SCRIPT_DIR" "REPO_TDE_MAIN" "REPO_TDE_PACKAGING" "REPO_EXTRA_DEPENDENCIES" "HOOK_DIR") + +for var_name in ${BASE_DIRS[@]}; do + if [ ! -d "${!var_name}" ]; then + echo -e "$var_name directory missing. Value is \"${!var_name}\". Check your config or create it." + do_exit 4 + fi +done + + +#---------------------------- +# Build output directories +#---------------------------- +BUILD_DIRS=("TDE_BUILD_DIR" "TDE_DEBS_DIR") + +for var_name in ${BUILD_DIRS[@]}; do + if [ ! -d "${!var_name}" ]; then + mkdir "${!var_name}" + fi +done + + +#---------------------------- +# Check module name validity +#---------------------------- +if [ "$bool_EXTRADEP_MOD" != "y" ]; then + # Standard module + MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME" + MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian" +else + # Extra dependency module + MOD_GIT_PATH="$REPO_DIR/$MOD_NAME" +fi +export MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME" +MOD_BUILD_PKGING_PATH="$MOD_BUILD_PATH/debian" + +if [ "$bool_BUILD_FROM_GIT" = "y" ]; then + echo -e "${CYellow}> Building from GIT repo${CNone}" + # source files + if [ ! -d "$MOD_GIT_PATH" ]; then + echo "Module \"$MOD_NAME\" not found in GIT" + do_exit 5 + fi + bool_COPY_MOD_SRC="y" + + # packaging scripts + if [ "$bool_EXTRADEP_MOD" != "y" -a ! -d "$MOD_GIT_PKGING_PATH" ]; then + echo "Packaging for \"$MOD_NAME\" not found in GIT" + do_exit 6 + fi + bool_COPY_PKGING_FILES="y" + # +else + echo -e "${CYellow}> Building from BUILD folder${CNone}" + # source files + bool_COPY_MOD_SRC="n" + if [ ! -d "$MOD_BUILD_PATH" ]; then + if [ ! -d "$MOD_GIT_PATH" ]; then + echo "Module \"$MOD_NAME\" not found neither in BUILD nor in GIT" + do_exit 7 + fi + bool_COPY_MOD_SRC="y" + fi + + # packaging scripts + bool_COPY_PKGING_FILES="n" + if [ "$bool_EXTRADEP_MOD" != "y" -a ! -d "$MOD_BUILD_PKGING_PATH" ]; then + if [ ! -d "$MOD_GIT_PKGING_PATH" ]; then + echo "Packaging for \"$MOD_NAME\" not found neither in BUILD nor in GIT" + do_exit 8 + fi + bool_COPY_PKGING_FILES="y" + fi +fi + +#---------------------------- +# Prepare source files +#---------------------------- +# remove output from previous build +if [ -d "$MOD_BUILD_PATH" ]; then + cd "$MOD_BUILD_PATH/.." + $SUDO_CMD rm *.deb *.dsc *.changes *.tar.bz2 *.tar.gz *.tar.xz *.log *.buildinfo &>/dev/null +fi + +# copy main repo source files, if needed +if [ "$bool_COPY_MOD_SRC" = "y" ]; then + bool_COPY_PKGING_FILES="y" + recreate_folder "$MOD_BUILD_PATH" + if [ "$bool_EXTRADEP_MOD" != "y" ]; then + # Normal module + cp -R "$MOD_GIT_PATH" "$MOD_BUILD_PATH/.." + # Add SCM information for crash test report + [ -f "$MOD_BUILD_PATH/.tdescmmodule" ] && rm "$MOD_BUILD_PATH/.tdescmmodule" + [ -f "$MOD_BUILD_PATH/.tdescmrevision" ] && rm "$MOD_BUILD_PATH/.tdescmrevision" + # --> Module name + echo "$MOD_NAME" >"$MOD_BUILD_PATH/.tdescmmodule" + # --> SCM info + cd "$MOD_GIT_PATH" + MOD_BRANCH=`git branch --contains HEAD | grep -v "no branch" | head -n1 | cut -c 3-` + COMMIT_HASH=`git rev-parse HEAD` + echo "$MOD_BRANCH-$COMMIT_HASH" >"$MOD_BUILD_PATH/.tdescmrevision" + else + # Extra dependency module + if [ `find "$MOD_GIT_PATH" -name '*.dsc' | wc -l` == 1 ]; then + if [ -d "$MOD_BUILD_PATH" ]; then + $SUDO_CMD rm -R "$MOD_BUILD_PATH" + fi + 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\"" + do_exit 9 + fi + fi +fi + +# copying packaging scripts, if needed +if [ "$bool_EXTRADEP_MOD" != "y" -a "$bool_COPY_PKGING_FILES" = "y" ]; then + if [ -d "$MOD_BUILD_PKGING_PATH" ]; then + $SUDO_CMD rm -R $MOD_BUILD_PKGING_PATH + fi + cp -R "$MOD_GIT_PKGING_PATH" "$MOD_BUILD_PKGING_PATH" + + # TODO metapackage support + + # Default package name (Slavek's repo style) + # Calculate package version + cd $MOD_GIT_PATH + branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + target_tag=`git tag | grep -F "$TDE_RELEASE" | head -n1` + tag=`git tag | \ + sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \ + while read t; do \ + git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \ + echo "$t..HEAD" && break; done` + count=`git log $tag --pretty=oneline | wc -l` + package=$(basename $PWD)-trinity-$TDE_RELEASE + if [[ "$count" -gt 0 ]] || [[ -z "$target_tag" ]]; then + package=$package~pre$count+$(git rev-parse HEAD | cut -c 1-8) + fi + REL=4:$TDE_RELEASE${package#*$TDE_RELEASE} + REL=${REL%+*} + REL=${REL/4:14.0.0/4:14.0.0-s} + REL=${REL/4:14.0.0-s~pre/4:14.0.0-s~} + REL=${REL/.0~pre/.0~s} + # Get package name and packaging release + PKG_NAME=$(head -n1 $MOD_BUILD_PKGING_PATH/changelog) + PKG_NAME=${PKG_NAME%% *} + PKG_TAG=$(cd "$REPO_TDE_PACKAGING/$MOD_NAME" && + git tag | \ + sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \ + while read t; do \ + git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \ + echo "$t..HEAD" && break; done) + PKG_REL=$(cd "$REPO_TDE_PACKAGING/$MOD_NAME" && + git log $PKG_TAG --pretty=oneline . | wc -l) + if [ -n "$REL_SUFFIX" ]; then + PKG_REL="${PKG_REL}${REL_SUFFIX}" + fi + # TODO add relative patch count + ADD_REL=0 + + DATE=$(date -R) + GITUSER="$(git config --get user.name) <$(git config --get user.email)>" + echo "$PKG_NAME ($REL-0$DISTRO$DISTRO_VERSION.$ADD_REL+$PKG_REL) $DISTRO_NAME; urgency=low" > "$MOD_BUILD_PKGING_PATH/changelog" + echo -e "\n * Automated git build\n\n -- $GITUSER $DATE\n" >> "$MOD_BUILD_PKGING_PATH/changelog" + cat "$REPO_TDE_PACKAGING/$MOD_NAME/debian/changelog" >> "$MOD_BUILD_PKGING_PATH/changelog" +fi + +# prepare destination directory for building +export MOD_DEB_PATH="$TDE_DEBS_DIR/$MOD_NAME" +MOD_DEBSRC_PATH="$MOD_DEB_PATH/src" +recreate_folder "$MOD_DEB_PATH" +recreate_folder "$MOD_DEBSRC_PATH" + + +#---------------------------- +# Apply pre-build hooks if present +#---------------------------- +if [ -x "$HOOK_DIR/$MOD_NAME/pre_build.sh" ]; then + echo -e "${CYellow}> Applying pre-build hook${CNone}" + . "$HOOK_DIR/$MOD_NAME/pre_build.sh" + if [ $? -eq 0 ]; then + echo -e "> ${CBrown}Pre-build hook applied successfully${CNone}" + else + echo -e "> ${CLightBlue}Pre-build hook failed${CNone}" + fi +fi + + +#---------------------------- +# Switch to 3.0(quilt) format +#---------------------------- +# create orig tarball +cd "$MOD_BUILD_PATH" +MOD_BASENAME=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^([^ ]+).*/\1/"` +MOD_MAJOR_VER=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^[^ ]+ \(([^:]+:)?.*/\1/"` +MOD_UP_VER=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^[^ ]+ \(([^:]+:)?([^-]+).*/\2/"` +MOD_DEB_VER=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^[^ ]+ \([^-]+-([^\)]+).*/\1/"` + +tar cJf "../${MOD_BASENAME}_${MOD_UP_VER}.orig.tar.xz" --exclude="debian" --exclude=".git*" . + +# switch to quilt format +if [ -f "$MOD_BUILD_PKGING_PATH/source/format" ]; then + grep -q "(native)" "$MOD_BUILD_PKGING_PATH/source/format" && \ + sed -i "s/(native)/(quilt)/" "$MOD_BUILD_PKGING_PATH/source/format" +else + [ -d "$MOD_BUILD_PKGING_PATH/source" ] || mkdir -p "$MOD_BUILD_PKGING_PATH/source" + echo "3.0 (quilt)" >"$MOD_BUILD_PKGING_PATH/source/format" +fi + +# remove quilt references from rules file +grep -q "^include.*/usr/share/cdbs/1/rules/patchsys-quilt\.mk" "$MOD_BUILD_PKGING_PATH/rules" && \ +sed -i "s/^\(include.*\/usr\/share\/cdbs\/1\/rules\/patchsys-quilt\.mk\)/#\1/" "$MOD_BUILD_PKGING_PATH/rules" + +if [ "$bool_PREPARE_ONLY" = "y" ]; then + echo -e "${CBrown}Source code prepared for building${CNone}" + do_exit 0 +fi + + +#---------------------------- +# Enable debug mode if required +#---------------------------- +if [ "$bool_DEBUG_MODE" = "y" ]; then + echo -e "${CBrown}Enable debug mode${CNone}" + sed -i "s/RelWithDebInfo/Debug/" "$MOD_BUILD_PKGING_PATH/rules" +fi + + +#---------------------------- +# Build +#---------------------------- +export BUILDING_LOG_FILE="$MOD_DEBSRC_PATH/__build__.log" +cd "$MOD_BUILD_PATH" + +if [ "$bool_BUILD_LOCALLY" = "y" ]; then + ## Build module locally + echo -e "${CYellow}> Building locally${CNone}" + eval dpkg-buildpackage $OPT_SIGN_PKG_LOCAL $OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\" + build_retval=$? +else + ## Build module in a clean chroot environment using pbuilder + $SUDO_CMD "$SCRIPT_DIR/internals/_pbuilder.sh" + build_retval=$? + if [ "`whoami`" != "root" ]; then + cd "$MOD_DEB_PATH" + $SUDO_CMD chown -R `id -u -n`:`id -g -n` . &>/dev/null + cd "$MOD_BUILD_PATH/.." + $SUDO_CMD chown `id -u -n`:`id -g -n` *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.buildinfo &>/dev/null + $SUDO_CMD chown `id -u -n`:`id -g -n` "$TDE_DEBS_DIR/Packages" &>/dev/null + cd "$MOD_BUILD_PATH" + fi +fi + +if [ $build_retval -eq 0 ]; then + echo -e "${CLightGreen}> Building completed SUCCESSFULLY${CNone}" +else + echo -e "${CLightRed}> Building completed WITH ERRORS${CNone}" +fi + + +#---------------------------- +# Apply post-build hooks if present +#---------------------------- +if [ -x "$HOOK_DIR/$MOD_NAME/post_build.sh" ]; then + echo -e "${CYellow}> Applying post-build hook${CNone}" + . "$HOOK_DIR/$MOD_NAME/post_build.sh" + if [ $? -eq 0 ]; then + echo -e "${CBrown}Post-build hook applied successfully${CNone}" + else + echo -e "${CLightBlue}Post-build hook failed${CNone}" + fi +fi + +#---------------------------- +# Move compiled module files to destination folders +#---------------------------- +if [ "$bool_BUILD_LOCALLY" = "y" ]; then + cd "$MOD_BUILD_PATH/.." + mv *.deb "$MOD_DEB_PATH" &>/dev/null + mv *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.buildinfo "$MOD_DEBSRC_PATH" &>/dev/null +else + cd "$MOD_DEB_PATH" + mv *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.buildinfo "$MOD_DEBSRC_PATH" &>/dev/null + cd "$MOD_BUILD_PATH/.." + mv *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.buildinfo "$MOD_DEBSRC_PATH" &>/dev/null +fi + + +#---------------------------- +# Removing leftover files +#---------------------------- +cd "$MOD_BUILD_PATH/.." +rm *.deb *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.log *.buildinfo &>/dev/null +cd "$MOD_DEB_PATH" +rm *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.log *.buildinfo &>/dev/null + + +#---------------------------- +# Building completed +#---------------------------- +exec_time_stop $_BUILDMOD_TIMER_NUM "_BUILDMOD_TIME" +do_exit $build_retval diff --git a/debian/_buildscripts/local/create_repo.sh b/debian/_buildscripts/local/create_repo.sh new file mode 100755 index 000000000..f03f92e84 --- /dev/null +++ b/debian/_buildscripts/local/create_repo.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Create/update TDE local debian repository +# + +# Load common code and initialization +. ./internals/_build_common.sh +init_common + +#---------------------------- +# Check command line arguments +parm_MAKE_BACKUP="n" +for arg in $@; do + if [ "$arg" = "-b" ]; then # backup old repository + parm_MAKE_BACKUP="y" + fi +done + + +#---------------------------- +# Create/update TDE local debian repository +echo -e "${CLightCyan}#### TDE local repository creation begin ####${CNone}" +ARCH_PATH="dists/$DISTRO_NAME/main/binary-$ARCHITECTURE" +REPO_DIR="$TDE_DIR/$CFG_REPO_DIR" +REPO_DIR_BACKUP="$REPO_DIR.backup" +REPO_PKG_DIR="$REPO_DIR/$ARCH_PATH" + +# Backup +if [ "$parm_MAKE_BACKUP" = "y" ] && [ -d "$REPO_DIR" ]; then + echo -e "${CYellow}> Backing up old repository${CNone}" + rm -R "$REPO_DIR_BACKUP" &>/dev/null + mv "$REPO_DIR" "$REPO_DIR_BACKUP" &>/dev/null + echo "Copy of the old repository available at \"$REPO_DIR_BACKUP\"" +fi + +# Create repository +echo -e "${CYellow}> Creating new repository${CNone}" +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="*/src/*.buildinfo" --exclude="Packages*" "$TDE_DEBS_DIR/" "$REPO_PKG_DIR/" + +# Create package index file +echo -e "${CYellow}> Creating package index file${CNone}" +cd "$REPO_DIR" +dpkg-scanpackages "./$ARCH_PATH" | gzip -9c > "./$ARCH_PATH/Packages.gz" + + +#---------------------------- +# Repository created +echo -e "${CLightGreen}#### TDE local repository created ####${CNone}" +cd "$SCRIPT_DIR" +exit 0 diff --git a/debian/_buildscripts/local/hook_examples/applications/kaffeine/kaffeine-wizard.diff b/debian/_buildscripts/local/hook_examples/applications/kaffeine/kaffeine-wizard.diff new file mode 100644 index 000000000..c35ba6516 --- /dev/null +++ b/debian/_buildscripts/local/hook_examples/applications/kaffeine/kaffeine-wizard.diff @@ -0,0 +1,65 @@ +diff -urN kaffeine/kaffeine/src/kaffeine.cpp kaffeine.new/kaffeine/src/kaffeine.cpp +--- kaffeine/kaffeine/src/kaffeine.cpp 2013-03-02 15:47:14.000000000 -0600 ++++ kaffeine.new/kaffeine/src/kaffeine.cpp 2013-11-24 11:39:09.809430631 -0600 +@@ -683,7 +683,9 @@ + m_autoResizeTriple = new TDEToggleAction(i18n("Triple Size"), 0, ALT|Key_3, TQT_TQOBJECT(this), TQT_SLOT(slotAutoresizeTriple()), actionCollection(), "view_auto_resize_triple"); + + m_playersMenu = new TDEActionMenu(i18n("&Player Engine"), actionCollection(), "options_player"); +- KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureKeys()), actionCollection()); ++ m_instWizard = new TDEAction(i18n("Installation &Wizard"), 0, 0, TQT_TQOBJECT(this), TQT_SLOT(slotInstWizard()), actionCollection(), "inst_wizard"); ++ ++ KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureKeys()), actionCollection()); + KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureToolbars()), actionCollection()); + KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(slotPreferences()), actionCollection(), "options_preferences"); + +@@ -1619,6 +1621,18 @@ + mute(); + } + ++void Kaffeine::slotInstWizard() ++{ ++ TQString stamp = locateLocal("appdata", "wizard_stamp_v0.7.1"); ++ InstWizard::showWizard(); ++ ++ TDEProcess process; ++ process << "touch" << stamp; ++ process.start(TDEProcess::Block, TDEProcess::Stderr); ++ process.clearArguments(); ++} ++ ++ + /********* DCOP INTERFACE *********/ + + void Kaffeine::openURL(TQString url) +diff -urN kaffeine/kaffeine/src/kaffeine.h kaffeine.new/kaffeine/src/kaffeine.h +--- kaffeine/kaffeine/src/kaffeine.h 2013-03-02 15:47:14.000000000 -0600 ++++ kaffeine.new/kaffeine/src/kaffeine.h 2013-11-24 11:09:17.455756279 -0600 +@@ -193,6 +193,7 @@ + void slotDvbClient(bool,const TQString&,int,int,const TQString&); + void slotNumKeyInput( int ); + void slotDVBNextBack( int ); ++ void slotInstWizard(); + + private: + void autoresize(); +@@ -258,7 +259,8 @@ + TDEToggleAction* m_autoResizeTriple; + TDEToggleAction* m_originalAspect; + TDEToggleAction* m_toggleLayout; +- TDEActionMenu* m_playersMenu; ++ TDEActionMenu* m_playersMenu; ++ TDEAction* m_instWizard; + TDEToggleAction* m_sleepAfterPlay; + TDEToggleAction* m_quitAfterPlay; + TDEToggleAction* m_quitAfterPlaylist; +diff -urN kaffeine/kaffeine/src/kaffeineui.rc kaffeine.new/kaffeine/src/kaffeineui.rc +--- kaffeine/kaffeine/src/kaffeineui.rc 2012-09-14 17:39:52.000000000 -0500 ++++ kaffeine.new/kaffeine/src/kaffeineui.rc 2013-11-24 11:10:15.335565312 -0600 +@@ -34,6 +34,7 @@ + + &Settings + ++ + + + diff --git a/debian/_buildscripts/local/hook_examples/applications/kaffeine/pre_build.sh b/debian/_buildscripts/local/hook_examples/applications/kaffeine/pre_build.sh new file mode 100755 index 000000000..96400d6e9 --- /dev/null +++ b/debian/_buildscripts/local/hook_examples/applications/kaffeine/pre_build.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +CURR_DIR=$PWD +cd "$PKG_BUILD_PATH" + +# Apply patches +if [ "$bool_COPY_PKG_SRC" = "y" ]; then + echo -e "${CLightPurple}Applying Kaffeine wizard patch${CNone}" + patch -p2 < "$HOOK_DIR/$PKG_NAME/kaffeine-wizard.diff" +fi + +cd "$CURR_DIR" +return 0 diff --git a/debian/_buildscripts/local/hook_examples/tdebase/018_kate_save_all.diff b/debian/_buildscripts/local/hook_examples/tdebase/018_kate_save_all.diff new file mode 100644 index 000000000..16ac7c7dc --- /dev/null +++ b/debian/_buildscripts/local/hook_examples/tdebase/018_kate_save_all.diff @@ -0,0 +1,37 @@ +diff -Nur ori/tdebase/kate/app/katedocmanager.cpp new/tdebase/kate/app/katedocmanager.cpp +--- ori/tdebase/kate/app/katedocmanager.cpp 2013-07-27 02:36:57.000000000 +0900 ++++ new/tdebase/kate/app/katedocmanager.cpp 2013-12-05 15:56:20.311928016 +0900 +@@ -381,7 +381,6 @@ + return modified; + } + +- + bool KateDocManager::queryCloseDocuments(KateMainWindow *w) + { + uint docCount = m_docList.count(); +@@ -436,12 +435,22 @@ + return true; + } + +- + void KateDocManager::saveAll() + { + for (TQPtrListIterator it(m_docList); it.current(); ++it) +- if ( it.current()->isModified() && it.current()->views().count() ) +- ((Kate::View*)it.current()->views().first())->save(); ++ { ++ if (it.current()->views().count()) ++ { ++ if (it.current()->url().isEmpty()) ++ { ++ ((Kate::View*)it.current()->views().first())->saveAs(); ++ } ++ else if (it.current()->isModified()) ++ { ++ ((Kate::View*)it.current()->views().first())->save(); ++ } ++ } ++ } + } + + void KateDocManager::saveDocumentList (TDEConfig* config) diff --git a/debian/_buildscripts/local/hook_examples/tdebase/pre_build.sh b/debian/_buildscripts/local/hook_examples/tdebase/pre_build.sh new file mode 100755 index 000000000..e764c29ad --- /dev/null +++ b/debian/_buildscripts/local/hook_examples/tdebase/pre_build.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +CURR_DIR=$PWD +cd "$PKG_BUILD_PATH" + +# Apply patches +if [ "$bool_COPY_PKG_SRC" = "y" ]; then + echo -e "${CLightPurple}Applying Kate save all patch${CNone}" + patch -p2 < "$HOOK_DIR/$PKG_NAME/018_kate_save_all.diff" + + echo -e "${CLightPurple}Applying SAK patch${CNone}" + patch -p1 < "$HOOK_DIR/$PKG_NAME/tdebase-usesak.diff" +fi + +cd "$CURR_DIR" +return 0 diff --git a/debian/_buildscripts/local/hook_examples/tdebase/tdebase-usesak.diff b/debian/_buildscripts/local/hook_examples/tdebase/tdebase-usesak.diff new file mode 100644 index 000000000..e85ca1047 --- /dev/null +++ b/debian/_buildscripts/local/hook_examples/tdebase/tdebase-usesak.diff @@ -0,0 +1,15 @@ +diff -urNa tdebase/tdm/config.def tdebase.new/tdm/config.def +--- tdebase/tdm/config.def 2013-09-12 11:51:29.000000000 -0500 ++++ tdebase.new/tdm/config.def 2014-02-10 06:29:38.537806886 -0600 +@@ -2010,9 +2010,9 @@ + + Key: UseSAK + Type: bool +-Default: true ++Default: false + User: greeter +-Instance: #*/! ++Instance: #:*/false + Comment: + SAK + Description: diff --git a/debian/_buildscripts/local/hook_examples/tdelibs/038_placeholder.diff b/debian/_buildscripts/local/hook_examples/tdelibs/038_placeholder.diff new file mode 100644 index 000000000..65d64cc72 --- /dev/null +++ b/debian/_buildscripts/local/hook_examples/tdelibs/038_placeholder.diff @@ -0,0 +1,64 @@ +diff -Nur ori/tdelibs/tdeutils/kfinddialog.cpp new/tdelibs/tdeutils/kfinddialog.cpp +--- ori/tdelibs/tdeutils/kfinddialog.cpp 2014-02-05 16:54:13.852605699 +0900 ++++ new/tdelibs/tdeutils/kfinddialog.cpp 2014-02-11 18:16:55.292214876 +0900 +@@ -149,8 +149,9 @@ + m_replace->setMaxCount(10); + m_replace->setDuplicatesEnabled(false); + m_backRef = new TQCheckBox(i18n("Use p&laceholders"), m_replaceGrp); ++ m_backRef->setEnabled(m_regExp->isChecked()); + m_backRefItem = new TQPushButton(i18n("Insert Place&holder"), m_replaceGrp); +- m_backRefItem->setEnabled(false); ++ m_backRefItem->setEnabled(m_regExp->isChecked() && m_backRef->isChecked()); + + m_replaceLayout->addWidget(m_replaceLabel, 0, 0); + m_replaceLayout->addMultiCellWidget(m_replace, 1, 1, 0, 1); +@@ -193,8 +194,8 @@ + + // signals and slots connections + connect(m_selectedText, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotSelectedTextToggled(bool))); +- connect(m_regExp, TQT_SIGNAL(toggled(bool)), m_regExpItem, TQT_SLOT(setEnabled(bool))); +- connect(m_backRef, TQT_SIGNAL(toggled(bool)), m_backRefItem, TQT_SLOT(setEnabled(bool))); ++ connect(m_regExp, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotRegexCheckBoxToggled(bool))); ++ connect(m_backRef, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPlaceholdersCheckBoxToggled(bool))); + connect(m_regExpItem, TQT_SIGNAL(clicked()), this, TQT_SLOT(showPatterns())); + connect(m_backRefItem, TQT_SIGNAL(clicked()), this, TQT_SLOT(showPlaceholders())); + +@@ -276,11 +277,23 @@ + "Ask before replacing each match found.") ); + } + +-void KFindDialog::textSearchChanged( const TQString & text) ++void KFindDialog::textSearchChanged(const TQString & text) + { + enableButtonOK( !text.isEmpty() ); + } + ++void KFindDialog::slotRegexCheckBoxToggled(bool checked) ++{ ++ m_regExpItem->setEnabled(checked); ++ m_backRef->setEnabled(checked); ++ m_backRefItem->setEnabled(checked && m_backRef->isChecked()); ++} ++ ++void KFindDialog::slotPlaceholdersCheckBoxToggled(bool checked) ++{ ++ m_backRefItem->setEnabled(checked && m_regExp->isChecked()); ++} ++ + void KFindDialog::showEvent( TQShowEvent *e ) + { + if ( !d->m_initialShowDone ) +diff -Nur ori/tdelibs/tdeutils/kfinddialog.h new/tdelibs/tdeutils/kfinddialog.h +--- ori/tdelibs/tdeutils/kfinddialog.h 2014-02-05 16:54:13.852605699 +0900 ++++ new/tdelibs/tdeutils/kfinddialog.h 2014-02-11 18:16:57.876214916 +0900 +@@ -250,7 +250,9 @@ + void slotSelectedTextToggled(bool); + void showPatterns(); + void showPlaceholders(); +- void textSearchChanged( const TQString &); ++ void textSearchChanged(const TQString &); ++ void slotRegexCheckBoxToggled(bool checked); ++ void slotPlaceholdersCheckBoxToggled(bool checked); + + protected: + virtual void showEvent ( TQShowEvent * ); diff --git a/debian/_buildscripts/local/hook_examples/tdelibs/pre_build.sh b/debian/_buildscripts/local/hook_examples/tdelibs/pre_build.sh new file mode 100755 index 000000000..35bfc3c1b --- /dev/null +++ b/debian/_buildscripts/local/hook_examples/tdelibs/pre_build.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +CURR_DIR=$PWD +cd "$PKG_BUILD_PATH" + +# Apply patches +if [ "$bool_COPY_PKG_SRC" = "y" ]; then + echo -e "${CLightPurple}Applying kfinddialog placeholder patch${CNone}" + patch -p2 < "$HOOK_DIR/$PKG_NAME/038_placeholder.diff" +fi + +cd "$CURR_DIR" +return 0 diff --git a/debian/_buildscripts/local/internals/C10shell b/debian/_buildscripts/local/internals/C10shell new file mode 100755 index 000000000..7c6a8761b --- /dev/null +++ b/debian/_buildscripts/local/internals/C10shell @@ -0,0 +1,18 @@ +#!/bin/sh + +# Color table +CPurple='\e[0;35m' +CWhite='\e[1;37m' +CNone='\e[0m' + +# Invoke shell if build fails. +apt-get install -y --force-yes vim less bash mc +cd /tmp/buildd/*/debian/.. +echo "${CPurple}---------------------------------------------------------${CNone}" >/dev/tty +echo "${CPurple} !!! Build FAILED !!! ${CNone}" >/dev/tty +echo "${CPurple} You are now inside a shell in the building environment. ${CNone}" >/dev/tty +echo "${CPurple} ${CWhite}mc, vim, less${CPurple} are available for your convenience. ${CNone}" >/dev/tty +echo "${CPurple} Type ${CWhite}exit${CPurple} to leave the shell when you are done. ${CNone}" >/dev/tty +echo "${CPurple}---------------------------------------------------------${CNone}" >/dev/tty +/bin/bash /dev/tty 2>/dev/tty + diff --git a/debian/_buildscripts/local/internals/_build_common.sh b/debian/_buildscripts/local/internals/_build_common.sh new file mode 100755 index 000000000..5e4ba67fe --- /dev/null +++ b/debian/_buildscripts/local/internals/_build_common.sh @@ -0,0 +1,248 @@ +#!/bin/bash + +set -a + +#---------------------------- +# Color table +# Black 0;30 Dark Gray 1;30 +# Blue 0;34 Light Blue 1;34 +# Green 0;32 Light Green 1;32 +# Cyan 0;36 Light Cyan 1;36 +# Red 0;31 Light Red 1;31 +# Purple 0;35 Light Purple 1;35 +# Brown 0;33 Yellow 1;33 +# Light Gray 0;37 White 1;37 +# No Color 0 +#---------------------------- +CBlack='\e[0;30m' +CDarkGray='\e[1;30m' +CBlue='\e[0;34m' +CLightBlue='\e[1;34m' +CGreen='\e[0;32m' +CLightGreen='\e[1;32m' +CCyan='\e[0;36m' +CLightCyan='\e[1;36m' +CRed='\e[0;31m' +CLightRed='\e[1;31m' +CPurple='\e[0;35m' +CLightPurple='\e[1;35m' +CBrown='\e[0;33m' +CYellow='\e[1;33m' +CGray='\e[0;37m' +CWhite='\e[1;37m' +CNone='\e[0m' + +set +a + +#---------------------------- +# Echo a colored string to tty and tee-append it to a file without color codes +# Parameters: +# $1 - string to echo +# $2 - log filename +# $3 - if "y" create a new file. +function echo_and_tee() +{ + if [ "$3" = "y" ]; then + echo -e "$1" | tee /dev/tty | sed -r "s|\x1b\[[0-9]+(;[0-9]+)?m||g" >"$2" + else + echo -e "$1" | tee /dev/tty | sed -r "s|\x1b\[[0-9]+(;[0-9]+)?m||g" >>"$2" + fi +} + +#---------------------------- +function _set_path_varables() +{ + # Set useful path variables + set -a + REPO_DIR="$TDE_DIR/$CFG_GIT_DIR" + REPO_TDE="$TDE_DIR/$CFG_GIT_DIR/tde" + REPO_TDE_MAIN="$REPO_TDE/main" + REPO_TDE_PACKAGING="$TDE_DIR/$CFG_GIT_DIR/tde-packaging/$DISTRO/$DISTRO_NAME" + REPO_EXTRA_DEPENDENCIES="$TDE_DIR/$CFG_GIT_DIR/$CFG_EXTRA_DEPS_DIR" + + BUILD_DIR="$TDE_DIR/$CFG_BUILD_DIR" + TDE_BUILD_DIR="$TDE_DIR/$CFG_BUILD_DIR/build" + TDE_DEBS_DIR="$TDE_DIR/$CFG_BUILD_DIR/debs" + + HOOK_DIR="$TDE_DIR/$CFG_GIT_DIR/$CFG_HOOKS_DIR" + + SCRIPT_LOG_DIR="$TDE_DIR/$CFG_SCRIPT_LOG_DIR" + LOG_BUILD_RESULT_FILENAME="$SCRIPT_LOG_DIR/build_result.log" # Common build logfile + LOG_UPDATE_REPO_FILENAME="$SCRIPT_LOG_DIR/update_repo.log" # Update repository logfile + set +a +} + +#---------------------------- +function init_common() +{ + # Check script folder + export SCRIPT_DIR=$(dirname $(readlink -f "$0")) + + # Prevent the script to be run from TDE packaging repo + REPO_URL=$(git config --get remote.origin.url 2>/dev/null) + if [ ! -z "$REPO_URL" ] && [ -z "${REPO_URL##*tde-packaging}" ]; then + echo -e "${CLightRed} --- ERROR ---${CNone}" + echo "This script cannot be run from the TDE packaging repository." + echo "Please follow the instructions provided, then rerun this script." + exit 1 + fi + + # Read config settings + CFG_FILE=$SCRIPT_DIR/_config.sh + if [ -f "$CFG_FILE" ]; then + . "$CFG_FILE" + _set_path_varables + else + echo -e "${CLightRed} --- NOTE ---${CNone}" + echo -e "Creating TDE build configuration file from template as ${CLightPurple}$CFG_FILE${CNone}." + echo "Please check and modify as required, then rerun this script." + cp "$SCRIPT_DIR/internals/_config_template.sh" "$CFG_FILE" + exit 2 + fi + + # Make sure we have selected a supported distribution + DISTS_FILE="$SCRIPT_DIR/internals/distro_list.txt" + if [ ! -f "$DISTS_FILE" ]; then + echo -e "${CLightRed} --- ERROR ---${CNone}" + echo "Could not find the list of supported distributions." + echo -e "Please check the file ${CLightPurple}$DISTS_FILE${CNone} exists, then rerun this script." + exit 3 + fi + # -- Need to use a "here string" otherwise if the DISTRO_FOUND value is modified + # -- inside the while loop, this would not remember after the loop. + DISTRO_FOUND="n" + while read l_distro l_version l_name l_rel_suffix; do + if [ "$l_distro" = "$DISTRO" -a "$l_name" = "$DISTRO_NAME" ]; then + DISTRO_FOUND="y" + export DISTRO_VERSION="$l_version" + export REL_SUFFIX="$l_rel_suffix" + break + fi + done <<< $(cat $DISTS_FILE | grep -E "^(\s*[^#\s]+\s+[^\s]+.*)$") + if [ "$DISTRO_FOUND" != "y" ]; then + echo -e "${CLightRed} --- ERROR ---${CNone}" + echo -e "The specified distribution (${CYellow}$DISTRO $DISTRO_NAME${CNone}) is not supported." + echo -e "Something is wrong with your configuration (${CLightPurple}$CFG_FILE${CNone})" + echo -e "or with the list of supported distributions (${CLightPurple}$DISTS_FILE${CNone})." + echo -e "Please check the ${CLightCyan}DISTRO${CNone} and ${CLightCyan}DISTRO_NAME${CNone} variables, then rerun this script." + exit 4 + fi + + # TDE root folder must exist + if [ ! -d "$TDE_DIR" ]; then + echo -e "${CLightRed} --- ERROR ---${CNone}" + echo "A valid TDE root folder could not be located. Something is wrong with your configuration" + echo -e "in the config file ${CLightPurple}$CFG_FILE${CNone}" + echo -e "Please check and modify the ${CLightCyan}TDE_DIR${CNone} variable as required, then rerun this script." + exit 5 + fi + + # Search for main TDE repo + CURR_DIR="" + [ -d "$REPO_TDE_MAIN" ] && cd "$REPO_TDE_MAIN" &>/dev/null && \ + CURR_DIR=$(git rev-parse --show-toplevel 2>/dev/null) + if [ -z "$CURR_DIR" ]; then + echo -e "${CLightRed} --- ERROR ---${CNone}" + echo "The main TDE repo could not be located. Something is wrong with your configuration" + echo -e "in the config file ${CLightPurple}$CFG_FILE${CNone}" + echo -e "Please check and modify the ${CLightCyan}TDE_DIR${CNone} variable as required, then rerun this script." + exit 6 + fi + + # Search for TDE packaging repo + CURR_DIR="" + [ -d "$REPO_TDE_PACKAGING" ] && cd "$REPO_TDE_PACKAGING" &>/dev/null && \ + CURR_DIR=$(git rev-parse --show-toplevel 2>/dev/null) + if [ -z "$CURR_DIR" ]; then + echo -e "${CLightRed} --- ERROR ---${CNone}" + echo "The TDE packaging repo could not be located. Something is wrong with your configuration" + echo -e "in the config file ${CLightPurple}$CFG_FILE${CNone}" + echo -e "Please check and modify the ${CLightCyan}TDE_DIR${CNone} variable as required, then rerun this script." + exit 7 + fi + + # Check branch configuration + # - branch existance + cd "$REPO_TDE" + BRANCHES=() + REMOTE_BRANCHES=(`git branch --remote | grep -v "HEAD" | sed "s|origin/||g"`) + for br in $UPDATE_BRANCHES; do + branch=`echo "$br" | sed -e "s|^[[:space:]]*||" -e "s|[[:space:]]*$||"` + found=0 + for rem_br in "${REMOTE_BRANCHES[@]}"; do + if [[ "$rem_br" == "$branch" ]]; then + found=1 + break + fi + done + if [[ found -eq 1 ]]; then + BRANCHES+=($branch) + else + echo -e "${CLightRed} --- ERROR ---${CNone}" + echo -e "Invalid branch specified (${CYellow}$branch${CNone}). Something is wrong with your configuration" + echo -e "in the config file ${CLightPurple}$CFG_FILE${CNone}" + echo -e "Please check and modify the ${CLightCyan}UPDATE_BRANCHES${CNone} variable as required, then rerun this script." + exit 8 + fi + done + if [ ${#BRANCHES[@]} -eq 0 ]; then + echo -e "${CLightRed} --- ERROR ---${CNone}" + echo -e "No valid branch was specified. Something is wrong with your configuration" + echo -e "in the config file ${CLightPurple}$CFG_FILE${CNone}" + echo -e "Please check and modify the ${CLightCyan}UPDATE_BRANCHES${CNone} variable as required, then rerun this script." + exit 9 + fi + export BRANCHES + # - default branch + DEFAULT_REPO_BRANCH=${OVERRIDE_DEFAULT_REPO_BRANCH:-"$DEFAULT_REPO_BRANCH"} + found=0 + for branch in "${BRANCHES[@]}"; do + if [[ "$DEFAULT_REPO_BRANCH" == "$branch" ]]; then + found=1 + break + fi + done + if [[ found -ne 1 ]]; then + echo -e "${CLightRed} --- ERROR ---${CNone}" + echo -e "Invalid default repo branch specified (${CYellow}$DEFAULT_REPO_BRANCH${CNone}). Something is wrong with your configuration" + echo -e "in the config file ${CLightPurple}$CFG_FILE${CNone}" + echo -e "Please check and modify the ${CLightCyan}DEFAULT_REPO_BRANCH${CNone} variable as required, then rerun this script." + exit 10 + fi + + cd "$SCRIPT_DIR" +} + + +#---------------------------- +# Save execution start time +# Parameters: +# $1 - timer number +function exec_time_start() +{ + _ET_start_var="_ET_start_$1" + eval "$_ET_start_var=`date +%s.%N`" +} + + +#---------------------------- +# Save execution stop time and set $2 to the execution time +# in the format: dd/hh:mm:ss.mmm +# Parameters: +# $1 - timer number +# $2 - result variable name +function exec_time_stop() +{ + _ET_start_var="_ET_start_$1" + _ET_stop_var="_ET_stop_$1" + eval "$_ET_stop_var=`date +%s.%N`" + _ET_diff=`echo "${!_ET_stop_var} - ${!_ET_start_var}" | bc` + _ET_days=`echo "$_ET_diff/86400" | bc` + _ET_diff_day=`echo "$_ET_diff-86400*$_ET_days" | bc` + _ET_hours=`echo "$_ET_diff_day/3600" | bc` + _ET_diff_hour=`echo "$_ET_diff_day-3600*$_ET_hours" | bc` + _ET_mins=`echo "$_ET_diff_hour/60" | bc` + _ET_secs=`echo "$_ET_diff_hour-60*$_ET_mins" | bc` + local _resultvar=$2 + eval "$_resultvar=`printf \"%02d/%02d:%02d:%06.3f\" $_ET_days $_ET_hours $_ET_mins $_ET_secs`" +} diff --git a/debian/_buildscripts/local/internals/_build_set_common.sh b/debian/_buildscripts/local/internals/_build_set_common.sh new file mode 100755 index 000000000..4bc1ea3e8 --- /dev/null +++ b/debian/_buildscripts/local/internals/_build_set_common.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +# Load common code and initialization +. ./internals/_build_common.sh +init_common + +_BUILDSET_TIMER=1 +_BUILDSET_TIME="--/--:--:--:---" + +parm_SKIP_FETCH="n" # if "y" skips N packages from the list +parm_SKIP_N=0 # this argument represents the number of packages to skip +SKIP_cnt=0 + + +#---------------------------- +# do_exit for set building +function do_exit() +{ + cd "$SCRIPT_DIR" + if [ $1 -eq 0 ]; then + echo -e "${CGray}#### Building process for set \"${0##*/}\" completed ####${CNone}" + else + echo -e "${CGray}#### Building process for set \"${0##*/}\" interrupted ($1) ####${CNone}" + fi + exit $1 +} + + +#---------------------------- +function set_log_start() +{ + echo -e "${CGray}#### Starting building process for set \"${0##*/}\" ####${CNone}" + echo + echo "---------- ${0##*/} ----------" >>"$LOG_BUILD_RESULT_FILENAME" + exec_time_start $_BUILDSET_TIMER +} + + +#---------------------------- +function set_log_end() +{ + exec_time_stop $_BUILDSET_TIMER "_BUILDSET_TIME" + echo " [$_BUILDSET_TIME] SET ${0##*/}" >>"$LOG_BUILD_RESULT_FILENAME" + echo >>"$LOG_BUILD_RESULT_FILENAME" + do_exit 0 +} + + +#---------------------------- +function build_module() +{ + if [ $parm_SKIP_N -gt 0 -a $SKIP_cnt -lt $parm_SKIP_N ]; then + SKIP_cnt=$((SKIP_cnt+1)) + else + ./build_module.sh "$BUILD_DEFAULT_OPTIONS $@" + echo + fi +} + + +#---------------------------- +# Check command line arguments +#---------------------------- +for arg in $@; do + if [ "$parm_SKIP_FETCH" = "y" ]; then + parm_SKIP_N=$arg + parm_SKIP_FETCH="n"BUILD_DEFAULT_OPTIONS + elif [ "$arg" = "-s" ]; then # skip first N packages + parm_SKIP_FETCH="y" + fi +done +if [ "$parm_SKIP_FETCH" = "y" ]; then + echo "Invalid command line arguments ($@)" + do_exit 3 +fi diff --git a/debian/_buildscripts/local/internals/_config_template.sh b/debian/_buildscripts/local/internals/_config_template.sh new file mode 100644 index 000000000..be992d297 --- /dev/null +++ b/debian/_buildscripts/local/internals/_config_template.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -a + +#---------------------------- +# Repo information +#---------------------------- +TDE_DIR="" # TDE root folder +UPDATE_BRANCHES="master" # Space separated list. Available choices: master, r14.0.x +DEFAULT_REPO_BRANCH="master" # After update in completed, switch repo to this branch. Must be + # one of the branches specified in UPDATE_BRANCHES + +#---------------------------- +# Build information +#---------------------------- +TDE_RELEASE="14.1.0" # TDE release number +DISTRO="debian" # Distro family +DISTRO_NAME="buster" # Distro name of specific version +ARCHITECTURE="amd64" # Build for this architecture +USE_PREBUILD_EXTRA_DEPS="y" # If == "y", use pre-built extra dependency packages +BUILD_DEFAULT_OPTIONS="-g -lr" # Default building options (pbuilder) +GPG_SIGN_KEYID="" # Use this GPG key to sign packages. If null, packages will not be signed + +#---------------------------- +# Base directories +#---------------------------- +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 + +set +a diff --git a/debian/_buildscripts/local/internals/_pbuilder.sh b/debian/_buildscripts/local/internals/_pbuilder.sh new file mode 100755 index 000000000..931fba56f --- /dev/null +++ b/debian/_buildscripts/local/internals/_pbuilder.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +function run_pdebuild() +{ + # pbuilder absolute paths + PBUILDER_HOOK_DIR="/var/cache/pbuilder/hooks" + PBUILDER_SHELL_HOOK_TEMPLATE="$SCRIPT_DIR/internals/C10shell" + PBUILDER_SHELL_HOOK="$PBUILDER_HOOK_DIR/C10shell" + PBUILDER_DEPS_HOOK="$PBUILDER_HOOK_DIR/D05deps" + + # Local option variables + # - internal pbuilder + OPT_INTERNAL_PBUILDER="" + if [ "$bool_INTERNAL_PBUILDER" = "y" ]; then + OPT_INTERNAL_PBUILDER="--use-pdebuild-internal" + fi + # Sign packages optino + OPT_SIGN_PKG_PBUILDER="" + 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 + + ## Build module in a clean chroot environment using pbuilder + # Install/remove shell hook + if [ ! -d "$PBUILDER_HOOK_DIR" ]; then + mkdir -p "$PBUILDER_HOOK_DIR" + fi + if [ "$bool_SHELL_HOOK" = "y" ]; then + cp "$PBUILDER_SHELL_HOOK_TEMPLATE" "$PBUILDER_SHELL_HOOK" + chmod a+x "$PBUILDER_SHELL_HOOK" + else + if [ -x "$PBUILDER_SHELL_HOOK" ]; then + rm "$PBUILDER_SHELL_HOOK" + fi + 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 + cat < "$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 +END_D05_01 + if [[ "$USE_PREBUILD_EXTRA_DEPS" = "y" ]]; then + # Get building branch from .tdescmrevision file + if [[ -f "$MOD_BUILD_PATH/.tdescmrevision" ]]; then + BUILD_BRANCH=`sed -r "s/([^-]+)-.*/\1/" "$MOD_BUILD_PATH/.tdescmrevision"` + while read l_branch l_repo l_component; do + if [ "$l_branch" = "$BUILD_BRANCH" ]; then + cat <> "$PBUILDER_DEPS_HOOK" +echo "deb [trusted=yes] $l_repo $DISTRO_NAME $l_component" >> /etc/apt/sources.list +END_D05_02 + break + fi + done <<< $(cat "$SCRIPT_DIR/internals/extra_deps.txt" | grep -E "^[[:space:]]*[^#[:space:]]+[[:space:]]+[^[:space:]]+.*$") + fi + fi + cat <> "$PBUILDER_DEPS_HOOK" +apt-get update +END_D05_03 + chmod a+x "$PBUILDER_DEPS_HOOK" + # Build + 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\" \ + -- \ + --bindmounts \"$TDE_DEBS_DIR\" \ + --hookdir \"$PBUILDER_HOOK_DIR\" \ + $OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\" + PBUILDER_RETVAL=$? + # Remove shell hook if it was installed before the build + if [ -x "$PBUILDER_SHELL_HOOK" ]; then + rm "$PBUILDER_SHELL_HOOK" + fi + # Remove deps hook + if [ -x "$PBUILDER_DEPS_HOOK" ]; then + rm "$PBUILDER_DEPS_HOOK" + fi + # Return pdebuild return value to calling function + return $PBUILDER_RETVAL +} + + +#---------------------------- +# The actual code is inside a function to allow the pdebuild return value to be +# correctly passed back to the calling script in all cases (root and non root users) +run_pdebuild \ No newline at end of file diff --git a/debian/_buildscripts/local/internals/distro_list.txt b/debian/_buildscripts/local/internals/distro_list.txt new file mode 100644 index 000000000..0ca037eb0 --- /dev/null +++ b/debian/_buildscripts/local/internals/distro_list.txt @@ -0,0 +1,31 @@ +#!/bin/bash + +# List of supported distributions +DISTROS=" + debian 5.0 lenny + debian 6.0 squeeze + debian 7.0 wheezy + debian 8.0 jessie + debian 9.0 stretch + debian 10.0 buster ~a + debian 10.0 sid ~b + raspbian 7.0 raspbian-wheezy + raspbian 8.0 raspbian-jessie + ubuntu 10.04 lucid + ubuntu 10.10 maverick + ubuntu 11.04 natty + ubuntu 11.10 oneiric + ubuntu 12.04 precise + ubuntu 12.10 quantal + ubuntu 13.04 raring + ubuntu 13.10 saucy + ubuntu 14.04 trusty + ubuntu 14.10 utopic + ubuntu 15.04 vivid + ubuntu 15.10 wily + ubuntu 16.04 xenial + ubuntu 16.10 yakkety + ubuntu 17.04 zesty + ubuntu 17.10 artful + ubuntu 18.04 bionic ~a +" diff --git a/debian/_buildscripts/local/internals/extra_deps.txt b/debian/_buildscripts/local/internals/extra_deps.txt new file mode 100644 index 000000000..12cd3b395 --- /dev/null +++ b/debian/_buildscripts/local/internals/extra_deps.txt @@ -0,0 +1,7 @@ +#!/bin/bash + +# List of repositories for extra dependency packages +EDEPS_REPO=" + master http://mirror.xcer.cz/trinity-tb deps + r14.0.x http://mirror.xcer.cz/trinity-sb deps-r14 +" diff --git a/debian/_buildscripts/local/scripts/00_extradeps.sh b/debian/_buildscripts/local/scripts/00_extradeps.sh deleted file mode 100755 index 4764dbc4c..000000000 --- a/debian/_buildscripts/local/scripts/00_extradeps.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -. ./internals/_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 deleted file mode 100755 index d9611d13d..000000000 --- a/debian/_buildscripts/local/scripts/01_base_01.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -set_log_start - -build_module "dependencies/tqt3" -build_module "dependencies/tqtinterface" -build_module "dependencies/arts" -build_module "dependencies/dbus-tqt" -build_module "dependencies/dbus-1-tqt" -build_module "dependencies/tqca-tls" -build_module "dependencies/libart-lgpl" -build_module "dependencies/avahi-tqt" -build_module "dependencies/libcaldav" -build_module "dependencies/libcarddav" -build_module "tdelibs" -build_module "libraries/libtdeldap" -build_module "tdebase" - -set_log_end diff --git a/debian/_buildscripts/local/scripts/02_base_02.sh b/debian/_buildscripts/local/scripts/02_base_02.sh deleted file mode 100755 index f92cb7f17..000000000 --- a/debian/_buildscripts/local/scripts/02_base_02.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -set_log_start - -build_module "dependencies/sip4-tqt" -build_module "dependencies/tqscintilla" -build_module "dependencies/python-tqt" -build_module "libraries/python-trinity" -build_module "libraries/pytdeextensions" -build_module "tdebindings" -build_module "tdeutils" -build_module "tdemultimedia" -build_module "tdeaccessibility" -build_module "tdenetwork" -build_module "tdeadmin" - -set_log_end diff --git a/debian/_buildscripts/local/scripts/03_base_03.sh b/debian/_buildscripts/local/scripts/03_base_03.sh deleted file mode 100755 index 11209ff55..000000000 --- a/debian/_buildscripts/local/scripts/03_base_03.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -set_log_start - -build_module "tdeartwork" -build_module "tdegames" -build_module "tdetoys" -build_module "tdeedu" -build_module "tdegraphics" -build_module "tdepim" -build_module "tdeaddons" -build_module "tdesdk" -build_module "tdevelop" -build_module "tdewebdev" - -set_log_end diff --git a/debian/_buildscripts/local/scripts/04_applications_01.sh b/debian/_buildscripts/local/scripts/04_applications_01.sh deleted file mode 100755 index 4901f3d9e..000000000 --- a/debian/_buildscripts/local/scripts/04_applications_01.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -set_log_start - -build_module "libraries/libkipi" -build_module "libraries/libkdcraw" -build_module "libraries/libkexiv2" -build_module "libraries/kipi-plugins" -build_module "applications/abakus" -build_module "applications/amarok" -build_module "applications/basket" -build_module "applications/digikam" -build_module "applications/dolphin" -build_module "applications/filelight" -build_module "applications/gtk3-tqt-engine" -build_module "applications/gtk-qt-engine" -build_module "applications/gwenview" -build_module "applications/gwenview-i18n" - -set_log_end diff --git a/debian/_buildscripts/local/scripts/05_applications_02.sh b/debian/_buildscripts/local/scripts/05_applications_02.sh deleted file mode 100755 index 489f832d4..000000000 --- a/debian/_buildscripts/local/scripts/05_applications_02.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -set_log_start - -build_module "applications/k3b" -build_module "applications/k3b-i18n" -build_module "applications/k9copy" -build_module "applications/kaffeine" -build_module "applications/kaffeine-mozilla" -build_module "applications/kasablanca" -build_module "applications/katapult" -build_module "applications/kbarcode" -build_module "applications/kbfx" -build_module "applications/kbibtex" -build_module "applications/kbiff" -build_module "applications/kbookreader" -build_module "applications/kchmviewer" -build_module "applications/kcmautostart" -# LDAP packages -build_module "libraries/libtdeldap" -build_module "applications/kcmldap" -build_module "applications/kcmldapcontroller" -build_module "applications/kcmldapmanager" -build_module "applications/kerberostray" - -set_log_end diff --git a/debian/_buildscripts/local/scripts/06_applications_03.sh b/debian/_buildscripts/local/scripts/06_applications_03.sh deleted file mode 100755 index 75a8a7e15..000000000 --- a/debian/_buildscripts/local/scripts/06_applications_03.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -set_log_start - -build_module "applications/kcpuload" -build_module "applications/kdbg" -build_module "applications/kdbusnotification" -build_module "applications/kdiff3" -build_module "applications/kdirstat" -build_module "applications/keep" -build_module "applications/kftpgrabber" -build_module "applications/kile" -build_module "applications/kima" -build_module "applications/kkbswitch" -build_module "applications/klcddimmer" -build_module "applications/kmplayer" -build_module "applications/kmyfirewall" -build_module "applications/kmymoney" -build_module "applications/knemo" -build_module "applications/knetload" -build_module "applications/knetstats" -build_module "applications/knmap" -build_module "applications/knowit" -build_module "applications/knutclient" - -set_log_end diff --git a/debian/_buildscripts/local/scripts/07_applications_04.sh b/debian/_buildscripts/local/scripts/07_applications_04.sh deleted file mode 100755 index f21a6e24f..000000000 --- a/debian/_buildscripts/local/scripts/07_applications_04.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -set_log_start - -build_module "applications/koffice" -build_module "applications/koffice-i18n" -build_module "applications/keximdb" -build_module "applications/konversation" -build_module "applications/kooldock" -build_module "applications/kopete-otr" -build_module "applications/kpicosim" -build_module "applications/kpilot" -build_module "applications/kplayer" -build_module "applications/krecipes" -build_module "applications/krename" -build_module "applications/krusader" -build_module "applications/kscope" -build_module "applications/ksensors" -build_module "applications/kshowmail" -build_module "applications/kshutdown" -build_module "applications/ksplash-engine-moodin" -build_module "applications/kstreamripper" -build_module "applications/ksystemlog" -build_module "applications/ktechlab" -build_module "applications/ktorrent" -build_module "applications/kuickshow" -build_module "applications/kvirc" -build_module "applications/kvkbd" -build_module "applications/kvpnc" -build_module "applications/kxmleditor" - -set_log_end - diff --git a/debian/_buildscripts/local/scripts/08_applications_05.sh b/debian/_buildscripts/local/scripts/08_applications_05.sh deleted file mode 100755 index 2d7622b15..000000000 --- a/debian/_buildscripts/local/scripts/08_applications_05.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -set_log_start - -build_module "applications/mplayerthumbs" -build_module "applications/qalculate-tde" -build_module "applications/piklab" -build_module "applications/potracegui" -build_module "applications/soundkonverter" -build_module "applications/tastymenu" -build_module "applications/tde-guidance" -build_module "applications/tdeio-apt" -build_module "applications/tdeio-ftps" -build_module "applications/tdeio-locate" -build_module "applications/tdeio-umountwrapper" -build_module "applications/tdenetworkmanager" -build_module "applications/tdepowersave" -build_module "applications/tderadio" -build_module "applications/tde-style-baghira" -build_module "applications/tde-style-domino" -build_module "applications/tde-style-ia-ora" -build_module "applications/tde-style-lipstik" -build_module "applications/tde-style-qtcurve" -build_module "applications/tde-systemsettings" -build_module "applications/tdmtheme" -build_module "applications/tork" -build_module "applications/twin-style-crystal" -build_module "applications/wlassistant" -build_module "applications/yakuake" - -set_log_end diff --git a/debian/_buildscripts/local/scripts/09_others_01.sh b/debian/_buildscripts/local/scripts/09_others_01.sh deleted file mode 100755 index 0d43fe983..000000000 --- a/debian/_buildscripts/local/scripts/09_others_01.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -set_log_start - -build_module "applications/tdeio-sword" -build_module "applications/bibletime" -build_module "applications/desktop-effects-tde" -build_module "applications/fusion-icon" -build_module "metapackages/sudo-trinity" -build_module "applications/kdpkg" -build_module "applications/kerry" -build_module "applications/kgtk-qt3" -build_module "applications/tdesudo" -build_module "applications/kiosktool" -build_module "applications/knights" -build_module "libraries/libksquirrel" -build_module "applications/ksquirrel" -build_module "applications/qt4-tqt-theme-engine" -build_module "applications/rosegarden" -build_module "applications/smartcardauth" -build_module "applications/smb4k" -build_module "applications/tdesvn" -build_module "applications/tellico" - -set_log_end diff --git a/debian/_buildscripts/local/scripts/10_others_02.sh b/debian/_buildscripts/local/scripts/10_others_02.sh deleted file mode 100755 index aa21f8dd1..000000000 --- a/debian/_buildscripts/local/scripts/10_others_02.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -. ./internals/_build_set_common.sh - -#---------------------------- -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 deleted file mode 100755 index a631a814f..000000000 --- a/debian/_buildscripts/local/scripts/91_build_base.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -./00_extradeps.sh -./01_base_01.sh -./02_base_02.sh -./03_base_03.sh diff --git a/debian/_buildscripts/local/scripts/92_build_applications.sh b/debian/_buildscripts/local/scripts/92_build_applications.sh deleted file mode 100755 index 174464c41..000000000 --- a/debian/_buildscripts/local/scripts/92_build_applications.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -./04_applications_01.sh -./05_applications_02.sh -./06_applications_03.sh -./07_applications_04.sh -./08_applications_05.sh - diff --git a/debian/_buildscripts/local/scripts/93_build_others.sh b/debian/_buildscripts/local/scripts/93_build_others.sh deleted file mode 100755 index c1222f8b0..000000000 --- a/debian/_buildscripts/local/scripts/93_build_others.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -./09_others_01.sh -./10_others_02.sh \ No newline at end of file diff --git a/debian/_buildscripts/local/scripts/99_build_TDE.sh b/debian/_buildscripts/local/scripts/99_build_TDE.sh deleted file mode 100755 index 32d4e4375..000000000 --- a/debian/_buildscripts/local/scripts/99_build_TDE.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -# Load common code and initialization -. ./internals/_build_common.sh -init_common - -_BUILDALL_TIMER=2 -_BUILDALL_TIME="--/--:--:--:---" - -parm_SKIP_FETCH="n" # if "y" skips N packages from the list -parm_SKIP_N=0 # this argument represents the number of packages to skip -SKIP_cnt=0 - - -#---------------------------- -# do_exit for set building -function do_exit() -{ - cd "$SCRIPT_DIR" - if [ $1 -eq 0 ]; then - echo -e "${CGray}#### Building process for TDE completed ####${CNone}" - else - echo -e "${CGray}#### Building process for TDE interrupted ($1) ####${CNone}" - fi - exit $1 -} - - -#---------------------------- -function set_log_start() -{ - echo -e "${CGray}#### Starting building process for TDE ####${CNone}" - echo - echo "********** TDE **********" >>"$LOG_RESULT_FILENAME" - exec_time_start $_BUILDALL_TIMER -} - - -#---------------------------- -function set_log_end() -{ - exec_time_stop $_BUILDALL_TIMER "_BUILDALL_TIME" - echo " [$_BUILDALL_TIME] All TDE " >>"$LOG_RESULT_FILENAME" - echo >>"$LOG_RESULT_FILENAME" - do_exit 0 -} - - -#---------------------------- -function build_set() -{ - if [ $parm_SKIP_N -gt 0 -a $SKIP_cnt -lt $parm_SKIP_N ]; then - SKIP_cnt=$((SKIP_cnt+1)) - else - ./build_module.sh -g -lr "$@" - echo - fi -} - - -#---------------------------- -# Check command line arguments -#---------------------------- -for arg in $@; do - if [ "$parm_SKIP_FETCH" = "y" ]; then - parm_SKIP_N=$arg - parm_SKIP_FETCH="n" - elif [ "$arg" = "-s" ]; then # skip first N packages - parm_SKIP_FETCH="y" - fi -done -if [ "$parm_SKIP_FETCH" = "y" ]; then - echo "Invalid command line arguments ($@)" - do_exit 3 -fi - - -#---------------------------- -# Build TDE -#---------------------------- -set_log_start -for setname in `find . -maxdepth 1 -type f -iname '[01]*' | sort`; do - if [ $parm_SKIP_N -gt 0 -a $SKIP_cnt -lt $parm_SKIP_N ]; then - SKIP_cnt=$((SKIP_cnt+1)) - else - $setname - fi -done -set_log_end diff --git a/debian/_buildscripts/local/scripts/README.txt b/debian/_buildscripts/local/scripts/README.txt deleted file mode 100644 index 8d8a248c7..000000000 --- a/debian/_buildscripts/local/scripts/README.txt +++ /dev/null @@ -1,207 +0,0 @@ ------ -Index ------ -A) Environment preparation -B) Notes about scripts -C) How to use the scripts - - --------------------------- -A) Environment preparation --------------------------- -0) Initial notes - - this guide has been prepared based on a clean debian testing netinstall system without any other DE. - It should work for other debian/ubuntu distros as well, but eventually you may run into small differences - here and there. - - you can change folder names below, as long as you update the "_config.sh" file accordingly. - -1) Install following packages: bc, cdbs, git, links2, pbuilder, rsync and required dependencies. - NOTE: sudo should already be installed. If not, install sudo as well. - -2) Create a base folder for TDE, hereafter referred to as TDE_DIR (for example $HOME/tde_src) - -3) Create the following folders [ see NOTE at point 0) about folder names ] - - in TDE_DIR: 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_DIR/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 - -4) Clone TDE git repositories and extra dependency modules: - - TDE main repo - cd "TDE_DIR/1_git" - git clone https://mirror.git.trinitydesktop.org/gitea/TDE/tde - cd tde - git submodule init -- scripts - git submodule update -- scripts - ./scripts/switch_all_submodules_to_head_and_clean anonymous - - TDE packaging repo - cd "TDE_DIR/1_git" - git clone https://mirror.git.trinitydesktop.org/gitea/TDE/tde-packaging - - extra dependency packages - 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 - 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 near the "Filter" button and click - the button to update. You should get a list of 10-15 modules, depending on the distro. - * Click on one module at a time, it will expand (or open another page) and show a list of .deb and other files. - * Save those files (exclude .deb files. Only .orig.tar.xz, .dsc, .debian.tar.xz are required) and store - them to TDE_DIR/1_git/edeps/ folder (one folder per module). - -5) Add your user to the sudo group (not required if you are root) - su -c "adduser sudo" - Optionally, consider extending your sudo timeout interval to avoid having to type your password too often (this - could be quite painful especially during long builds, which would not be able to complete if unattended). - Logout and login again to make sure the setting is applied. - -6) Copy the files from "TDE_DIR/1_git/tde-packaging/debian/_buildscripts/local/buildscripts/additional files" folder - to the respectivily named folders. - -7) Create pbuilder base package with the command: - sudo pbuilder --create - If you wish to build for a different distro or architecture, use the command: - sudo DIST= ARCH= pbuilder --create - -8) Setup the build scripts locally: - - copy build scripts from "TDE_DIR/1_git/tde-packaging/debian/_buildscripts/local/buildscripts" to "TDE_DIR/buildscripts" - and make sure all shell scripts are executable - - cd "TDE_DIR/buildscripts" - - cp ./internals/_config_template.sh _config.sh - - edit "_config.sh" to set your preferences and check that the various folder names match the structure on your disk. - Make sure to set the variable TDE_DIR to the correct path and the variables DISTRO, DISTRO_NAME and ARCHITECTURE to - match the distro and architecture you want to build for. - - - ----------------------- -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_DIR/2_build/debs// and the source code and build reports in TDE_DIR/2_build/debs//src/ - -The source code can be either the git repo or a local copy in TDE_DIR/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. - -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_DIR/2_build/debs//src/__build__.log - -When building sets of modules or the whole TDE, a global build summary is automatically stored to TDE_DIR/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 * -- scripts in 'internals' folder - Scripts used intenally by other scripts. No need for invoking these directly. - -- 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 while the build is ongoing - -lr (Log Result) : log (append) build result (OK, FAILED) to TDE_DIR/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 (experimental) - --
_.sh - A number of scripts used to build sets of modules. Each script builds an individual set. - Modules are built from the git sources and the build result is automatically appended to - TDE_DIR/0_logs/build_result.log. - Usage: -
_.sh [options] set_name - Options: - -s N: if specified, skip first N modules from the set of modules - - The sets are logically grouped as "base system", "applications" and "others" - 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_others.sh : all modules in 09_others_01.sh - 10_others_02.sh - -- 99_build_TDE.sh - Script used to build the whole TDE at once. Calls the dd_setname.sh set scripts in order. - Usage: - build_TDE.sh [options] - Options: - -s N: if specified, skip first N sets from the list of sets - -- create_repo.sh - Creates a local repository from the .deb files currently stored in TDE_DIR/2_build/debs. - Usage: - create_repo.sh [options] - Options: - -b (Backup) : create a backup of the existing repository in TDE_DIR/CFG_REPO_DIR.backup - - -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. -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_DIR/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 -------------------------- -1) Follow the steps in section "A) Environment preparation" (only required the first time). -2) cd "TDE_DIR/buildscripts" -3) Update to latest git repository using - ./update_repositories.sh - Wait until "Update completed" is printed out. Check log in TDE_DIR/0_logs/ if you wish. -4) Run "sudo 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. You don't need to use "sudo" directly since the scripts will do that automatically if - required. Just type your sudo password when prompted to do so. -6) Create a local repository from the packages you have just built, to be used as installation repository. - Add the following lines to /etc/apt/sources.list and follow the usual way to install TDE. - # --- LOCAL TDE REPOSITORY --- - deb [arch= trusted=yes] file:TDE_DIR/3_repo main - For example: - deb [arch=amd64 trusted=yes] file:/home/tde_src/3_repo buster main - - -Examples of real usage: - -1) build a single module - - ./build_module.sh -g -sl "dependencies/libr" -> build libr package. This is a good test to check - whether everything is working fine - - ./build_module.sh -g "tdelibs" -> build "tdelibs" from git sources in a clean chroot environment - - ./build_module.sh -g -l -sl "applications/amarok" -> build "amarok" locally from git sources and - display building logs during building - - ./build_module.sh -sh -lr "tdebase" -> build "tdebase" from the local sources (in TDE_DIR/2_build/build/tdebase) - in a clean chroot environment and launch a shell in case of building failure. - Append the build result (OK, FAILED) to TDE_DIR/scripts/logs/build_result.log - - ./build_module.sh -g -po "tdelibs" -> prepare "tdelibs" for building from git sources. Source code will be available - in TDE_DIR/2_build/build/tdelibs. After you have made changes to the source and - want to build the modified package, run './build_module.sh "tdelibs"' - -2) build a single set - (optional) delete the TDE_DIR/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 of the set. - -3) build all TDE - ./99_build_TDE.sh : build all TDE - ./99_build_TDE.sh -s 4 : build all TDE, but skip the first 4 sets diff --git a/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc b/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc deleted file mode 100644 index 81e7894c4..000000000 --- a/debian/_buildscripts/local/scripts/additional files/etc/pbuilderrc +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/bash - -# general options -BUILDPLACE="/var/cache/pbuilder/build/" -USEPROC=yes -USEDEVPTS=yes -USEDEVFS=no - -# the username and ID used by pbuilder, inside chroot. Needs fakeroot, really -BUILDUSERID=1234 -BUILDUSERNAME=pbuilder - -# 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" - -# this is necessary for running 'apt-ftparchive' in a hook script if required -EXTRAPACKAGES="$EXTRAPACKAGES apt-utils" - -#APT configuration files directory -APTCONFDIR="" - -# Set the PATH to be used inside pbuilder -export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin" -# Shell to be used inside pbuilder by commands like 'su' -export SHELL=/bin/bash - -# default PKGNAME_LOGFILE -PKGNAME_LOGFILE="__build__.log" - -#-- get desired distribution and architecture -if [ "$DIST" = "" ]; then - DIST=$(lsb_release -cs) -fi -DISTRIBUTION=$DIST -if [ "$ARCH" = "" ]; then - ARCH=$(dpkg --print-architecture) -fi -ARCHITECTURE=$ARCH - -if [ -n "$T" ]; then - if [ "${T##*-}" = "vm" ]; then - BUILD_VM="qemu" - T=${T%-vm} - fi - if [ "${T#*@}" = "$T" ]; then - DISTRIBUTION=${T%-*} - ARCHITECTURE=${T##*-} - else - DISTRIBUTION=${T%@*} - ARCHITECTURE=${T##*@} - fi - if [ "${DISTRIBUTION##*-}" = "backports" ]; then - BACKPORTS="yes" - DISTRIBUTION=${DISTRIBUTION%-backports} - fi -fi - -BASETGZ="/var/cache/pbuilder/base-$DIST@$ARCH.tgz" - -#-- select apt components -case "$DISTRIBUTION" in - sid|buster|stretch|jessie|wheezy|squeeze|lenny|etch|sarge) - COMPONENTS="main contrib non-free" - ;; - - ceres|beowulf|ascii) - COMPONENTS="main" - DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg) - EXTRAPACKAGES="$EXTRAPACKAGES devuan-keyring" - ;; - - bionic|artful|zesty|yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick|lucid) - COMPONENTS="main restricted universe multiverse" - DEBOOTSTRAPOPTS=(--variant=buildd) - ;; - - raspbian-jessie|raspbian-wheezy) - COMPONENTS="main contrib non-free" - DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg) - ;; -esac -EXTRAPACKAGES="$EXTRAPACKAGES fakeroot apt-transport-https ca-certificates" - -#-- select base apt sources -case "$DISTRIBUTION" in - sid|buster|stretch|jessie|wheezy) - MIRRORSITE=http://deb.debian.org/debian - ;; - - squeeze|lenny|etch|sarge) - MIRRORSITE=http://archive.debian.org/debian - OTHERMIRROR="#deb http://archive.debian.org/backports.org $DISTRIBUTION-backports main contrib non-free" - ;; - - ceres|beowulf|ascii) - MIRRORSITE=http://auto.mirror.devuan.org/merged - ;; - - bionic|artful|zesty|yakkety|wily|vivid|trusty|precise) - if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then - MIRRORSITE=http://archive.ubuntu.com/ubuntu - else - MIRRORSITE=http://ports.ubuntu.com - fi - ;; - - xenial) - if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then - MIRRORSITE=http://archive.ubuntu.com/ubuntu - else - MIRRORSITE=http://ports.ubuntu.com - fi - OTHERMIRROR="deb $MIRRORSITE $DISTRIBUTION-updates $COMPONENTS" - ;; - - utopic|saucy|raring|quantal|oneiric|natty|maverick|lucid) - MIRRORSITE=http://old-releases.ubuntu.com/ubuntu - ;; - - raspbian-jessie|raspbian-wheezy) - MIRRORSITE=http://ftp.fi.muni.cz/pub/linux/raspbian/raspbian - ;; -esac - -if [ -n "${ARCH}" ]; then - NAME="$NAME-$ARCH" - DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}") -fi - -BUILDRESULT="/var/cache/pbuilder/$DISTRIBUTION/result/" - -APTCACHE="/var/cache/pbuilder/aptcache/$DISTRIBUTION/" -if [ -n "$APTCACHE" ] && [ ! -d "$APTCACHE" ]; then - mkdir $APTCACHE -fi -if [ -z "$(stat -L --print "%d\n" $APTCACHE/. /var/cache/pbuilder/build/. | uniq -d)" ]; then - # apt cache for build on tmpfs is managed by hook scripts - BINDMOUNTS="${BINDMOUNTS} ${APTCACHE}" - APTCACHEHARDLINK=no - APTCACHE="" -fi - -# default PKGNAME_LOGFILE -PKGNAME_LOGFILE="__build__.log" - -#-- extra options -DEBBUILDOPTS="-B" -if [ "$ARCHITECTURE" == "amd64" ]; then - DEBBUILDOPTS="-b" -fi -if [ "${DISTRIBUTION#raspbian}" != "$DISTRIBUTION" ] && [ "$ARCHITECTURE" == "armhf" ]; then - DEBBUILDOPTS="-b" - DISTRIBUTION=${DISTRIBUTION#raspbian-} -fi -if [ -z "$DEB_SIGN_KEYID" ]; then - AUTO_DEBSIGN=${AUTO_DEBSIGN:-no} -fi - -#-- choose dependency solver -#-- apt is better if target distribution contains apt >= 1.4~beta3 -#-- aptitude is better if target distribution contains apt < 1.4~beta3 -case "$DISTRIBUTION" in - sid|buster|stretch|\ - ceres|beowulf|ascii|\ - bionic|artful|zesty) - PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt" - ;; - - jessie|wheezy|squeeze|lenny|etch|sarge|\ - raspbian-jessie|raspbian-wheezy|\ - yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick|lucid) - PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-aptitude" - ;; -esac diff --git a/debian/_buildscripts/local/scripts/build_module.sh b/debian/_buildscripts/local/scripts/build_module.sh deleted file mode 100755 index adfc4172e..000000000 --- a/debian/_buildscripts/local/scripts/build_module.sh +++ /dev/null @@ -1,455 +0,0 @@ -#!/bin/bash -# -# Build a single TDE module -# - -# Load common code and initialization -. ./internals/_build_common.sh -init_common - - -# Timer settings -_BUILDMOD_TIMER_NUM=0 -_BUILDMOD_TIME="--/--:--:--:---" -exec_time_start $_BUILDMOD_TIMER_NUM - - -# Need sudo for non-root users -SUDO_CMD="" -if [ "`whoami`" != "root" ]; then - SUDO_CMD="sudo -E" -fi - - -#---------------------------- -# Parameters: -# $1 - error code -function do_exit() -{ - cd "$SCRIPT_DIR" - if [ $1 -eq 0 ]; then - echo -e "${CGreen}#### Processing module ${CLightGreen}\"$MOD_NAME\"${CGreen} succeeded ####${CNone}" - if [ "$bool_LOG_RESULT" = "y" ]; then - echo "[ OK ] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_RESULT_FILENAME" - fi - else - echo -e "${CRed}#### Processing module ${CLightRed}\"$MOD_NAME\"${CRed} failed ($1) ####${CNone}" - if [ "$bool_LOG_RESULT" = "y" ]; then - echo "[FAILED] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_RESULT_FILENAME" - fi - fi - exit $1 -} - - -#---------------------------- -# Parameters: -# $1 - folder name -function recreate_folder() -{ - if [ -d "$1" ]; then - $SUDO_CMD rm -R "$1" - fi - mkdir -p "$1" -} - - -#---------------------------- -# Check command line arguments and set options -#---------------------------- -MOD_NAME="" # the module to be built -bool_BUILD_FROM_GIT="n" -bool_EXTRADEP_MOD="n" -bool_SHOW_BUILD_LOGS="n" -bool_BUILD_LOCALLY="n" -bool_LOG_RESULT="n" -bool_SHELL_HOOK="n" -bool_PREPARE_ONLY="n" -bool_DEBUG_MODE="n" -bool_INTERNAL_PBUILDER="n" -for arg in $@; do - if [ "$arg" = "-g" ]; then # select code to build from Git repo (-g) or from local build copy - bool_BUILD_FROM_GIT="y" - elif [ "$arg" = "-l" ]; then # build module Locally instead of in a clean chroot environment - bool_BUILD_LOCALLY="y" - elif [ "$arg" = "-sl" ]; then # output the building logs to terminal (ShowLog) - bool_SHOW_BUILD_LOGS="y" - elif [ "$arg" = "-lr" ]; then # Log build Result to file - bool_LOG_RESULT="y" - elif [ "$arg" = "-sh" ]; then # install Shell Hook for failing builds (only valid if NOT building locally) - bool_SHELL_HOOK="y" - elif [ "$arg" = "-po" ]; then # Prepare build folder Only but do not build - 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 (experimental) - bool_INTERNAL_PBUILDER="y" - elif [ "$MOD_NAME" = "" ]; then # module to be built - MOD_NAME="$arg" - fi -done - -if [ "$MOD_NAME" = "" ]; then - echo "Please specify the module to build" - do_exit 3 -fi - -# Check if module is an extra dependency -if [[ $MOD_NAME =~ ^$CFG_EXTRA_DEPS_DIR/ ]]; then - bool_EXTRADEP_MOD="y" -fi - -# Shell hook is only valid if not building locally -# Internal pbuilder option has no meaning if we are building locally -if [ "bool_BUILD_LOCALLY" = "y" ]; then - bool_SHELL_HOOK="n" - bool_INTERNAL_PBUILDER="n" -fi -export bool_SHELL_HOOK -export bool_INTERNAL_PBUILDER - -# Local option variables -# - sign packages -OPT_SIGN_PKG_LOCAL="-uc -us" -# - show logs -OPT_SHOW_LOGS="&>" -if [ "$bool_SHOW_BUILD_LOGS" = "y" ]; then - OPT_SHOW_LOGS=" | tee " -fi -export OPT_SHOW_LOGS - -# Log start -echo -e "${CLightCyan}#### Processing module \"$MOD_NAME\" ####${CNone}" - - -#---------------------------- -# Base directories -#---------------------------- -GIT_DIR="$TDE_DIR/$CFG_GIT_DIR" -BUILD_DIR="$TDE_DIR/$CFG_BUILD_DIR" -GIT_TDE_MAIN="$TDE_DIR/$CFG_GIT_TDE_MAIN" -GIT_TDE_PACKAGING="$TDE_DIR/$CFG_GIT_TDE_PACKAGING" -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") - -for var_name in ${BASE_DIRS[@]}; do - if [ ! -d "${!var_name}" ]; then - echo -e "$var_name directory missing. Value is \"${!var_name}\". Check your config or create it." - do_exit 4 - fi -done - - -#---------------------------- -# Build output directories -#---------------------------- -TDE_BUILD_DIR="$TDE_DIR/$CFG_TDE_BUILD_DIR" -export TDE_DEBS_DIR="$TDE_DIR/$CFG_TDE_DEBS_DIR" - -BUILD_DIRS=("TDE_BUILD_DIR" "TDE_DEBS_DIR") - -for var_name in ${BUILD_DIRS[@]}; do - if [ ! -d "${!var_name}" ]; then - mkdir "${!var_name}" - fi -done - - -#---------------------------- -# Check module name validity -#---------------------------- -if [ "$bool_EXTRADEP_MOD" != "y" ]; then - # Standard module - MOD_GIT_PATH="$GIT_TDE_MAIN/$MOD_NAME" - MOD_GIT_PKGING_PATH="$GIT_TDE_PACKAGING/$MOD_NAME/debian" -else - # Extra dependency module - MOD_GIT_PATH="$GIT_DIR/$MOD_NAME" -fi -MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME" -MOD_BUILD_PKGING_PATH="$MOD_BUILD_PATH/debian" - -if [ "$bool_BUILD_FROM_GIT" = "y" ]; then - echo -e "${CYellow}> Building from GIT repo${CNone}" - # source files - if [ ! -d "$MOD_GIT_PATH" ]; then - echo "Module \"$MOD_NAME\" not found in GIT" - do_exit 5 - fi - bool_COPY_MOD_SRC="y" - - # packaging scripts - if [ "$bool_EXTRADEP_MOD" != "y" -a ! -d "$MOD_GIT_PKGING_PATH" ]; then - echo "Packaging for \"$MOD_NAME\" not found in GIT" - do_exit 6 - fi - bool_COPY_PKGING_FILES="y" - # -else - echo -e "${CYellow}> Building from BUILD folder${CNone}" - # source files - bool_COPY_MOD_SRC="n" - if [ ! -d "$MOD_BUILD_PATH" ]; then - if [ ! -d "$MOD_GIT_PATH" ]; then - echo "Module \"$MOD_NAME\" not found neither in BUILD nor in GIT" - do_exit 7 - fi - bool_COPY_MOD_SRC="y" - fi - - # packaging scripts - bool_COPY_PKGING_FILES="n" - if [ "$bool_EXTRADEP_MOD" != "y" -a ! -d "$MOD_BUILD_PKGING_PATH" ]; then - if [ ! -d "$MOD_GIT_PKGING_PATH" ]; then - echo "Packaging for \"$MOD_NAME\" not found neither in BUILD nor in GIT" - do_exit 8 - fi - bool_COPY_PKGING_FILES="y" - fi -fi - -#---------------------------- -# Prepare source files -#---------------------------- -# remove output from previous build -if [ -d "$MOD_BUILD_PATH" ]; then - cd "$MOD_BUILD_PATH/.." - $SUDO_CMD rm *.deb *.dsc *.changes *.tar.bz2 *.tar.gz *.tar.xz *.log *.buildinfo &>/dev/null -fi - -# copy main repo source files, if needed -if [ "$bool_COPY_MOD_SRC" = "y" ]; then - bool_COPY_PKGING_FILES="y" - recreate_folder "$MOD_BUILD_PATH" - if [ "$bool_EXTRADEP_MOD" != "y" ]; then - # Normal module - cp -R "$MOD_GIT_PATH" "$MOD_BUILD_PATH/.." - # Add SCM information for crash test report - [ -f "$MOD_BUILD_PATH/.tdescmmodule" ] && rm "$MOD_BUILD_PATH/.tdescmmodule" - [ -f "$MOD_BUILD_PATH/.tdescmrevision" ] && rm "$MOD_BUILD_PATH/.tdescmrevision" - # --> Module name - echo "$MOD_NAME" >"$MOD_BUILD_PATH/.tdescmmodule" - # --> SCM info - cd "$MOD_GIT_PATH" - MOD_BRANCH=`git branch --contains HEAD | grep -v "no branch" | head -n1 | cut -c 3-` - COMMIT_HASH=`git rev-parse HEAD` - echo "$MOD_BRANCH-$COMMIT_HASH" >"$MOD_BUILD_PATH/.tdescmrevision" - else - # Extra dependency module - if [ `find "$MOD_GIT_PATH" -name '*.dsc' | wc -l` == 1 ]; then - if [ -d "$MOD_BUILD_PATH" ]; then - $SUDO_CMD rm -R "$MOD_BUILD_PATH" - fi - 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\"" - do_exit 9 - fi - fi -fi - -# copying packaging scripts, if needed -if [ "$bool_EXTRADEP_MOD" != "y" -a "$bool_COPY_PKGING_FILES" = "y" ]; then - if [ -d "$MOD_BUILD_PKGING_PATH" ]; then - $SUDO_CMD rm -R $MOD_BUILD_PKGING_PATH - fi - cp -R "$MOD_GIT_PKGING_PATH" "$MOD_BUILD_PKGING_PATH" - - # TODO metapackage support - - if [ "$USE_LOCAL_BUILD_NUMBER" != "y" ]; then - # Default package name (Slavek's repo style) - # Calculate package version - cd $MOD_GIT_PATH - branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` - target_tag=`git tag | grep -F "$TDE_RELEASE" | head -n1` - tag=`git tag | \ - sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \ - while read t; do \ - git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \ - echo "$t..HEAD" && break; done` - count=`git log $tag --pretty=oneline | wc -l` - package=$(basename $PWD)-trinity-$TDE_RELEASE - if [[ "$count" -gt 0 ]] || [[ -z "$target_tag" ]]; then - package=$package~pre$count+$(git rev-parse HEAD | cut -c 1-8) - fi - REL=4:$TDE_RELEASE${package#*$TDE_RELEASE} - REL=${REL%+*} - REL=${REL/4:14.0.0/4:14.0.0-s} - REL=${REL/4:14.0.0-s~pre/4:14.0.0-s~} - REL=${REL/.0~pre/.0~s} - # Get package name and packaging release - PKG_NAME=$(head -n1 $MOD_BUILD_PKGING_PATH/changelog) - PKG_NAME=${PKG_NAME%% *} - PKG_TAG=$(cd "$GIT_TDE_PACKAGING/$MOD_NAME" && - git tag | \ - sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \ - while read t; do \ - git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \ - echo "$t..HEAD" && break; done) - PKG_REL=$(cd "$GIT_TDE_PACKAGING/$MOD_NAME" && - git log $PKG_TAG --pretty=oneline . | wc -l) - if [ -n "$REL_SUFFIX" ]; then - PKG_REL="${PKG_REL}${REL_SUFFIX}" - fi - # TODO add relative patch count - ADD_REL=0 - - DATE=$(date -R) - GITUSER="$(git config --get user.name) <$(git config --get user.email)>" - echo "$PKG_NAME ($REL-0$DISTRO$DISTRO_VERSION.$ADD_REL+$PKG_REL) $DISTRO_NAME; urgency=low" > "$MOD_BUILD_PKGING_PATH/changelog" - echo -e "\n * Automated git build\n\n -- $GITUSER $DATE\n" >> "$MOD_BUILD_PKGING_PATH/changelog" - cat "$GIT_TDE_PACKAGING/$MOD_NAME/debian/changelog" >> "$MOD_BUILD_PKGING_PATH/changelog" - else - # Local build version - if [ "$BUILD_DATE" = "" ]; then - BUILD_DATE=`date +%Y%m%d+%H%M` - fi - BUILDISTRO_NAME="4:$TDE_RELEASE-${BUILD_NUMBER}+$BUILD_DATE" # Module build version number (quilt format) - dch -b -v "$BUILDISTRO_NAME" -D "$DISTRO_NAME" -c "$MOD_BUILD_PKGING_PATH/changelog" "Autogenerated by building script" &>/dev/null - fi -fi - -# prepare destination directory for building -export MOD_DEB_PATH="$TDE_DEBS_DIR/$MOD_NAME" -MOD_DEBSRC_PATH="$MOD_DEB_PATH/src" -recreate_folder "$MOD_DEB_PATH" -recreate_folder "$MOD_DEBSRC_PATH" - - -#---------------------------- -# Apply pre-build hooks if present -#---------------------------- -if [ -x "$HOOK_DIR/$MOD_NAME/pre_build.sh" ]; then - echo -e "${CYellow}> Applying pre-build hook${CNone}" - . "$HOOK_DIR/$MOD_NAME/pre_build.sh" - if [ $? -eq 0 ]; then - echo -e "> ${CBrown}Pre-build hook applied successfully${CNone}" - else - echo -e "> ${CLightBlue}Pre-build hook failed${CNone}" - fi -fi - - -#---------------------------- -# Switch to 3.0(quilt) format -#---------------------------- -# create orig tarball -cd "$MOD_BUILD_PATH" -MOD_BASENAME=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^([^ ]+).*/\1/"` -MOD_MAJOR_VER=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^[^ ]+ \(([^:]+:)?.*/\1/"` -MOD_UP_VER=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^[^ ]+ \(([^:]+:)?([^-]+).*/\2/"` -MOD_DEB_VER=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^[^ ]+ \([^-]+-([^\)]+).*/\1/"` - -tar cJf "../${MOD_BASENAME}_${MOD_UP_VER}.orig.tar.xz" --exclude="debian" --exclude=".git*" . - -# switch to quilt format -if [ -f "$MOD_BUILD_PKGING_PATH/source/format" ]; then - grep -q "(native)" "$MOD_BUILD_PKGING_PATH/source/format" && \ - sed -i "s/(native)/(quilt)/" "$MOD_BUILD_PKGING_PATH/source/format" -else - [ -d "$MOD_BUILD_PKGING_PATH/source" ] || mkdir -p "$MOD_BUILD_PKGING_PATH/source" - echo "3.0 (quilt)" >"$MOD_BUILD_PKGING_PATH/source/format" -fi - -# remove quilt references from rules file -grep -q "^include.*/usr/share/cdbs/1/rules/patchsys-quilt\.mk" "$MOD_BUILD_PKGING_PATH/rules" && \ -sed -i "s/^\(include.*\/usr\/share\/cdbs\/1\/rules\/patchsys-quilt\.mk\)/#\1/" "$MOD_BUILD_PKGING_PATH/rules" - -if [ "$bool_PREPARE_ONLY" = "y" ]; then - echo -e "${CBrown}Source code prepared for building${CNone}" - do_exit 0 -fi - - -#---------------------------- -# Enable debug mode if required -#---------------------------- -if [ "$bool_DEBUG_MODE" = "y" ]; then - echo -e "${CBrown}Enable debug mode${CNone}" - sed -i "s/RelWithDebInfo/Debug/" "$MOD_BUILD_PKGING_PATH/rules" -fi - - -#---------------------------- -# Build -#---------------------------- -export BUILDING_LOG_FILE="$MOD_DEBSRC_PATH/__build__.log" -cd "$MOD_BUILD_PATH" - -if [ "$bool_BUILD_LOCALLY" = "y" ]; then - ## Build module locally - echo -e "${CYellow}> Building locally${CNone}" - eval dpkg-buildpackage $OPT_SIGN_PKG_LOCAL $OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\" - build_retval=$? -else - ## Build module in a clean chroot environment using pbuilder - $SUDO_CMD "$SCRIPT_DIR/internals/_pbuilder.sh" - build_retval=$? - if [ "`whoami`" != "root" ]; then - cd "$MOD_DEB_PATH" - $SUDO_CMD chown -R `id -u -n`:`id -g -n` . &>/dev/null - cd "$MOD_BUILD_PATH/.." - $SUDO_CMD chown `id -u -n`:`id -g -n` *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.buildinfo &>/dev/null - $SUDO_CMD chown `id -u -n`:`id -g -n` "$TDE_DEBS_DIR/Packages" &>/dev/null - cd "$MOD_BUILD_PATH" - fi -fi - -if [ $build_retval -eq 0 ]; then - echo -e "${CLightGreen}> Building completed SUCCESSFULLY${CNone}" -else - echo -e "${CLightRed}> Building completed WITH ERRORS${CNone}" -fi - - -#---------------------------- -# Apply post-build hooks if present -#---------------------------- -if [ -x "$HOOK_DIR/$MOD_NAME/post_build.sh" ]; then - echo -e "${CYellow}> Applying post-build hook${CNone}" - . "$HOOK_DIR/$MOD_NAME/post_build.sh" - if [ $? -eq 0 ]; then - echo -e "${CBrown}Post-build hook applied successfully${CNone}" - else - echo -e "${CLightBlue}Post-build hook failed${CNone}" - fi -fi - -#---------------------------- -# Move compiled module files to destination folders -#---------------------------- -if [ "$bool_BUILD_LOCALLY" = "y" ]; then - cd "$MOD_BUILD_PATH/.." - mv *.deb "$MOD_DEB_PATH" &>/dev/null - mv *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.buildinfo "$MOD_DEBSRC_PATH" &>/dev/null -else - cd "$MOD_DEB_PATH" - mv *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.buildinfo "$MOD_DEBSRC_PATH" &>/dev/null - cd "$MOD_BUILD_PATH/.." - mv *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.buildinfo "$MOD_DEBSRC_PATH" &>/dev/null -fi - - -#---------------------------- -# Removing leftover files -#---------------------------- -cd "$MOD_BUILD_PATH/.." -rm *.deb *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.log *.buildinfo &>/dev/null -cd "$MOD_DEB_PATH" -rm *.dsc *.changes *.tar.xz *.tar.bz2 *.tar.gz *.log *.buildinfo &>/dev/null - - -#---------------------------- -# Building completed -#---------------------------- -exec_time_stop $_BUILDMOD_TIMER_NUM "_BUILDMOD_TIME" -do_exit $build_retval diff --git a/debian/_buildscripts/local/scripts/create_repo.sh b/debian/_buildscripts/local/scripts/create_repo.sh deleted file mode 100755 index 1f1e1cb0f..000000000 --- a/debian/_buildscripts/local/scripts/create_repo.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# -# Create/update TDE local debian repository -# - -# Load common code and initialization -. ./internals/_build_common.sh -init_common - -#---------------------------- -# Check command line arguments -parm_MAKE_BACKUP="n" -for arg in $@; do - if [ "$arg" = "-b" ]; then # backup old repository - parm_MAKE_BACKUP="y" - fi -done - - -#---------------------------- -# Create/update TDE local debian repository -echo -e "${CLightCyan}#### TDE local repository creation begin ####${CNone}" -ARCH_PATH="dists/$DISTRO_NAME/main/binary-$ARCHITECTURE" -REPO_DIR="$TDE_DIR/$CFG_REPO_DIR" -REPO_DIR_BACKUP="$REPO_DIR.backup" -REPO_PKG_DIR="$REPO_DIR/$ARCH_PATH" -TDE_DEBS_DIR="$TDE_DIR/$CFG_TDE_DEBS_DIR" - -# Backup -if [ "$parm_MAKE_BACKUP" = "y" ] && [ -d "$REPO_DIR" ]; then - echo -e "${CYellow}> Backing up old repository${CNone}" - rm -R "$REPO_DIR_BACKUP" &>/dev/null - mv "$REPO_DIR" "$REPO_DIR_BACKUP" &>/dev/null - echo "Copy of the old repository available at \"$REPO_DIR_BACKUP\"" -fi - -# Create repository -echo -e "${CYellow}> Creating new repository${CNone}" -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="*/src/*.buildinfo" --exclude="Packages*" "$TDE_DEBS_DIR/" "$REPO_PKG_DIR/" - -# Create package index file -echo -e "${CYellow}> Creating package index file${CNone}" -cd "$REPO_DIR" -dpkg-scanpackages "./$ARCH_PATH" | gzip -9c > "./$ARCH_PATH/Packages.gz" - - -#---------------------------- -# Repository created -echo -e "${CLightGreen}#### TDE local repository created ####${CNone}" -cd "$SCRIPT_DIR" -exit 0 diff --git a/debian/_buildscripts/local/scripts/hook examples/applications/kaffeine/kaffeine-wizard.diff b/debian/_buildscripts/local/scripts/hook examples/applications/kaffeine/kaffeine-wizard.diff deleted file mode 100644 index c35ba6516..000000000 --- a/debian/_buildscripts/local/scripts/hook examples/applications/kaffeine/kaffeine-wizard.diff +++ /dev/null @@ -1,65 +0,0 @@ -diff -urN kaffeine/kaffeine/src/kaffeine.cpp kaffeine.new/kaffeine/src/kaffeine.cpp ---- kaffeine/kaffeine/src/kaffeine.cpp 2013-03-02 15:47:14.000000000 -0600 -+++ kaffeine.new/kaffeine/src/kaffeine.cpp 2013-11-24 11:39:09.809430631 -0600 -@@ -683,7 +683,9 @@ - m_autoResizeTriple = new TDEToggleAction(i18n("Triple Size"), 0, ALT|Key_3, TQT_TQOBJECT(this), TQT_SLOT(slotAutoresizeTriple()), actionCollection(), "view_auto_resize_triple"); - - m_playersMenu = new TDEActionMenu(i18n("&Player Engine"), actionCollection(), "options_player"); -- KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureKeys()), actionCollection()); -+ m_instWizard = new TDEAction(i18n("Installation &Wizard"), 0, 0, TQT_TQOBJECT(this), TQT_SLOT(slotInstWizard()), actionCollection(), "inst_wizard"); -+ -+ KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureKeys()), actionCollection()); - KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureToolbars()), actionCollection()); - KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(slotPreferences()), actionCollection(), "options_preferences"); - -@@ -1619,6 +1621,18 @@ - mute(); - } - -+void Kaffeine::slotInstWizard() -+{ -+ TQString stamp = locateLocal("appdata", "wizard_stamp_v0.7.1"); -+ InstWizard::showWizard(); -+ -+ TDEProcess process; -+ process << "touch" << stamp; -+ process.start(TDEProcess::Block, TDEProcess::Stderr); -+ process.clearArguments(); -+} -+ -+ - /********* DCOP INTERFACE *********/ - - void Kaffeine::openURL(TQString url) -diff -urN kaffeine/kaffeine/src/kaffeine.h kaffeine.new/kaffeine/src/kaffeine.h ---- kaffeine/kaffeine/src/kaffeine.h 2013-03-02 15:47:14.000000000 -0600 -+++ kaffeine.new/kaffeine/src/kaffeine.h 2013-11-24 11:09:17.455756279 -0600 -@@ -193,6 +193,7 @@ - void slotDvbClient(bool,const TQString&,int,int,const TQString&); - void slotNumKeyInput( int ); - void slotDVBNextBack( int ); -+ void slotInstWizard(); - - private: - void autoresize(); -@@ -258,7 +259,8 @@ - TDEToggleAction* m_autoResizeTriple; - TDEToggleAction* m_originalAspect; - TDEToggleAction* m_toggleLayout; -- TDEActionMenu* m_playersMenu; -+ TDEActionMenu* m_playersMenu; -+ TDEAction* m_instWizard; - TDEToggleAction* m_sleepAfterPlay; - TDEToggleAction* m_quitAfterPlay; - TDEToggleAction* m_quitAfterPlaylist; -diff -urN kaffeine/kaffeine/src/kaffeineui.rc kaffeine.new/kaffeine/src/kaffeineui.rc ---- kaffeine/kaffeine/src/kaffeineui.rc 2012-09-14 17:39:52.000000000 -0500 -+++ kaffeine.new/kaffeine/src/kaffeineui.rc 2013-11-24 11:10:15.335565312 -0600 -@@ -34,6 +34,7 @@ - - &Settings - -+ - - - diff --git a/debian/_buildscripts/local/scripts/hook examples/applications/kaffeine/pre_build.sh b/debian/_buildscripts/local/scripts/hook examples/applications/kaffeine/pre_build.sh deleted file mode 100755 index 96400d6e9..000000000 --- a/debian/_buildscripts/local/scripts/hook examples/applications/kaffeine/pre_build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -CURR_DIR=$PWD -cd "$PKG_BUILD_PATH" - -# Apply patches -if [ "$bool_COPY_PKG_SRC" = "y" ]; then - echo -e "${CLightPurple}Applying Kaffeine wizard patch${CNone}" - patch -p2 < "$HOOK_DIR/$PKG_NAME/kaffeine-wizard.diff" -fi - -cd "$CURR_DIR" -return 0 diff --git a/debian/_buildscripts/local/scripts/hook examples/tdebase/018_kate_save_all.diff b/debian/_buildscripts/local/scripts/hook examples/tdebase/018_kate_save_all.diff deleted file mode 100644 index 16ac7c7dc..000000000 --- a/debian/_buildscripts/local/scripts/hook examples/tdebase/018_kate_save_all.diff +++ /dev/null @@ -1,37 +0,0 @@ -diff -Nur ori/tdebase/kate/app/katedocmanager.cpp new/tdebase/kate/app/katedocmanager.cpp ---- ori/tdebase/kate/app/katedocmanager.cpp 2013-07-27 02:36:57.000000000 +0900 -+++ new/tdebase/kate/app/katedocmanager.cpp 2013-12-05 15:56:20.311928016 +0900 -@@ -381,7 +381,6 @@ - return modified; - } - -- - bool KateDocManager::queryCloseDocuments(KateMainWindow *w) - { - uint docCount = m_docList.count(); -@@ -436,12 +435,22 @@ - return true; - } - -- - void KateDocManager::saveAll() - { - for (TQPtrListIterator it(m_docList); it.current(); ++it) -- if ( it.current()->isModified() && it.current()->views().count() ) -- ((Kate::View*)it.current()->views().first())->save(); -+ { -+ if (it.current()->views().count()) -+ { -+ if (it.current()->url().isEmpty()) -+ { -+ ((Kate::View*)it.current()->views().first())->saveAs(); -+ } -+ else if (it.current()->isModified()) -+ { -+ ((Kate::View*)it.current()->views().first())->save(); -+ } -+ } -+ } - } - - void KateDocManager::saveDocumentList (TDEConfig* config) diff --git a/debian/_buildscripts/local/scripts/hook examples/tdebase/pre_build.sh b/debian/_buildscripts/local/scripts/hook examples/tdebase/pre_build.sh deleted file mode 100755 index e764c29ad..000000000 --- a/debian/_buildscripts/local/scripts/hook examples/tdebase/pre_build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -CURR_DIR=$PWD -cd "$PKG_BUILD_PATH" - -# Apply patches -if [ "$bool_COPY_PKG_SRC" = "y" ]; then - echo -e "${CLightPurple}Applying Kate save all patch${CNone}" - patch -p2 < "$HOOK_DIR/$PKG_NAME/018_kate_save_all.diff" - - echo -e "${CLightPurple}Applying SAK patch${CNone}" - patch -p1 < "$HOOK_DIR/$PKG_NAME/tdebase-usesak.diff" -fi - -cd "$CURR_DIR" -return 0 diff --git a/debian/_buildscripts/local/scripts/hook examples/tdebase/tdebase-usesak.diff b/debian/_buildscripts/local/scripts/hook examples/tdebase/tdebase-usesak.diff deleted file mode 100644 index e85ca1047..000000000 --- a/debian/_buildscripts/local/scripts/hook examples/tdebase/tdebase-usesak.diff +++ /dev/null @@ -1,15 +0,0 @@ -diff -urNa tdebase/tdm/config.def tdebase.new/tdm/config.def ---- tdebase/tdm/config.def 2013-09-12 11:51:29.000000000 -0500 -+++ tdebase.new/tdm/config.def 2014-02-10 06:29:38.537806886 -0600 -@@ -2010,9 +2010,9 @@ - - Key: UseSAK - Type: bool --Default: true -+Default: false - User: greeter --Instance: #*/! -+Instance: #:*/false - Comment: - SAK - Description: diff --git a/debian/_buildscripts/local/scripts/hook examples/tdelibs/038_placeholder.diff b/debian/_buildscripts/local/scripts/hook examples/tdelibs/038_placeholder.diff deleted file mode 100644 index 65d64cc72..000000000 --- a/debian/_buildscripts/local/scripts/hook examples/tdelibs/038_placeholder.diff +++ /dev/null @@ -1,64 +0,0 @@ -diff -Nur ori/tdelibs/tdeutils/kfinddialog.cpp new/tdelibs/tdeutils/kfinddialog.cpp ---- ori/tdelibs/tdeutils/kfinddialog.cpp 2014-02-05 16:54:13.852605699 +0900 -+++ new/tdelibs/tdeutils/kfinddialog.cpp 2014-02-11 18:16:55.292214876 +0900 -@@ -149,8 +149,9 @@ - m_replace->setMaxCount(10); - m_replace->setDuplicatesEnabled(false); - m_backRef = new TQCheckBox(i18n("Use p&laceholders"), m_replaceGrp); -+ m_backRef->setEnabled(m_regExp->isChecked()); - m_backRefItem = new TQPushButton(i18n("Insert Place&holder"), m_replaceGrp); -- m_backRefItem->setEnabled(false); -+ m_backRefItem->setEnabled(m_regExp->isChecked() && m_backRef->isChecked()); - - m_replaceLayout->addWidget(m_replaceLabel, 0, 0); - m_replaceLayout->addMultiCellWidget(m_replace, 1, 1, 0, 1); -@@ -193,8 +194,8 @@ - - // signals and slots connections - connect(m_selectedText, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotSelectedTextToggled(bool))); -- connect(m_regExp, TQT_SIGNAL(toggled(bool)), m_regExpItem, TQT_SLOT(setEnabled(bool))); -- connect(m_backRef, TQT_SIGNAL(toggled(bool)), m_backRefItem, TQT_SLOT(setEnabled(bool))); -+ connect(m_regExp, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotRegexCheckBoxToggled(bool))); -+ connect(m_backRef, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPlaceholdersCheckBoxToggled(bool))); - connect(m_regExpItem, TQT_SIGNAL(clicked()), this, TQT_SLOT(showPatterns())); - connect(m_backRefItem, TQT_SIGNAL(clicked()), this, TQT_SLOT(showPlaceholders())); - -@@ -276,11 +277,23 @@ - "Ask before replacing each match found.") ); - } - --void KFindDialog::textSearchChanged( const TQString & text) -+void KFindDialog::textSearchChanged(const TQString & text) - { - enableButtonOK( !text.isEmpty() ); - } - -+void KFindDialog::slotRegexCheckBoxToggled(bool checked) -+{ -+ m_regExpItem->setEnabled(checked); -+ m_backRef->setEnabled(checked); -+ m_backRefItem->setEnabled(checked && m_backRef->isChecked()); -+} -+ -+void KFindDialog::slotPlaceholdersCheckBoxToggled(bool checked) -+{ -+ m_backRefItem->setEnabled(checked && m_regExp->isChecked()); -+} -+ - void KFindDialog::showEvent( TQShowEvent *e ) - { - if ( !d->m_initialShowDone ) -diff -Nur ori/tdelibs/tdeutils/kfinddialog.h new/tdelibs/tdeutils/kfinddialog.h ---- ori/tdelibs/tdeutils/kfinddialog.h 2014-02-05 16:54:13.852605699 +0900 -+++ new/tdelibs/tdeutils/kfinddialog.h 2014-02-11 18:16:57.876214916 +0900 -@@ -250,7 +250,9 @@ - void slotSelectedTextToggled(bool); - void showPatterns(); - void showPlaceholders(); -- void textSearchChanged( const TQString &); -+ void textSearchChanged(const TQString &); -+ void slotRegexCheckBoxToggled(bool checked); -+ void slotPlaceholdersCheckBoxToggled(bool checked); - - protected: - virtual void showEvent ( TQShowEvent * ); diff --git a/debian/_buildscripts/local/scripts/hook examples/tdelibs/pre_build.sh b/debian/_buildscripts/local/scripts/hook examples/tdelibs/pre_build.sh deleted file mode 100755 index 35bfc3c1b..000000000 --- a/debian/_buildscripts/local/scripts/hook examples/tdelibs/pre_build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -CURR_DIR=$PWD -cd "$PKG_BUILD_PATH" - -# Apply patches -if [ "$bool_COPY_PKG_SRC" = "y" ]; then - echo -e "${CLightPurple}Applying kfinddialog placeholder patch${CNone}" - patch -p2 < "$HOOK_DIR/$PKG_NAME/038_placeholder.diff" -fi - -cd "$CURR_DIR" -return 0 diff --git a/debian/_buildscripts/local/scripts/internals/C10shell b/debian/_buildscripts/local/scripts/internals/C10shell deleted file mode 100755 index 7c6a8761b..000000000 --- a/debian/_buildscripts/local/scripts/internals/C10shell +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Color table -CPurple='\e[0;35m' -CWhite='\e[1;37m' -CNone='\e[0m' - -# Invoke shell if build fails. -apt-get install -y --force-yes vim less bash mc -cd /tmp/buildd/*/debian/.. -echo "${CPurple}---------------------------------------------------------${CNone}" >/dev/tty -echo "${CPurple} !!! Build FAILED !!! ${CNone}" >/dev/tty -echo "${CPurple} You are now inside a shell in the building environment. ${CNone}" >/dev/tty -echo "${CPurple} ${CWhite}mc, vim, less${CPurple} are available for your convenience. ${CNone}" >/dev/tty -echo "${CPurple} Type ${CWhite}exit${CPurple} to leave the shell when you are done. ${CNone}" >/dev/tty -echo "${CPurple}---------------------------------------------------------${CNone}" >/dev/tty -/bin/bash /dev/tty 2>/dev/tty - diff --git a/debian/_buildscripts/local/scripts/internals/_build_common.sh b/debian/_buildscripts/local/scripts/internals/_build_common.sh deleted file mode 100755 index c692ac26c..000000000 --- a/debian/_buildscripts/local/scripts/internals/_build_common.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/bash - - -#---------------------------- -#---------------------------- -# Color table -# Black 0;30 Dark Gray 1;30 -# Blue 0;34 Light Blue 1;34 -# Green 0;32 Light Green 1;32 -# Cyan 0;36 Light Cyan 1;36 -# Red 0;31 Light Red 1;31 -# Purple 0;35 Light Purple 1;35 -# Brown 0;33 Yellow 1;33 -# Light Gray 0;37 White 1;37 -# No Color 0 -set -a -CBlack='\e[0;30m' -CDarkGray='\e[1;30m' -CBlue='\e[0;34m' -CLightBlue='\e[1;34m' -CGreen='\e[0;32m' -CLightGreen='\e[1;32m' -CCyan='\e[0;36m' -CLightCyan='\e[1;36m' -CRed='\e[0;31m' -CLightRed='\e[1;31m' -CPurple='\e[0;35m' -CLightPurple='\e[1;35m' -CBrown='\e[0;33m' -CYellow='\e[1;33m' -CGray='\e[0;37m' -CWhite='\e[1;37m' -CNone='\e[0m' -set +a - -#---------------------------- -function init_common() -{ - # Check script folder - export SCRIPT_DIR=$(dirname $(readlink -f "$0")) - - # Prevent the script to be run from TDE packaging repo - REPO_URL=$(git config --get remote.origin.url 2>/dev/null) - if [ ! -z "$REPO_URL" ] && [ -z "${REPO_URL##*tde-packaging}" ]; then - echo -e "${CYellow} --- ERROR ---${CNone}" - echo "This script cannot be run from the TDE packaging repository." - echo "Please follow the instructions provided, then rerun this script." - exit 1 - fi - - # Read config settings - CFG_FILE=$SCRIPT_DIR/_config.sh - if [ -f "$CFG_FILE" ]; then - . "$CFG_FILE" - else - echo -e "${CYellow} --- NOTE ---${CNone}" - 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/internals/_config_template.sh" "$CFG_FILE" - exit 2 - 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 3 - 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 4 - 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 5 - fi - - # Make sure we have selected a supported distribution - DISTS_FILE=$SCRIPT_DIR/internals/distro_list.txt - if [ ! -f "$DISTS_FILE" ]; then - echo -e "${CYellow} --- NOTE ---${CNone}" - echo "Could not find the list of supported distributions." - echo "Please check the file $DISTS_FILE exists, then rerun this script." - exit 6 - fi - export DISTRO_FOUND=${DISTRO_FOUND:-"n"} - if [ "$DISTRO_FOUND" != "y" ]; then - # Need to use a "here string" otherwise if the DISTRO_FOUND value is modified - # inside the while loop, this would not remember after the loop. - while read l_distro l_version l_name l_rel_suffix; do - if [ "$l_distro" = "$DISTRO" -a "$l_name" = "$DISTRO_NAME" ]; then - export DISTRO_FOUND="y" - export DISTRO_VERSION="$l_version" - export REL_SUFFIX="$l_rel_suffix" - break - fi - done <<< $(cat $DISTS_FILE | grep -E "^(\s*[^#\s]+\s+[^\s]+.*)$") - fi - if [ "$DISTRO_FOUND" != "y" ]; then - echo -e "${CYellow} --- NOTE ---${CNone}" - echo "The specified distribution ($DISTRO $DISTRO_NAME) is not supported." - echo "Something is wrong with your configuration ($CFG_FILE)" - echo "or with the list of supported distributions ($DISTS_FILE)." - echo "Please check the DISTRO and DISTRO_NAME variables, then rerun this script." - exit 7 - fi - - export SCRIPT_LOG_DIR=$TDE_DIR/$CFG_SCRIPT_LOG_DIR - export LOG_RESULT_FILENAME="$SCRIPT_LOG_DIR/build_result.log" # Log result into the common build logfile - - cd "$SCRIPT_DIR" -} - - -#---------------------------- -# Save execution start time -# Parameters: -# $1 - timer number -function exec_time_start() -{ - _ET_start_var="_ET_start_$1" - eval "$_ET_start_var=`date +%s.%N`" -} - - -#---------------------------- -# Save execution stop time and set $2 to the execution time -# in the format: dd/hh:mm:ss.mmm -# Parameters: -# $1 - timer number -# $2 - result variable name -function exec_time_stop() -{ - _ET_start_var="_ET_start_$1" - _ET_stop_var="_ET_stop_$1" - eval "$_ET_stop_var=`date +%s.%N`" - _ET_diff=`echo "${!_ET_stop_var} - ${!_ET_start_var}" | bc` - _ET_days=`echo "$_ET_diff/86400" | bc` - _ET_diff_day=`echo "$_ET_diff-86400*$_ET_days" | bc` - _ET_hours=`echo "$_ET_diff_day/3600" | bc` - _ET_diff_hour=`echo "$_ET_diff_day-3600*$_ET_hours" | bc` - _ET_mins=`echo "$_ET_diff_hour/60" | bc` - _ET_secs=`echo "$_ET_diff_hour-60*$_ET_mins" | bc` - local _resultvar=$2 - eval "$_resultvar=`printf \"%02d/%02d:%02d:%06.3f\" $_ET_days $_ET_hours $_ET_mins $_ET_secs`" -} diff --git a/debian/_buildscripts/local/scripts/internals/_build_set_common.sh b/debian/_buildscripts/local/scripts/internals/_build_set_common.sh deleted file mode 100755 index 7d28736b0..000000000 --- a/debian/_buildscripts/local/scripts/internals/_build_set_common.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -# Load common code and initialization -. ./internals/_build_common.sh -init_common - -_BUILDSET_TIMER=1 -_BUILDSET_TIME="--/--:--:--:---" - -parm_SKIP_FETCH="n" # if "y" skips N packages from the list -parm_SKIP_N=0 # this argument represents the number of packages to skip -SKIP_cnt=0 - - -#---------------------------- -# do_exit for set building -function do_exit() -{ - cd "$SCRIPT_DIR" - if [ $1 -eq 0 ]; then - echo -e "${CGray}#### Building process for set \"${0##*/}\" completed ####${CNone}" - else - echo -e "${CGray}#### Building process for set \"${0##*/}\" interrupted ($1) ####${CNone}" - fi - exit $1 -} - - -#---------------------------- -function set_log_start() -{ - echo -e "${CGray}#### Starting building process for set \"${0##*/}\" ####${CNone}" - echo - echo "---------- ${0##*/} ----------" >>"$LOG_RESULT_FILENAME" - exec_time_start $_BUILDSET_TIMER -} - - -#---------------------------- -function set_log_end() -{ - exec_time_stop $_BUILDSET_TIMER "_BUILDSET_TIME" - echo " [$_BUILDSET_TIME] SET ${0##*/}" >>"$LOG_RESULT_FILENAME" - echo >>"$LOG_RESULT_FILENAME" - do_exit 0 -} - - -#---------------------------- -function build_module() -{ - if [ $parm_SKIP_N -gt 0 -a $SKIP_cnt -lt $parm_SKIP_N ]; then - SKIP_cnt=$((SKIP_cnt+1)) - else - ./build_module.sh "$BUILD_DEFAULT_OPTIONS $@" - echo - fi -} - - -#---------------------------- -# Check command line arguments -#---------------------------- -for arg in $@; do - if [ "$parm_SKIP_FETCH" = "y" ]; then - parm_SKIP_N=$arg - parm_SKIP_FETCH="n"BUILD_DEFAULT_OPTIONS - elif [ "$arg" = "-s" ]; then # skip first N packages - parm_SKIP_FETCH="y" - fi -done -if [ "$parm_SKIP_FETCH" = "y" ]; then - echo "Invalid command line arguments ($@)" - do_exit 3 -fi diff --git a/debian/_buildscripts/local/scripts/internals/_config_template.sh b/debian/_buildscripts/local/scripts/internals/_config_template.sh deleted file mode 100644 index ea8f438ba..000000000 --- a/debian/_buildscripts/local/scripts/internals/_config_template.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -set -a - -#---------------------------- -# Build information -#---------------------------- -TDE_RELEASE="14.1.0" # TDE release number -DISTRO="debian" # Distro family -DISTRO_NAME="buster" # Distro name of specific version -ARCHITECTURE="amd64" # Build for this architecture -USE_LOCAL_BUILD_NUMBER="n" # If == "y", use local build numbering for modules -BUILD_NUMBER="b001" # TDE build number -BUILD_DATE="" # Module build date (automatic if "" or fixed otherwise, ex 20171201) -BUILD_DEFAULT_OPTIONS="-g -lr" # Default building options (pbuilder) -GPG_SIGN_KEYID="" # Use this GPG key to sign packages. If null, packages will not be signed - -#---------------------------- -# Base directories -#---------------------------- -# TDE root folder -TDE_DIR="" -# Relative paths -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/$CFG_EXTRA_DEPS_DIR" -CFG_HOOK_DIR="$CFG_GIT_DIR/$CFG_HOOKS_DIR" - -#---------------------------- -# Build output directories -#---------------------------- -CFG_TDE_BUILD_DIR="$CFG_BUILD_DIR/build" -CFG_TDE_DEBS_DIR="$CFG_BUILD_DIR/debs" - -#---------------------------- -set +a diff --git a/debian/_buildscripts/local/scripts/internals/_pbuilder.sh b/debian/_buildscripts/local/scripts/internals/_pbuilder.sh deleted file mode 100755 index 9b6ffb7b5..000000000 --- a/debian/_buildscripts/local/scripts/internals/_pbuilder.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -function run_pdebuild() -{ - # pbuilder absolute paths - PBUILDER_HOOK_DIR="/var/cache/pbuilder/hooks" - PBUILDER_SHELL_HOOK_TEMPLATE="$SCRIPT_DIR/internals/C10shell" - PBUILDER_SHELL_HOOK="$PBUILDER_HOOK_DIR/C10shell" - PBUILDER_DEPS_HOOK="$PBUILDER_HOOK_DIR/D05deps" - - # Local option variables - # - internal pbuilder - OPT_INTERNAL_PBUILDER="" - if [ "$bool_INTERNAL_PBUILDER" = "y" ]; then - OPT_INTERNAL_PBUILDER="--use-pdebuild-internal" - fi - # Sign packages optino - OPT_SIGN_PKG_PBUILDER="" - 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 - - ## Build module in a clean chroot environment using pbuilder - # Install/remove shell hook - if [ ! -d "$PBUILDER_HOOK_DIR" ]; then - mkdir -p "$PBUILDER_HOOK_DIR" - fi - if [ "$bool_SHELL_HOOK" = "y" ]; then - cp "$PBUILDER_SHELL_HOOK_TEMPLATE" "$PBUILDER_SHELL_HOOK" - chmod a+x "$PBUILDER_SHELL_HOOK" - else - if [ -x "$PBUILDER_SHELL_HOOK" ]; then - rm "$PBUILDER_SHELL_HOOK" - fi - 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 - cat < "$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\" \ - --pbuilderroot \"sudo DIST=$DISTRO_NAME ARCH=$ARCHITECTURE\" \ - --logfile \"$BUILDING_LOG_FILE\" \ - -- \ - --bindmounts \"$TDE_DEBS_DIR\" \ - --hookdir \"$PBUILDER_HOOK_DIR\" \ - $OPT_SHOW_LOGS\"$BUILDING_LOG_FILE\" - PBUILDER_RETVAL=$? - # Remove shell hook if it was installed before the build - if [ -x "$PBUILDER_SHELL_HOOK" ]; then - rm "$PBUILDER_SHELL_HOOK" - fi - # Remove deps hook - if [ -x "$PBUILDER_DEPS_HOOK" ]; then - rm "$PBUILDER_DEPS_HOOK" - fi - # Return pdebuild return value to calling function - return $PBUILDER_RETVAL -} - - -#---------------------------- -# The actual code is inside a function to allow the pdebuild return value to be -# correctly passed back to the calling script in all cases (root and non root users) -run_pdebuild \ No newline at end of file diff --git a/debian/_buildscripts/local/scripts/internals/_update_repositories.sh b/debian/_buildscripts/local/scripts/internals/_update_repositories.sh deleted file mode 100755 index fa5a1bd74..000000000 --- a/debian/_buildscripts/local/scripts/internals/_update_repositories.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -#---------------------------- -# Update TDE main repository -echo -e "\n---- Updating main TDE GIT repo ----\n" - -cd "$TDE_DIR/$CFG_GIT_DIR/tde" -if [[ ! -e .git ]] || [[ -z "`git rev-parse --git-dir 2>/dev/null`" ]]; then - echo "Current directory does not contain a .git folder. Exiting..." - cd $SCRIPT_DIR - exit 1 -fi - -branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"` -if [[ -z "$branch" ]] || [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then - echo "There is not active upstream branch. Exiting..." - cd $SCRIPT_DIR - exit 1 -fi - -touch /var/lock/update-tde-git-submodules - -PARENTDIR=$PWD -echo "---- Main repo ----" -git pull --rebase -if [[ ! -z "`git status --porcelain --ignore-submodules`" ]]; then - git reset --hard HEAD - git clean -dxff -fi - -exec 3< submodules -while read <&3 -do - cd $PARENTDIR - DIR2UPDATE=$REPLY - if [[ $DIR2UPDATE != "" ]]; then - echo -e "\n---- Submodule $DIR2UPDATE ----" - cd $PARENTDIR/$DIR2UPDATE/.. - cd `git rev-parse --show-toplevel` - if [[ -z "`grep \"^Updated: $PWD$\" /var/lock/update-tde-git-submodules`" ]]; then - echo "Updated: $PWD" >>/var/lock/update-tde-git-submodules - git submodule init - git submodule update - fi - cd $PARENTDIR/$DIR2UPDATE - if [[ ! -z "`git status --porcelain --ignore-submodules`" ]]; then - git reset --hard HEAD - git clean -dxff - fi - git checkout $branch - git pull --rebase - cd .. - cd `git rev-parse --show-toplevel` - fi -done -exec 3>&- - -rm /var/lock/update-tde-git-submodules - - -#------------------------------ -# Update TDE-packaging repository -echo -e "\n----------------------------------------" -echo -e "\n--- Updating TDE-packaging GIT repo ----\n" - -cd "$TDE_DIR/$CFG_GIT_DIR/tde-packaging" -git pull --rebase - - -#------------------------------ -# Done -cd $SCRIPT_DIR diff --git a/debian/_buildscripts/local/scripts/internals/distro_list.txt b/debian/_buildscripts/local/scripts/internals/distro_list.txt deleted file mode 100644 index 0ca037eb0..000000000 --- a/debian/_buildscripts/local/scripts/internals/distro_list.txt +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# List of supported distributions -DISTROS=" - debian 5.0 lenny - debian 6.0 squeeze - debian 7.0 wheezy - debian 8.0 jessie - debian 9.0 stretch - debian 10.0 buster ~a - debian 10.0 sid ~b - raspbian 7.0 raspbian-wheezy - raspbian 8.0 raspbian-jessie - ubuntu 10.04 lucid - ubuntu 10.10 maverick - ubuntu 11.04 natty - ubuntu 11.10 oneiric - ubuntu 12.04 precise - ubuntu 12.10 quantal - ubuntu 13.04 raring - ubuntu 13.10 saucy - ubuntu 14.04 trusty - ubuntu 14.10 utopic - ubuntu 15.04 vivid - ubuntu 15.10 wily - ubuntu 16.04 xenial - ubuntu 16.10 yakkety - ubuntu 17.04 zesty - ubuntu 17.10 artful - ubuntu 18.04 bionic ~a -" diff --git a/debian/_buildscripts/local/scripts/update_repositories.sh b/debian/_buildscripts/local/scripts/update_repositories.sh deleted file mode 100755 index efa739aa6..000000000 --- a/debian/_buildscripts/local/scripts/update_repositories.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# Load common code -. ./internals/_build_common.sh -init_common - -#---------------------------- -# Run real update script -if [ ! -d "$SCRIPT_LOG_DIR" ]; then - echo -e "\"$SCRIPT_LOG_DIR\" folder is missing. Check your config or create it." - exit 1 -fi -echo "Update in progress..." -. ./internals/_update_repositories.sh &>"$SCRIPT_LOG_DIR/update-repos.log" -echo "Update completed." - diff --git a/debian/_buildscripts/local/update_repositories.sh b/debian/_buildscripts/local/update_repositories.sh new file mode 100755 index 000000000..a9d2fef12 --- /dev/null +++ b/debian/_buildscripts/local/update_repositories.sh @@ -0,0 +1,188 @@ +#!/bin/bash + +# Load common code +. ./internals/_build_common.sh +init_common + +UPDATE_LOCK_FILENAME="/var/lock/TDE_update_repo_lock" # Lock file for incremental update + +#---------------------------- +# Update a given module from the upstream repo +# Parameters: +# $1 - module folder +# $2 - operation type +# $3 - branch to update +function _do_update() +{ + local MOD_PATH=$1 + local OP_TYPE=$2 + local BRANCH=$3 + local RESULT="" + + case "$OP_TYPE" in + "update") + if [[ -z `grep "^$BRANCH - $MOD_PATH$" "$UPDATE_LOCK_FILENAME"` ]]; then + cd "$MOD_PATH" &>/dev/null + if [ $? -eq 0 ]; then + # Clean up any possible uncommitted changes + if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then + git reset --hard HEAD &>/dev/null + git clean -dxff &>/dev/null + fi + # Make sure the local branch exists and is a tracking branch + if [[ -z `git branch | grep -E "\b$BRANCH\b"` ]]; then + eval git checkout -b \"$BRANCH\" \"origin/$BRANCH\" $OPT_VERBOSE_LOG + else + eval git checkout \"$BRANCH\" $OPT_VERBOSE_LOG + fi + if [[ ! -z `git branch -v | grep -E "^\*\s+$BRANCH"` ]]; then + if [[ -z `git branch -vv | grep "origin/$BRANCH"` ]]; then + git branch -u "origin/$BRANCH" &>/dev/null #$ + git reset --hard "origin/$BRANCH" &>/dev/null + fi + fi + # Update + eval git reset --hard HEAD $OPT_VERBOSE_LOG + eval git clean -dxff $OPT_VERBOSE_LOG + eval git fetch $OPT_VERBOSE_LOG + if [[ $(git rev-parse HEAD) != $(git rev-parse "origin/$BRANCH") ]]; then + eval git pull --rebase $GIT_NO_RECURSE_SUBMODULES $OPT_VERBOSE_LOG + if [[ `git rev-parse HEAD` == `git rev-parse "origin/$BRANCH"` ]]; then + RESULT="${CLightGreen}[ UPDATE ]" + else + RESULT="${CLightRed}[ FAIL ]" + fi + else + RESULT="[ OK ]" + fi + else + RESULT="${CLightRed}[ FAIL ]" + fi + echo "$BRANCH - $MOD_PATH" >> "$UPDATE_LOCK_FILENAME" + else + RESULT="${CBrown}[ SKIP ]" + fi + ;; + + "switch-to") + cd "$MOD_PATH" &>/dev/null + eval git checkout \"$BRANCH\" $OPT_VERBOSE_LOG + if [[ ! -z `git branch -v | grep -E "^\*\s+$BRANCH"` ]]; then + RESULT="[ OK ]" + else + RESULT="${CLightRed}[ FAIL ]" + fi + ;; + + *) + RESULT="[ INV-OP ]" + ;; + esac + + echo_and_tee "$RESULT $MOD_PATH${CNone}" "$LOG_UPDATE_REPO_FILENAME" +} + +#---------------------------- +# Update a given module and all submodules from the upstream repo +# Parameters: +# $1 - module folder +# $2 - operation type +# $3 - branch to update +function _update_module() +{ + local MOD_PATH=$1 + local OP_TYPE=$2 + local BRANCH=$3 + # Current module + _do_update "$@" + # Submodules + local SUBMOD_LIST="$MOD_PATH/.gitmodules" + if [[ -e "$SUBMOD_LIST" ]]; then + sed -n "s|^\[submodule \"\([^\"]*\)\"\]$|\1|p" <$SUBMOD_LIST |\ + while read -r SUBMOD_PATH; do + cd "$MOD_PATH" &>/dev/null + if [[ -z "`git config --get submodule.$SUBMOD_PATH.url`" ]]; then + eval git submodule init -- \"$SUBMOD_PATH\" $OPT_VERBOSE_LOG + fi + if [[ ! -e "$MOD_PATH/$SUBMOD_PATH/.git" ]]; then + eval git submodule update -- \"$SUBMOD_PATH\" $OPT_VERBOSE_LOG + fi + _update_module "$MOD_PATH/$SUBMOD_PATH" "$OP_TYPE" "$BRANCH" + done + fi +} + +#---------------------------- +# Check command line arguments and set options +bool_INCREMENTAL="n" +bool_VERBOSE_LOG="n" +for arg in $@; do + if [ "$arg" = "-i" ]; then # continue from last updated module (Incremental) + bool_INCREMENTAL="y" + elif [ "$arg" = "-v" ]; then # display and log git command output + bool_VERBOSE_LOG="y" + fi +done + +if [ "$bool_INCREMENTAL" = "y" ]; then + [ ! -f "$UPDATE_LOCK_FILENAME" ] && bool_INCREMENTAL="n" +else + [ -f "$UPDATE_LOCK_FILENAME" ] && rm "$UPDATE_LOCK_FILENAME" +fi + +OPT_VERBOSE_LOG="&>/dev/null" +if [[ "$bool_VERBOSE_LOG" = "y" ]]; then + OPT_VERBOSE_LOG=" |& tee -a \"$LOG_UPDATE_REPO_FILENAME\"" +fi + +#---------------------------- +# Check git abilities +GIT_IGNORE_SUBMODULES="" +if [[ -n "`git status --help 2>/dev/null|grep -- '--ignore-submodules'`" ]]; then + GIT_IGNORE_SUBMODULES="--ignore-submodules" +fi +GIT_NO_RECURSE_SUBMODULES="" +if [[ -n "`git pull --help |grep -- '--\[no-\]recurse-submodules'`" ]]; then + GIT_NO_RECURSE_SUBMODULES="--no-recurse-submodules" +fi + +# Start update +if [ "$bool_INCREMENTAL" != "y" ]; then + echo "TDE repositories update started" > "$UPDATE_LOCK_FILENAME" +fi + +# Branch update +_LAST_BRANCH="" +for branch in "${BRANCHES[@]}"; do + _LAST_BRANCH="$branch" + echo_and_tee "${CLightCyan}---------------------------------------${CNone}" "$LOG_UPDATE_REPO_FILENAME" "y" + echo_and_tee "${CLightCyan} Updating branch ${CYellow}$branch ${CNone}" "$LOG_UPDATE_REPO_FILENAME" + echo_and_tee "${CLightCyan}---------------------------------------${CNone}" "$LOG_UPDATE_REPO_FILENAME" + + # Update TDE main repository + _update_module "$REPO_TDE" "update" "$branch" + + # Update TDE packaging repository + _update_module "$TDE_DIR/$CFG_GIT_DIR/tde-packaging" "update" "$branch" + + echo_and_tee "" "$LOG_UPDATE_REPO_FILENAME" +done + +# Switch to specified branch if necessary +if [[ "$DEFAULT_REPO_BRANCH" != "$_LAST_BRANCH" ]]; then + echo_and_tee "${CLightCyan}---------------------------------------${CNone}" "$LOG_UPDATE_REPO_FILENAME" "y" + echo_and_tee "${CLightCyan} Switching to branch ${CYellow}$DEFAULT_REPO_BRANCH ${CNone}" "$LOG_UPDATE_REPO_FILENAME" + echo_and_tee "${CLightCyan}---------------------------------------${CNone}" "$LOG_UPDATE_REPO_FILENAME" + + # Switch TDE main repository + _update_module "$REPO_TDE" "switch-to" "$DEFAULT_REPO_BRANCH" + + # Switch TDE packaging repository + _update_module "$TDE_DIR/$CFG_GIT_DIR/tde-packaging" "switch-to" "$DEFAULT_REPO_BRANCH" + + echo_and_tee "" "$LOG_UPDATE_REPO_FILENAME" +fi + +# Update completed +[ -f "$UPDATE_LOCK_FILENAME" ] && rm "$UPDATE_LOCK_FILENAME" +cd $SCRIPT_DIR -- cgit v1.2.3