sys-fs/lxcfs: new package

It's from Gentoo commit 91137d52c4f6307b512c6f447236bc75e8f8b3ec.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
This commit is contained in:
Mathieu Tortuyaux 2025-05-14 17:18:55 +02:00
parent c9c1f6f437
commit ce43c81f6d
No known key found for this signature in database
GPG Key ID: AC5CCFB52545D9B8
9 changed files with 345 additions and 0 deletions

View File

@ -0,0 +1,6 @@
DIST lxcfs-5.0.4.tar.gz 104249 BLAKE2B 83a7b861136c34da8a24dd525fd0767193f2bbd92b40e3b9fd5e42d7645465411792e65e95797ab13b33330299d12b19bdd5786352875ed88ac0097b72b711a9 SHA512 b404045dbabe23e1d1f1d74c1648d2596bb70aaa9f9e46f9f5635b0a02d0c451f68b2559920bbefc5b889e908cf1da0a33c148b26bdce3e45c3d0cbdff710604
DIST lxcfs-5.0.4.tar.gz.asc 833 BLAKE2B aff883d24b374b296ea3678670e5e82c723fd0e35cfd7fed555aabbd811a104becc0b741331b4aa4a5129c9fff4dc88c6a86e7d64a89fe86aea81718f5d432dd SHA512 56b639597dbaf3008fe030147ea37192bd465c467a79e11ce139bcaa6bca1625b4bb9c4eda6ea1877446769f0fad9b4c5a3513d4f4415b841db96d5da8325ddc
DIST lxcfs-6.0.3.tar.gz 106684 BLAKE2B 358033df95b52c6b04f5f622eb89e1f62f4f86098d9478b2643c83c3b62c5a6d1429c34b37b7d6241b522ec1d0ec8f8922c01a990cfb75b0b022b00720ded1d3 SHA512 c32941ccdba5906f5542b393077ea6cad9d5cd83eab38692c22614c19fec4f0fe95d3428ae7a49f6e9e9e1879db3479a2a09f37755d2c45c8230b099986eec2d
DIST lxcfs-6.0.3.tar.gz.asc 833 BLAKE2B 202b5539f5d4621e0d2071aaa861976af801a6c5c49bf921acd9015923bf8201178273aa79d7b69b51d7fa1abb0112a4960452e86d7d340b752b2f8d4bb2c559 SHA512 dd27747d56cddb6e0057232a9a451f5d08d812aa73fe70633d31ce38d650dcbdda3e6f195aad3d591dd4ba3ad7cdf658b0bb1ce55b660d26d315ad598d44a74e
DIST lxcfs-6.0.4.tar.gz 106751 BLAKE2B 4f05cb5e31ed1f313eeb42ac7cc9e68031011af363992e9d15266d7c831fb83078821a42181142cb58418dc87b6ae71ccd79559e0c77c19b5810cb2f5dde98ab SHA512 27e27dd14e3ab6d6f33b78f3316d1d15ccdb5af76fd3631770fe8ff4e1d1a3cc6d7a8009a604660fccc63e4fa5f1601c6505f66ab76c11dcfcddd3baf7ff173b
DIST lxcfs-6.0.4.tar.gz.asc 833 BLAKE2B 71d552694273e6b3fbeaa4fd2a07ad783ca66824fa7fef69ba79a343b65e57295a702efe580c17e77c6fdb3f79364e98206a099ef3ac99b1d1238178cd343e20 SHA512 fecc002f39f841f3ffbfd7c543cdfed61b9276e962a75230b2962a36bbef04f5444481bb1409ba38ed8f619d0887313f1cc84389f64755d6168c017f68bbaeb2

View File

@ -0,0 +1,8 @@
# /etc/conf.d/lxcfs: config file for /etc/init.d/lxcfs
# lxcfs options:
# -l == calculate container load average instead of displaying host load average
# -u == don't display swap usage to containers
LXCFS_OPTS="-l -u"
LXCFS_PATH="/var/lib/lxcfs"

View File

@ -0,0 +1,27 @@
#!/sbin/openrc-run
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
DAEMON=/usr/bin/lxcfs
PIDFILE=/run/lxcfs.pid
start() {
ebegin "Starting lxcfs."
/sbin/modprobe -q fuse
install -d "${LXCFS_PATH}"
start-stop-daemon --start \
--pidfile ${PIDFILE} \
--exec ${DAEMON} \
--background \
--make-pidfile \
-- ${LXCFS_OPTS} \
"${LXCFS_PATH}"
eend ${?}
}
stop() {
ebegin "Stopping lxcfs."
/usr/bin/fusermount3 -u "${LXCFS_PATH}"
start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE}
eend ${?}
}

View File

@ -0,0 +1,18 @@
[Unit]
Description=FUSE filesystem for LXC
ConditionVirtualization=!container
Before=lxc.service
Documentation=man:lxcfs(1)
[Service]
ExecStartPre=/sbin/modprobe -q fuse
ExecStartPre=install -d /var/lib/lxcfs
ExecStart=/usr/bin/lxcfs /var/lib/lxcfs
KillMode=process
Restart=on-failure
ExecStopPost=-/usr/bin/fusermount3 -u /var/lib/lxcfs
Delegate=yes
ExecReload=/bin/kill -USR1 ${MAINPID}
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,19 @@
Bug: https://bugs.gentoo.org/894348
Upstream PR: https://github.com/lxc/lxcfs/pull/610
--- a/src/proc_loadavg.c
+++ b/src/proc_loadavg.c
@@ -603,12 +603,12 @@ pthread_t load_daemon(int load_use)
ret = init_load();
if (ret == -1)
- return log_error(0, "Initialize hash_table fails in load_daemon!");
+ return (pthread_t) log_error(0, "Initialize hash_table fails in load_daemon!");
ret = pthread_create(&pid, NULL, load_begin, NULL);
if (ret != 0) {
load_free();
- return log_error(0, "Create pthread fails in load_daemon!");
+ return (pthread_t) log_error(0, "Create pthread fails in load_daemon!");
}
/* use loadavg, here loadavg = 1*/

View File

@ -0,0 +1,84 @@
# Copyright 2022-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
inherit cmake meson python-any-r1 systemd verify-sig
DESCRIPTION="FUSE filesystem for LXC"
HOMEPAGE="https://linuxcontainers.org/lxcfs/introduction/ https://github.com/lxc/lxcfs/"
SRC_URI="https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz
verify-sig? ( https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz.asc )"
LICENSE="Apache-2.0 LGPL-2+"
SLOT="0"
KEYWORDS="amd64 ~arm64 ~riscv ~x86"
IUSE="doc test"
DEPEND="sys-fs/fuse:3="
RDEPEND="${DEPEND}"
BDEPEND="${PYTHON_DEPS}
virtual/pkgconfig
$(python_gen_any_dep '
dev-python/jinja2[${PYTHON_USEDEP}]
')
doc? ( sys-apps/help2man )
verify-sig? ( sec-keys/openpgp-keys-linuxcontainers )"
# Needs some black magic to work inside container/chroot.
RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/linuxcontainers.asc
PATCHES=(
"${FILESDIR}"/${PN}-5.0.4-fix-incompatible-pointer-conversion.patch
)
python_check_deps() {
python_has_version -b "dev-python/jinja2[${PYTHON_USEDEP}]"
}
pkg_setup() {
python-any-r1_pkg_setup
}
src_prepare() {
default
# Fix python shebangs for python-exec[-native-symlinks], #851480
local shebangs=($(grep -rl "#!/usr/bin/env python3" || die))
python_fix_shebang -q ${shebangs[*]}
}
src_configure() {
local emesonargs=(
--localstatedir "${EPREFIX}/var"
$(meson_use doc docs)
$(meson_use test tests)
-Dfuse-version=3
-Dinit-script=""
-Dwith-init-script=""
)
meson_src_configure
}
src_test() {
cd "${BUILD_DIR}"/tests || die "failed to change into tests/ directory."
./main.sh || die
}
src_install() {
meson_src_install
newconfd "${FILESDIR}"/lxcfs-5.0.2.confd lxcfs
newinitd "${FILESDIR}"/lxcfs-5.0.2.initd lxcfs
# Provide our own service file (copy of upstream) due to paths being different from upstream,
# #728470
systemd_newunit "${FILESDIR}"/lxcfs-5.0.2.service lxcfs.service
}

View File

@ -0,0 +1,80 @@
# Copyright 2022-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
inherit cmake meson python-any-r1 systemd verify-sig
DESCRIPTION="FUSE filesystem for LXC"
HOMEPAGE="https://linuxcontainers.org/lxcfs/introduction/ https://github.com/lxc/lxcfs/"
SRC_URI="https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz
verify-sig? ( https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz.asc )"
LICENSE="Apache-2.0 LGPL-2+"
SLOT="0"
KEYWORDS="amd64 ~arm64 ~riscv ~x86"
IUSE="doc test"
DEPEND="sys-fs/fuse:3="
RDEPEND="${DEPEND}"
BDEPEND="${PYTHON_DEPS}
virtual/pkgconfig
$(python_gen_any_dep '
dev-python/jinja2[${PYTHON_USEDEP}]
')
doc? ( sys-apps/help2man )
verify-sig? ( sec-keys/openpgp-keys-linuxcontainers )"
# Needs some black magic to work inside container/chroot.
RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/linuxcontainers.asc
python_check_deps() {
python_has_version -b "dev-python/jinja2[${PYTHON_USEDEP}]"
}
pkg_setup() {
python-any-r1_pkg_setup
}
src_prepare() {
default
# Fix python shebangs for python-exec[-native-symlinks], #851480
local shebangs=($(grep -rl "#!/usr/bin/env python3" || die))
python_fix_shebang -q ${shebangs[*]}
}
src_configure() {
local emesonargs=(
--localstatedir "${EPREFIX}/var"
$(meson_use doc docs)
$(meson_use test tests)
-Dfuse-version=3
-Dinit-script=""
-Dwith-init-script=""
)
meson_src_configure
}
src_test() {
cd "${BUILD_DIR}"/tests || die "failed to change into tests/ directory."
./main.sh || die
}
src_install() {
meson_src_install
newconfd "${FILESDIR}"/lxcfs-5.0.2.confd lxcfs
newinitd "${FILESDIR}"/lxcfs-5.0.2.initd lxcfs
# Provide our own service file (copy of upstream) due to paths being different from upstream,
# #728470
systemd_newunit "${FILESDIR}"/lxcfs-5.0.2.service lxcfs.service
}

View File

@ -0,0 +1,81 @@
# Copyright 2022-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
inherit cmake meson python-any-r1 systemd verify-sig
DESCRIPTION="FUSE filesystem for LXC"
HOMEPAGE="https://linuxcontainers.org/lxcfs/introduction/ https://github.com/lxc/lxcfs/"
SRC_URI="https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz
verify-sig? ( https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz.asc )"
LICENSE="Apache-2.0 LGPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~riscv ~x86"
IUSE="doc test"
DEPEND="sys-fs/fuse:3="
RDEPEND="${DEPEND}"
BDEPEND="${PYTHON_DEPS}
virtual/pkgconfig
$(python_gen_any_dep '
dev-python/jinja2[${PYTHON_USEDEP}]
')
doc? ( sys-apps/help2man )
verify-sig? ( sec-keys/openpgp-keys-linuxcontainers )"
# Needs some black magic to work inside container/chroot.
RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/linuxcontainers.asc
python_check_deps() {
python_has_version -b "dev-python/jinja2[${PYTHON_USEDEP}]"
}
pkg_setup() {
python-any-r1_pkg_setup
}
src_prepare() {
default
# Fix python shebangs for python-exec[-native-symlinks], #851480
local shebangs=($(grep -rl "#!/usr/bin/env python3" || die))
python_fix_shebang -q ${shebangs[*]}
}
src_configure() {
local emesonargs=(
--localstatedir "${EPREFIX}/var"
$(meson_use doc docs)
$(meson_use test tests)
-Dfuse-version=3
-Dinit-script=""
-Dwith-init-script=""
)
meson_src_configure
}
src_test() {
cd "${BUILD_DIR}"/tests || die "failed to change into tests/ directory."
./main.sh || die
}
src_install() {
meson_src_install
newconfd "${FILESDIR}"/lxcfs-5.0.2.confd lxcfs
newinitd "${FILESDIR}"/lxcfs-5.0.2.initd lxcfs
# Provide our own service file (copy of upstream) due to paths being different from upstream,
# #728470
# https://github.com/lxc/lxcfs/tree/main/config/init
systemd_newunit "${FILESDIR}"/lxcfs-5.0.2.service lxcfs.service
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>juippis@gentoo.org</email>
<name>Joonas Niilola</name>
</maintainer>
<maintainer type="project">
<email>virtualization@gentoo.org</email>
<name>Gentoo Virtualization Project</name>
</maintainer>
<longdescription>
LXCFS is a simple userspace filesystem designed to
provide a cgroupfs-like tree which is container aware
and a set of files which can be bind-mounted over
their /proc originals to provide cgroup-aware values.
</longdescription>
<upstream>
<remote-id type="github">lxc/lxfs</remote-id>
<remote-id type="cpe">cpe:/a:canonical:lxcfs</remote-id>
</upstream>
</pkgmetadata>