Merge pull request #307 from marineam/parttype

add(sys-apps/util-linux): Add patched util-linux to support PARTTYPE
This commit is contained in:
Michael Marineau 2014-01-20 11:44:55 -08:00
commit 32a45fcd01
6 changed files with 239 additions and 1 deletions

View File

@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_COMMIT="48df5752fe930646dfb85c22e9c80df6cf55225c"
CROS_WORKON_COMMIT="ca5a891a95a5c300e85fe6899a5297b91f476eb4"
CROS_WORKON_PROJECT="coreos/vboot_reference"
CROS_WORKON_REPO="git://github.com"
CROS_WORKON_LOCALDIR="src/platform"

View File

@ -0,0 +1 @@
DIST util-linux-2.23.2.tar.xz 3383052 SHA256 7c4042bd91f621250d7b3b2f34e3b11921a32c7f080c149dcc0c7ce62a8a7cac SHA512 dcccf8e3a3892a2ac98eea0a7e1c24c1b612ef10b466a8b34d8ebe6c2d49778bc9e8bfb1866ce0daa6db387396659120c290c5b36f47864c4d513b5ed15f9618 WHIRLPOOL 525d1043b985fc8238a023caf79c5ebf8f105e9e2c3730b70f19f2e8e0ecbf4984ab6a6a1a6edc2bb41f0b2067e6a788a0c5fb41ad00e84bf0c1bfd5b53cf7f6

View File

@ -0,0 +1,30 @@
From 55d8ed5295f09c73403dd2c09bc56fad9343af17 Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Tue, 14 Jan 2014 13:06:43 -0800
Subject: [PATCH 1/2] libblkid: add PARTTYPE tag
Add PARTTYPE to make searching for devices partition possible without
dropping to the low-level probe API and searching all devices by
PART_ENTRY_TYPE. For example to find any 'EFI System Partition' devices:
$ blkid -t PARTTYPE=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
---
libblkid/src/verify.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libblkid/src/verify.c b/libblkid/src/verify.c
index 1c0ca0f..eac613e 100644
--- a/libblkid/src/verify.c
+++ b/libblkid/src/verify.c
@@ -38,6 +38,8 @@ static void blkid_probe_to_tags(blkid_probe pr, blkid_dev dev)
blkid_set_tag(dev, "PARTUUID", data, len);
else if (strcmp(name, "PART_ENTRY_NAME") == 0)
blkid_set_tag(dev, "PARTLABEL", data, len);
+ else if (strcmp(name, "PART_ENTRY_TYPE") == 0)
+ blkid_set_tag(dev, "PARTTYPE", data, len);
} else if (!strstr(name, "_ID")) {
/* superblock UUID, LABEL, ...
--
1.8.3.2

View File

@ -0,0 +1,79 @@
From e317d6c10d773519489794752ab0dcad1e65763e Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Tue, 14 Jan 2014 13:07:07 -0800
Subject: [PATCH 2/2] lsblk: add PARTTYPE tag
To stay in sync with blkid add PARTTYPE as an available output column.
---
misc-utils/lsblk.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 9b53be3..7061531 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -71,6 +71,7 @@ enum {
COL_TARGET,
COL_LABEL,
COL_UUID,
+ COL_PARTTYPE,
COL_PARTLABEL,
COL_PARTUUID,
COL_RA,
@@ -125,6 +126,7 @@ static struct colinfo infos[] = {
[COL_LABEL] = { "LABEL", 0.1, 0, N_("filesystem LABEL") },
[COL_UUID] = { "UUID", 36, 0, N_("filesystem UUID") },
+ [COL_PARTTYPE] = { "PARTTYPE", 36, 0, N_("partition type UUID") },
[COL_PARTLABEL] = { "PARTLABEL", 0.1, 0, N_("partition LABEL") },
[COL_PARTUUID] = { "PARTUUID", 36, 0, N_("partition UUID") },
@@ -208,6 +210,7 @@ struct blkdev_cxt {
char *fstype; /* detected fs, NULL or "?" if cannot detect */
char *uuid; /* filesystem UUID (or stack uuid) */
char *label; /* filesystem label */
+ char *parttype; /* partiton type UUID */
char *partuuid; /* partition UUID */
char *partlabel; /* partiton label */
char *wwn; /* storage WWN */
@@ -291,6 +294,7 @@ static void reset_blkdev_cxt(struct blkdev_cxt *cxt)
free(cxt->fstype);
free(cxt->uuid);
free(cxt->label);
+ free(cxt->parttype);
free(cxt->partuuid);
free(cxt->partlabel);
free(cxt->wwn);
@@ -441,6 +445,8 @@ static int get_udev_properties(struct blkdev_cxt *cxt)
}
if ((data = udev_device_get_property_value(dev, "ID_FS_TYPE")))
cxt->fstype = xstrdup(data);
+ if ((data = udev_device_get_property_value(dev, "ID_PART_ENTRY_TYPE")))
+ cxt->parttype = xstrdup(data);
if ((data = udev_device_get_property_value(dev, "ID_PART_ENTRY_UUID")))
cxt->partuuid = xstrdup(data);
if ((data = udev_device_get_property_value(dev, "ID_WWN")))
@@ -496,6 +502,8 @@ static void probe_device(struct blkdev_cxt *cxt)
cxt->uuid = xstrdup(data);
if (!blkid_probe_lookup_value(pr, "LABEL", &data, NULL))
cxt->label = xstrdup(data);
+ if (!blkid_probe_lookup_value(pr, "PART_ENTRY_TYPE", &data, NULL))
+ cxt->parttype = xstrdup(data);
if (!blkid_probe_lookup_value(pr, "PART_ENTRY_UUID", &data, NULL))
cxt->partuuid = xstrdup(data);
if (!blkid_probe_lookup_value(pr, "PART_ENTRY_NAME", &data, NULL))
@@ -752,6 +760,11 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
if (cxt->uuid)
tt_line_set_data(ln, col, xstrdup(cxt->uuid));
break;
+ case COL_PARTTYPE:
+ probe_device(cxt);
+ if (cxt->parttype)
+ tt_line_set_data(ln, col, xstrdup(cxt->parttype));
+ break;
case COL_PARTLABEL:
probe_device(cxt);
if (!cxt->partlabel)
--
1.8.3.2

View File

@ -0,0 +1,128 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/util-linux-2.23.2-r2.ebuild,v 1.1 2013/09/29 01:41:58 vapier Exp $
EAPI="4"
inherit eutils toolchain-funcs libtool flag-o-matic bash-completion-r1
MY_PV=${PV/_/-}
MY_P=${PN}-${MY_PV}
if [[ ${PV} == 9999 ]] ; then
inherit git-2 autotools
EGIT_REPO_URI="git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git"
else
KEYWORDS="amd64"
SRC_URI="mirror://kernel/linux/utils/util-linux/v${PV:0:4}/${MY_P}.tar.xz"
fi
DESCRIPTION="Various useful Linux utilities"
HOMEPAGE="http://www.kernel.org/pub/linux/utils/util-linux/"
LICENSE="GPL-2 GPL-3 LGPL-2.1 BSD-4 MIT public-domain"
SLOT="0"
IUSE="bash-completion caps +cramfs cytune fdformat ncurses nls old-linux pam selinux slang static-libs +suid test tty-helpers udev unicode"
RDEPEND="!sys-process/schedutils
!sys-apps/setarch
!<sys-apps/sysvinit-2.88-r5
!sys-block/eject
!<sys-libs/e2fsprogs-libs-1.41.8
!<sys-fs/e2fsprogs-1.41.8
!<app-shells/bash-completion-1.3-r2
caps? ( sys-libs/libcap-ng )
cramfs? ( sys-libs/zlib )
ncurses? ( >=sys-libs/ncurses-5.2-r2 )
pam? ( sys-libs/pam )
selinux? ( sys-libs/libselinux )
slang? ( sys-libs/slang )
udev? ( virtual/udev )"
DEPEND="${RDEPEND}
virtual/pkgconfig
nls? ( sys-devel/gettext )
test? ( sys-devel/bc )
virtual/os-headers"
S=${WORKDIR}/${MY_P}
src_prepare() {
epatch "${FILESDIR}/0001-libblkid-add-PARTTYPE-tag.patch"
epatch "${FILESDIR}/0002-lsblk-add-PARTTYPE-tag.patch"
if [[ ${PV} == 9999 ]] ; then
po/update-potfiles
eautoreconf
fi
elibtoolize
}
lfs_fallocate_test() {
# Make sure we can use fallocate with LFS #300307
cat <<-EOF > "${T}"/fallocate.c
#define _GNU_SOURCE
#include <fcntl.h>
main() { return fallocate(0, 0, 0, 0); }
EOF
append-lfs-flags
$(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} "${T}"/fallocate.c -o /dev/null >/dev/null 2>&1 \
|| export ac_cv_func_fallocate=no
rm -f "${T}"/fallocate.c
}
src_configure() {
lfs_fallocate_test
export ac_cv_header_security_pam_misc_h=$(usex pam) #485486
econf \
--enable-fs-paths-extra=/usr/sbin:/bin:/usr/bin \
$(use_enable nls) \
--enable-agetty \
--with-bashcompletiondir="$(get_bashcompdir)" \
$(use_enable bash-completion) \
$(use_enable caps setpriv) \
$(use_enable cramfs) \
$(use_enable cytune) \
$(use_enable fdformat) \
$(use_enable old-linux elvtune) \
--with-ncurses=$(usex ncurses $(usex unicode auto yes) no) \
--disable-kill \
--disable-last \
--disable-login \
$(use_enable tty-helpers mesg) \
--enable-partx \
--enable-raw \
--enable-rename \
--disable-reset \
--enable-schedutils \
--disable-su \
$(use_enable tty-helpers wall) \
$(use_enable tty-helpers write) \
$(use_enable suid makeinstall-chown) \
$(use_enable suid makeinstall-setuid) \
$(use_with selinux) \
$(use_with slang) \
$(use_enable static-libs static) \
$(use_with udev) \
$(tc-has-tls || echo --disable-tls)
}
src_install() {
default
dodoc AUTHORS NEWS README* Documentation/{TODO,*.txt,releases/*}
# need the libs in /
gen_usr_ldscript -a blkid mount uuid
# e2fsprogs-libs didnt install .la files, and .pc work fine
prune_libtool_files
}
pkg_postinst() {
if ! use tty-helpers; then
elog "The mesg/wall/write tools have been disabled due to USE=-tty-helpers."
fi
if [[ -z ${REPLACING_VERSIONS} ]]; then
elog "The agetty util now clears the terminal by default. You"
elog "might want to add --noclear to your /etc/inittab lines."
fi
}