sync: improve pkgspec for --ignore{,-file}

pull/1010/head
Alad Wenter 3 months ago
parent 25b4f69837
commit 71aeaf42fd
  1. 31
      lib/aur-sync

@ -30,16 +30,6 @@ lib32() {
}' "$@"
}
split_pkgspec() {
awk -F'/' '{
if (NF == 2) {
printf("%s\t%s\n", $1, $2)
} else {
printf("-\t%s\n", $1)
}
}' "$@"
}
# argv[1]: $1 pkgname $2 depends $3 pkgbase
# note: edges are not checked for duplicates
select_pkgbase() {
@ -64,6 +54,16 @@ select_ignores() {
}' "$@"
}
select_ignores_pkgspec() {
awk -F'/' -v needle="$1" '{
if (NF == 2 && $1 == needle) {
print $2
} else {
print $1
}
}' "${@:2}"
}
# argv[1]: $1 pkgname $2 depends[<>=]
tr_ver() {
awk '{
@ -282,16 +282,11 @@ fi
# Concatenate ignores from file and command-line arguments
: "${ignore_file=$XDG_CONFIG_HOME/aurutils/sync/ignore}"
# Restrict ignores to local repository with a single pass (#880)
{ if [[ -r $ignore_file ]] && [[ ! -d $ignore_file ]]; then
# Restrict ignores to local repository with single pass (#880)
while IFS=$'\t' read -r repo pkg; do
[[ $repo == "$db_name" || $repo == "-" ]] && pkg_i+=("$pkg")
done < <(split_pkgspec "$ignore_file")
fi
if (( ${#pkg_i[@]} )); then
printf '%s\n' "${pkg_i[@]}"
select_ignores_pkgspec "$db_name" "$ignore_file"
fi
(( ${#pkg_i[@]} )) && printf '%s\n' "${pkg_i[@]}"
} | complement <(printf '%s\n' "$@") >igni
if [[ -s igni ]]; then

Loading…
Cancel
Save