3 core_path
=/var
/lib
/pacman
/sync
/core.db
4 core_files_path
=/var
/lib
/pacman
/sync
/core.files
6 # check repository entries are parsed correctly
7 diff -u <(pacsift
--repo=core | expac
-S '%n\t%v' - |
sort -u) \
8 <(aur repo-parse
-p "$core_path" --list |
sort -u)
10 # check attributes are up-to-date
11 cnt1
=$
({ echo GROUPS
; bsdtar
-Oxf "$core_files_path" |
grep -Po '(?<=%).+(?=%)'; } |
sort -u |
wc -l) \
12 cnt2
=$
(aur repo-parse
--list-attr |
wc -l)
15 # check if output is valid JSON
16 aur repo-parse
-p "$core_files_path" --json |
tee core.json | jq
-e >/dev
/null
18 # check if fields match aur-format
19 diff -u <(aur format
-F '%n\t%v\n' core.json
) \
20 <(aur repo-parse
-p "$core_files_path" --list)
22 # test formatting options applicable to pacman repositories
24 fmt_c
=('a' 'b' 'c' 'C' 'd' 'D' 'e' 'g' 'M' 'n' 'O' 'P' 'U' 'v')
26 for f
in "${fmt_p[@]}" "${fmt_c[@]}"; do
27 cnt
=$
(aur format core.json
--format "$f\n" |
awk NF |
wc -l)
32 aur repo-parse || err
=$?
34 aur repo-parse
-p /does
/not
/exist
--list || err
=$?
37 # --json output with varying number of packages
38 core_entries
=('acl-*/desc' 'archlinux-keyring-*/desc')
39 json_cnt1
=$
(bsdtar
-Oxf "$core_path" "${core_entries[0]}" | aur repo-parse
--json - | jq
'. | length')
41 json_cnt2
=$
(bsdtar
-Oxf "$core_path" "${core_entries[@]:0:2}" | aur repo-parse
--json - | jq
'. | length')
43 json_cnt3
=$
(printf '\n' | aur repo-parse
--json - | jq
'. | length')
46 # --json output with constrained entries
47 aur repo-parse
-p "$core_files_path" --json -s '^a' | jq
'. | length' >/dev
/null