sys-apps/lsb-release: Import from Gentoo

We have previously avoided this package because its /etc/lsb-release
clashes with the symlink created by our sys-apps/baselayout. This has
led to the need to fork some packages, such as dev-lang/rust, just to
avoid the dependency.

Instead, we can just stop it from installing /etc/lsb-release with
INSTALL_MASK. I also considered having it create the symlink instead of
baselayout, but baselayout has the tmpfiles.d handling, so this is
simpler.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This commit is contained in:
James Le Cuirot 2024-07-23 08:51:31 +01:00
parent 1d141f67c0
commit b88b31acb9
No known key found for this signature in database
GPG Key ID: 1226415D00DD3137
8 changed files with 168 additions and 0 deletions

View File

@ -565,6 +565,7 @@ sys-apps/kexec-tools
sys-apps/kmod
sys-apps/less
sys-apps/locale-gen
sys-apps/lsb-release
sys-apps/lshw
sys-apps/makedev
sys-apps/man-db

View File

@ -0,0 +1 @@
INSTALL_MASK+=" /etc/lsb-release"

View File

@ -0,0 +1,3 @@
DIST lsb-release-1.4.tar.gz 10769 BLAKE2B d6c71d6604481a637f63fae00742ba77421345b36234fcfcae1da98bc1c80a8450bc569c2ea2f4b1c3a852de2fe24413fe397d4a60a0ca94eb70a9626871f4bb SHA512 84f6f8794380463587005043f601b7a40190cd9e3409abff7f5ce7658cf029a14346eff87838296d90307192bdeff68cc00480c5c04814da7acdb3e220640fde
DIST lsb-release-3.2.tar.gz 16246 BLAKE2B f790b52c403ff42ec1bf787100c6c9715b7bebf3feb1772a6c4caee40b09c121ba7522553d145c478c752b196109747e31b2d8c14764c67c4a7e57fbae06348d SHA512 5ccc2f38c3603b8261310d5f30d8304a95bd6c24fbbf00484609078839a68894b2ba761a7465fc3c22f55dd69d67612d3cc4cb453765e3eea6b9af96834d85fd
DIST lsb-release-3.3.tar.gz 16364 BLAKE2B 91b53df571ebebae67ea2fc5f1f31a11a42166d4a584f5a236cee2a108e965d02b676c7be175239b616e42bc454bcff86485896191522ce5d0c7744f7178a636 SHA512 123291295000d4ce827c692a9ab5ebe300a61cb1dabf9af8bfffdd5f20363159e61a98670aac37ae087aa3639b4ec7dfdb5528aa8c3520f43225e9eae50270db

View File

@ -0,0 +1,10 @@
--- a/lsb_release
+++ b/lsb_release
@@ -250,6 +250,7 @@
CHECKFIRST=$(find $INFO_ROOT/ -maxdepth 1 \
-name \*$INFO_DISTRIB_SUFFIX \
-and ! -name $INFO_LSB_FILE \
+ -and ! -name os-release \
-and -type f \
2>/dev/null \
| head -1 ) # keep one of the files found (if many)

View File

@ -0,0 +1,50 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit prefix
DESCRIPTION="LSB version query program"
HOMEPAGE="https://wiki.linuxfoundation.org/lsb/"
SRC_URI="https://downloads.sourceforge.net/lsb/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
# Perl isn't needed at runtime, it is just used to generate the man page.
BDEPEND="dev-lang/perl"
PATCHES=(
"${FILESDIR}"/${P}-os-release.patch # bug 443116
)
src_prepare() {
default
# use POSIX 'printf' instead of bash 'echo -e', bug #482370
sed -i \
-e "s:echo -e:printf '%b\\\n':g" \
-e 's:--long:-l:g' \
lsb_release || die
hprefixify lsb_release
}
src_install() {
emake \
prefix="${ED}/usr" \
mandir="${ED}/usr/share/man" \
install
# installs gz compressed manpage, https://bugs.gentoo.org/729140
rm "${ED}/usr/share/man/man1/lsb_release.1.gz" || die
gunzip lsb_release.1.gz
doman lsb_release.1
dodir /etc
cat > "${ED}/etc/lsb-release" <<- EOF || die
DISTRIB_ID="Gentoo"
EOF
}

View File

@ -0,0 +1,41 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit prefix
DESCRIPTION="LSB version query program"
HOMEPAGE="https://wiki.linuxfoundation.org/lsb/"
# https://downloads.sourceforge.net/lsb/${P}.tar.gz
SRC_URI="https://github.com/thkukuk/lsb-release_os-release/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/${PN}_os-release-${PV}
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
# Perl isn't needed at runtime, it is just used to generate the man page.
BDEPEND="dev-lang/perl"
src_prepare() {
default
# Use POSIX 'printf' instead of bash 'echo -e', bug #482370
sed -i \
-e "s:echo -e:printf '%b\\\n':g" \
-e 's:--long:-l:g' \
lsb_release || die
# TODO: unbundle help2man?
hprefixify lsb_release help2man
}
src_install() {
emake prefix="${ED}"/usr install
dodir /etc
cat > "${ED}"/etc/lsb-release <<- EOF || die
DISTRIB_ID="Gentoo"
EOF
}

View File

@ -0,0 +1,39 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit prefix
DESCRIPTION="LSB version query program"
HOMEPAGE="https://wiki.linuxfoundation.org/lsb/"
# https://downloads.sourceforge.net/lsb/${P}.tar.gz
SRC_URI="https://github.com/thkukuk/lsb-release_os-release/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/${PN}_os-release-${PV}
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
# Perl isn't needed at runtime, it is just used to generate the man page via
# bundled sys-apps/help2man.
BDEPEND="dev-lang/perl"
src_prepare() {
default
# POSIX compat
sed -i -e 's:--long:-l:g' lsb_release || die
# TODO: unbundle help2man?
hprefixify lsb_release help2man
}
src_install() {
emake prefix="${ED}"/usr install
insinto /etc
newins - lsb-release <<-EOF
DISTRIB_ID="Gentoo"
EOF
}

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>base-system@gentoo.org</email>
<name>Gentoo Base System</name>
</maintainer>
<longdescription lang="en">
This program forms part of the required functionality of
the LSB (Linux Standard Base) specification.
The program queries the installed state of the distribution
to display certain properties such as the version of the
LSB against which the distribution claims compliance as
well. It can also attempt to display the name and release
of the distribution along with an identifier of who produces
the distribution.
</longdescription>
<upstream>
<remote-id type="sourceforge">lsb</remote-id>
<remote-id type="github">thkukuk/lsb-release_os-release</remote-id>
</upstream>
</pkgmetadata>