Merge pull request #275895 from adamcstephens/lxcfs/5
lxcfs: 4.0.12 -> 5.0.4
This commit is contained in:
commit
c52e9de9ae
5 changed files with 111 additions and 21 deletions
|
@ -56,6 +56,10 @@ in
|
||||||
retry(instance_is_up)
|
retry(instance_is_up)
|
||||||
machine.succeed("echo true | incus exec container /run/current-system/sw/bin/bash -")
|
machine.succeed("echo true | incus exec container /run/current-system/sw/bin/bash -")
|
||||||
|
|
||||||
|
with subtest("Container mounts lxcfs overlays"):
|
||||||
|
machine.succeed("incus exec container mount | grep 'lxcfs on /proc/cpuinfo type fuse.lxcfs'")
|
||||||
|
machine.succeed("incus exec container mount | grep 'lxcfs on /proc/meminfo type fuse.lxcfs'")
|
||||||
|
|
||||||
with subtest("Container CPU limits can be managed"):
|
with subtest("Container CPU limits can be managed"):
|
||||||
set_container("limits.cpu 1")
|
set_container("limits.cpu 1")
|
||||||
cpuinfo = machine.succeed("incus exec container grep -- -c ^processor /proc/cpuinfo").strip()
|
cpuinfo = machine.succeed("incus exec container grep -- -c ^processor /proc/cpuinfo").strip()
|
||||||
|
|
|
@ -1,41 +1,58 @@
|
||||||
{ config, lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, help2man, fuse
|
{
|
||||||
, util-linux, makeWrapper
|
lib,
|
||||||
, enableDebugBuild ? config.lxcfs.enableDebugBuild or false }:
|
stdenv,
|
||||||
|
fetchFromGitHub,
|
||||||
|
fuse3,
|
||||||
|
help2man,
|
||||||
|
makeWrapper,
|
||||||
|
meson,
|
||||||
|
ninja,
|
||||||
|
nixosTests,
|
||||||
|
pkg-config,
|
||||||
|
python3,
|
||||||
|
util-linux,
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "lxcfs";
|
pname = "lxcfs";
|
||||||
version = "4.0.12";
|
version = "5.0.4";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "lxc";
|
owner = "lxc";
|
||||||
repo = "lxcfs";
|
repo = "lxcfs";
|
||||||
rev = "lxcfs-${version}";
|
rev = "lxcfs-${version}";
|
||||||
sha256 = "sha256-+wp29GD+toXGfQbPGYbDJ7/P+FY1uQY4uK3OQxTE9GM=";
|
sha256 = "sha256-vusxbFV7cnQVBOOo7E+fSyaE63f5QiE2xZhYavc8jJU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = ''
|
patches = [
|
||||||
sed -i -e '1i #include <sys/pidfd.h>' src/bindings.c
|
# skip RPM spec generation
|
||||||
'';
|
./no-spec.patch
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config help2man autoreconfHook makeWrapper ];
|
# skip installing systemd files
|
||||||
buildInputs = [ fuse ];
|
./skip-init.patch
|
||||||
|
|
||||||
preConfigure = lib.optionalString enableDebugBuild ''
|
# fix pidfd checks and include
|
||||||
sed -i 's,#AM_CFLAGS += -DDEBUG,AM_CFLAGS += -DDEBUG,' Makefile.am
|
./pidfd.patch
|
||||||
'';
|
|
||||||
|
|
||||||
configureFlags = [
|
|
||||||
"--with-init-script=systemd"
|
|
||||||
"--sysconfdir=/etc"
|
|
||||||
"--localstatedir=/var"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
installFlags = [ "SYSTEMD_UNIT_DIR=\${out}/lib/systemd" ];
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
meson
|
||||||
|
help2man
|
||||||
|
makeWrapper
|
||||||
|
ninja
|
||||||
|
(python3.withPackages (p: [ p.jinja2 ]))
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
buildInputs = [ fuse3 ];
|
||||||
|
|
||||||
|
preConfigure = ''
|
||||||
|
patchShebangs tools/
|
||||||
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
# `mount` hook requires access to the `mount` command from `util-linux`:
|
# `mount` hook requires access to the `mount` command from `util-linux`:
|
||||||
wrapProgram "$out/share/lxcfs/lxc.mount.hook" \
|
wrapProgram "$out/share/lxcfs/lxc.mount.hook" --prefix PATH : "${util-linux}/bin"
|
||||||
--prefix PATH : "${util-linux}/bin"
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
|
@ -43,6 +60,10 @@ stdenv.mkDerivation rec {
|
||||||
patchelf --set-rpath "$(patchelf --print-rpath "$out/bin/lxcfs"):$out/lib" "$out/bin/lxcfs"
|
patchelf --set-rpath "$(patchelf --print-rpath "$out/bin/lxcfs"):$out/lib" "$out/bin/lxcfs"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests = {
|
||||||
|
incus-container = nixosTests.incus.container;
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "FUSE filesystem for LXC";
|
description = "FUSE filesystem for LXC";
|
||||||
homepage = "https://linuxcontainers.org/lxcfs";
|
homepage = "https://linuxcontainers.org/lxcfs";
|
||||||
|
|
24
pkgs/os-specific/linux/lxcfs/no-spec.patch
Normal file
24
pkgs/os-specific/linux/lxcfs/no-spec.patch
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index a0289ad..93fc61a 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -253,19 +253,6 @@ if want_tests == true
|
||||||
|
c_args: '-DRELOADTEST -DDEBUG')
|
||||||
|
endif
|
||||||
|
|
||||||
|
-# RPM spec.
|
||||||
|
-lxcfs_spec = custom_target(
|
||||||
|
- 'lxcfs.spec',
|
||||||
|
- build_by_default: true,
|
||||||
|
- input: 'lxcfs.spec.in',
|
||||||
|
- output: 'lxcfs.spec',
|
||||||
|
- command: [
|
||||||
|
- meson_render_jinja2,
|
||||||
|
- config_h,
|
||||||
|
- '@INPUT@',
|
||||||
|
- '@OUTPUT@',
|
||||||
|
- ])
|
||||||
|
-
|
||||||
|
# Man pages
|
||||||
|
if want_docs == true
|
||||||
|
help2man = find_program('help2man')
|
29
pkgs/os-specific/linux/lxcfs/pidfd.patch
Normal file
29
pkgs/os-specific/linux/lxcfs/pidfd.patch
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index a0289ad..211b01b 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -134,11 +134,13 @@ foreach ident: [
|
||||||
|
'''#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <signal.h>
|
||||||
|
+ #include <sys/pidfd.h>
|
||||||
|
#include <sys/wait.h>'''],
|
||||||
|
['pidfd_open',
|
||||||
|
'''#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <signal.h>
|
||||||
|
+ #include <sys/pidfd.h>
|
||||||
|
#include <sys/wait.h>'''],
|
||||||
|
]
|
||||||
|
have = cc.has_function(ident[0], prefix: ident[1], args: '-D_GNU_SOURCE')
|
||||||
|
diff --git a/src/bindings.c b/src/bindings.c
|
||||||
|
index 13259c1..e760330 100644
|
||||||
|
--- a/src/bindings.c
|
||||||
|
+++ b/src/bindings.c
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <sys/pidfd.h>
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <dirent.h>
|
12
pkgs/os-specific/linux/lxcfs/skip-init.patch
Normal file
12
pkgs/os-specific/linux/lxcfs/skip-init.patch
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index a0289ad..10c0a28 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -285,7 +285,6 @@ endif
|
||||||
|
|
||||||
|
|
||||||
|
# Include sub-directories.
|
||||||
|
-subdir('config/init')
|
||||||
|
subdir('share')
|
||||||
|
subdir('tests')
|
||||||
|
|
Loading…
Reference in a new issue