This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository buildscripts. from a81454d bin/ubuntu-codename-to-version.sh: add new testing Ubuntu codename "zesty". new eedc5bf bin/build-rpm-package: typo fixes in comments. new fec56c7 bin/build-rpm-package: be safe and terminate options in chmod call. new 93057bc bin/build-rpm-package: add comment to explain why caching is a good thing to the create_mock_config () comment. new 92b0df7 bin/build-rpm-package: implement cache_mock_config () and use it in generate_mock_config (). The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: bin/build-rpm-package | 82 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 3 deletions(-) -- Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository buildscripts. commit eedc5bfed42cf3d6a7a29c9e07d3b2c7c3d88d84 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Oct 29 01:05:47 2016 +0200 bin/build-rpm-package: typo fixes in comments. --- bin/build-rpm-package | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/build-rpm-package b/bin/build-rpm-package index 6e2f491..0f27945 100755 --- a/bin/build-rpm-package +++ b/bin/build-rpm-package @@ -249,7 +249,7 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET # Check argument sanity. - # Append .cfg is not already specified. + # Append .cfg if not already specified. typeset TMP_REGEX='^.*\.cfg$' if [[ ! "${MOCK_BASE}" =~ ${TMP_REGEX} ]]; then MOCK_BASE="${MOCK_BASE}.cfg" @@ -408,7 +408,7 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET fi done < "/etc/mock/${MOCK_BASE}" - # Reset input field separator to original value. + # Reset input field separator to its original value. IFS="${OLDIFS}" return 0 -- Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository buildscripts. commit 93057bc254892fffd32315166e0a4ce98ac8f014 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Oct 29 01:15:38 2016 +0200 bin/build-rpm-package: add comment to explain why caching is a good thing to the create_mock_config () comment. --- bin/build-rpm-package | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/build-rpm-package b/bin/build-rpm-package index 9005137..57b7787 100755 --- a/bin/build-rpm-package +++ b/bin/build-rpm-package @@ -240,6 +240,14 @@ check_mock_version_atleast () { # Base refers to adding x2go-extras only, while full means also # adding the full X2Go upstream repository with all published files. # +# The file will be created in a temporary directory with a temporary name and +# removed together with the directory upon script termination. +# This creates a huge problem: as mock checks the config file's modification time +# to determine if it cache is usable and discards the whole cache if the file's +# modification time is newer than the cache creation time, each build will +# discard the cache and subsequently rebuild it. The I/O stress caused by this +# is high enough to warrant the implementation of a caching feature here... +# # Calling this function in a subshell is an error, as it NEEDS to modify # variables in global scope! create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET -- Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository buildscripts. commit fec56c7b30b5c30e7d41029ef9147e65948eb36a Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Oct 29 01:11:10 2016 +0200 bin/build-rpm-package: be safe and terminate options in chmod call. --- bin/build-rpm-package | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build-rpm-package b/bin/build-rpm-package index 0f27945..9005137 100755 --- a/bin/build-rpm-package +++ b/bin/build-rpm-package @@ -129,7 +129,7 @@ trap cleanup ERR EXIT SIGTERM SIGINT SIGHUP SIGPIPE SIGALRM SIGUSR1 SIGUSR2 set_vars() { mkdir -p -- "${TEMP_BASE}" - chmod 2770 "${TEMP_BASE}" + chmod 2770 -- "${TEMP_BASE}" # first argv is the name of the Git project PROJECT_PATH="${1}" -- Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository buildscripts. commit 92b0df7405fdbe05691c14ea52241b768b85be8b Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Oct 29 01:16:30 2016 +0200 bin/build-rpm-package: implement cache_mock_config () and use it in generate_mock_config (). --- bin/build-rpm-package | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/bin/build-rpm-package b/bin/build-rpm-package index 57b7787..c46dc00 100755 --- a/bin/build-rpm-package +++ b/bin/build-rpm-package @@ -71,6 +71,7 @@ test -f "${HOME}/.buildscripts/${PREFIX}.conf" && . "${HOME}/.buildscripts/${PRE TMP_MOCK_CFG_DIR="" TMP_MOCK_CFG_FILE="" TEMP_BASE="${HOME}/tmp/" +MOCK_CACHE_DIR="${HOME}/mock-cache/" typeset -ag temp_cleanup # End of non-user-serviceable part. @@ -131,6 +132,9 @@ set_vars() { mkdir -p -- "${TEMP_BASE}" chmod 2770 -- "${TEMP_BASE}" + mkdir -p -- "${MOCK_CACHE_DIR}" + chmod 2770 -- "${MOCK_CACHE_DIR}" + # first argv is the name of the Git project PROJECT_PATH="${1}" PROJECT_PATH="${PROJECT_PATH/%.git/}" @@ -419,9 +423,73 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET # Reset input field separator to its original value. IFS="${OLDIFS}" + # Cache config file to work around mock constantly rebuilding its cache if the + # config file's modification time is newer than the cache, even though the + # the config file's content didn't change between runs. + cache_mock_config + return 0 } +# Either caches, updates or uses a cached mock config file. +# +# Calling this function in a subshell is an error, as it NEEDS to modify +# variables in global scope! +cache_mock_config () { + # Check argument sanity. + + typeset tmp_mock_config="${TMP_MOCK_CFG_FILE}" + + # Append .cfg if not already specified. + typeset tmp_regex='^.*\.cfg$' + if [[ ! "${tmp_mock_config}" =~ ${tmp_regex} ]]; then + echo "Error: mock temporary config path must end in '.cfg'." >&2 + exit 1 + fi + + # Must exist and be readable. + if [ ! -f "${tmp_mock_config}" ] || [ ! -r "${tmp_mock_config}" ]; then + echo "Error: ${tmp_mock_config} parameter must exist, be a regular file and readable." >&2 + exit 1 + fi + + # Fetch file name only and delete the extension. + typeset mock_cache_file_name="$(basename -s '.cfg' "${tmp_mock_config}")" + typeset tmp="${mock_cache_file_name}" + mock_cache_file_name="${mock_cache_file_name%.*}" + + if [ "${mock_cache_file_name}" = "${tmp}" ]; then + echo "Error: unable to remove the random suffix of the temporary config file name '${tmp}'." >&2 + exit 1 + fi + + typeset mock_cache_file_path="${MOCK_CACHE_DIR}/${mock_cache_file_name}" + if [ -f "${mock_cache_file_path}" ]; then + # A cached config file exists. + if [ -r "${mock_cache_file_path}" ]; then + # It's also readable. Compare it. + cmp "${TMP_MOCK_CFG_FILE}" "${mock_cache_file_path}" && { + echo "Cached mock config file matches generated one, using the cached file." >&2 + } || { + echo "Refreshing cached mock config file due to differing content." >&2 + cp -av "${TMP_MOCK_CFG_FILE}" "${mock_cache_file_path}" + } + else + echo "Error: a cached mock config file already exists as '${mock_cache_file_path}', but is not readable." >&2 + exit 1 + fi + else + # No cached config file exists yet, copy the file + # and set it as the new mock config file. + echo "Caching mock config file." + cp -av "${TMP_MOCK_CFG_FILE}" "${mock_cache_file_path}" + fi + + TMP_MOCK_CFG_FILE="${mock_cache_file_path}" + + return "0" +} + # Fetches extras repositories, if requested. # Takes the build system type (suse or redhat -- implicitly means OBS or mock), # the distribution, its version (either a real number or a codename), -- Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git