From f771cbb67294107d4f320a8f188acc021ff248ef Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Wed, 29 Jun 2016 09:19:00 +0200 Subject: [PATCH] [dev-python/python-blivet] add support for /etc/sabayon-release --- ...port-for-parsing-etc-sabayon-release.patch | 54 +++++++++++++++++++ .../python-blivet/python-blivet-1.0.10.ebuild | 1 + 2 files changed, 55 insertions(+) create mode 100644 dev-python/python-blivet/files/1.0/0004-Add-support-for-parsing-etc-sabayon-release.patch diff --git a/dev-python/python-blivet/files/1.0/0004-Add-support-for-parsing-etc-sabayon-release.patch b/dev-python/python-blivet/files/1.0/0004-Add-support-for-parsing-etc-sabayon-release.patch new file mode 100644 index 000000000..256cef7bc --- /dev/null +++ b/dev-python/python-blivet/files/1.0/0004-Add-support-for-parsing-etc-sabayon-release.patch @@ -0,0 +1,54 @@ +From a02bdea93c25139effd7fa755b288c25f7226e35 Mon Sep 17 00:00:00 2001 +From: Fabio Erculiani +Date: Wed, 29 Jun 2016 09:17:36 +0200 +Subject: [PATCH 4/4] Add support for parsing /etc/sabayon-release + +--- + blivet/osinstall.py | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/blivet/osinstall.py b/blivet/osinstall.py +index a2b1895..d198f77 100644 +--- a/blivet/osinstall.py ++++ b/blivet/osinstall.py +@@ -106,6 +106,25 @@ def releaseFromOsRelease(fn): + + return (relName, relVer) + ++def releaseFromSabayonRelease(fn): ++ """ ++ Attempt to identify the installation of a Linux distribution via ++ /etc/sabayon-release. This file must already have been verified to exist ++ and be readable. ++ ++ :param fn: an open filehandle on /etc/sabayon-release ++ :type fn: filehandle ++ :returns: The distribution's name and version, or None for either or both ++ if they cannot be determined ++ :rtype: (string, string) ++ """ ++ with open(fn, "r") as f: ++ rellist = f.readline().split() ++ relVer = rellist[-1] ++ relName = rellist[0] ++ ++ return (relName, relVer) ++ + def getReleaseString(): + """ + Attempt to identify the installation of a Linux distribution by checking +@@ -125,8 +144,11 @@ def getReleaseString(): + relArch = None + + filename = "%s/etc/redhat-release" % getSysroot() ++ sabayon_filename = "%s/etc/sabayon-release" % getSysroot() + if os.access(filename, os.R_OK): + (relName, relVer) = releaseFromRedhatRelease(filename) ++ elif os.access(sabayon_filename, os.R_OK): ++ (relName, relVer) = releaseFromSabayonRelease(sabayon_filename) + else: + filename = "%s/etc/os-release" % getSysroot() + if os.access(filename, os.R_OK): +-- +2.7.4 + diff --git a/dev-python/python-blivet/python-blivet-1.0.10.ebuild b/dev-python/python-blivet/python-blivet-1.0.10.ebuild index 1a7f77459..9378e48c3 100644 --- a/dev-python/python-blivet/python-blivet-1.0.10.ebuild +++ b/dev-python/python-blivet/python-blivet-1.0.10.ebuild @@ -45,6 +45,7 @@ src_prepare() { epatch "${FILESDIR}/1.0/0001-Update-package-names-to-reflect-Gentoo-ones.patch" epatch "${FILESDIR}/1.0/0002-devices-enable-UUID-for-dm-based-devices-in-fstab.patch" epatch "${FILESDIR}/1.0/0003-Call-udev.settle-when-committing-to-disk.patch" + epatch "${FILESDIR}/1.0/0004-Add-support-for-parsing-etc-sabayon-release.patch" distutils_src_prepare }