Diff gpsd-3.25 with a gpsd-9999

/usr/portage/sci-geosciences/gpsd/gpsd-9999.ebuild 2024-12-25 14:59:52.703270181 +0300
4 4
EAPI=8
5 5

  
6 6
DISTUTILS_OPTIONAL=1
7
PYTHON_COMPAT=( python3_{10..11} )
7
DISTUTILS_USE_PEP517=setuptools
8
PYTHON_COMPAT=( python3_{10..12} )
8 9
SCONS_MIN_VERSION="2.3.0"
9 10

  
10 11
inherit distutils-r1 scons-utils systemd toolchain-funcs udev
......
14 15
	inherit git-r3
15 16
else
16 17
	SRC_URI="mirror://nongnu/${PN}/${P}.tar.xz"
17
	KEYWORDS="amd64 arm ~arm64 ~loong ~ppc ppc64 ~riscv ~sparc ~x86"
18
	KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
18 19
fi
19 20

  
20 21
DESCRIPTION="GPS daemon and library for USB/serial GPS devices and GPS/mapping clients"
......
25 26

  
26 27
GPSD_PROTOCOLS=(
27 28
	aivdm ashtech earthmate evermore fury fv18 garmin garmintxt geostar
28
	gpsclock greis isync itrax navcom nmea2000 oceanserver oncore
29
	rtcm104v2 rtcm104v3 sirf skytraq superstar2 tnt tripmate tsip ublox
29
	gpsclock greis isync itrax navcom nmea2000 oncore
30
	sirf skytraq superstar2 tnt tripmate tsip
30 31
)
31 32
IUSE_GPSD_PROTOCOLS=${GPSD_PROTOCOLS[@]/#/+gpsd_protocols_}
32
IUSE="${IUSE_GPSD_PROTOCOLS} bluetooth +cxx dbus debug ipv6 latency-timing ncurses ntp +python qt5 selinux +shm +sockets static systemd test udev usb X"
33
IUSE="${IUSE_GPSD_PROTOCOLS} bluetooth +cxx dbus debug ipv6 latency-timing ncurses ntp qt5 selinux +shm static systemd test udev usb X"
33 34
REQUIRED_USE="
34
	X? ( python )
35 35
	gpsd_protocols_nmea2000? ( gpsd_protocols_aivdm )
36
	gpsd_protocols_isync? ( gpsd_protocols_ublox )
37
	gpsd_protocols_ublox? ( python )
38
	gpsd_protocols_greis? ( python )
39
	python? ( ${PYTHON_REQUIRED_USE} )
36
	${PYTHON_REQUIRED_USE}
40 37
	qt5? ( cxx )
41 38
"
42 39
RESTRICT="!test? ( test )"
......
60 57
		dev-qt/qtcore:5
61 58
		dev-qt/qtnetwork:5
62 59
	)
63
	python? ( ${PYTHON_DEPS} )
64
	gpsd_protocols_ublox? ( dev-python/pyserial )
65
	gpsd_protocols_greis? ( dev-python/pyserial )
60
	${PYTHON_DEPS}
61
	dev-python/pyserial[${PYTHON_USEDEP}]
66 62
	usb? ( virtual/libusb:1 )
67 63
	X? ( dev-python/pygobject:3[cairo,${PYTHON_USEDEP}] )"
68 64
DEPEND="${RDEPEND}"
69 65
BDEPEND="virtual/pkgconfig
70 66
	$(python_gen_any_dep 'dev-build/scons[${PYTHON_USEDEP}]')
67
	${DISTUTILS_DEPS}
71 68
	test? ( app-alternatives/bc )"
72 69
RDEPEND+=" selinux? ( sec-policy/selinux-gpsd )"
73 70

  
......
77 74
fi
78 75

  
79 76
python_check_deps() {
80
	has_version -b "dev-build/scons[${PYTHON_USEDEP}]" || return 1
77
	python_has_version -b "dev-build/scons[${PYTHON_USEDEP}]" || return 1
81 78
}
82 79

  
83 80
src_prepare() {
84 81
	# Make sure our list matches the source.
85 82
	local src_protocols=$(echo $(
86
		sed -n '/# GPS protocols/,/# Time service/{s:#.*::;s:[(",]::g;p}' "${S}"/SConscript | awk '{print $1}' | LC_ALL=C sort
83
		sed -n '/# GPS protocols/,/# Time service/{s:#.*::;s:[(",]::g;p}' \
84
		 "${S}"/SConscript | awk '{print $1}' | LC_ALL=C sort
87 85
	) )
88 86

  
89 87
	if [[ ${src_protocols} != ${GPSD_PROTOCOLS[*]} ]] ; then
......
97 95

  
98 96
	default
99 97

  
100
	use python && distutils-r1_src_prepare
98
	distutils-r1_src_prepare
101 99
}
102 100

  
103 101
python_prepare_all() {
......
113 111
		print(list(set(python_progs) - {'xgps', 'xgpsspeed', 'ubxtool', 'zerk'}))" || die "Unable to list pybins")
114 112
	# Handle conditional tools manually. #666734
115 113
	use X && pybins+="+ ['xgps', 'xgpsspeed']"
116
	use gpsd_protocols_ublox && pybins+="+ ['ubxtool']"
114
	pybins+="+ ['ubxtool']"
117 115
	use gpsd_protocols_greis && pybins+="+ ['zerk']"
118 116
	local pysrcs=$(pyarray packet_ffi_extension)
119 117
	local packet=$("${PYTHON}" -c "${pysrcs}; print(packet_ffi_extension)" || die "Unable to extract packet types")
......
137 135
		-e "s|@SUPPORT@|https://gpsd.io/SUPPORT.html|" \
138 136
		-e "s|@WEBSITE@|https://gpsd.io/|" \
139 137
		"${S}"/packaging/gpsd-setup.py.in > setup.py || die
138

  
139
	if [[ "${PV}" == *9999* ]]; then
140
		# Distutils doesn't like the tilde
141
		sed -i s/~dev/-dev/ setup.py || die
142
	fi
143

  
140 144
	distutils-r1_python_prepare_all
141 145
}
142 146

  
......
162 166
		ncurses=$(usex ncurses)
163 167
		ntpshm=$(usex ntp)
164 168
		pps=$(usex ntp)
165
		python=$(usex python)
166 169
		# force a predictable python libdir because lib vs. lib64 usage differs
167 170
		# from 3.5 to 3.6+
168
		$(usex python python_libdir="${EPREFIX}"/python-discard "")
171
		python_libdir="${EPREFIX}"/python-discard
169 172
		qt=$(usex qt5)
170 173
		shm_export=$(usex shm)
171
		socket_export=$(usex sockets)
174
		socket_export=True # Required, see bug #900891
172 175
		usb=$(usex usb)
173 176
	)
174 177

  
......
195 198
	export SHLINKFLAGS=${LDFLAGS} LINKFLAGS=${LDFLAGS}
196 199
	escons "${scons_opts[@]}"
197 200

  
198
	pushd "${P}" || die
201
	pushd "${PN}"-* || die
199 202
	ln -sf ../setup.py . || die
200
	use python && distutils-r1_src_compile
203
	distutils-r1_src_compile
201 204
	popd || die
202 205
}
203 206

  
......
210 213
	:;
211 214
}
212 215

  
216
python_install() {
217
	while read -d '' -r file ; do
218
		grep -q "#!/usr/bin/env python" "${file}" && python_doscript "${file}"
219
	done < <(find "${T}"/scripts -type f -print0)
220

  
221
	distutils-r1_python_install
222
}
223

  
213 224
src_install() {
214 225
	DESTDIR="${D}" escons install "${scons_opts[@]}" $(usev udev udev-install)
215 226

  
......
219 230
	# Cleanup bad alt copy due to Scons
220 231
	rm -rf "${D}"/python-discard/gps*
221 232
	find "${D}"/python-discard/ -type d -delete
233

  
222 234
	# Install correct multi-python copy
223
	pushd "${P}" || die
224
	use python && distutils-r1_src_install
235
	pushd "${PN}"-* || die
236
	mkdir -p "${T}/scripts" || die
237
	grep -Rl "${D}/usr/bin" -e "/usr/bin/env python" | xargs cp -t "${T}/scripts"
238
	assert "Moving Python scripts failed"
239
	distutils-r1_src_install
225 240
	popd || die
226 241
}
227 242

  
Thank you!