1 |
commit: 83c7cf6db1a8db6ef050c0d31cd06e2c7d25d252 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 3 06:41:04 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 3 07:41:20 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83c7cf6d |
7 |
|
8 |
sys-fs/mdadm: various build fixes |
9 |
|
10 |
- Fix udev automagic dependency (add USE=udev); |
11 |
|
12 |
- ... and fix building without udev too. |
13 |
|
14 |
- Add patch to fix static linking against udev (only option is |
15 |
sys-fs/eudev though, as we dropped static-libs from sys-fs/udev |
16 |
and sys-apps/systemd due to issues like this and upstream not |
17 |
supporting it). |
18 |
|
19 |
Thanks-to: Hank Leininger <hlein <AT> korelogic.com> (static linking patch) |
20 |
Thanks-to: Krzysztof Olędzki <ole+gentoo <AT> ans.pl> (udev report/fix) |
21 |
Closes: https://bugs.gentoo.org/830461 |
22 |
Closes: https://bugs.gentoo.org/830485 |
23 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
24 |
|
25 |
.../files/mdadm-4.2-in_initrd-collision.patch | 36 +++++++ |
26 |
sys-fs/mdadm/mdadm-4.2-r1.ebuild | 105 +++++++++++++++++++++ |
27 |
2 files changed, 141 insertions(+) |
28 |
|
29 |
diff --git a/sys-fs/mdadm/files/mdadm-4.2-in_initrd-collision.patch b/sys-fs/mdadm/files/mdadm-4.2-in_initrd-collision.patch |
30 |
new file mode 100644 |
31 |
index 000000000000..689e7d698788 |
32 |
--- /dev/null |
33 |
+++ b/sys-fs/mdadm/files/mdadm-4.2-in_initrd-collision.patch |
34 |
@@ -0,0 +1,36 @@ |
35 |
+Fix collision with libudev symbols when statically linking. |
36 |
+ |
37 |
+https://bugs.gentoo.org/830485 |
38 |
+--- a/mdadm.h |
39 |
++++ b/mdadm.h |
40 |
+@@ -1665,7 +1665,7 @@ |
41 |
+ extern void udev_block(char *devnm); |
42 |
+ extern void udev_unblock(void); |
43 |
+ |
44 |
+-extern int in_initrd(void); |
45 |
++extern int mdadm_in_initrd(void); |
46 |
+ |
47 |
+ struct cmap_hooks { |
48 |
+ void *cmap_handle; /* corosync lib related */ |
49 |
+--- a/mdmon.c |
50 |
++++ b/mdmon.c |
51 |
+@@ -309,7 +309,7 @@ |
52 |
+ {NULL, 0, NULL, 0} |
53 |
+ }; |
54 |
+ |
55 |
+- if (in_initrd()) { |
56 |
++ if (mdadm_in_initrd()) { |
57 |
+ /* |
58 |
+ * set first char of argv[0] to @. This is used by |
59 |
+ * systemd to signal that the task was launched from |
60 |
+--- a/util.c |
61 |
++++ b/util.c |
62 |
+@@ -2219,7 +2219,7 @@ |
63 |
+ return 0; |
64 |
+ } |
65 |
+ |
66 |
+-int in_initrd(void) |
67 |
++int mdadm_in_initrd(void) |
68 |
+ { |
69 |
+ /* This is based on similar function in systemd. */ |
70 |
+ struct statfs s; |
71 |
|
72 |
diff --git a/sys-fs/mdadm/mdadm-4.2-r1.ebuild b/sys-fs/mdadm/mdadm-4.2-r1.ebuild |
73 |
new file mode 100644 |
74 |
index 000000000000..0a79356c4210 |
75 |
--- /dev/null |
76 |
+++ b/sys-fs/mdadm/mdadm-4.2-r1.ebuild |
77 |
@@ -0,0 +1,105 @@ |
78 |
+# Copyright 1999-2022 Gentoo Authors |
79 |
+# Distributed under the terms of the GNU General Public License v2 |
80 |
+ |
81 |
+EAPI=7 |
82 |
+ |
83 |
+inherit flag-o-matic systemd toolchain-funcs udev |
84 |
+ |
85 |
+DESCRIPTION="Tool for running RAID systems - replacement for the raidtools" |
86 |
+HOMEPAGE="https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/" |
87 |
+DEB_PF="4.2~rc2-7" |
88 |
+SRC_URI="https://www.kernel.org/pub/linux/utils/raid/mdadm/${P/_/-}.tar.xz |
89 |
+ mirror://debian/pool/main/m/mdadm/${PN}_${DEB_PF}.debian.tar.xz" |
90 |
+ |
91 |
+LICENSE="GPL-2" |
92 |
+SLOT="0" |
93 |
+[[ "${PV}" = *_rc* ]] || \ |
94 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" |
95 |
+IUSE="static +udev" |
96 |
+ |
97 |
+BDEPEND="app-arch/xz-utils |
98 |
+ virtual/pkgconfig" |
99 |
+DEPEND="udev? ( |
100 |
+ static? ( sys-fs/eudev[static-libs] ) |
101 |
+ !static? ( virtual/libudev:= ) |
102 |
+ )" |
103 |
+RDEPEND=">=sys-apps/util-linux-2.16 |
104 |
+ udev? ( !static? ( virtual/libudev:= ) )" |
105 |
+DEPEND="${RDEPEND}" |
106 |
+ |
107 |
+# The tests edit values in /proc and run tests on software raid devices. |
108 |
+# Thus, they shouldn't be run on systems with active software RAID devices. |
109 |
+RESTRICT="test" |
110 |
+ |
111 |
+PATCHES=( |
112 |
+ "${FILESDIR}/${PN}"-3.4-sysmacros.patch #580188 |
113 |
+ "${FILESDIR}/${PN}"-4.2-in_initrd-collision.patch #830461 |
114 |
+) |
115 |
+ |
116 |
+mdadm_emake() { |
117 |
+ # We should probably make corosync & libdlm into USE flags. #573782 |
118 |
+ local args=( |
119 |
+ PKG_CONFIG="$(tc-getPKG_CONFIG)" |
120 |
+ CC="$(tc-getCC)" |
121 |
+ CWFLAGS="-Wall" |
122 |
+ CXFLAGS="${CFLAGS}" |
123 |
+ UDEVDIR="$(get_udevdir)" |
124 |
+ SYSTEMD_DIR="$(systemd_get_systemunitdir)" |
125 |
+ COROSYNC="-DNO_COROSYNC" |
126 |
+ DLM="-DNO_DLM" |
127 |
+ |
128 |
+ # https://bugs.gentoo.org/732276 |
129 |
+ STRIP= |
130 |
+ |
131 |
+ "$@" |
132 |
+ ) |
133 |
+ emake "${args[@]}" |
134 |
+} |
135 |
+ |
136 |
+src_compile() { |
137 |
+ use static && append-ldflags -static |
138 |
+ |
139 |
+ # CPPFLAGS won't work for this |
140 |
+ use udev || append-cflags -DNO_LIBUDEV |
141 |
+ |
142 |
+ mdadm_emake all |
143 |
+} |
144 |
+ |
145 |
+src_test() { |
146 |
+ mdadm_emake test |
147 |
+ |
148 |
+ sh ./test || die |
149 |
+} |
150 |
+ |
151 |
+src_install() { |
152 |
+ mdadm_emake DESTDIR="${D}" install install-systemd |
153 |
+ dodoc ChangeLog INSTALL TODO README* ANNOUNCE-* |
154 |
+ |
155 |
+ insinto /etc |
156 |
+ newins mdadm.conf-example mdadm.conf |
157 |
+ newinitd "${FILESDIR}"/mdadm.rc mdadm |
158 |
+ newconfd "${FILESDIR}"/mdadm.confd mdadm |
159 |
+ newinitd "${FILESDIR}"/mdraid.rc mdraid |
160 |
+ newconfd "${FILESDIR}"/mdraid.confd mdraid |
161 |
+ |
162 |
+ # From the Debian patchset |
163 |
+ into /usr |
164 |
+ dodoc "${WORKDIR}"/debian/README.checkarray |
165 |
+ dosbin "${WORKDIR}"/debian/checkarray |
166 |
+ insinto /etc/default |
167 |
+ newins "${FILESDIR}"/etc-default-mdadm mdadm |
168 |
+ |
169 |
+ exeinto /etc/cron.weekly |
170 |
+ newexe "${FILESDIR}"/mdadm.weekly mdadm |
171 |
+} |
172 |
+ |
173 |
+pkg_postinst() { |
174 |
+ if ! systemd_is_booted; then |
175 |
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then |
176 |
+ # Only inform people the first time they install. |
177 |
+ elog "If you're not relying on kernel auto-detect of your RAID" |
178 |
+ elog "devices, you need to add 'mdraid' to your 'boot' runlevel:" |
179 |
+ elog " rc-update add mdraid boot" |
180 |
+ fi |
181 |
+ fi |
182 |
+} |