NBash

Форк
0
105 строк · 2.7 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2013  Etersoft
4
# Copyright (C) 2013  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
load_helper epm-query
21

22
epm_conflicts_files()
23
{
24
    [ -n "$pkg_files" ] || return
25

26
    case $(get_package_type $pkg_files) in
27
        rpm)
28
            assure_exists rpm
29
            docmd rpm -q --conflicts -p $pkg_files
30
            ;;
31
        #deb)
32
        #    a= docmd dpkg -I $pkg_files | grep "^ *Depends:" | sed "s|^ *Depends:||g"
33
        #    ;;
34
        *)
35
            fatal "Have no suitable command for $PMTYPE"
36
            ;;
37
    esac
38
}
39

40
epm_conflicts_names()
41
{
42
    local CMD
43
    [ -n "$pkg_names" ] || return
44

45
# by package name
46
case $PMTYPE in
47
    apt-rpm)
48
        # FIXME: need fix for a few names case
49
        # FIXME: too low level of requires name (libSOME.so)
50
        if is_installed $pkg_names ; then
51
            CMD="rpm -q --conflicts"
52
        else
53
            EXTRA_SHOWDOCMD=' | grep "Conflicts:"'
54
            docmd apt-cache show $pkg_names | grep "Conflicts:"
55
            return
56
        fi
57

58
        ;;
59
    urpm-rpm|zypper-rpm)
60
        # FIXME: use hi level commands
61
        CMD="rpm -q --conflicts"
62
        ;;
63
    #yum-rpm)
64
    #    CMD="yum deplist"
65
    #    ;;
66
    #pacman)
67
    #    CMD="pactree"
68
    #    ;;
69
    apt-dpkg)
70
        # FIXME: need fix for a few names case
71
        if is_installed $pkg_names ; then
72
            showcmd dpkg -s $pkg_names
73
            a='' dpkg -s $pkg_names | grep "^Conflicts:" | sed "s|^Conflicts:||g"
74
            return
75
        else
76
            EXTRA_SHOWDOCMD=' | grep "Conflicts:"'
77
            docmd apt-cache show $pkg_names | grep "Conflicts:"
78
            return
79
        fi
80
        ;;
81
    # TODO: why-not show who conflicts with us
82
    #aptitude-dpkg)
83
    #    docmd aptitude why-not $pkg_names
84
    #    ;;
85

86
    #emerge)
87
    #    assure_exists equery
88
    #    CMD="equery depgraph"
89
    #    ;;
90
    *)
91
        fatal "Have no suitable command for $PMTYPE"
92
        ;;
93
esac
94

95

96
docmd $CMD $pkg_names
97

98
}
99

100
epm_conflicts()
101
{
102
    [ -n "$pkg_filenames" ] || fatal "Conflicts: Missing package(s) name"
103
    epm_conflicts_files
104
    epm_conflicts_names
105
}
106

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

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

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

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