summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-02-14 23:48:30 +0100
committerErich Eckner <git@eckner.net>2018-02-14 23:48:30 +0100
commitb4eb9d2dcda28b0107b0bde28f4f4426bb08af05 (patch)
tree9d775a405e5ea42322cece2141357afb7d159e6e /bin
parentfcb02682d01c6a39d9313897bc43dfe566188f15 (diff)
downloadbuilder-b4eb9d2dcda28b0107b0bde28f4f4426bb08af05.tar.xz
bin/get-assignment: do not use next_sub_pkgrel, but take info straight from database
Diffstat (limited to 'bin')
-rwxr-xr-xbin/common-functions64
-rwxr-xr-xbin/get-assignment33
2 files changed, 27 insertions, 70 deletions
diff --git a/bin/common-functions b/bin/common-functions
index 3a03d27..bc43686 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -1237,70 +1237,6 @@ print_list_of_archaic_packages() {
sort -u
}
-# 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 'tmp.common-functions.next_sub_pkgrel.XXXXXXXXXX' --tmpdir)
- trap 'rm -rf --one-file-system "${temp_dir}"' EXIT
-
- 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
- )
-}
-
# modification_revision_link "${mod_rev}" "${repo}" "${pkg}"
# print the given modification revision possibly with a html link to github
diff --git a/bin/get-assignment b/bin/get-assignment
index 67c7aa4..a7eec2d 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -22,11 +22,6 @@ 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 \
@@ -43,7 +38,33 @@ hand_out_assignment() {
$ a '"$1 $2 $3 $4" \
"${work_dir}/build-list"
- echo "$1 $2 $3 $4 ${sub_pkgrel}"
+ # shellcheck disable=SC2016
+ {
+ printf 'SELECT '
+ printf '`package_sources`.`%s`,' \
+ 'pkgbase' 'git_revision' 'mod_git_revision'
+ printf '`upstream_repositories`.`name`,`binary_packages`.`sub_pkgrel`'
+ printf ' FROM `upstream_repositories`'
+ printf ' JOIN `%s` ON `%s`.`%s`=`%s`.`id`' \
+ 'package_sources' 'package_sources' 'upstream_package_repository' 'upstream_repositories' \
+ 'build_assignments' 'build_assignments' 'package_source' 'package_sources' \
+ 'binary_packages' 'binary_packages' 'build_assignment' 'build_assignments' \
+ 'repositories' 'binary_packages' 'repository' 'repositories'
+ printf ' WHERE `repositories`.`name`="build-list"'
+ printf ' AND `package_sources`.`%s`=from_base64("%s")' \
+ 'pkgbase' "$(printf '%s' "$1" | base64 -w0)" \
+ 'git_revision' "$(printf '%s' "$2" | base64 -w0)" \
+ 'mod_git_revision' "$(printf '%s' "$3" | base64 -w0)"
+ printf ' AND `upstream_repositories`.`name`=from_base64("%s")' \
+ "$(printf '%s' "$4" | base64 -w0)"
+ printf ' LIMIT 1;\n'
+ } | \
+ ${mysql_command} --raw --batch | \
+ sed '
+ 1d
+ y/\t/ /
+ '
+
{
# shellcheck disable=SC2154
echo "${slave}"