index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-11-23 00:14:30 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-11-23 00:14:30 +0100 |
commit | a9c806363fa6afd5a14bb41c72ef2991f9c3803c (patch) | |
tree | 13705e9c83c03ab9b1a69df79e75e4eebe8f8bbe | |
parent | bfc69b2cd5b771b6483c6e9b95ea36f6f9d82cda (diff) |
-rwxr-xr-x | bin/build-packages | 2 | ||||
-rwxr-xr-x | bin/common-functions | 63 | ||||
-rwxr-xr-x | bin/get-assignment | 7 | ||||
-rwxr-xr-x | bin/return-assignment | 3 |
diff --git a/bin/build-packages b/bin/build-packages index 4f455b3..5ec36c0 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -406,7 +406,7 @@ while [ "${count}" -ne 0 ]; do -i "${master_build_server_identity}" \ -p "${master_build_server_port}" \ "${master_build_server_user}@${master_build_server}" \ - 'return-assignment' "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" \ + 'return-assignment' "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" "${sub_pkgrel}" \ < 'package.tar' || \ err=$? case ${err} in diff --git a/bin/common-functions b/bin/common-functions index b25335b..9b7fe03 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -1213,3 +1213,66 @@ receive_buglist() { s/".*$// ' } + +# next_sub_pkgrel $package $git_revision $mod_git_revision $repository +# giv out the next sub-pkgrel of the given package + +next_sub_pkgrel() { + ( # new shell is intentional + package="$1" + git_revision="$2" + mod_git_revision="$3" + repository="$4" + git_repo=$(find_git_repository_to_package_repository "${repository}") + + temp_dir=$(mktemp -d) + + find_pkgbuilds "${package}" "${repository}" "${git_repo}" "${git_revision}" "${mod_git_revision}" + extract_source_directory "${git_repo}" "${git_revision}" "${mod_git_revision}" "${temp_dir}" '0' + + version=$( + cd "${temp_dir}" + makepkg --printsrcinfo | \ + sed -n ' + /^\s*\(epoch\|pkg\(name\|ver\|rel\)\) = /{s|^\s\+||;p} + ' | \ + sed ' + /^pkgname = /{ + s/^.*= // + w pkgnames + d + } + s|^epoch = \(.*\)$|1 \1:| + s|^pkgver = \(.*\)$|2 \1-| + s|^pkgrel = \([^.]*\)\(\..*\)\?$|3 \1| + ' | \ + sort -k1n,1 | \ + sed ' + s|^[0-9] || + :a + N + s|\n[0-9] \(\S\+\)$|\1| + ta + ' + ) + sub_pkgrel=$( + ls_master_mirror 'i686/*/' | \ + sed -n "$( + sed ' + s/$/-'"${version}"'/ + s/\./\\./g + s/^/^/ + s/$/\\(\\.\\([0-9]\\+\\)\\)\\?-[^-]\\+$/ + s|^.*$|/\0/{ s/\0/\\2/; s/^$/0/; p; b; }| + ' "${temp_dir}/pkgnames" + )" | \ + sort -n | \ + tail -n1 + ) + if [ -z "${sub_pkgrel}" ]; then + echo '0' + else + echo "$((sub_pkgrel+1))" + fi + ) +} diff --git a/bin/get-assignment b/bin/get-assignment index cb6f48e..607f826 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -19,6 +19,11 @@ mkdir -p "${work_dir}/package-states" hand_out_assignment() { + # find out the sub_pkgrel + sub_pkgrel=$( + next_sub_pkgrel "$1" "$2" "$3" "$4" + ) + # we don't care anymore if an older version of this package was # "locked" or "broken" find "${work_dir}/package-states" -maxdepth 1 -regextype grep \ @@ -35,7 +40,7 @@ hand_out_assignment() { $ a '"$1 $2 $3 $4" \ "${work_dir}/build-list" - echo "$1 $2 $3 $4" + echo "$1 $2 $3 $4 ${sub_pkgrel}" # shellcheck disable=SC2154 echo "${slave}" >> \ "${work_dir}/package-states/$1.$2.$3.$4.locked" diff --git a/bin/return-assignment b/bin/return-assignment index 18a4cf4..865f1fd 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -123,7 +123,8 @@ clean_up_lock_file() { } if ! grep -qxF "$1 $2 $3 $4" "${work_dir}/build-list" || - ! [ -f "${work_dir}/package-states/$1.$2.$3.$4.locked" ]; then + ! [ -f "${work_dir}/package-states/$1.$2.$3.$4.locked" ] || + ! [ "$5" = "$(next_sub_pkgrel "$1" "$2" "$3" "$4")" ]; then >&2 echo 'Sorry, the sent package is outdated.' exit 2 fi |