Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/eudev/files/, sys-fs/eudev/
Date: Mon, 01 May 2017 14:48:39
Message-Id: 1493649416.5e5a23d25855ad4b022e60e62430577784e712a5.blueness@gentoo
1 commit: 5e5a23d25855ad4b022e60e62430577784e712a5
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Mon May 1 14:36:56 2017 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Mon May 1 14:36:56 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e5a23d2
7
8 sys-fs/eudev: fix bug #616628
9
10 Package-Manager: Portage-2.3.3, Repoman-2.3.1
11
12 sys-fs/eudev/eudev-3.2.2-r1.ebuild | 244 ++++++++++++++++++++++++++
13 sys-fs/eudev/files/eudev-fix-disk-by-id.patch | 43 +++++
14 2 files changed, 287 insertions(+)
15
16 diff --git a/sys-fs/eudev/eudev-3.2.2-r1.ebuild b/sys-fs/eudev/eudev-3.2.2-r1.ebuild
17 new file mode 100644
18 index 00000000000..a2612d6b967
19 --- /dev/null
20 +++ b/sys-fs/eudev/eudev-3.2.2-r1.ebuild
21 @@ -0,0 +1,244 @@
22 +# Copyright 1999-2017 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI="6"
26 +
27 +KV_min=2.6.39
28 +
29 +inherit autotools eutils linux-info multilib multilib-minimal user
30 +
31 +if [[ ${PV} = 9999* ]]; then
32 + EGIT_REPO_URI="git://github.com/gentoo/eudev.git"
33 + inherit git-2
34 +else
35 + SRC_URI="https://dev.gentoo.org/~blueness/${PN}/${P}.tar.gz"
36 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
37 +fi
38 +
39 +DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
40 +HOMEPAGE="https://github.com/gentoo/eudev"
41 +
42 +LICENSE="LGPL-2.1 MIT GPL-2"
43 +SLOT="0"
44 +IUSE="+hwdb +kmod introspection rule-generator selinux static-libs test"
45 +
46 +COMMON_DEPEND=">=sys-apps/util-linux-2.20
47 + introspection? ( >=dev-libs/gobject-introspection-1.38 )
48 + kmod? ( >=sys-apps/kmod-16 )
49 + selinux? ( >=sys-libs/libselinux-2.1.9 )
50 + !<sys-libs/glibc-2.11
51 + !sys-apps/gentoo-systemd-integration
52 + !sys-apps/systemd
53 + abi_x86_32? (
54 + !<=app-emulation/emul-linux-x86-baselibs-20130224-r7
55 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
56 + )"
57 +DEPEND="${COMMON_DEPEND}
58 + dev-util/gperf
59 + virtual/os-headers
60 + virtual/pkgconfig
61 + >=sys-devel/make-3.82-r4
62 + >=sys-kernel/linux-headers-${KV_min}
63 + >=dev-util/intltool-0.50
64 + test? ( app-text/tree dev-lang/perl )"
65 +
66 +RDEPEND="${COMMON_DEPEND}
67 + !<sys-fs/lvm2-2.02.103
68 + !<sec-policy/selinux-base-2.20120725-r10
69 + !sys-fs/udev
70 + !sys-apps/systemd"
71 +
72 +PDEPEND=">=sys-fs/udev-init-scripts-26
73 + hwdb? ( >=sys-apps/hwids-20140304[udev] )"
74 +
75 +# The multilib-build.eclass doesn't handle situation where the installed headers
76 +# are different in ABIs. In this case, we install libgudev headers in native
77 +# ABI but not for non-native ABI.
78 +multilib_check_headers() { :; }
79 +
80 +pkg_pretend() {
81 + ewarn
82 + ewarn "As of 2013-01-29, ${P} provides the new interface renaming functionality,"
83 + ewarn "as described in the URL below:"
84 + ewarn "https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames"
85 + ewarn
86 + ewarn "This functionality is enabled BY DEFAULT because eudev has no means of synchronizing"
87 + ewarn "between the default or user-modified choice of sys-fs/udev. If you wish to disable"
88 + ewarn "this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules"
89 + ewarn "exists: touch /etc/udev/rules.d/80-net-name-slot.rules"
90 + ewarn
91 +}
92 +
93 +pkg_setup() {
94 + CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL ~FHANDLE ~NET ~UNIX"
95 + linux-info_pkg_setup
96 + get_running_version
97 +
98 + # These are required kernel options, but we don't error out on them
99 + # because you can build under one kernel and run under another.
100 + if kernel_is lt ${KV_min//./ }; then
101 + ewarn
102 + ewarn "Your current running kernel version ${KV_FULL} is too old to run ${P}."
103 + ewarn "Make sure to run udev under kernel version ${KV_min} or above."
104 + ewarn
105 + fi
106 +}
107 +
108 +src_prepare() {
109 + # change rules back to group uucp instead of dialout for now
110 + sed -e 's/GROUP="dialout"/GROUP="uucp"/' -i rules/*.rules \
111 + || die "failed to change group dialout to uucp"
112 +
113 + eapply "${FILESDIR}"/${PN}-fix-disk-by-id.patch
114 +
115 + eapply_user
116 + eautoreconf
117 +}
118 +
119 +multilib_src_configure() {
120 + tc-export CC #463846
121 + export cc_cv_CFLAGS__flto=no #502950
122 +
123 + # Keep sorted by ./configure --help and only pass --disable flags
124 + # when *required* to avoid external deps or unnecessary compile
125 + local econf_args
126 + econf_args=(
127 + ac_cv_search_cap_init=
128 + ac_cv_header_sys_capability_h=yes
129 + DBUS_CFLAGS=' '
130 + DBUS_LIBS=' '
131 + --with-rootprefix=
132 + --with-rootrundir=/run
133 + --libdir="${EPREFIX}"/usr/$(get_libdir)
134 + --with-rootlibexecdir="${EPREFIX}"/lib/udev
135 + --enable-split-usr
136 + --enable-manpages
137 + --disable-hwdb
138 + --exec-prefix="${EPREFIX}"
139 + )
140 +
141 + # Only build libudev for non-native_abi, and only install it to libdir,
142 + # that means all options only apply to native_abi
143 + if multilib_is_native_abi; then
144 + econf_args+=(
145 + --with-rootlibdir="${EPREFIX}"/$(get_libdir)
146 + $(use_enable introspection)
147 + $(use_enable kmod)
148 + $(use_enable static-libs static)
149 + $(use_enable selinux)
150 + $(use_enable rule-generator)
151 + )
152 + else
153 + econf_args+=(
154 + --disable-static
155 + --disable-introspection
156 + --disable-kmod
157 + --disable-selinux
158 + --disable-rule-generator
159 + )
160 + fi
161 + ECONF_SOURCE="${S}" econf "${econf_args[@]}"
162 +}
163 +
164 +multilib_src_compile() {
165 + if multilib_is_native_abi; then
166 + emake
167 + else
168 + emake -C src/shared
169 + emake -C src/libudev
170 + fi
171 +}
172 +
173 +multilib_src_install() {
174 + if multilib_is_native_abi; then
175 + emake DESTDIR="${D}" install
176 + else
177 + emake -C src/libudev DESTDIR="${D}" install
178 + fi
179 +}
180 +
181 +multilib_src_test() {
182 + # make sandbox get out of the way
183 + # these are safe because there is a fake root filesystem put in place,
184 + # but sandbox seems to evaluate the paths of the test i/o instead of the
185 + # paths of the actual i/o that results.
186 + # also only test for native abi
187 + if multilib_is_native_abi; then
188 + addread /sys
189 + addwrite /dev
190 + addwrite /run
191 + default_src_test
192 + fi
193 +}
194 +
195 +multilib_src_install_all() {
196 + prune_libtool_files --all
197 +
198 + insinto /lib/udev/rules.d
199 + doins "${FILESDIR}"/40-gentoo.rules
200 +
201 + use rule-generator && doinitd "${FILESDIR}"/udev-postmount
202 +}
203 +
204 +pkg_postinst() {
205 + mkdir -p "${EROOT}"run
206 +
207 + # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
208 + # So try to remove it here (will only work if empty).
209 + rmdir "${EROOT}"dev/loop 2>/dev/null
210 + if [[ -d ${EROOT}dev/loop ]]; then
211 + ewarn "Please make sure your remove /dev/loop,"
212 + ewarn "else losetup may be confused when looking for unused devices."
213 + fi
214 +
215 + # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
216 + # https://bugs.gentoo.org/246847
217 + # https://bugs.gentoo.org/514174
218 + enewgroup input
219 +
220 + # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
221 + # process it as a list. We only care about the zero case (new install) or the case where
222 + # the same version is being re-emerged. If there is a second version, allow it to abort.
223 + local rv rvres=doitnew
224 + for rv in ${REPLACING_VERSIONS} ; do
225 + if [[ ${rvres} == doit* ]]; then
226 + if [[ ${rv%-r*} == ${PV} ]]; then
227 + rvres=doit
228 + else
229 + rvres=${rv}
230 + fi
231 + fi
232 + done
233 +
234 + if use hwdb && has_version 'sys-apps/hwids[udev]'; then
235 + udevadm hwdb --update --root="${ROOT%/}"
236 +
237 + # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
238 + # reload database after it has be rebuilt, but only if we are not upgrading
239 + # also pass if we are -9999 since who knows what hwdb related changes there might be
240 + if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
241 + udevadm control --reload
242 + fi
243 + fi
244 + if [[ ${rvres} != doitnew ]]; then
245 + ewarn
246 + ewarn "You need to restart eudev as soon as possible to make the"
247 + ewarn "upgrade go into effect:"
248 + ewarn "\t/etc/init.d/udev --nodeps restart"
249 + fi
250 +
251 + if use rule-generator && \
252 + [[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
253 + ewarn
254 + ewarn "Please add the udev-postmount init script to your default runlevel"
255 + ewarn "to ensure the legacy rule-generator functionality works as reliably"
256 + ewarn "as possible."
257 + ewarn "\trc-update add udev-postmount default"
258 + fi
259 +
260 + elog
261 + elog "For more information on eudev on Gentoo, writing udev rules, and"
262 + elog "fixing known issues visit:"
263 + elog " https://www.gentoo.org/doc/en/udev-guide.xml"
264 + elog
265 +}
266
267 diff --git a/sys-fs/eudev/files/eudev-fix-disk-by-id.patch b/sys-fs/eudev/files/eudev-fix-disk-by-id.patch
268 new file mode 100644
269 index 00000000000..07bc0c518c6
270 --- /dev/null
271 +++ b/sys-fs/eudev/files/eudev-fix-disk-by-id.patch
272 @@ -0,0 +1,43 @@
273 +diff -ruN eudev-3.2.2-orig/rules/60-persistent-storage.rules eudev-3.2.2-new/rules/60-persistent-storage.rules
274 +--- eudev-3.2.2-orig/rules/60-persistent-storage.rules 2016-12-11 16:41:58.000000000 +0100
275 ++++ eudev-3.2.2-new/rules/60-persistent-storage.rules 2017-04-26 23:14:04.197109882 +0200
276 +@@ -83,6 +83,9 @@
277 + # by-id (World Wide Name)
278 + ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}"
279 + ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n"
280 ++#(Temporary) Compatibility rule for old broken WWNs in case some uses them:
281 ++ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION_REVERSED_DO_NOT_USE}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION_REVERSED_DO_NOT_USE}"
282 ++ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION_REVERSED_DO_NOT_USE}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION_REVERSED_DO_NOT_USE}-part%n"
283 +
284 + # by-partlabel/by-partuuid links (partition metadata)
285 + ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}"
286 +diff -ruN eudev-3.2.2-orig/src/ata_id/ata_id.c eudev-3.2.2-new/src/ata_id/ata_id.c
287 +--- eudev-3.2.2-orig/src/ata_id/ata_id.c 2016-11-17 22:14:19.000000000 +0100
288 ++++ eudev-3.2.2-new/src/ata_id/ata_id.c 2017-04-26 23:18:51.116127146 +0200
289 +@@ -645,10 +645,22 @@
290 + * All other values are reserved.
291 + */
292 + word = identify.wyde[108];
293 +- if ((word & 0xf000) == 0x5000)
294 +- printf("ID_WWN=0x%1$"PRIu64"x\n"
295 +- "ID_WWN_WITH_EXTENSION=0x%1$"PRIu64"x\n",
296 +- identify.octa[108/4]);
297 ++ if ((word & 0xf000) == 0x5000){
298 ++ uint64_t wwn;
299 ++
300 ++ wwn = identify.wyde[108];
301 ++ wwn <<= 16;
302 ++ wwn |= identify.wyde[109];
303 ++ wwn <<= 16;
304 ++ wwn |= identify.wyde[110];
305 ++ wwn <<= 16;
306 ++ wwn |= identify.wyde[111]; /* Could possibly done nicer ? */
307 ++ printf("ID_WWN=0x%1$" PRIx64 "\n"
308 ++ "ID_WWN_WITH_EXTENSION=0x%1$" PRIx64 "\n",
309 ++ wwn);
310 ++ printf("ID_WWN_WITH_EXTENSION_REVERSED_DO_NOT_USE=0x%" PRIu64 "x\n",
311 ++ identify.octa[108/4]);
312 ++ }
313 +
314 + /* from Linux's include/linux/ata.h */
315 + if (identify.wyde[0] == 0x848a ||