Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/get-assignment
diff options
context:
space:
mode:
Diffstat (limited to 'bin/get-assignment')
-rwxr-xr-xbin/get-assignment27
1 files changed, 15 insertions, 12 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
index fd76a7f..7185a35 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -17,6 +17,7 @@
# respect build-manually-list ("blocked")
+# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"
mkdir -p "${work_dir}/package-states"
@@ -30,10 +31,9 @@ hand_out_assignment() {
# we don't care anymore if an older version of this package was
# "locked" or "broken" (we keep only marker for older "done" packages)
- ls "${work_dir}/package-states" | \
- grep "^$(str_to_regex "${1}")\(\.[^.]\+\)\{3\}\.\(locked\|broken\)\$" | \
- grep -v "^$(str_to_regex "$1.$2.$3.$4.")[^.]\+\$" | \
- sed "s|^|${work_dir}/package-states/|" | \
+ find "${work_dir}/package-states" -maxdepth 1 | \
+ grep "/$(str_to_regex "${1}")\(\.[^.]\+\)\{3\}\.\(locked\|broken\)\$" | \
+ grep -v "/$(str_to_regex "$1.$2.$3.$4.")[^.]\+\$" | \
xargs -rn1 rm -f
echo "$1 $2 $3 $4"
@@ -81,7 +81,7 @@ while read -r package git_revision mod_git_revision repository; do
continue
fi
- generate_package_metadata $package.$git_revision.$mod_git_revision.$repository
+ generate_package_metadata "${package}.${git_revision}.${mod_git_revision}.${repository}"
if [ -f "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.blocked" ]; then
continue
@@ -90,7 +90,7 @@ while read -r package git_revision mod_git_revision repository; do
if [ -f "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.locked" ];
then
if [ "${slave}" = "$(head -n1 "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.locked")" ]; then
- num_jobs=$((${num_jobs}+1));
+ num_jobs=$((num_jobs+1));
fi
else
pending_packages=true
@@ -150,7 +150,8 @@ for hand_out_broken in false true; do
hand_out_assignment "${package}" "${git_revision}" "${mod_git_revision}" "${repository}"
- done < "${work_dir}/build-list"
+ done < \
+ "${work_dir}/build-list"
done
@@ -158,7 +159,7 @@ done
# which breaks the most unlocked loops
locked_packages=$(
- ls "${work_dir}/package-states/" | \
+ find "${work_dir}/package-states/" -maxdepth 1 -printf '%f\n' | \
grep '\(\.[0-9a-f]\{40\}\)\{2\}\.[^\.\]\+\.locked$' | \
sed 's|\(\.[0-9a-f]\{40\}\)\{2\}\.[^\.\]\+\.locked$||'
)
@@ -168,18 +169,19 @@ grep -vxF 'break_loops' "${work_dir}/build-list" | \
"${work_dir}/build-list.sorted-by-package"
for package in $(
- ls "${work_dir}/build-list.loops/" | \
- grep '^loop_[0-9]\+$' | \
+ # shellcheck disable=SC2030
+ find "${work_dir}/build-list.loops/" -maxdepth 1 | \
+ grep '/loop_[0-9]\+$' | \
while read -r loop; do
if [ -z "$(
(
- cat "${work_dir}/build-list.loops/${loop}"
+ cat "${loop}"
echo "${locked_packages}"
) | \
sort | \
uniq -d
)" ]; then
- cat "${work_dir}/build-list.loops/${loop}"
+ cat "${loop}"
fi
done | \
sort | \
@@ -207,6 +209,7 @@ for package in $(
sort -k1n,1 -k2nr,2 | \
cut -d' ' -f3
); do
+ # shellcheck disable=SC2046,SC2031
hand_out_assignment $(
echo "${package}" | \
sed 's|\.\([^.]\+\)\.\([^.]\+\)\.\([^.]\+\)$| \1 \2 \3|'