epm-whatdepends 1.61 KB
Newer Older
1 2
#!/bin/sh
#
Vitaly Lipatov's avatar
Vitaly Lipatov committed
3 4
# Copyright (C) 2013, 2016  Etersoft
# Copyright (C) 2013, 2016  Vitaly Lipatov <lav@etersoft.ru>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

20 21
# TODO: will it has local only mode?

22 23
load_helper epm-print

24 25 26
epm_whatdepends()
{
	local CMD
27 28 29
	[ -n "$pkg_files" ] && fatal "whatdepends do not handle files"
	[ -n "$pkg_names" ] || fatal "whatdepends: missing package(s) name"
	local pkg=$(print_name $pkg_names)
30 31 32

# by package name
case $PMTYPE in
33
	apt-rpm)
34 35
		CMD="apt-cache whatdepends"
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
36
	apt-dpkg|aptitude-dpkg)
37 38
		CMD="apt-cache rdepends"
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
39 40 41
	aptitude-dpkg)
		CMD="aptitude why"
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
42 43 44
	yum-rpm)
		CMD="repoquery --whatrequires"
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
45 46 47
	urpm-rpm)
		CMD="urpmq --whatrequires"
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
48
	dnf-rpm)
49
		# check command: dnf repoquery --whatrequires
Vitaly Lipatov's avatar
Vitaly Lipatov committed
50 51
		CMD="repoquery --whatrequires"
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
52
	emerge)
53
		assure_exists equery
Vitaly Lipatov's avatar
Vitaly Lipatov committed
54 55
		CMD="equery depends -a"
		;;
56 57 58
	pkgng)
		CMD="pkg info -r"
		;;
59 60 61
	aptcyg)
		CMD="apt-cyg rdepends"
		;;
62 63 64
	xbps)
		CMD="xbps-query -X"
		;;
65
	*)
66
		fatal "Have no suitable command for $PMTYPE"
67 68 69
		;;
esac

70
docmd $CMD $pkg
71 72

}