1 |
commit: 51d0568910e9438cb5c05976a0d4a3001adc3d45 |
2 |
Author: Sergey Popov <pinkbyte <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Nov 2 10:54:44 2015 +0000 |
4 |
Commit: Sergey Popov <pinkbyte <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 2 10:55:19 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=51d05689 |
7 |
|
8 |
sys-fs/lvm2: workaround for building with USE="cman" enabled |
9 |
|
10 |
Currently LVM installs systemd units and services unconditionally, |
11 |
which breaks if USE="clvm" is enabled. |
12 |
|
13 |
This commit adds proper REQUIRED_USE blocker and installs systemd |
14 |
related files only when USE="systemd" is enabled |
15 |
|
16 |
Gentoo-Bug: 522430 |
17 |
|
18 |
Package-Manager: portage-2.2.23 |
19 |
|
20 |
sys-fs/lvm2/lvm2-2.02.116-r2.ebuild | 275 ++++++++++++++++++++++++++++++++++++ |
21 |
1 file changed, 275 insertions(+) |
22 |
|
23 |
diff --git a/sys-fs/lvm2/lvm2-2.02.116-r2.ebuild b/sys-fs/lvm2/lvm2-2.02.116-r2.ebuild |
24 |
new file mode 100644 |
25 |
index 0000000..e3eb6e5 |
26 |
--- /dev/null |
27 |
+++ b/sys-fs/lvm2/lvm2-2.02.116-r2.ebuild |
28 |
@@ -0,0 +1,275 @@ |
29 |
+# Copyright 1999-2015 Gentoo Foundation |
30 |
+# Distributed under the terms of the GNU General Public License v2 |
31 |
+# $Id$ |
32 |
+ |
33 |
+EAPI=5 |
34 |
+inherit autotools eutils linux-info multilib systemd toolchain-funcs udev flag-o-matic |
35 |
+ |
36 |
+DESCRIPTION="User-land utilities for LVM2 (device-mapper) software" |
37 |
+HOMEPAGE="https://sources.redhat.com/lvm2/" |
38 |
+SRC_URI="ftp://sources.redhat.com/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz |
39 |
+ ftp://sources.redhat.com/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz" |
40 |
+ |
41 |
+LICENSE="GPL-2" |
42 |
+SLOT="0" |
43 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux" |
44 |
+IUSE="readline static static-libs systemd clvm cman lvm1 lvm2create_initrd selinux +udev +thin device-mapper-only" |
45 |
+REQUIRED_USE="device-mapper-only? ( !clvm !cman !lvm1 !lvm2create_initrd !thin ) |
46 |
+ systemd? ( udev ) |
47 |
+ clvm? ( !systemd )" |
48 |
+ |
49 |
+DEPEND_COMMON="clvm? ( cman? ( =sys-cluster/cman-3* ) =sys-cluster/libdlm-3* ) |
50 |
+ readline? ( sys-libs/readline:0= ) |
51 |
+ udev? ( >=virtual/libudev-208:=[static-libs?] )" |
52 |
+# /run is now required for locking during early boot. /var cannot be assumed to |
53 |
+# be available -- thus, pull in recent enough baselayout for /run. |
54 |
+# This version of LVM is incompatible with cryptsetup <1.1.2. |
55 |
+RDEPEND="${DEPEND_COMMON} |
56 |
+ >=sys-apps/baselayout-2.2 |
57 |
+ !<sys-apps/openrc-0.11 |
58 |
+ !<sys-fs/cryptsetup-1.1.2 |
59 |
+ !!sys-fs/clvm |
60 |
+ !!sys-fs/lvm-user |
61 |
+ >=sys-apps/util-linux-2.16 |
62 |
+ lvm2create_initrd? ( sys-apps/makedev ) |
63 |
+ thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )" |
64 |
+# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check |
65 |
+# USE 'static' currently only works with eudev, bug 520450 |
66 |
+DEPEND="${DEPEND_COMMON} |
67 |
+ virtual/pkgconfig |
68 |
+ >=sys-devel/binutils-2.20.1-r1 |
69 |
+ static? ( |
70 |
+ selinux? ( sys-libs/libselinux[static-libs] ) |
71 |
+ udev? ( >=sys-fs/eudev-3.1.2[static-libs] ) |
72 |
+ >=sys-apps/util-linux-2.16[static-libs] |
73 |
+ )" |
74 |
+ |
75 |
+S=${WORKDIR}/${PN/lvm/LVM}.${PV} |
76 |
+ |
77 |
+pkg_setup() { |
78 |
+ local CONFIG_CHECK="~SYSVIPC" |
79 |
+ |
80 |
+ if use udev; then |
81 |
+ local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n" |
82 |
+ if linux_config_exists; then |
83 |
+ local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH) |
84 |
+ if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then |
85 |
+ ewarn "It's recommended to set an empty value to the following kernel config option:" |
86 |
+ ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}" |
87 |
+ fi |
88 |
+ fi |
89 |
+ fi |
90 |
+ |
91 |
+ check_extra_config |
92 |
+ |
93 |
+ # 1. Genkernel no longer copies /sbin/lvm blindly. |
94 |
+ if use static; then |
95 |
+ elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with" |
96 |
+ elog "their static versions. If you need the static binaries," |
97 |
+ elog "you must append .static to the filename!" |
98 |
+ fi |
99 |
+} |
100 |
+ |
101 |
+src_prepare() { |
102 |
+ # Gentoo specific modification(s): |
103 |
+ epatch "${FILESDIR}"/${PN}-2.02.108-example.conf.in.patch |
104 |
+ |
105 |
+ sed -i \ |
106 |
+ -e "1iAR = $(tc-getAR)" \ |
107 |
+ -e "s:CC ?= @CC@:CC = $(tc-getCC):" \ |
108 |
+ make.tmpl.in || die #444082 |
109 |
+ |
110 |
+ sed -i -e '/FLAG/s:-O2::' configure{.in,} || die #480212 |
111 |
+ |
112 |
+ if use udev && ! use device-mapper-only; then |
113 |
+ sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196 |
114 |
+ elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in" |
115 |
+ elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad" |
116 |
+ elog "if it was previously disabled." |
117 |
+ fi |
118 |
+ |
119 |
+ sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514 |
120 |
+ |
121 |
+ # For upstream -- review and forward: |
122 |
+ epatch "${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch |
123 |
+ epatch "${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch |
124 |
+ epatch "${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331 |
125 |
+ epatch "${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373 |
126 |
+ epatch "${FILESDIR}"/${PN}-2.02.70-asneeded.patch # -Wl,--as-needed |
127 |
+ epatch "${FILESDIR}"/${PN}-2.02.92-dynamic-static-ldflags.patch #332905 |
128 |
+ epatch "${FILESDIR}"/${PN}-2.02.108-static-pkgconfig-libs.patch #370217, #439414 + blkid |
129 |
+ epatch "${FILESDIR}"/${PN}-2.02.106-pthread-pkgconfig.patch #492450 |
130 |
+ |
131 |
+ # Without thin-privision-tools, there is nothing to install for target install_man7: |
132 |
+ use thin || { sed -i -e '/^install_lvm2/s:install_man7::' man/Makefile.in || die; } |
133 |
+ |
134 |
+ eautoreconf |
135 |
+} |
136 |
+ |
137 |
+src_configure() { |
138 |
+ filter-flags -flto |
139 |
+ local myconf |
140 |
+ local buildmode |
141 |
+ |
142 |
+ myconf="${myconf} $(use_enable !device-mapper-only dmeventd)" |
143 |
+ myconf="${myconf} $(use_enable !device-mapper-only cmdlib)" |
144 |
+ myconf="${myconf} $(use_enable !device-mapper-only applib)" |
145 |
+ myconf="${myconf} $(use_enable !device-mapper-only fsadm)" |
146 |
+ myconf="${myconf} $(use_enable !device-mapper-only lvmetad)" |
147 |
+ use device-mapper-only && myconf="${myconf} --disable-udev-systemd-background-jobs" |
148 |
+ |
149 |
+ # Most of this package does weird stuff. |
150 |
+ # The build options are tristate, and --without is NOT supported |
151 |
+ # options: 'none', 'internal', 'shared' |
152 |
+ if use static; then |
153 |
+ buildmode="internal" |
154 |
+ # This only causes the .static versions to become available |
155 |
+ myconf="${myconf} --enable-static_link" |
156 |
+ else |
157 |
+ buildmode="shared" |
158 |
+ fi |
159 |
+ dmbuildmode=$(use !device-mapper-only && echo internal || echo none) |
160 |
+ |
161 |
+ # dmeventd requires mirrors to be internal, and snapshot available |
162 |
+ # so we cannot disable them |
163 |
+ myconf="${myconf} --with-mirrors=${dmbuildmode}" |
164 |
+ myconf="${myconf} --with-snapshots=${dmbuildmode}" |
165 |
+ if use thin; then |
166 |
+ myconf="${myconf} --with-thin=internal --with-cache=internal" |
167 |
+ local texec |
168 |
+ for texec in check dump repair restore; do |
169 |
+ myconf="${myconf} --with-thin-${texec}=${EPREFIX}/sbin/thin_${texec}" |
170 |
+ myconf="${myconf} --with-cache-${texec}=${EPREFIX}/sbin/cache_${texec}" |
171 |
+ done |
172 |
+ else |
173 |
+ myconf="${myconf} --with-thin=none --with-cache=none" |
174 |
+ fi |
175 |
+ |
176 |
+ if use lvm1; then |
177 |
+ myconf="${myconf} --with-lvm1=${buildmode}" |
178 |
+ else |
179 |
+ myconf="${myconf} --with-lvm1=none" |
180 |
+ fi |
181 |
+ |
182 |
+ # disable O_DIRECT support on hppa, breaks pv detection (#99532) |
183 |
+ use hppa && myconf="${myconf} --disable-o_direct" |
184 |
+ |
185 |
+ if use clvm; then |
186 |
+ myconf="${myconf} --with-cluster=${buildmode}" |
187 |
+ # 4-state! Make sure we get it right, per bug 210879 |
188 |
+ # Valid options are: none, cman, gulm, all |
189 |
+ # |
190 |
+ # 2009/02: |
191 |
+ # gulm is removed now, now dual-state: |
192 |
+ # cman, none |
193 |
+ # all still exists, but is not needed |
194 |
+ # |
195 |
+ # 2009/07: |
196 |
+ # TODO: add corosync and re-enable ALL |
197 |
+ local clvmd="" |
198 |
+ use cman && clvmd="cman" |
199 |
+ #clvmd="${clvmd/cmangulm/all}" |
200 |
+ [ -z "${clvmd}" ] && clvmd="none" |
201 |
+ myconf="${myconf} --with-clvmd=${clvmd}" |
202 |
+ myconf="${myconf} --with-pool=${buildmode}" |
203 |
+ else |
204 |
+ myconf="${myconf} --with-clvmd=none --with-cluster=none" |
205 |
+ fi |
206 |
+ |
207 |
+ econf \ |
208 |
+ $(use_enable readline) \ |
209 |
+ $(use_enable selinux) \ |
210 |
+ --enable-pkgconfig \ |
211 |
+ --with-confdir="${EPREFIX}"/etc \ |
212 |
+ --exec-prefix="${EPREFIX}" \ |
213 |
+ --sbindir="${EPREFIX}/sbin" \ |
214 |
+ --with-staticdir="${EPREFIX}"/sbin \ |
215 |
+ --libdir="${EPREFIX}/$(get_libdir)" \ |
216 |
+ --with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \ |
217 |
+ --with-default-dm-run-dir=/run \ |
218 |
+ --with-default-run-dir=/run/lvm \ |
219 |
+ --with-default-locking-dir=/run/lock/lvm \ |
220 |
+ --with-default-pid-dir=/run \ |
221 |
+ $(use_enable udev udev_rules) \ |
222 |
+ $(use_enable udev udev_sync) \ |
223 |
+ $(use_with udev udevdir "$(get_udevdir)"/rules.d) \ |
224 |
+ $(use_enable systemd udev-systemd-background-jobs) \ |
225 |
+ "$(systemd_with_unitdir)" \ |
226 |
+ ${myconf} \ |
227 |
+ CLDFLAGS="${LDFLAGS}" |
228 |
+} |
229 |
+ |
230 |
+src_compile() { |
231 |
+ pushd include >/dev/null |
232 |
+ emake |
233 |
+ popd >/dev/null |
234 |
+ |
235 |
+ if use device-mapper-only ; then |
236 |
+ emake device-mapper |
237 |
+ else |
238 |
+ emake |
239 |
+ emake CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat |
240 |
+ fi |
241 |
+} |
242 |
+ |
243 |
+src_install() { |
244 |
+ local inst |
245 |
+ INSTALL_TARGETS="install install_tmpfiles_configuration" |
246 |
+ # install systemd related files only when requested, bug #522430 |
247 |
+ use systemd && INSTALL_TARGETS="${INSTALL_TARGETS} install_systemd_units install_systemd_generators" |
248 |
+ use device-mapper-only && INSTALL_TARGETS="install_device-mapper" |
249 |
+ for inst in ${INSTALL_TARGETS}; do |
250 |
+ emake DESTDIR="${D}" ${inst} |
251 |
+ done |
252 |
+ |
253 |
+ newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper |
254 |
+ newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper |
255 |
+ |
256 |
+ if use !device-mapper-only ; then |
257 |
+ newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd |
258 |
+ newinitd "${FILESDIR}"/lvm.rc-2.02.105-r2 lvm |
259 |
+ newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm |
260 |
+ |
261 |
+ newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring |
262 |
+ newinitd "${FILESDIR}"/lvmetad.initd-2.02.105-r2 lvmetad |
263 |
+ fi |
264 |
+ |
265 |
+ if use clvm; then |
266 |
+ newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd |
267 |
+ newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd |
268 |
+ fi |
269 |
+ |
270 |
+ if use static-libs; then |
271 |
+ dolib.a libdm/ioctl/libdevmapper.a |
272 |
+ dolib.a libdaemon/client/libdaemonclient.a #462908 |
273 |
+ #gen_usr_ldscript libdevmapper.so |
274 |
+ dolib.a daemons/dmeventd/libdevmapper-event.a |
275 |
+ #gen_usr_ldscript libdevmapper-event.so |
276 |
+ else |
277 |
+ rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a |
278 |
+ fi |
279 |
+ |
280 |
+ if use lvm2create_initrd; then |
281 |
+ dosbin scripts/lvm2create_initrd/lvm2create_initrd |
282 |
+ doman scripts/lvm2create_initrd/lvm2create_initrd.8 |
283 |
+ newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd |
284 |
+ fi |
285 |
+ |
286 |
+ insinto /etc |
287 |
+ doins "${FILESDIR}"/dmtab |
288 |
+ |
289 |
+ dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf |
290 |
+} |
291 |
+ |
292 |
+pkg_postinst() { |
293 |
+ ewarn "Make sure the \"lvm\" init script is in the runlevels:" |
294 |
+ ewarn "# rc-update add lvm boot" |
295 |
+ ewarn |
296 |
+ ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want" |
297 |
+ ewarn "to enable lvm autoactivation and metadata caching." |
298 |
+} |
299 |
+ |
300 |
+src_test() { |
301 |
+ einfo "Tests are disabled because of device-node mucking, if you want to" |
302 |
+ einfo "run tests, compile the package and see ${S}/tests" |
303 |
+} |