aboutsummaryrefslogtreecommitdiff
path: root/common/xbps-src/shutils/show.sh
blob: 84db717dc363ca3010e72569fc0bfa02f3bd1609 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# vim: set ts=4 sw=4 et:

show_pkg() {
    local i=

    echo "pkgname:	$pkgname"
    echo "version:	$version"
    echo "revision:	$revision"
    for i in ${distfiles}; do
        [ -n "$i" ] && echo "distfiles:	$i"
    done
    for i in ${checksum}; do
        [ -n "$i" ] && echo "checksum:	$i"
    done
    for i in ${archs}; do
        [ -n "$i" ] && echo "archs:		$i"
    done
    echo "maintainer:	$maintainer"
    [ -n "$homepage" ] && echo "Upstream URL:	$homepage"
    [ -n "$license" ] && echo "License(s):	$license"
    [ -n "$build_style" ] && echo "build_style:	$build_style"
    for i in $build_helper; do
        [ -n "$i" ] && echo "build_helper:  $i"
    done
    for i in ${configure_args}; do
        [ -n "$i" ] && echo "configure_args:	$i"
    done
    echo "short_desc:	$short_desc"
    for i in ${subpackages}; do
        [ -n "$i" ] && echo "subpackages:	$i"
    done
    set -f
    for i in ${conf_files}; do
        [ -n "$i" ] && echo "conf_files:	$i"
    done
    set +f
    for i in ${replaces}; do
        [ -n "$i" ] && echo "replaces:	$i"
    done
    for i in ${provides}; do
        [ -n "$i" ] && echo "provides:	$i"
    done
    for i in ${conflicts}; do
        [ -n "$i" ] && echo "conflicts:	$i"
    done
    [ -n "$long_desc" ] && echo "long_desc: $long_desc"

    return 0
}

show_pkg_deps() {
    [ -f "${PKGDESTDIR}/rdeps" ] && cat ${PKGDESTDIR}/rdeps
}

show_pkg_files() {
    [ -d ${PKGDESTDIR} ] && find ${PKGDESTDIR} -print
}

show_avail() {
    check_pkg_arch "$XBPS_CROSS_BUILD" 2>/dev/null
}

show_pkg_build_depends() {
    local f x _pkgname _srcpkg _dep found result
    local _deps="$1"

    result=$(mktemp || exit 1)

    # build time deps
    for f in ${_deps}; do
        # ignore virtual deps
        local _rpkg="${f%\?*}"
        local _vpkg="${f#*\?}"

        # ignore virtual dependencies
        if [ "${_rpkg}" != "${_vpkg}" ]; then
            f="${_vpkg}"
        fi
        unset found
        # check for subpkgs
        for x in ${subpackages}; do
            _pkgname="$($XBPS_UHELPER_CMD getpkgdepname $f 2>/dev/null)"
            if [ -z "${_pkgname}" ]; then
                _pkgname="$($XBPS_UHELPER_CMD getpkgname $f 2>/dev/null)"
            fi
            if [ "${_pkgname}" = "$x" ]; then
                found=1
                break
            fi
        done
        if [ -n "$found" ]; then
            continue
        fi
        _pkgname="$($XBPS_UHELPER_CMD getpkgdepname $f 2>/dev/null)"
        if [ -z "${_pkgname}" ]; then
            _pkgname="$($XBPS_UHELPER_CMD getpkgname $f 2>/dev/null)"
        fi
        if [ -z "${_pkgname}" ]; then
            _pkgname="$f"
        fi
        _pkgname=${_pkgname/-32bit}
        _srcpkg=$(readlink -f ${XBPS_SRCPKGDIR}/${_pkgname})
        _srcpkg=${_srcpkg##*/}
        echo "${_srcpkg}" >> $result
    done
    sort -u $result
    rm -f $result
}

show_pkg_build_deps() {
    setup_pkg_depends
    show_pkg_build_depends "${host_build_depends} ${build_depends} ${run_depends}"
}

show_pkg_hostmakedepends() {
    setup_pkg_depends
    show_pkg_build_depends "${host_build_depends}"
}

show_pkg_makedepends() {
    setup_pkg_depends
    show_pkg_build_depends "${build_depends}"
}

show_pkg_build_options() {
    local f opt desc

    [ -z "$PKG_BUILD_OPTIONS" ] && return 0

    source $XBPS_COMMONDIR/options.description
    msg_normal "$pkgver: the following build options are set:\n"
    for f in ${PKG_BUILD_OPTIONS}; do
        opt="${f#\~}"
        eval desc="\${desc_option_${opt}}"
        if [[ ${f:0:1} == '~' ]]; then
            echo "   $opt: $desc (OFF)"
        else
            printf "   "
            msg_normal_append "$opt: "
            printf "$desc (ON)\n"
        fi
    done
}

show_pkg_shlib_provides() {
    [ -f "${PKGDESTDIR}/shlib-provides" ] && cat ${PKGDESTDIR}/shlib-provides
}

show_pkg_shlib_requires() {
    [ -f "${PKGDESTDIR}/shlib-requires" ] && cat ${PKGDESTDIR}/shlib-requires
}