Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 446826 - sys-fs/lvm2-2.02.88: problem with sys-fs/udev-171-r8 and sys-fs/udev-164-r2
Summary: sys-fs/lvm2-2.02.88: problem with sys-fs/udev-171-r8 and sys-fs/udev-164-r2
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-11 02:57 UTC by Hanfei Shen
Modified: 2012-12-11 07:30 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hanfei Shen 2012-12-11 02:57:42 UTC
On a fresh installation, I wanted to install the lvm2, but it required virtual/udev-0, and it has the keyword ~amd64.

Reproducible: Always

Steps to Reproduce:
1. boot the livecd
2. extract the latest portage
3. emerge --sync
4. emerge lvm2
Actual Results:  
livecd / # emerge -av lvm2 

 * IMPORTANT: 5 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.


These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] sys-apps/hwids-20121119  366 kB
[ebuild  N     ] dev-util/gperf-3.0.4  961 kB
[ebuild  N     ] dev-libs/libusb-1.0.9  USE="-debug -doc -static-libs" 413 kB
[ebuild  N     ] virtual/libusb-1  0 kB
[ebuild  N     ] sys-apps/pciutils-3.1.10  USE="zlib -static-libs" 338 kB
[ebuild  N     ] sys-apps/usbutils-006  USE="zlib -python" 399 kB
[ebuild  N     ] dev-libs/libusb-compat-0.1.4  USE="-debug -static-libs" 237 kB
[ebuild  N     ] virtual/libusb-0  0 kB
[ebuild     UD~] sys-fs/udev-164-r2 [171-r8] USE="extras* -build (-selinux) -test (-action_modeswitch%) (-debug%) (-edd%) (-floppy%) (-gudev%) (-hwdb%) (-introspection%) (-keymap%) (-rule_generator%*)" 568 kB
[ebuild  N    ~] virtual/udev-0  USE="acl -gudev -hwdb -keymap (-selinux) -static-libs" 0 kB
[ebuild  N     ] sys-fs/lvm2-2.02.88  USE="lvm1 readline static static-libs (-clvm) (-cman) (-selinux)" 1,006 kB

Total: 11 packages (1 downgrade, 10 new), Size of downloads: 4,283 kB

The following keyword changes are necessary to proceed:
#required by virtual/udev-0[-gudev,-keymap,-hwdb,acl], required by sys-fs/lvm2-2.02.88, required by @selected, required by @world (argument)
=sys-fs/udev-164-r2 ~amd64
#required by sys-fs/lvm2-2.02.88, required by @selected, required by @world (argument)
=virtual/udev-0 ~amd64

The following USE changes are necessary to proceed:
#required by virtual/udev-0[-gudev,-keymap,-hwdb,acl], required by sys-fs/lvm2-2.02.88, required by @selected, required by @world (argument)
=sys-fs/udev-164-r2 extras

Use --autounmask-write to write changes to config files (honoring CONFIG_PROTECT).

Expected Results:  
install successfully

livecd / # emerge --info
Portage 2.1.11.9 (default/linux/amd64/10.0, gcc-4.5.4, glibc-2.15-r3, 3.2.12-gentoo x86_64)
=================================================================
System uname: Linux-3.2.12-gentoo-x86_64-QEMU_Virtual_CPU_version_1.1.1-with-gentoo-2.1
Timestamp of tree: Mon, 10 Dec 2012 21:00:01 +0000
app-shells/bash:          4.2_p37
dev-lang/python:          3.2.3
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.5.4
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.4-r2 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=3 --load-average=9.0"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirrors.163.com/gentoo http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://61.135.158.199/gentoo-portage"
USE="acl amd64 berkdb bzip2 cli cracklib crypt cups cxx dri fortran gdbm gpm iconv ipv6 mmx modules mudflap multilib ncurses nls nptl openmp pam pcre pppd readline session sse sse2 ssl tcpd unicode zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Hanfei Shen 2012-12-11 03:04:18 UTC
Actually I had these in the /var/lib/portage/world 
app-admin/logrotate
app-admin/mcelog
app-admin/sudo
app-admin/syslog-ng
app-arch/unzip
app-editors/nano
app-editors/vim
app-misc/screen
app-misc/tmux
app-portage/eix
app-portage/gentoolkit
dev-vcs/git
net-misc/curl
net-misc/dhcpcd
net-misc/ntp
sys-fs/lvm2
sys-fs/mdadm
sys-kernel/gentoo-sources
sys-process/atop
sys-process/fcron
sys-process/htop
sys-boot/grub

after emerge --sync, I failed on:
emerge --update --deep --with-bdeps=y --newuse world
Comment 2 Hanfei Shen 2012-12-11 03:50:26 UTC
after add

=sys-fs/udev-164-r2 ~amd64
=virtual/udev-0 ~amd64

to /etc/portage/package.keywords, and

=sys-fs/udev-164-r2 extras

to /etc/portage/package.use, I got these:

>>> Messages generated by process 21551 on 2012-12-11 03:39:05 GMT for package sys-fs/static-dev-0.1:

ERROR: preinst
We have detected that you currently use udev or devfs
and this ebuild cannot install to the same mount-point.
Please reinstall the ebuild (as root) like follows:

mkdir /tmp/newroot
mount -o bind / /tmp/newroot
ROOT=/tmp/newroot/ emerge sys-fs/static-dev
umount /tmp/newroot
ERROR: sys-fs/static-dev-0.1 failed (preinst phase):
  Cannot install on udev/devfs tmpfs.

Call stack:
    ebuild.sh, line  85:  Called pkg_preinst
  environment, line 138:  Called die
The specific snippet of code:
          die "Cannot install on udev/devfs tmpfs.";

If you need support, post the output of `emerge --info '=sys-fs/static-dev-0.1'`,
the complete build log and the output of `emerge -pqv '=sys-fs/static-dev-0.1'`.
The complete build log is located at '/var/tmp/portage/sys-fs/static-dev-0.1/temp/build.log'.
The ebuild environment file is located at '/var/tmp/portage/sys-fs/static-dev-0.1/temp/environment'.
Working directory: '/var/tmp/portage/sys-fs/static-dev-0.1'
S: '/var/tmp/portage/sys-fs/static-dev-0.1/work/static-dev-0.1'
Comment 3 Hanfei Shen 2012-12-11 05:02:16 UTC
it worked yesterday (2012-DEC-10)
Comment 4 Rafał Mużyło 2012-12-11 05:20:32 UTC
This didn't require virtual/udev-0, it required virtual/udev.

The correct solution was to set the useflags on virtual/udev.
Comment 5 Hanfei Shen 2012-12-11 05:23:11 UTC
but in the lastest portage:

livecd ~ # cat /mnt/gentoo/usr/portage/sys-fs/lvm2/lvm2-2.02.88.ebuild 
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/lvm2-2.02.88.ebuild,v 1.15 2012/12/10 20:24:11 robbat2 Exp $

EAPI=3
inherit eutils multilib toolchain-funcs autotools linux-info

DESCRIPTION="User-land utilities for LVM2 (device-mapper) software."
HOMEPAGE="http://sources.redhat.com/lvm2/"
SRC_URI="ftp://sources.redhat.com/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
		 ftp://sources.redhat.com/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~x86-linux"

IUSE="readline +static +static-libs clvm cman +lvm1 selinux"

DEPEND_COMMON="!!sys-fs/device-mapper
	readline? ( sys-libs/readline )
	clvm? ( =sys-cluster/dlm-2*
			cman? ( =sys-cluster/cman-2* ) )
	~virtual/udev-0"

RDEPEND="${DEPEND_COMMON}
	!<sys-apps/openrc-0.4
	!!sys-fs/lvm-user
	!!sys-fs/clvm
	>=sys-apps/util-linux-2.16"

# Upgrading to this LVM will break older cryptsetup
RDEPEND="${RDEPEND}
		!<sys-fs/cryptsetup-1.1.2"

DEPEND="${DEPEND_COMMON}
		virtual/pkgconfig
		>=sys-devel/binutils-2.20.1-r1"

S="${WORKDIR}/${PN/lvm/LVM}.${PV}"

pkg_setup() {
	local CONFIG_CHECK="~SYSVIPC"
	local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
	check_extra_config
	# 1. Genkernel no longer copies /sbin/lvm blindly.
	# 2. There are no longer any linking deps in /usr.
	if use static; then
		elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
		elog "their static versions. If you need the static binaries,"
		elog "you must append .static to the filename!"
	fi
}

src_unpack() {
	unpack ${A}
}

src_prepare() {
	epatch "${FILESDIR}"/lvm.conf-2.02.67.patch

	# Should not be needed due to upstream re-arrangement of build
	#epatch "${FILESDIR}"/${PN}-2.02.56-dmeventd.patch
	# Should not be need with new upstream udev rules
	#epatch "${FILESDIR}"/${PN}-2.02.56-device-mapper-export-format.patch

	# Merged upstream:
	#epatch "${FILESDIR}"/${PN}-2.02.51-as-needed.patch
	# Merged upstream:
	#epatch "${FILESDIR}"/${PN}-2.02.48-fix-pkgconfig.patch
	# Merged upstream:
	#epatch "${FILESDIR}"/${PN}-2.02.51-fix-pvcreate.patch
	# Fixed differently upstream:
	#epatch "${FILESDIR}"/${PN}-2.02.51-dmsetup-selinux-linking-fix-r3.patch

	epatch "${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
	epatch "${FILESDIR}"/lvm2-2.02.56-lvm2create_initrd.patch
	# bug 318513
	epatch "${FILESDIR}"/${PN}-2.02.64-dmeventd-libs.patch
	# bug 301331
	epatch "${FILESDIR}"/${PN}-2.02.67-createinitrd.patch
	# bug 330373
	epatch "${FILESDIR}"/${PN}-2.02.73-locale-muck.patch
	# --as-needed
	epatch "${FILESDIR}"/${PN}-2.02.70-asneeded.patch
	# bug 332905
	epatch "${FILESDIR}"/${PN}-2.02.72-dynamic-static-ldflags.patch
	# bug 361429 - merged upstream in .85
	#epatch "${FILESDIR}"/${PN}-2.02.84-udev-pkgconfig.patch

	# Merged upstream
	#epatch "${FILESDIR}"/${PN}-2.02.73-asneeded.patch

	epatch "${FILESDIR}"/${PN}-2.02.88-respect-cc.patch

	eautoreconf
}

src_configure() {
	local myconf
	local buildmode

	myconf="${myconf} --enable-dmeventd"
	myconf="${myconf} --enable-cmdlib"
	myconf="${myconf} --enable-applib"
	myconf="${myconf} --enable-fsadm"

	# Most of this package does weird stuff.
	# The build options are tristate, and --without is NOT supported
	# options: 'none', 'internal', 'shared'
	if use static ; then
		einfo "Building static LVM, for usage inside genkernel"
		buildmode="internal"
		# This only causes the .static versions to become available
		# For recent systems, there are no linkages against anything in /usr anyway.
		# We explicitly provide the .static versions so that they can be included in
		# initramfs environments.
		myconf="${myconf} --enable-static_link"
	else
		ewarn "Building shared LVM, it will not work inside genkernel!"
		buildmode="shared"
	fi

	# dmeventd requires mirrors to be internal, and snapshot available
	# so we cannot disable them
	myconf="${myconf} --with-mirrors=internal"
	myconf="${myconf} --with-snapshots=internal"

	if use lvm1 ; then
		myconf="${myconf} --with-lvm1=${buildmode}"
	else
		myconf="${myconf} --with-lvm1=none"
	fi

	# disable O_DIRECT support on hppa, breaks pv detection (#99532)
	use hppa && myconf="${myconf} --disable-o_direct"

	if use clvm; then
		myconf="${myconf} --with-cluster=${buildmode}"
		# 4-state! Make sure we get it right, per bug 210879
		# Valid options are: none, cman, gulm, all
		#
		# 2009/02:
		# gulm is removed now, now dual-state:
		# cman, none
		# all still exists, but is not needed
		#
		# 2009/07:
		# TODO: add corosync and re-enable ALL
		local clvmd=""
		use cman && clvmd="cman"
		#clvmd="${clvmd/cmangulm/all}"
		[ -z "${clvmd}" ] && clvmd="none"
		myconf="${myconf} --with-clvmd=${clvmd}"
		myconf="${myconf} --with-pool=${buildmode}"
	else
		myconf="${myconf} --with-clvmd=none --with-cluster=none"
	fi

	myconf="${myconf}
			--with-dmeventd-path=/sbin/dmeventd"
	econf $(use_enable readline) \
		$(use_enable selinux) \
		--enable-pkgconfig \
		--with-confdir="${EPREFIX}/etc" \
		--sbindir="${EPREFIX}/sbin" \
		--with-staticdir="${EPREFIX}/sbin" \
		--libdir="${EPREFIX}/$(get_libdir)" \
		--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
		--enable-udev_rules \
		--enable-udev_sync \
		--with-udevdir="${EPREFIX}/lib/udev/rules.d/" \
		${myconf} \
		CLDFLAGS="${LDFLAGS}" || die
}

src_compile() {
	einfo "Doing symlinks"
	pushd include
	emake || die "Failed to prepare symlinks"
	popd

	einfo "Starting main build"
	emake || die "compile fail"
}

src_install() {
	emake DESTDIR="${D}" install || die "Failed to emake install"

	dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{conf,c,txt}
	insinto /$(get_libdir)/rcscripts/addons
	newins "${FILESDIR}"/lvm2-start.sh-2.02.67-r1 lvm-start.sh || die
	newins "${FILESDIR}"/lvm2-stop.sh-2.02.67-r1 lvm-stop.sh || die
	newinitd "${FILESDIR}"/lvm.rc-2.02.67-r1 lvm || die
	newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.67-r2 lvm-monitoring || die
	newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm || die
	if use clvm; then
		newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd || die
		newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd || die
	fi

	# move shared libs to /lib(64)
	if use static-libs; then
		dolib.a libdm/ioctl/libdevmapper.a || die "dolib.a libdevmapper.a"
		#gen_usr_ldscript libdevmapper.so
	fi

	dosbin "${S}"/scripts/lvm2create_initrd/lvm2create_initrd
	doman  "${S}"/scripts/lvm2create_initrd/lvm2create_initrd.8
	newdoc "${S}"/scripts/lvm2create_initrd/README README.lvm2create_initrd

	insinto /etc
	doins "${FILESDIR}"/dmtab
	insinto /$(get_libdir)/rcscripts/addons
	doins "${FILESDIR}"/dm-start.sh

	# Device mapper stuff
	newinitd "${FILESDIR}"/device-mapper.rc-2.02.67-r1 device-mapper || die
	newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper || die

	newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd || die
	if use static-libs; then
		dolib.a daemons/dmeventd/libdevmapper-event.a \
		|| die "dolib.a libdevmapper-event.a"
		#gen_usr_ldscript libdevmapper-event.so
	fi

	use static-libs || \
	rm -f "${D}"/usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a

	#insinto /etc/udev/rules.d/
	#newins "${FILESDIR}"/64-device-mapper.rules-2.02.56-r3 64-device-mapper.rules || die

	# do not rely on /lib -> /libXX link
	sed -e "s-/lib/rcscripts/-/$(get_libdir)/rcscripts/-" -i "${ED}"/etc/init.d/*

	elog "USE flag nocman is deprecated and replaced"
	elog "with the cman USE flag."
	elog ""
	elog "USE flags clvm and cman are masked"
	elog "by default and need to be unmasked to be used"
	elog ""
	elog "If you are using genkernel and root-on-LVM, rebuild the initramfs."
}

pkg_postinst() {
	elog "lvm volumes are no longer automatically created for"
	elog "baselayout-2 users. If you are using baselayout-2, be sure to"
	elog "run: # rc-update add lvm boot"
	elog "Do NOT add it if you are still using baselayout-1."
}

src_test() {
	einfo "Testcases disabled because of device-node mucking"
	einfo "If you want them, compile the package and see ${S}/tests"
}
Comment 6 Hanfei Shen 2012-12-11 05:24:55 UTC
the one I setup a vm with:

gentoo@gentoo ~ $ cat /usr/portage/sys-fs/lvm2/lvm2-2.02.88.ebuild 
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/lvm2-2.02.88.ebuild,v 1.14 2012/11/28 10:55:33 ssuominen Exp $

EAPI=3
inherit eutils multilib toolchain-funcs autotools linux-info

DESCRIPTION="User-land utilities for LVM2 (device-mapper) software."
HOMEPAGE="http://sources.redhat.com/lvm2/"
SRC_URI="ftp://sources.redhat.com/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
		 ftp://sources.redhat.com/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~x86-linux"

IUSE="readline +static +static-libs clvm cman +lvm1 selinux"

DEPEND_COMMON="!!sys-fs/device-mapper
	readline? ( sys-libs/readline )
	clvm? ( =sys-cluster/dlm-2*
			cman? ( =sys-cluster/cman-2* ) )
	virtual/udev"

RDEPEND="${DEPEND_COMMON}
	!<sys-apps/openrc-0.4
	!!sys-fs/lvm-user
	!!sys-fs/clvm
	>=sys-apps/util-linux-2.16"

# Upgrading to this LVM will break older cryptsetup
RDEPEND="${RDEPEND}
		!<sys-fs/cryptsetup-1.1.2"

DEPEND="${DEPEND_COMMON}
		virtual/pkgconfig
		>=sys-devel/binutils-2.20.1-r1"

S="${WORKDIR}/${PN/lvm/LVM}.${PV}"

pkg_setup() {
	local CONFIG_CHECK="~SYSVIPC"
	local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
	check_extra_config
	# 1. Genkernel no longer copies /sbin/lvm blindly.
	# 2. There are no longer any linking deps in /usr.
	if use static; then
		elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
		elog "their static versions. If you need the static binaries,"
		elog "you must append .static to the filename!"
	fi
}

src_unpack() {
	unpack ${A}
}

src_prepare() {
	epatch "${FILESDIR}"/lvm.conf-2.02.67.patch

	# Should not be needed due to upstream re-arrangement of build
	#epatch "${FILESDIR}"/${PN}-2.02.56-dmeventd.patch
	# Should not be need with new upstream udev rules
	#epatch "${FILESDIR}"/${PN}-2.02.56-device-mapper-export-format.patch

	# Merged upstream:
	#epatch "${FILESDIR}"/${PN}-2.02.51-as-needed.patch
	# Merged upstream:
	#epatch "${FILESDIR}"/${PN}-2.02.48-fix-pkgconfig.patch
	# Merged upstream:
	#epatch "${FILESDIR}"/${PN}-2.02.51-fix-pvcreate.patch
	# Fixed differently upstream:
	#epatch "${FILESDIR}"/${PN}-2.02.51-dmsetup-selinux-linking-fix-r3.patch

	epatch "${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
	epatch "${FILESDIR}"/lvm2-2.02.56-lvm2create_initrd.patch
	# bug 318513
	epatch "${FILESDIR}"/${PN}-2.02.64-dmeventd-libs.patch
	# bug 301331
	epatch "${FILESDIR}"/${PN}-2.02.67-createinitrd.patch
	# bug 330373
	epatch "${FILESDIR}"/${PN}-2.02.73-locale-muck.patch
	# --as-needed
	epatch "${FILESDIR}"/${PN}-2.02.70-asneeded.patch
	# bug 332905
	epatch "${FILESDIR}"/${PN}-2.02.72-dynamic-static-ldflags.patch
	# bug 361429 - merged upstream in .85
	#epatch "${FILESDIR}"/${PN}-2.02.84-udev-pkgconfig.patch

	# Merged upstream
	#epatch "${FILESDIR}"/${PN}-2.02.73-asneeded.patch

	epatch "${FILESDIR}"/${PN}-2.02.88-respect-cc.patch

	eautoreconf
}

src_configure() {
	local myconf
	local buildmode

	myconf="${myconf} --enable-dmeventd"
	myconf="${myconf} --enable-cmdlib"
	myconf="${myconf} --enable-applib"
	myconf="${myconf} --enable-fsadm"

	# Most of this package does weird stuff.
	# The build options are tristate, and --without is NOT supported
	# options: 'none', 'internal', 'shared'
	if use static ; then
		einfo "Building static LVM, for usage inside genkernel"
		buildmode="internal"
		# This only causes the .static versions to become available
		# For recent systems, there are no linkages against anything in /usr anyway.
		# We explicitly provide the .static versions so that they can be included in
		# initramfs environments.
		myconf="${myconf} --enable-static_link"
	else
		ewarn "Building shared LVM, it will not work inside genkernel!"
		buildmode="shared"
	fi

	# dmeventd requires mirrors to be internal, and snapshot available
	# so we cannot disable them
	myconf="${myconf} --with-mirrors=internal"
	myconf="${myconf} --with-snapshots=internal"

	if use lvm1 ; then
		myconf="${myconf} --with-lvm1=${buildmode}"
	else
		myconf="${myconf} --with-lvm1=none"
	fi

	# disable O_DIRECT support on hppa, breaks pv detection (#99532)
	use hppa && myconf="${myconf} --disable-o_direct"

	if use clvm; then
		myconf="${myconf} --with-cluster=${buildmode}"
		# 4-state! Make sure we get it right, per bug 210879
		# Valid options are: none, cman, gulm, all
		#
		# 2009/02:
		# gulm is removed now, now dual-state:
		# cman, none
		# all still exists, but is not needed
		#
		# 2009/07:
		# TODO: add corosync and re-enable ALL
		local clvmd=""
		use cman && clvmd="cman"
		#clvmd="${clvmd/cmangulm/all}"
		[ -z "${clvmd}" ] && clvmd="none"
		myconf="${myconf} --with-clvmd=${clvmd}"
		myconf="${myconf} --with-pool=${buildmode}"
	else
		myconf="${myconf} --with-clvmd=none --with-cluster=none"
	fi

	myconf="${myconf}
			--with-dmeventd-path=/sbin/dmeventd"
	econf $(use_enable readline) \
		$(use_enable selinux) \
		--enable-pkgconfig \
		--with-confdir="${EPREFIX}/etc" \
		--sbindir="${EPREFIX}/sbin" \
		--with-staticdir="${EPREFIX}/sbin" \
		--libdir="${EPREFIX}/$(get_libdir)" \
		--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
		--enable-udev_rules \
		--enable-udev_sync \
		--with-udevdir="${EPREFIX}/lib/udev/rules.d/" \
		${myconf} \
		CLDFLAGS="${LDFLAGS}" || die
}

src_compile() {
	einfo "Doing symlinks"
	pushd include
	emake || die "Failed to prepare symlinks"
	popd

	einfo "Starting main build"
	emake || die "compile fail"
}

src_install() {
	emake DESTDIR="${D}" install || die "Failed to emake install"

	dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{conf,c,txt}
	insinto /$(get_libdir)/rcscripts/addons
	newins "${FILESDIR}"/lvm2-start.sh-2.02.67-r1 lvm-start.sh || die
	newins "${FILESDIR}"/lvm2-stop.sh-2.02.67-r1 lvm-stop.sh || die
	newinitd "${FILESDIR}"/lvm.rc-2.02.67-r1 lvm || die
	newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.67-r2 lvm-monitoring || die
	newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm || die
	if use clvm; then
		newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd || die
		newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd || die
	fi

	# move shared libs to /lib(64)
	if use static-libs; then
		dolib.a libdm/ioctl/libdevmapper.a || die "dolib.a libdevmapper.a"
		#gen_usr_ldscript libdevmapper.so
	fi

	dosbin "${S}"/scripts/lvm2create_initrd/lvm2create_initrd
	doman  "${S}"/scripts/lvm2create_initrd/lvm2create_initrd.8
	newdoc "${S}"/scripts/lvm2create_initrd/README README.lvm2create_initrd

	insinto /etc
	doins "${FILESDIR}"/dmtab
	insinto /$(get_libdir)/rcscripts/addons
	doins "${FILESDIR}"/dm-start.sh

	# Device mapper stuff
	newinitd "${FILESDIR}"/device-mapper.rc-2.02.67-r1 device-mapper || die
	newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper || die

	newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd || die
	if use static-libs; then
		dolib.a daemons/dmeventd/libdevmapper-event.a \
		|| die "dolib.a libdevmapper-event.a"
		#gen_usr_ldscript libdevmapper-event.so
	fi

	use static-libs || \
	rm -f "${D}"/usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a

	#insinto /etc/udev/rules.d/
	#newins "${FILESDIR}"/64-device-mapper.rules-2.02.56-r3 64-device-mapper.rules || die

	# do not rely on /lib -> /libXX link
	sed -e "s-/lib/rcscripts/-/$(get_libdir)/rcscripts/-" -i "${ED}"/etc/init.d/*

	elog "USE flag nocman is deprecated and replaced"
	elog "with the cman USE flag."
	elog ""
	elog "USE flags clvm and cman are masked"
	elog "by default and need to be unmasked to be used"
	elog ""
	elog "If you are using genkernel and root-on-LVM, rebuild the initramfs."
}

pkg_postinst() {
	elog "lvm volumes are no longer automatically created for"
	elog "baselayout-2 users. If you are using baselayout-2, be sure to"
	elog "run: # rc-update add lvm boot"
	elog "Do NOT add it if you are still using baselayout-1."
}

src_test() {
	einfo "Testcases disabled because of device-node mucking"
	einfo "If you want them, compile the package and see ${S}/tests"
}
Comment 7 Hanfei Shen 2012-12-11 07:30:56 UTC
emerge --sync again

fixed.

Thanks Ian Stakenvicius.