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/common-functions36
-rwxr-xr-xbin/get-assignment17
-rwxr-xr-xbin/get-package-updates5
3 files changed, 50 insertions, 8 deletions
diff --git a/bin/common-functions b/bin/common-functions
index 3146572..25c592f 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -424,3 +424,39 @@ recursively_umount_and_rm() {
-exec 'sudo' 'umount' '-l' '{}' ';'
rm -rf --one-file-system "${dir}"
}
+
+# insert_break_loops_orders $file
+# inserts the correct number of 'break_loops' order into $file
+
+insert_break_loops_orders() {
+ local file="$1"
+ local looped_packages
+ local line
+
+ looped_packages="$(
+ ls "${work_dir}/build-list.loops" | \
+ grep '^loop_[0-9]\+$' | \
+ sed "s|^|${work_dir}/build-list.loops/|" | \
+ xargs -r cat | \
+ sort -u | \
+ wc -l
+ )"
+
+ (
+ while read -r line; do
+ if [ "${line}" = 'break_loops' ]; then
+ if [ ${looped_packages} -eq 0 ]; then
+ continue
+ fi
+ looped_packages=$((${looped_packages}-1))
+ fi
+ printf '%s\n' "${line}"
+ done < \
+ "${file}"
+ while [ ${looped_packages} -gt 0 ]; do
+ looped_packages=$((${looped_packages}-1))
+ echo 'break_loops'
+ done
+ ) | \
+ sponge "${file}"
+}
diff --git a/bin/get-assignment b/bin/get-assignment
index 2ef8556..64f6046 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -115,11 +115,18 @@ for hand_out_broken in false true; do
if [ -z "${git_revision}${mod_git_revision}${repository}" ] && \
[ "${package}" = 'break_loops' ]; then
if ${hand_out_broken}; then
- sed -i \
- '/^break_loops$/d' \
- "${work_dir}/build-list"
- echo 'break_loops' >> \
- "${work_dir}/build-list"
+ first=true
+ while read -r s; do
+ if [ "${s}" = 'break_loops' ] && \
+ ${first}; then
+ first=false
+ continue
+ fi
+ printf '%s\n' "${s}"
+ done < \
+ "${work_dir}/build-list" | \
+ sponge "${work_dir}/build-list"
+ insert_break_loops_orders "${work_dir}/build-list"
break
else
continue
diff --git a/bin/get-package-updates b/bin/get-package-updates
index 12ae82f..46b0440 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -360,9 +360,8 @@ if [ -s "${work_dir}/tsort.error" ]; then
"${work_dir}/build-list.loops.new/${loop}"
done
- # add order to break loops to build list
- echo 'break_loops' >> \
- "${work_dir}/build-list.new.new"
+ # add orders to break loops to build list
+ insert_break_loops_orders "${work_dir}/build-list.new.new"
else
rm "${work_dir}/tsort.error"