Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-assignment49
-rwxr-xr-xbin/get-package-updates12
2 files changed, 44 insertions, 17 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
index a35e415..69bfb3f 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -22,6 +22,7 @@ mkdir -p "${work_dir}/package-states"
hand_out_assignment() {
+ # locked packages won't be handed out
if [ -f "${work_dir}/package-states/$1.$2.$3.locked" ]; then
return 0
fi
@@ -29,6 +30,13 @@ hand_out_assignment() {
echo "$1 $2 $3"
echo "${SSH_CLIENT%% *}" > "${work_dir}/package-states/$1.$2.$3.locked"
+ # lock every loop this package breaks
+ grep "^${1//./\\.}\$" "${work_dir}/build-list.loops/"loop_* | \
+ cut -d: -f1 | \
+ tee -a "${work_dir}/package-states/$1.$2.$3.locked" | \
+ sed 's|$|.locked|' | \
+ xargs -rn1 touch
+
rm -f "${lock_file}"
exit 0
@@ -52,7 +60,7 @@ while read -r package git_revision repository; do
if [ -f "${work_dir}/package-states/${package}.${git_revision}.${repository}.locked" ];
then
- if [ "${SSH_CLIENT%% *}" = "$(cat "${work_dir}/package-states/${package}.${git_revision}.${repository}.locked")" ]; then
+ if [ "${SSH_CLIENT%% *}" = "$(head -n1 "${work_dir}/package-states/${package}.${git_revision}.${repository}.locked")" ]; then
num_jobs=$[${num_jobs}+1];
fi
else
@@ -90,23 +98,30 @@ while read -r package git_revision repository; do
done < "${work_dir}/build-list"
-# Find first package which breaks a loop and is not locked
-
-if [ -s "${work_dir}/tsort.error" ]; then
-
- grep -A1 '^tsort: -: input contains a loop:$' "${work_dir}/tsort.error" | \
- cut -d' ' -f2 | \
- grep -v -- '^-:$' | \
- while read package; do
-
- grep "^${package} " "${work_dir}/build-list" | \
- while read -r package git_revision repository; do
- hand_out_assignment "${package}" "${git_revision}" "${repository}"
- done
-
- done
+# Find package (of all packages which are not locked)
+# which breaks the most unlocked loops
+
+for package in $(
+ ls "${work_dir}/build-list.loops/"loop_* | \
+ sed 's|\.locked$||' | \
+ sort | \
+ uniq -u | \
+ # now, we have all unlocked loops
+ xargs cat | \
+ # now, we have their content
+ sort | \
+ uniq -c | \
+ sort -k1nr,1 | \
+ awk '{print $2}'
+ ); do
+
+ if assignment="$(grep "^${package} " "${work_dir}/build-list")"; then
+ hand_out_assignment ${assignment}
+ else
+ echo "'${package}' ..."
+ fi
-fi
+done
# Remove the lock file
diff --git a/bin/get-package-updates b/bin/get-package-updates
index ac7e905..f6aef31 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -196,11 +196,23 @@ echo 'Now actually sort it.'
awk '{print $4 " " $6 " " $7}' > \
"${work_dir}/build-list.new.new"
+rm -f "${work_dir}/build-order.loops/*"
+
if [ -s "${work_dir}/tsort.error" ]; then
>&2 echo 'WARNING: There is a dependency cycle!'
>&2 cat "${work_dir}/tsort.error"
>&2 echo
>&2 echo 'I will continue anyway.'
+ # save loops in separate files each, so breaking them is easier
+ awk '
+ /^tsort: \S+: input contains a loop:$/{
+ n++;
+ getline
+ }
+ {
+ print $2 >"'"${work_dir}"'/build-list.loops/loop_" n
+ }
+ ' "${work_dir}/tsort.error"
else
rm "${work_dir}/tsort.error"
fi