Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/lvm2/, sys-fs/lvm2/files/
Date: Thu, 28 Nov 2019 22:45:24
Message-Id: 1574981075.0a7dcaff7c920619ffce4c0195223cbd9db02411.robbat2@gentoo
1 commit: 0a7dcaff7c920619ffce4c0195223cbd9db02411
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 28 22:43:05 2019 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 28 22:44:35 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a7dcaff
7
8 sys-fs/lvm2: partial revert of 2161b3a104c9a5664131b9297766db0538e7464e
9
10 Bug 690494 shows that the regression is still not fixed in 2.02.186-r2,
11 so 2.02.145-r2 is still required for some users.
12
13 Bug: https://bugs.gentoo.org/show_bug.cgi?id=690494
14 Package-Manager: Portage-2.3.79, Repoman-2.3.18
15 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
16
17 sys-fs/lvm2/Manifest | 3 +
18 .../lvm2-2.02.129-static-pkgconfig-libs.patch | 102 +++++++++
19 .../files/lvm2-2.02.130-pthread-pkgconfig.patch | 32 +++
20 .../lvm2-2.02.139-dynamic-static-ldflags.patch | 63 +++++
21 sys-fs/lvm2/files/lvm2-2.02.145-mkdev.patch | 127 +++++++++++
22 sys-fs/lvm2/lvm2-2.02.145-r2.ebuild | 254 +++++++++++++++++++++
23 6 files changed, 581 insertions(+)
24
25 diff --git a/sys-fs/lvm2/Manifest b/sys-fs/lvm2/Manifest
26 index 701f9bc11eb..9b72fb0647e 100644
27 --- a/sys-fs/lvm2/Manifest
28 +++ b/sys-fs/lvm2/Manifest
29 @@ -1,4 +1,7 @@
30 DIST LVM2.2.02.116.tgz 1538340 BLAKE2B 718261b60626f2eca5ba13011646bf551523ed8e59aaceceb9097221c000268b7533ac43151ff1d9229911d87e764fbdb29ffa1d305f2aae99220a68e301559a SHA512 992541339637d597257850b4ff7f5348fb7cdcccf806ac8d986a3be1ad1edc5f6bfaedeed5128690c541d1a485cdc75742e90a766363c39867901003518fb84d
31 +DIST LVM2.2.02.145.tgz 1986370 BLAKE2B 0c9e5efae17f26ff86152cecbf0b11a74e85007b2fa9491f44dec03ac8c11375bacf6685213b4be19037c8fbf70e13549516716ecf8fa262919a44625e6aab34 SHA512 84e28b3efc940837ea9da70fce620744aea0945ba29383b76ad7bcd4b5259b897c714162a8e8b7cfe26ae736a3ad2eca633a3e0df4d6280a32b28bd4cf472d27
32 +DIST LVM2.2.02.183.tgz 2380574 BLAKE2B b1fe71b6cdb8ee20dd53d0ad3399c553487baafa12657ec81a794c84ad161988afdb8693ac247877a2645d693a0740c74c8b991047ed2ba4adc9ec75f1c261a9 SHA512 3947523c6b0862ada40677ed171ed0cf95e070119e377296fc5ccb153e9c4212d34c0b16a887dbd68ccf265525345dabfed2aa59fb3604555429a7e2ecfff4d7
33 DIST LVM2.2.02.184.tgz 2383698 BLAKE2B b6e308d76d541b9461dfcc6e82db256a175ccdabfae9c9d57d84eabd0d5ea50e3e09954b34741903e027412c2c26f72a5005fe934261576337a810738139deb8 SHA512 9db74f675e7c58f663a39afb79b6f33a33ad2cfbda63e9783ef5027f33977b4a1262a2e6754aa67c586eed083ee119a2e837c32a7746dcc53f13877c9d65c390
34 +DIST LVM2.2.02.185.tgz 2386328 BLAKE2B d2e31de3eedd7518ea2d239cb9b36b38e351d7fc070097a1fc4e7934e3636195da3247fba57d684bb0b31b7f3dbdfe29161bd121b2962b2c35c8c9d7914b4506 SHA512 f421505551aec2a09bc862f2fcc1ee825bc4d94c53a01d13265631e99308d60fbca40112be5bc7824cce3ef223c0775d2f6c345f6a3f227229a0566c903841bf
35 DIST LVM2.2.02.186.tgz 2389759 BLAKE2B e094c0135d455386ea5789208899d4dbdd5e78bebf52e49ab5587f881fbc2b94c6accecacf1b4ed182b0c87046402c00a47a1b724795a94fe3ec998b580a77ae SHA512 06a1c00142ee41d8a576a5e06a5beae70baced3020e753ce3b612355cc4d9e33be4acf58569d49436c4ee1118d288d884c7301b7d886074eaf9f2fa6b0248c03
36 DIST LVM2.2.03.06.tgz 2453672 BLAKE2B 3d39bef4915ddb15c51011c131afcd2735723fc3e880e01fb863d82ccac0c34b7d71f6a3a126c6bb53fbf2dd923ccf0443e4e02a492fc0660ee1ef168dbb0e79 SHA512 2a01d34fa58348b0fac3d40a9ce736aa499af18c7e9bf96a3eeefc6a2de6a73460c83b6c67be20e9bd440998cbf847bc3e7a028385f38d715e221a5a857d391f
37
38 diff --git a/sys-fs/lvm2/files/lvm2-2.02.129-static-pkgconfig-libs.patch b/sys-fs/lvm2/files/lvm2-2.02.129-static-pkgconfig-libs.patch
39 new file mode 100644
40 index 00000000000..239694523b3
41 --- /dev/null
42 +++ b/sys-fs/lvm2/files/lvm2-2.02.129-static-pkgconfig-libs.patch
43 @@ -0,0 +1,102 @@
44 +--- LVM2.2.02.129/configure.in
45 ++++ LVM2.2.02.129/configure.in
46 +@@ -1287,6 +1287,7 @@
47 + fi])
48 + if test "$BLKID_WIPING" = yes; then
49 + BLKID_PC="blkid"
50 ++ BLKID_STATIC_LIBS=`$PKG_CONFIG --static --libs $BLKID_PC`
51 + DEFAULT_USE_BLKID_WIPING=1
52 + AC_DEFINE([BLKID_WIPING_SUPPORT], 1, [Define to 1 to use libblkid detection of signatures when wiping.])
53 + else
54 +@@ -1332,6 +1333,7 @@
55 + if test "$UDEV_SYNC" = yes; then
56 + pkg_config_init
57 + PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"])
58 ++ UDEV_STATIC_LIBS=`$PKG_CONFIG --static --libs libudev`
59 + AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.])
60 + fi
61 +
62 +@@ -1558,19 +1560,32 @@
63 + if test "$SELINUX" = yes; then
64 + AC_CHECK_LIB([sepol], [sepol_check_context], [
65 + AC_DEFINE([HAVE_SEPOL], 1, [Define to 1 if sepol_check_context is available.])
66 +- SELINUX_LIBS="-lsepol"])
67 ++ SEPOL_LIBS="-lsepol"])
68 ++
69 ++ dnl -- init pkgconfig if required
70 ++ if test x$PKGCONFIG_INIT != x1; then
71 ++ pkg_config_init
72 ++ fi
73 ++ PKG_CHECK_MODULES(SELINUX, libselinux, [
74 ++ SELINUX_PC="libselinux"
75 ++ SELINUX_STATIC_LIBS=`$PKG_CONFIG --static --libs libselinux`
76 ++ SELINUX_LIBS="$SELINUX_LIBS $SEPOL_LIBS"
77 ++ AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
78 ++ ],[
79 ++ dnl -- old non-pkgconfig method, is buggy with static builds
80 +
81 + AC_CHECK_LIB([selinux], [is_selinux_enabled], [
82 + AC_CHECK_HEADERS([selinux/selinux.h],, hard_bailout)
83 + AC_CHECK_HEADERS([selinux/label.h])
84 + AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
85 +- SELINUX_LIBS="-lselinux $SELINUX_LIBS"
86 ++ SELINUX_LIBS="-lselinux $SEPOL_LIBS"
87 + SELINUX_PC="libselinux"
88 + HAVE_SELINUX=yes ], [
89 + AC_MSG_WARN(Disabling selinux)
90 + SELINUX_LIBS=
91 + SELINUX_PC=
92 + HAVE_SELINUX=no ])
93 ++ ])
94 + fi
95 +
96 + ################################################################################
97 +@@ -1902,6 +1917,7 @@
98 + ################################################################################
99 + AC_SUBST(APPLIB)
100 + AC_SUBST(AWK)
101 ++AC_SUBST(BLKID_STATIC_LIBS)
102 + AC_SUBST(BLKID_PC)
103 + AC_SUBST(BUILD_CMIRRORD)
104 + AC_SUBST(BUILD_DMEVENTD)
105 +@@ -2005,6 +2021,7 @@
106 + AC_SUBST(SALCK_CFLAGS)
107 + AC_SUBST(SALCK_LIBS)
108 + AC_SUBST(SELINUX_LIBS)
109 ++AC_SUBST(SELINUX_STATIC_LIBS)
110 + AC_SUBST(SELINUX_PC)
111 + AC_SUBST(SNAPSHOTS)
112 + AC_SUBST(STATICDIR)
113 +@@ -2020,6 +2037,7 @@
114 + AC_SUBST(CACHE_DUMP_CMD)
115 + AC_SUBST(CACHE_REPAIR_CMD)
116 + AC_SUBST(CACHE_RESTORE_CMD)
117 ++AC_SUBST(UDEV_STATIC_LIBS)
118 + AC_SUBST(UDEV_PC)
119 + AC_SUBST(UDEV_RULES)
120 + AC_SUBST(UDEV_SYNC)
121 +--- LVM2.2.02.129/make.tmpl.in
122 ++++ LVM2.2.02.129/make.tmpl.in
123 +@@ -43,7 +43,7 @@
124 +
125 + LIBS = @LIBS@
126 + # Extra libraries always linked with static binaries
127 +-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
128 ++STATIC_LIBS = $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS)
129 + DEFS += @DEFS@
130 + # FIXME set this only where it's needed, not globally?
131 + CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
132 +@@ -58,10 +58,13 @@
133 + PTHREAD_LIBS = @PTHREAD_LIBS@
134 + READLINE_LIBS = @READLINE_LIBS@
135 + SELINUX_LIBS = @SELINUX_LIBS@
136 ++SELINUX_STATIC_LIBS = @SELINUX_STATIC_LIBS@
137 + UDEV_CFLAGS = @UDEV_CFLAGS@
138 + UDEV_LIBS = @UDEV_LIBS@
139 ++UDEV_STATIC_LIBS = @UDEV_STATIC_LIBS@
140 + BLKID_CFLAGS = @BLKID_CFLAGS@
141 + BLKID_LIBS = @BLKID_LIBS@
142 ++BLKID_STATIC_LIBS = @BLKID_STATIC_LIBS@
143 + VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
144 + TESTING = @TESTING@
145 +
146
147 diff --git a/sys-fs/lvm2/files/lvm2-2.02.130-pthread-pkgconfig.patch b/sys-fs/lvm2/files/lvm2-2.02.130-pthread-pkgconfig.patch
148 new file mode 100644
149 index 00000000000..11db632e2e7
150 --- /dev/null
151 +++ b/sys-fs/lvm2/files/lvm2-2.02.130-pthread-pkgconfig.patch
152 @@ -0,0 +1,32 @@
153 +Make sure that libdm usage always brings in pthread libraries, both in
154 +pkgconfig and during manual build.
155 +
156 +--- LVM2.2.02.130/libdm/libdevmapper.pc.in
157 ++++ LVM2.2.02.130/libdm/libdevmapper.pc.in
158 +@@ -9,4 +9,4 @@
159 + Cflags: -I${includedir}
160 + Libs: -L${libdir} -ldevmapper
161 + Requires.private: @SELINUX_PC@ @UDEV_PC@
162 +-Libs.private: -lm @RT_LIB@
163 ++Libs.private: -lm @RT_LIB@ @PTHREAD_LIBS@
164 +--- LVM2.2.02.130/tools/Makefile.in
165 ++++ LVM2.2.02.130/tools/Makefile.in
166 +@@ -90,6 +90,7 @@
167 + INSTALL_LVM_TARGETS += install_tools_static
168 + INSTALL_DMSETUP_TARGETS += install_dmsetup_static
169 + INSTALL_CMDLIB_TARGETS += install_cmdlib_static
170 ++ STATIC_LIBS += @PTHREAD_LIBS@
171 + endif
172 +
173 + LVMLIBS = $(LVMINTERNAL_LIBS)
174 +@@ -120,6 +121,10 @@
175 +
176 + include $(top_builddir)/make.tmpl
177 +
178 ++ifeq ("@STATIC_LINK@", "yes")
179 ++ STATIC_LIBS += @PTHREAD_LIBS@
180 ++endif
181 ++
182 + device-mapper: $(TARGETS_DM)
183 +
184 + CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)
185
186 diff --git a/sys-fs/lvm2/files/lvm2-2.02.139-dynamic-static-ldflags.patch b/sys-fs/lvm2/files/lvm2-2.02.139-dynamic-static-ldflags.patch
187 new file mode 100644
188 index 00000000000..312e546e240
189 --- /dev/null
190 +++ b/sys-fs/lvm2/files/lvm2-2.02.139-dynamic-static-ldflags.patch
191 @@ -0,0 +1,63 @@
192 +diff -ur LVM2.2.02.139_O/configure.in LVM2.2.02.139/configure.in
193 +--- LVM2.2.02.139_O/configure.in 2016-01-19 12:54:33.155187005 +0000
194 ++++ LVM2.2.02.139/configure.in 2016-01-19 12:56:39.487181372 +0000
195 +@@ -31,6 +31,7 @@
196 + linux*)
197 + CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
198 + ELDFLAGS="-Wl,--export-dynamic"
199 ++ STATIC_LDFLAGS="-Wl,--no-export-dynamic"
200 + # FIXME Generate list and use --dynamic-list=.dlopen.sym
201 + CLDWHOLEARCHIVE="-Wl,-whole-archive"
202 + CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
203 +@@ -2009,6 +2010,7 @@
204 + AC_SUBST(SELINUX_PC)
205 + AC_SUBST(SNAPSHOTS)
206 + AC_SUBST(STATICDIR)
207 ++AC_SUBST(STATIC_LDFLAGS)
208 + AC_SUBST(STATIC_LINK)
209 + AC_SUBST(TESTING)
210 + AC_SUBST(TESTSUITE_DATA)
211 +diff -ur LVM2.2.02.139_O/daemons/dmeventd/Makefile.in LVM2.2.02.139/daemons/dmeventd/Makefile.in
212 +--- LVM2.2.02.139_O/daemons/dmeventd/Makefile.in 2016-01-19 12:54:33.278186999 +0000
213 ++++ LVM2.2.02.139/daemons/dmeventd/Makefile.in 2016-01-19 12:57:44.277178484 +0000
214 +@@ -67,7 +67,7 @@
215 + $(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic
216 +
217 + dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
218 +- $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \
219 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) $(STATIC_LDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \
220 + dmeventd.o $(DL_LIBS) $(LVMLIBS) $(LIBS) $(STATIC_LIBS)
221 +
222 + ifeq ("@PKGCONFIG@", "yes")
223 +diff -ur LVM2.2.02.139_O/make.tmpl.in LVM2.2.02.139/make.tmpl.in
224 +--- LVM2.2.02.139_O/make.tmpl.in 2016-01-19 12:54:33.529186988 +0000
225 ++++ LVM2.2.02.139/make.tmpl.in 2016-01-19 12:58:31.514176378 +0000
226 +@@ -49,6 +49,7 @@
227 + # FIXME set this only where it's needed, not globally?
228 + CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
229 + LDFLAGS ?= @COPTIMISE_FLAG@ @LDFLAGS@
230 ++STATIC_LDFLAGS += @STATIC_LDFLAGS@
231 + CLDFLAGS += @CLDFLAGS@
232 + ELDFLAGS += @ELDFLAGS@
233 + LDDEPS += @LDDEPS@
234 +diff -ur LVM2.2.02.139_O/tools/Makefile.in LVM2.2.02.139/tools/Makefile.in
235 +--- LVM2.2.02.139_O/tools/Makefile.in 2016-01-08 18:51:21.000000000 +0000
236 ++++ LVM2.2.02.139/tools/Makefile.in 2016-01-19 13:00:08.349172060 +0000
237 +@@ -129,7 +129,7 @@
238 + -o $@ dmsetup.o -ldevmapper $(LIBS)
239 +
240 + dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
241 +- $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
242 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) \
243 + -o $@ dmsetup.o -ldevmapper $(M_LIBS) $(PTHREAD_LIBS) $(STATIC_LIBS) $(LIBS)
244 +
245 + all: device-mapper
246 +@@ -146,7 +146,7 @@
247 + endif
248 +
249 + lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a $(interfacebuilddir)/libdevmapper.a
250 +- $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
251 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
252 + $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
253 +
254 + liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
255
256 diff --git a/sys-fs/lvm2/files/lvm2-2.02.145-mkdev.patch b/sys-fs/lvm2/files/lvm2-2.02.145-mkdev.patch
257 new file mode 100644
258 index 00000000000..f91dccd5c18
259 --- /dev/null
260 +++ b/sys-fs/lvm2/files/lvm2-2.02.145-mkdev.patch
261 @@ -0,0 +1,127 @@
262 +https://bugs.gentoo.org/580062
263 +
264 +From 2a1d0fa8ea765604cd8274aac5aa7876f1c145c9 Mon Sep 17 00:00:00 2001
265 +From: Mike Frysinger <vapier@g.o>
266 +Date: Tue, 19 Apr 2016 23:53:22 -0400
267 +Subject: [PATCH] convert major/minor/makedev handling
268 +
269 +Most of the files in here use MAJOR/MINOR/MKDEV macros, but a few
270 +missed it. Update the defines in those files to match them.
271 +---
272 + daemons/cmirrord/functions.c | 16 ++++++++++++----
273 + daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c | 12 ++++++++++--
274 + lib/filters/filter-sysfs.c | 6 ++++--
275 + 3 files changed, 26 insertions(+), 8 deletions(-)
276 +
277 +diff --git a/daemons/cmirrord/functions.c b/daemons/cmirrord/functions.c
278 +index e9d3c09..5b3cb38 100644
279 +--- a/daemons/cmirrord/functions.c
280 ++++ b/daemons/cmirrord/functions.c
281 +@@ -20,6 +20,14 @@
282 + #include <time.h>
283 + #include <unistd.h>
284 +
285 ++#ifdef __linux__
286 ++# include "kdev_t.h"
287 ++#else
288 ++# define MAJOR(x) major((x))
289 ++# define MINOR(x) minor((x))
290 ++# define MKDEV(x,y) makedev((x),(y))
291 ++#endif
292 ++
293 + #define BYTE_SHIFT 3
294 +
295 + /*
296 +@@ -333,8 +341,8 @@ static int find_disk_path(char *major_minor_str, char *path_rtn, int *unlink_pat
297 + continue;
298 + }
299 + if (S_ISBLK(statbuf.st_mode) &&
300 +- (major(statbuf.st_rdev) == major) &&
301 +- (minor(statbuf.st_rdev) == minor)) {
302 ++ (MAJOR(statbuf.st_rdev) == major) &&
303 ++ (MINOR(statbuf.st_rdev) == minor)) {
304 + LOG_DBG(" %s: YES", dep->d_name);
305 + if (closedir(dp))
306 + LOG_DBG("Unable to closedir /dev/mapper %s",
307 +@@ -1451,7 +1459,7 @@ static int disk_status_info(struct log_c *lc, struct dm_ulog_request *rq)
308 + }
309 +
310 + r = sprintf(data, "3 clustered-disk %d:%d %c",
311 +- major(statbuf.st_rdev), minor(statbuf.st_rdev),
312 ++ MAJOR(statbuf.st_rdev), MINOR(statbuf.st_rdev),
313 + (lc->log_dev_failed) ? 'D' : 'A');
314 + if (r < 0)
315 + return r;
316 +@@ -1514,7 +1522,7 @@ static int disk_status_table(struct log_c *lc, struct dm_ulog_request *rq)
317 + }
318 +
319 + r = sprintf(data, "clustered-disk %d:%d %u %s%s ",
320 +- major(statbuf.st_rdev), minor(statbuf.st_rdev),
321 ++ MAJOR(statbuf.st_rdev), MINOR(statbuf.st_rdev),
322 + lc->region_size,
323 + (lc->sync == DEFAULTSYNC) ? "" :
324 + (lc->sync == NOSYNC) ? "nosync " : "sync ",
325 +diff --git a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
326 +index 7b060ed..4098203 100644
327 +--- a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
328 ++++ b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
329 +@@ -20,6 +20,14 @@
330 + #include <stdarg.h>
331 + #include <pthread.h>
332 +
333 ++#ifdef __linux__
334 ++# include "kdev_t.h"
335 ++#else
336 ++# define MAJOR(x) major((x))
337 ++# define MINOR(x) minor((x))
338 ++# define MKDEV(x,y) makedev((x),(y))
339 ++#endif
340 ++
341 + /* First warning when snapshot is 80% full. */
342 + #define WARNING_THRESH (DM_PERCENT_1 * 80)
343 + /* Run a check every 5%. */
344 +@@ -148,8 +156,8 @@ static void _umount(const char *device, int major, int minor)
345 + continue; /* can't stat, skip this one */
346 +
347 + if (S_ISBLK(st.st_mode) &&
348 +- major(st.st_rdev) == major &&
349 +- minor(st.st_rdev) == minor) {
350 ++ MAJOR(st.st_rdev) == major &&
351 ++ MINOR(st.st_rdev) == minor) {
352 + log_error("Unmounting invalid snapshot %s from %s.", device, words[1]);
353 + if (!_run(UMOUNT_COMMAND, "-fl", words[1], NULL))
354 + log_error("Failed to umount snapshot %s from %s: %s.",
355 +diff --git a/lib/filters/filter-sysfs.c b/lib/filters/filter-sysfs.c
356 +index 3115f86..5f76e8b 100644
357 +--- a/lib/filters/filter-sysfs.c
358 ++++ b/lib/filters/filter-sysfs.c
359 +@@ -19,6 +19,8 @@
360 +
361 + #include <dirent.h>
362 +
363 ++#include "kdev_t.h"
364 ++
365 + static int _locate_sysfs_blocks(const char *sysfs_dir, char *path, size_t len,
366 + unsigned *sysfs_depth)
367 + {
368 +@@ -120,7 +122,7 @@ static struct dev_set *_dev_set_create(struct dm_pool *mem,
369 +
370 + static unsigned _hash_dev(dev_t dev)
371 + {
372 +- return (major(dev) ^ minor(dev)) & (SET_BUCKETS - 1);
373 ++ return (MAJOR(dev) ^ MINOR(dev)) & (SET_BUCKETS - 1);
374 + }
375 +
376 + /*
377 +@@ -171,7 +173,7 @@ static int _parse_dev(const char *file, FILE *fp, dev_t *result)
378 + return 0;
379 + }
380 +
381 +- *result = makedev(major, minor);
382 ++ *result = MKDEV(major, minor);
383 + return 1;
384 + }
385 +
386 +--
387 +2.7.4
388 +
389
390 diff --git a/sys-fs/lvm2/lvm2-2.02.145-r2.ebuild b/sys-fs/lvm2/lvm2-2.02.145-r2.ebuild
391 new file mode 100644
392 index 00000000000..70a95fcb0f7
393 --- /dev/null
394 +++ b/sys-fs/lvm2/lvm2-2.02.145-r2.ebuild
395 @@ -0,0 +1,254 @@
396 +# Copyright 1999-2019 Gentoo Authors
397 +# Distributed under the terms of the GNU General Public License v2
398 +
399 +EAPI=6
400 +inherit autotools eutils linux-info multilib systemd toolchain-funcs udev flag-o-matic
401 +
402 +DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
403 +HOMEPAGE="https://sourceware.org/lvm2/"
404 +SRC_URI="ftp://sourceware.org/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
405 + ftp://sourceware.org/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
406 +
407 +LICENSE="GPL-2"
408 +SLOT="0"
409 +KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 ~sh sparc x86 ~amd64-linux ~x86-linux"
410 +IUSE="readline static static-libs systemd lvm1 lvm2create_initrd selinux +udev +thin device-mapper-only"
411 +REQUIRED_USE="device-mapper-only? ( !lvm1 !lvm2create_initrd !thin )
412 + systemd? ( udev )"
413 +
414 +DEPEND_COMMON="
415 + readline? ( sys-libs/readline:0= )
416 + systemd? ( >=sys-apps/systemd-205:0= )
417 + udev? ( >=virtual/libudev-208:=[static-libs(-)?] )"
418 +# /run is now required for locking during early boot. /var cannot be assumed to
419 +# be available -- thus, pull in recent enough baselayout for /run.
420 +# This version of LVM is incompatible with cryptsetup <1.1.2.
421 +RDEPEND="${DEPEND_COMMON}
422 + >=sys-apps/baselayout-2.2
423 + !<sys-apps/openrc-0.11
424 + !<sys-fs/cryptsetup-1.1.2
425 + !!sys-fs/lvm-user
426 + >=sys-apps/util-linux-2.16
427 + lvm2create_initrd? ( sys-apps/makedev )
428 + thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )"
429 +# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check
430 +# USE 'static' currently only works with eudev, bug 520450
431 +DEPEND="${DEPEND_COMMON}
432 + virtual/pkgconfig
433 + >=sys-devel/binutils-2.20.1-r1
434 + sys-devel/autoconf-archive
435 + static? (
436 + selinux? ( sys-libs/libselinux[static-libs] )
437 + udev? ( >=sys-fs/eudev-3.1.2[static-libs] )
438 + >=sys-apps/util-linux-2.16[static-libs]
439 + )"
440 +
441 +S=${WORKDIR}/${PN/lvm/LVM}.${PV}
442 +
443 +PATCHES=(
444 + # Gentoo specific modification(s):
445 + "${FILESDIR}"/${PN}-2.02.129-example.conf.in.patch
446 +
447 + # For upstream -- review and forward:
448 + "${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
449 + "${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch
450 + "${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331
451 + "${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373
452 + "${FILESDIR}"/${PN}-2.02.70-asneeded.patch # -Wl,--as-needed
453 + "${FILESDIR}"/${PN}-2.02.139-dynamic-static-ldflags.patch #332905
454 + "${FILESDIR}"/${PN}-2.02.129-static-pkgconfig-libs.patch #370217, #439414 + blkid
455 + "${FILESDIR}"/${PN}-2.02.130-pthread-pkgconfig.patch #492450
456 + "${FILESDIR}"/${PN}-2.02.145-mkdev.patch #580062
457 +)
458 +
459 +pkg_setup() {
460 + local CONFIG_CHECK="~SYSVIPC"
461 +
462 + if use udev; then
463 + local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
464 + if linux_config_exists; then
465 + local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
466 + if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then
467 + ewarn "It's recommended to set an empty value to the following kernel config option:"
468 + ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
469 + fi
470 + fi
471 + fi
472 +
473 + check_extra_config
474 +
475 + # 1. Genkernel no longer copies /sbin/lvm blindly.
476 + if use static; then
477 + elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
478 + elog "their static versions. If you need the static binaries,"
479 + elog "you must append .static to the filename!"
480 + fi
481 +}
482 +
483 +src_prepare() {
484 + default
485 +
486 + sed -i \
487 + -e "1iAR = $(tc-getAR)" \
488 + -e "s:CC ?= @CC@:CC = $(tc-getCC):" \
489 + make.tmpl.in || die #444082
490 +
491 + sed -i -e '/FLAG/s:-O2::' configure{.in,} || die #480212
492 +
493 + if use udev && ! use device-mapper-only; then
494 + sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196
495 + elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in"
496 + elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad"
497 + elog "if it was previously disabled."
498 + fi
499 +
500 + sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514
501 +
502 + # Without thin-privision-tools, there is nothing to install for target install_man7:
503 + use thin || { sed -i -e '/^install_lvm2/s:install_man7::' man/Makefile.in || die; }
504 +
505 + eautoreconf
506 +}
507 +
508 +src_configure() {
509 + filter-flags -flto
510 + local myconf=()
511 + local buildmode
512 +
513 + myconf+=( $(use_enable !device-mapper-only dmeventd) )
514 + myconf+=( $(use_enable !device-mapper-only cmdlib) )
515 + myconf+=( $(use_enable !device-mapper-only applib) )
516 + myconf+=( $(use_enable !device-mapper-only fsadm) )
517 + myconf+=( $(use_enable !device-mapper-only lvmetad) )
518 + use device-mapper-only && myconf+=( --disable-udev-systemd-background-jobs )
519 +
520 + # Most of this package does weird stuff.
521 + # The build options are tristate, and --without is NOT supported
522 + # options: 'none', 'internal', 'shared'
523 + if use static; then
524 + buildmode="internal"
525 + # This only causes the .static versions to become available
526 + myconf+=( --enable-static_link )
527 + else
528 + buildmode="shared"
529 + fi
530 + dmbuildmode=$(use !device-mapper-only && echo internal || echo none)
531 +
532 + # dmeventd requires mirrors to be internal, and snapshot available
533 + # so we cannot disable them
534 + myconf+=( --with-mirrors=${dmbuildmode} )
535 + myconf+=( --with-snapshots=${dmbuildmode} )
536 + if use thin; then
537 + myconf+=( --with-thin=internal --with-cache=internal )
538 + local texec
539 + for texec in check dump repair restore; do
540 + myconf+=( --with-thin-${texec}="${EPREFIX}"/sbin/thin_${texec} )
541 + myconf+=( --with-cache-${texec}="${EPREFIX}"/sbin/cache_${texec} )
542 + done
543 + else
544 + myconf+=( --with-thin=none --with-cache=none )
545 + fi
546 +
547 + if use lvm1; then
548 + myconf+=( --with-lvm1=${buildmode} )
549 + else
550 + myconf+=( --with-lvm1=none )
551 + fi
552 +
553 + # disable O_DIRECT support on hppa, breaks pv detection (#99532)
554 + use hppa && myconf+=( --disable-o_direct )
555 +
556 + myconf+=( --with-clvmd=none --with-cluster=none )
557 +
558 + econf \
559 + $(use_enable readline) \
560 + $(use_enable selinux) \
561 + --enable-pkgconfig \
562 + --with-confdir="${EPREFIX}"/etc \
563 + --exec-prefix="${EPREFIX}" \
564 + --sbindir="${EPREFIX}/sbin" \
565 + --with-staticdir="${EPREFIX}"/sbin \
566 + --libdir="${EPREFIX}/$(get_libdir)" \
567 + --with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
568 + --with-default-dm-run-dir=/run \
569 + --with-default-run-dir=/run/lvm \
570 + --with-default-locking-dir=/run/lock/lvm \
571 + --with-default-pid-dir=/run \
572 + $(use_enable udev udev_rules) \
573 + $(use_enable udev udev_sync) \
574 + $(use_with udev udevdir "$(get_udevdir)"/rules.d) \
575 + $(use_enable systemd udev-systemd-background-jobs) \
576 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
577 + ${myconf[@]} \
578 + CLDFLAGS="${LDFLAGS}"
579 +}
580 +
581 +src_compile() {
582 + pushd include >/dev/null
583 + emake
584 + popd >/dev/null
585 +
586 + if use device-mapper-only ; then
587 + emake device-mapper
588 + else
589 + emake
590 + emake CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat
591 + fi
592 +}
593 +
594 +src_install() {
595 + local inst
596 + INSTALL_TARGETS="install install_tmpfiles_configuration"
597 + # install systemd related files only when requested, bug #522430
598 + use systemd && INSTALL_TARGETS="${INSTALL_TARGETS} install_systemd_units install_systemd_generators"
599 + use device-mapper-only && INSTALL_TARGETS="install_device-mapper"
600 + for inst in ${INSTALL_TARGETS}; do
601 + emake DESTDIR="${D}" ${inst}
602 + done
603 +
604 + newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper
605 + newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper
606 +
607 + if use !device-mapper-only ; then
608 + newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd
609 + newinitd "${FILESDIR}"/lvm.rc-2.02.116-r6 lvm
610 + newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm
611 +
612 + newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring
613 + newinitd "${FILESDIR}"/lvmetad.initd-2.02.116-r3 lvmetad
614 + fi
615 +
616 + if use static-libs; then
617 + dolib.a libdm/ioctl/libdevmapper.a
618 + if use !device-mapper-only ; then
619 + dolib.a libdaemon/client/libdaemonclient.a #462908
620 + dolib.a daemons/dmeventd/libdevmapper-event.a
621 + fi
622 + else
623 + rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
624 + fi
625 +
626 + if use lvm2create_initrd; then
627 + dosbin scripts/lvm2create_initrd/lvm2create_initrd
628 + doman scripts/lvm2create_initrd/lvm2create_initrd.8
629 + newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd
630 + fi
631 +
632 + insinto /etc
633 + doins "${FILESDIR}"/dmtab
634 +
635 + dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
636 +}
637 +
638 +pkg_postinst() {
639 + ewarn "Make sure the \"lvm\" init script is in the runlevels:"
640 + ewarn "# rc-update add lvm boot"
641 + ewarn
642 + ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want"
643 + ewarn "to enable lvm autoactivation and metadata caching."
644 +}
645 +
646 +src_test() {
647 + einfo "Tests are disabled because of device-node mucking, if you want to"
648 + einfo "run tests, compile the package and see ${S}/tests"
649 +}