3 pkgfile=${ZPMDB:-/var/lib/zpm/local.db}
11 while getopts f:qlncCL opt; do
13 f) pkgfile="$OPTARG" ;;
24 if [ ! -f $pkgfile ]; then
25 echo cannot find $pkgfile
29 if [ $long -gt 0 ]; then
30 cols="filetype,printf('%.4s', mode) as mode,username,groupname,"
33 if [ $pkgonly -eq 1 ]; then
35 elif [ $quiet -eq 0 ]; then
40 while [ $# -gt 0 ]; do
43 if [ "$pkg" = '--' ]; then
47 pkgid=$(zpm findpkg -f $pkgfile "$pkg")
48 if [ -n "$pkgid" ]; then
49 q=$(zpm quote -q "$pkgid")
52 warn "package $pkg not found, ignoring"
59 q=$(zpm quote -q "$glob")
60 globlist="or path glob $q"
62 globlist=${globlist#'or '}
67 printf '.separator " "\n'
68 printf 'select %s\n' "$cols"
70 if [ $pkgonly -eq 0 ]; then
71 if [ -n "$cols" ]; then
76 printf "when filetype = 'd' then rtrim(path,'/') || '/'\n"
77 printf "when filetype = 'l' then printf('%%s -> %%s', path, target)\n"
78 if [ $showsoname -eq 1 ]; then
79 printf "when EL.soname is not null then printf('%%s (%%s)', path, EL.soname)\n"
81 printf "else path end as path\n"
83 printf 'from packagefiles_pkgid PF left join elflibraries EL on EL.file = PF.hash\nwhere true\n'
84 if [ -n "$globlist" ]; then
85 printf "and (%s)\n" "$globlist"
87 if [ -n "$pkglist" ]; then
88 printf "and pkgid in (%s)\n" "$pkglist"
91 only) printf "and configuration = 1\n" ;;
92 exclude) printf "and configuration = 0\n" ;;
94 printf 'order by pkgid,path\n'
96 } | zpm shell $pkgfile