3 pkgfile=${ZPMDB:-/var/lib/zpm/local.db}
13 while getopts f:qlncCLIs opt; do
15 f) pkgfile="$OPTARG" ;;
22 s) sharedlibsonly=1 ;;
23 I) status=installed ;;
28 if [ ! -f $pkgfile ]; then
29 echo cannot find $pkgfile
33 if [ $long -gt 0 ]; then
34 cols="filetype,printf('%.4s', mode) as mode,username,groupname,"
37 if [ $pkgonly -eq 1 ]; then
39 elif [ $quiet -eq 0 ]; then
45 while [ $# -gt 0 ]; do
49 if [ "$pkg" = ':' ]; then
53 pkgid=$(zpm findpkg -f $pkgfile "$pkg")
54 if [ -n "$pkgid" ]; then
55 pkglist="$pkglist $pkgid"
57 printf "package $pkg not found\n" 1>&2
62 if [ $efail -eq 1 ]; then
68 q=$(zpm quote -q "$glob")
69 globlist="or path glob $q"
71 globlist=${globlist#'or '}
76 printf '.separator " "\n'
78 printf 'select %s\n' "$cols"
80 if [ $pkgonly -eq 0 ]; then
81 if [ -n "$cols" ]; then
86 printf "when filetype = 'd' then rtrim(path,'/') || '/'\n"
87 printf "when filetype = 'l' then printf('%%s -> %%s', path, target)\n"
88 if [ $showsoname -eq 1 ]; then
89 printf "when EL.soname is not null then printf('%%s (%%s)', path, EL.soname)\n"
91 printf "else path end as path\n"
93 printf "from packagefiles_pkgid PF\n"
94 if [ $showsoname -eq 1 ] || [ $sharedlibsonly -eq 1 ]; then
95 printf "left join elflibraries EL on EL.file = PF.hash\n"
97 if [ -n "$status" ]; then
98 printf "join packages P on P.package = PF.package and P.version = PF.version and P.release = PF.release\n"
100 printf "where true\n"
101 if [ -n "$globlist" ]; then
102 printf "and (%s)\n" "$globlist"
104 if [ -n "$pkglist" ]; then
105 printf "and pkgid in (%s)\n" "$(zpm quote -d, -q $pkglist)"
108 only) printf "and configuration = 1\n" ;;
109 exclude) printf "and configuration = 0\n" ;;
111 if [ $sharedlibsonly -eq 1 ]; then
112 printf "and EL.soname is not null\n"
114 if [ -n "$status" ]; then
115 printf "and P.status = '%s'\n" "$status"
117 printf 'order by PF.package, PF.version collate vercmp, PF.release, PF.path\n'
119 } | zpm shell $pkgfile