Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/return-assignment
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-09-13 10:26:35 +0200
committerErich Eckner <git@eckner.net>2017-09-13 10:26:35 +0200
commitef1582777fff756ed391b403266b3bbbabb182a0 (patch)
tree5206fb6eea39cac7f51cead224ad40d9909efe8c /bin/return-assignment
parent79ee1532e6b4bc23a23398f7d60442feddb85b72 (diff)
bin/get-assignment, bin/return-assignment: clean up some "grep -l" occurences
Diffstat (limited to 'bin/return-assignment')
-rwxr-xr-xbin/return-assignment24
1 files changed, 15 insertions, 9 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index 05a8569..4cb8859 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -68,7 +68,11 @@ if [ "$5" = 'ERROR' ]; then
find "${work_dir}/package-states/" -maxdepth 1 -name '*.locked' -printf '%f\n' | \
sed 's@^\(.\+\)\.\([0-9a-f]\{40\}\.\)\{2\}[^.]\+\.locked$@\1@'
)
- grep -lxF "${1}" "${work_dir}/build-list.loops/loop_"* 2> /dev/null | \
+ find "${work_dir}/build-list.loops" -maxdepth 1 \
+ -name 'loop_*' \
+ -not -name 'loop_*.locked' \
+ -exec grep -qxF "$1" '{}' \; \
+ -print | \
while read -r loop; do
if [ -z "$(
(
@@ -202,16 +206,18 @@ done
# remove old state files (these should be only "done" markers, but
# actually we don't care what it is) - as long as it's not "testing"
-find "${work_dir}/package-states" -maxdepth 1 | \
- grep "/$(str_to_regex "$1")\(\.[^.]\+\)\{4\}\$" | \
- grep -v "/$(str_to_regex "$1.$2.$3.$4")\.[^.]\+\$" | \
- grep -v '\.testing$' | \
- xargs -rn1 rm -f
+find "${work_dir}/package-states" -maxdepth 1 -regextype grep \
+ -not -name '*.testing' \
+ -regex ".*/$(str_to_regex "$1")\(\.[^.]\+\)\{4\}" \
+ -not -regex ".*/$(str_to_regex "$1.$2.$3.$4")\.[^.]\+" \
+ -exec rm '{}' \;
# remove all loops which are broken by this package
-grep -lxF "$1" "${work_dir}/build-list.loops/loop_"* 2> /dev/null | \
- sed 'p;s|$|.locked|' | \
- xargs -rn1 rm -f
+find "${work_dir}/build-list.loops" -maxdepth 1 \
+ -name 'loop_*' \
+ -not -name 'loop_*.locked' \
+ -exec grep -qxF "$1" '{}' \; \
+ -exec rm '{}' '{}.locked' \;
if ! find "${work_dir}/build-list.loops" -maxdepth 1 -printf '%f\n' | \
grep -q '^loop_[0-9]\+$'; then