3
# Copyright (C) 2009, 2012, 2016 Etersoft
4
# Copyright (C) 2009, 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
# copied from etersoft-build-utils/bin/rpmqf
22
# TODO: check for lib64/name situations
25
if echo "$1" | grep -q "/" ; then
42
TOFILE="$(__abs_filename "$1")"
44
TOFILE=$(print_command_path "$1" || echo "$1")
45
if [ "$TOFILE" != "$1" ] ; then
46
info " > $1 is placed as $TOFILE"
50
[ -n "$TOFILE" ] || return
53
if [ -n "$short" ] ; then
54
__do_short_query "$TOFILE"
61
# get value of symbolic link
62
if [ -L "$TOFILE" ] ; then
64
LINKTO=$(readlink -- "$TOFILE")
65
info " > $TOFILE is link to $LINKTO"
66
LINKTO=$(readlink -f -- "$TOFILE")
67
__do_query_real_file "$LINKTO"
74
dpkg_print_name_version()
78
[ -n "$i" ] || continue
79
ver=$(dpkg -s "$i" 2>/dev/null | grep "Version:" | sed -e "s|Version: ||g")
80
if [ -z "$ver" ] ; then
95
dpkg_print_name_version "$(dpkg -S "$1" | grep -v "^diversion by" | sed -e "s|:.*||")"
111
CMD="conary query --path"
114
# note: need remove leading slash for grep
115
docmd grep -R -- "$(echo $@ | sed -e 's|^/\+||g')" /var/log/packages | sed -e "s|/var/log/packages/||g"
122
CMD="eopkg search-file"
125
# FIXME: maybe it is search file?
129
#CMD="apt-cyg packageof"
130
# is not implemented locally
134
fatal "Have no suitable query command for $PMTYPE"
147
CMD="rpm -qf --queryformat %{NAME}\n"
150
docmd dpkg -S "$1" | sed -e "s|:.*||"
160
# note: need remove leading slash for grep
161
docmd grep -R "$(echo $@ | sed -e 's|^/\+||g')" /var/log/packages | sed -e "s|/var/log/packages/||g"
165
fatal "Have no suitable query command for $PMTYPE"
175
# file can exists or not
176
[ -n "$pkg_filenames" ] || fatal "Run query without file names"
179
#load_helper epm-search_file
182
for pkg in $pkg_filenames ; do
183
__do_query_real_file "$pkg" || res=$?
186
[ "$res" = "0" ] || info "Try epm sf for search file in all packages of the repositories"
187
#|| pkg_filenames="$FULLFILEPATH" epm_search_file