epm-whatdepends 1.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/bin/sh
#
# Copyright (C) 2013  Etersoft
# Copyright (C) 2013  Vitaly Lipatov <lav@etersoft.ru>
#
# 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
load_helper epm-print

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

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

61
docmd $CMD $pkg
62 63

}