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/build-packages3
-rwxr-xr-xbin/common-functions50
2 files changed, 52 insertions, 1 deletions
diff --git a/bin/build-packages b/bin/build-packages
index fdeb420..8017725 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -343,7 +343,8 @@ while [ "${count}" -ne 0 ]; do
# now we generate diffs from the namcap.logs
find . "${tar_content_dir}/" -maxdepth 1 -type f -name '*.pkg.tar.xz-namcap.log' -printf '%p\n' | \
while read -r log; do
- sort "${log}" | \
+ sort_quare_bracket_content "${log}" | \
+ sort | \
sponge "${log}"
done
find "${tar_content_dir}/" -maxdepth 1 -type f -name '*.pkg.tar.xz-namcap.log' -printf '%f\n' | \
diff --git a/bin/common-functions b/bin/common-functions
index 9cf010b..0ad4b71 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -1045,3 +1045,53 @@ find_biggest_subset_of_packages() {
)
}
+
+# sort_quare_bracket_content $file
+# sort the content of [] in $file, print to stdout
+
+sort_quare_bracket_content() {
+ local file
+ local line
+ local token
+ local token_list
+ local rest
+ file="$1"
+
+ while read -r line; do
+ printf '%s ' "${line}" | \
+ tr ' ' '\n' | \
+ while read -r token; do
+ if echo "${token}" | \
+ grep -qF '['; then
+ printf '%s[' "${token%[*}"
+ token="${token##*[}"
+ token_list="${token%,}"
+ while ! echo "${token_list}" | \
+ grep -qF ']'; do
+ read -r token
+ token_list=$(
+ printf '%s\n' \
+ "${token_list}" \
+ "${token%,}"
+ )
+ done
+ rest="]${token_list#*]}"
+ token_list="${token_list%%]*}"
+ token=$(
+ printf '%s' "${token_list}" | \
+ sort | \
+ sed 's|$|,|'
+ printf '%s' "${rest}"
+ )
+ fi
+ printf '%s\n' "${token}"
+ done | \
+ tr '\n' ' ' | \
+ sed '
+ s|, ]|]|g
+ s| $||
+ '
+ printf '\n'
+ done < \
+ "${file}"
+}