NBash

Форк
0
99 строк · 2.8 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2013, 2016, 2018  Etersoft
4
# Copyright (C) 2013, 2016, 2018  Vitaly Lipatov <lav@etersoft.ru>
5
#
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.
10
#
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.
15
#
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/>.
18
#
19

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

22
load_helper epm-print
23

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

31
# by package name
32
case $PMTYPE in
33
    apt-rpm)
34
        if [ -z "$verbose" ] ; then
35
            showcmd apt-cache whatdepends $pkg
36
            if [ -n "$short" ] ; then
37
# TODO: use common converter from full name to short name
38
# TODO: see print_pkgname
39
                a= apt-cache whatdepends $pkg | grep "^  [^ ]" | sed -e "s|[0-9]*:||" | grep -E -v "(i586-|-debuginfo)" | sed -e 's|[@:].*||' -e "s|-[0-9].*||g" -e 's|^ *||' -e 's/\.32bit//g'
40
            else
41
                load_helper epm-query
42
                a= apt-cache whatdepends $pkg | grep "^  [^ ]" | sed -e "s|[0-9]*:||" | grep -E -v "(i586-|-debuginfo)"
43
            fi
44
            return
45
        fi
46
        CMD="apt-cache whatdepends"
47
        ;;
48
    apt-dpkg|aptitude-dpkg)
49
        CMD="apt-cache rdepends"
50
        ;;
51
    aptitude-dpkg)
52
        CMD="aptitude why"
53
        ;;
54
    packagekit)
55
        CMD="pkcon depends-on"
56
        ;;
57
    yum-rpm)
58
        CMD="repoquery --whatrequires"
59
        ;;
60
    urpm-rpm)
61
        CMD="urpmq --whatrequires"
62
        ;;
63
    dnf-rpm)
64
        # check command: dnf repoquery --whatrequires
65
        CMD="repoquery --whatrequires"
66
        ;;
67
    emerge)
68
        assure_exists equery
69
        CMD="equery depends -a"
70
        ;;
71
    homebrew)
72
        CMD="brew uses"
73
        ;;
74
    pkgng)
75
        CMD="pkg info -r"
76
        ;;
77
    aptcyg)
78
        CMD="apt-cyg rdepends"
79
        ;;
80
    opkg)
81
        CMD="opkg whatdepends"
82
        ;;
83
    eopkg)
84
        showcmd eopkg info $pkg
85
        # eopkg info prints it only from repo info
86
        LC_ALL=C eopkg info $pkg | grep "^Reverse Dependencies" | sed -e "s|Reverse Dependencies[[:space:]]*: ||" | grep -v "^$"
87
        return
88
        ;;
89
    xbps)
90
        CMD="xbps-query -X"
91
        ;;
92
    *)
93
        fatal "Have no suitable command for $PMTYPE"
94
        ;;
95
esac
96

97
docmd $CMD $pkg
98

99
}
100

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.