3 pkgfile=${ZPMDB:-/var/lib/zpm/local.db}
12 while getopts f:qlncCLI opt; do
14 f) pkgfile="$OPTARG" ;;
26 if [ ! -f $pkgfile ]; then
27 echo cannot find $pkgfile
31 if [ $long -gt 0 ]; then
32 cols="filetype,printf('%.4s', mode) as mode,username,groupname,"
35 if [ $pkgonly -eq 1 ]; then
37 elif [ $quiet -eq 0 ]; then
42 while [ $# -gt 0 ]; do
45 if [ "$pkg" = '--' ]; then
49 pkgid=$(zpm findpkg -f $pkgfile "$pkg")
50 if [ -n "$pkgid" ]; then
51 q=$(zpm quote -q "$pkgid")
54 warn "package $pkg not found, ignoring"
61 q=$(zpm quote -q "$glob")
62 globlist="or path glob $q"
64 globlist=${globlist#'or '}
69 printf '.separator " "\n'
71 printf 'select %s\n' "$cols"
73 if [ $pkgonly -eq 0 ]; then
74 if [ -n "$cols" ]; then
79 printf "when filetype = 'd' then rtrim(path,'/') || '/'\n"
80 printf "when filetype = 'l' then printf('%%s -> %%s', path, target)\n"
81 if [ $showsoname -eq 1 ]; then
82 printf "when EL.soname is not null then printf('%%s (%%s)', path, EL.soname)\n"
84 printf "else path end as path\n"
86 printf "from packagefiles_pkgid PF\n"
87 if [ $showsoname -eq 1 ]; then
88 printf "left join elflibraries EL on EL.file = PF.hash\n"
90 if [ -n "$status" ]; then
91 printf "join packages P on P.package = PF.package and P.version = PF.version and P.release = PF.release\n"
94 if [ -n "$globlist" ]; then
95 printf "and (%s)\n" "$globlist"
97 if [ -n "$pkglist" ]; then
98 printf "and pkgid in (%s)\n" "$pkglist"
101 only) printf "and configuration = 1\n" ;;
102 exclude) printf "and configuration = 0\n" ;;
104 if [ -n "$status" ]; then
105 printf "and P.status = '%s'\n" "$status"
107 printf 'order by package,version collate vercmp, release, path\n'
109 } | zpm shell $pkgfile