1 |
|
# Copyright 1999-2020 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=6
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
PYTHON_COMPAT=( python3_{6,7} )
|
|
6 |
PYTHON_COMPAT=( python3_{9..11} )
|
7 |
7 |
DISTUTILS_SINGLE_IMPL=1
|
8 |
|
|
9 |
|
inherit gnome2 distutils-r1
|
|
8 |
DISTUTILS_USE_SETUPTOOLS=no
|
|
9 |
inherit gnome2 distutils-r1 optfeature
|
10 |
10 |
|
11 |
11 |
DESCRIPTION="A graphical tool for administering virtual machines"
|
12 |
|
HOMEPAGE="http://virt-manager.org"
|
|
12 |
HOMEPAGE="https://virt-manager.org https://github.com/virt-manager/virt-manager"
|
13 |
13 |
|
14 |
|
if [[ ${PV} = *9999* ]]; then
|
15 |
|
inherit git-r3
|
16 |
|
SRC_URI=""
|
17 |
|
KEYWORDS="amd64 x86"
|
|
14 |
if [[ ${PV} == *9999* ]]; then
|
18 |
15 |
EGIT_REPO_URI="https://github.com/virt-manager/virt-manager.git"
|
|
16 |
EGIT_BRANCH="main"
|
|
17 |
SRC_URI=""
|
|
18 |
inherit git-r3
|
19 |
19 |
else
|
20 |
|
SRC_URI="http://virt-manager.org/download/sources/${PN}/${P}.tar.gz"
|
21 |
|
KEYWORDS="amd64 ~ppc64 x86"
|
|
20 |
SRC_URI="https://virt-manager.org/download/sources/${PN}/${P}.tar.gz"
|
|
21 |
KEYWORDS="amd64 ~arm64 ~ppc64 x86"
|
22 |
22 |
fi
|
23 |
23 |
|
24 |
24 |
LICENSE="GPL-2"
|
25 |
25 |
SLOT="0"
|
26 |
|
IUSE="gtk policykit sasl"
|
|
26 |
IUSE="gui policykit sasl"
|
27 |
27 |
|
28 |
|
RDEPEND="!app-emulation/virtinst
|
|
28 |
RDEPEND="
|
29 |
29 |
${PYTHON_DEPS}
|
30 |
30 |
app-cdr/cdrtools
|
31 |
31 |
>=app-emulation/libvirt-glib-1.0.0[introspection]
|
|
32 |
>=sys-libs/libosinfo-0.2.10[introspection]
|
32 |
33 |
$(python_gen_cond_dep '
|
33 |
|
dev-libs/libxml2[python,${PYTHON_MULTI_USEDEP}]
|
34 |
|
dev-python/ipaddr[${PYTHON_MULTI_USEDEP}]
|
35 |
|
dev-python/libvirt-python[${PYTHON_MULTI_USEDEP}]
|
36 |
|
dev-python/pygobject:3[${PYTHON_MULTI_USEDEP}]
|
37 |
|
dev-python/requests[${PYTHON_MULTI_USEDEP}]
|
|
34 |
dev-libs/libxml2[python,${PYTHON_USEDEP}]
|
|
35 |
dev-python/argcomplete[${PYTHON_USEDEP}]
|
|
36 |
>=dev-python/libvirt-python-6.10.0[${PYTHON_USEDEP}]
|
|
37 |
dev-python/pygobject:3[${PYTHON_USEDEP}]
|
|
38 |
dev-python/requests[${PYTHON_USEDEP}]
|
38 |
39 |
')
|
39 |
|
>=sys-libs/libosinfo-0.2.10[introspection]
|
40 |
|
gtk? (
|
|
40 |
gui? (
|
41 |
41 |
gnome-base/dconf
|
42 |
42 |
>=net-libs/gtk-vnc-0.3.8[gtk3(+),introspection]
|
43 |
43 |
net-misc/spice-gtk[usbredir,gtk3,introspection,sasl?]
|
44 |
|
net-misc/x11-ssh-askpass
|
|
44 |
sys-apps/dbus[X]
|
45 |
45 |
x11-libs/gtk+:3[introspection]
|
46 |
46 |
x11-libs/gtksourceview:4[introspection]
|
47 |
47 |
x11-libs/vte:2.91[introspection]
|
48 |
48 |
policykit? ( sys-auth/polkit[introspection] )
|
49 |
49 |
)
|
50 |
50 |
"
|
51 |
|
DEPEND="${RDEPEND}
|
52 |
|
dev-lang/perl
|
53 |
|
dev-util/intltool
|
54 |
|
"
|
|
51 |
DEPEND="${RDEPEND}"
|
|
52 |
BDEPEND="dev-python/docutils"
|
55 |
53 |
|
56 |
54 |
DOCS=( README.md NEWS.md )
|
57 |
55 |
|
58 |
|
src_prepare() {
|
59 |
|
distutils-r1_src_prepare
|
60 |
|
}
|
61 |
|
|
62 |
|
distutils-r1_python_compile() {
|
63 |
|
local defgraphics=
|
64 |
|
|
65 |
|
esetup.py configure \
|
66 |
|
--default-graphics=spice
|
67 |
|
}
|
68 |
|
|
69 |
|
virtmanager_python_install() {
|
70 |
|
debug-print-function ${FUNCNAME} "${@}"
|
71 |
|
|
72 |
|
local args=( "${@}" )
|
|
56 |
DISTUTILS_ARGS=(
|
|
57 |
--no-update-icon-cache
|
|
58 |
--no-compile-schemas
|
|
59 |
)
|
73 |
60 |
|
74 |
|
# enable compilation for the install phase.
|
75 |
|
local -x PYTHONDONTWRITEBYTECODE=
|
|
61 |
EPYTEST_IGNORE=(
|
|
62 |
# Wants to use /tmp osinfo config?
|
|
63 |
tests/test_cli.py
|
76 |
64 |
|
77 |
|
# python likes to compile any module it sees, which triggers sandbox
|
78 |
|
# failures if some packages haven't compiled their modules yet.
|
79 |
|
addpredict "${EPREFIX}/usr/lib/${EPYTHON}"
|
80 |
|
addpredict "${EPREFIX}/usr/$(get_libdir)/${EPYTHON}"
|
81 |
|
addpredict /usr/lib/pypy2.7
|
82 |
|
addpredict /usr/lib/pypy3.6
|
83 |
|
addpredict /usr/lib/portage/pym
|
84 |
|
addpredict /usr/local # bug 498232
|
85 |
|
|
86 |
|
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
|
87 |
|
# user may override --install-scripts
|
88 |
|
# note: this is poor but distutils argv parsing is dumb
|
89 |
|
local mydistutilsargs=( "${mydistutilsargs[@]}" )
|
90 |
|
local scriptdir=${EPREFIX}/usr/bin
|
91 |
|
|
92 |
|
# construct a list of mydistutilsargs[0] args[0] args[1]...
|
93 |
|
local arg arg_vars
|
94 |
|
[[ ${mydistutilsargs[@]} ]] && eval arg_vars+=(
|
95 |
|
'mydistutilsargs['{0..$(( ${#mydistutilsargs[@]} - 1 ))}']'
|
96 |
|
)
|
97 |
|
[[ ${args[@]} ]] && eval arg_vars+=(
|
98 |
|
'args['{0..$(( ${#args[@]} - 1 ))}']'
|
99 |
|
)
|
100 |
|
|
101 |
|
set -- "${arg_vars[@]}"
|
102 |
|
while [[ ${@} ]]; do
|
103 |
|
local arg_var=${1}
|
104 |
|
shift
|
105 |
|
local a=${!arg_var}
|
106 |
|
|
107 |
|
case "${a}" in
|
108 |
|
--install-scripts=*)
|
109 |
|
scriptdir=${a#--install-scripts=}
|
110 |
|
unset "${arg_var}"
|
111 |
|
;;
|
112 |
|
--install-scripts)
|
113 |
|
scriptdir=${!1}
|
114 |
|
unset "${arg_var}" "${1}"
|
115 |
|
shift
|
116 |
|
;;
|
117 |
|
esac
|
118 |
|
done
|
119 |
|
fi
|
120 |
|
|
121 |
|
local root=${D%/}/_${EPYTHON}
|
122 |
|
[[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D%/}
|
|
65 |
# These seem to be essentially coverage tests
|
|
66 |
tests/test_checkprops.py
|
|
67 |
)
|
123 |
68 |
|
124 |
|
esetup.py install --root="${root}" "${args[@]}"
|
|
69 |
distutils_enable_tests pytest
|
125 |
70 |
|
126 |
|
local forbidden_package_names=( examples test tests .pytest_cache )
|
127 |
|
local p
|
128 |
|
for p in "${forbidden_package_names[@]}"; do
|
129 |
|
if [[ -d ${root}$(python_get_sitedir)/${p} ]]; then
|
130 |
|
die "Package installs '${p}' package which is forbidden and likely a bug in the build system."
|
131 |
|
fi
|
132 |
|
done
|
133 |
|
|
134 |
|
local shopt_save=$(shopt -p nullglob)
|
135 |
|
shopt -s nullglob
|
136 |
|
local pypy_dirs=(
|
137 |
|
"${root}/usr/$(get_libdir)"/pypy*/share
|
138 |
|
"${root}/usr/lib"/pypy*/share
|
139 |
|
)
|
140 |
|
${shopt_save}
|
|
71 |
python_configure() {
|
|
72 |
esetup.py configure --default-graphics=spice
|
|
73 |
}
|
141 |
74 |
|
142 |
|
if [[ -n ${pypy_dirs} ]]; then
|
143 |
|
die "Package installs 'share' in PyPy prefix, see bug #465546."
|
144 |
|
fi
|
|
75 |
python_test() {
|
|
76 |
export VIRTINST_TEST_SUITE_FORCE_LIBOSINFO=0
|
145 |
77 |
|
146 |
|
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
|
147 |
|
_distutils-r1_wrap_scripts "${root}" "${scriptdir}"
|
148 |
|
multibuild_merge_root "${root}" "${D%/}"
|
149 |
|
fi
|
|
78 |
epytest
|
150 |
79 |
}
|
151 |
80 |
|
152 |
|
src_install() {
|
153 |
|
local mydistutilsargs=( --no-update-icon-cache --no-compile-schemas )
|
154 |
|
virtmanager_python_install
|
155 |
|
|
156 |
|
python_fix_shebang "${ED}"/usr/share/virt-manager
|
|
81 |
python_install() {
|
|
82 |
esetup.py install
|
157 |
83 |
}
|
158 |
84 |
|
159 |
85 |
pkg_preinst() {
|
160 |
|
if use gtk; then
|
|
86 |
if use gui ; then
|
161 |
87 |
gnome2_pkg_preinst
|
162 |
88 |
|
163 |
|
cd "${ED}"
|
164 |
|
export GNOME2_ECLASS_ICONS=$(find 'usr/share/virt-manager/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
|
|
89 |
cd "${ED}" || die
|
|
90 |
export GNOME2_ECLASS_ICONS=$(find 'usr/share/virt-manager/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null || die)
|
165 |
91 |
else
|
166 |
|
rm -rf "${ED}/usr/share/virt-manager/virtManager"
|
167 |
|
rm -f "${ED}/usr/share/virt-manager/virt-manager"
|
168 |
|
rm -rf "${ED}/usr/share/virt-manager/ui/"
|
169 |
|
rm -rf "${ED}/usr/share/virt-manager/icons/"
|
170 |
|
rm -rf "${ED}/usr/share/man/man1/virt-manager.1*"
|
171 |
|
rm -rf "${ED}/usr/share/icons/"
|
172 |
|
rm -rf "${ED}/usr/share/applications/virt-manager.desktop"
|
173 |
|
rm -rf "${ED}/usr/bin/virt-manager"
|
|
92 |
rm -r "${ED}/usr/share/virt-manager/ui/" || die
|
|
93 |
rm -r "${ED}/usr/share/virt-manager/icons/" || die
|
|
94 |
rm -r "${ED}/usr/share/icons/" || die
|
|
95 |
rm -r "${ED}/usr/share/applications/virt-manager.desktop" || die
|
|
96 |
rm -r "${ED}/usr/bin/virt-manager" || die
|
174 |
97 |
fi
|
175 |
98 |
}
|
176 |
99 |
|
177 |
100 |
pkg_postinst() {
|
178 |
|
use gtk && gnome2_pkg_postinst
|
|
101 |
use gui && gnome2_pkg_postinst
|
|
102 |
|
|
103 |
optfeature "SSH_ASKPASS program implementation" lxqt-base/lxqt-openssh-askpass net-misc/ssh-askpass-fullscreen net-misc/x11-ssh-askpass
|
|
104 |
optfeature "QEMU host support" app-emulation/qemu[usbredir,spice]
|
|
105 |
optfeature "virt-install --location ISO support" dev-libs/libisoburn
|
179 |
106 |
}
|