[packages/lxd] - up to 4.24

mis mis at pld-linux.org
Tue Nov 22 11:59:32 CET 2022


commit 158095497d4b3831b1e10199509db9fdfc1ce155
Author: mis <mis at pld-linux.org>
Date:   Tue Nov 22 11:58:48 2022 +0100

    - up to 4.24

 glibc2_36.patch | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lxd.init        | 13 +++++------
 lxd.spec        | 46 +++++++++++++++++++++++++++-----------
 3 files changed, 107 insertions(+), 21 deletions(-)
---
diff --git a/lxd.spec b/lxd.spec
index ef5066c..8ade43d 100644
--- a/lxd.spec
+++ b/lxd.spec
@@ -1,27 +1,28 @@
 Summary:	Fast, dense and secure container and virtual machine management
 Name:		lxd
-Version:	3.22
+Version:	4.24
 Release:	1
 License:	Apache v2.0
 Group:		Applications/System
 Source0:	https://linuxcontainers.org/downloads/lxd/%{name}-%{version}.tar.gz
-# Source0-md5:	3bbcfd764058f0383dfb599df635e0bb
+# Source0-md5:	85313ed5ded11aad00e6376a8f140cc7
 Source1:	%{name}.service
 Source2:	%{name}.init
 Source3:	%{name}.sysconfig
 Source4:	%{name}.sh
+Patch1:		glibc2_36.patch
 URL:		http://linuxcontainers.org/
 BuildRequires:	acl-devel
 %ifarch %{x8664} arm aarch64 ppc64
 BuildRequires:	criu-devel >= 1.7
 %endif
-BuildRequires:	dqlite-devel >= 1.4.0
-BuildRequires:	golang >= 1.5
+BuildRequires:	dqlite-devel >= 1.10.0
+BuildRequires:	golang >= 1.18
 BuildRequires:	libco-devel
 BuildRequires:	libuv-devel
 BuildRequires:	lxc-devel >= 3.0
 BuildRequires:	pkgconfig
-BuildRequires:	raft-devel
+BuildRequires:	raft-devel >= 0.14.0
 BuildRequires:	rpmbuild(macros) >= 1.228
 BuildRequires:	udev-devel
 Requires(post,preun):	/sbin/chkconfig
@@ -37,6 +38,7 @@ Requires:	squashfs
 # for sqfs2tar
 Requires:	squashfs-tools-ng
 Requires:	tar
+Requires:	uidmap
 Requires:	uname(release) >= 4.1
 Requires:	xz
 Provides:	group(lxd)
@@ -45,7 +47,7 @@ BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		_enable_debug_packages 0
 %define		gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
-%define		goinstall go install -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x
+%define		goinstall go install -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v
 %define		gopath		%{_libdir}/golang
 %define		import_path	github.com/lxc/lxd
 %define		_libexecdir	%{_prefix}/lib
@@ -77,6 +79,12 @@ Summary:	LXD Agent
 This package contains lxd-agent program to be used inside virtual
 machines (not containers) managed by LXD.
 
+%package tools
+Summary:	LXD Tools
+
+%description tools
+This package contains lxd extra tools
+
 %package -n bash-completion-%{name}
 Summary:	bash-completion for %{name}
 Summary(pl.UTF-8):	Bashowe dopełnianie parametrów dla %{name}
@@ -93,14 +101,21 @@ Bashowe dopełnianie parametrów dla %{name}
 
 %prep
 %setup -q
+%patch1 -p1
 
 %build
 export GOPATH=$(pwd)/_dist
 export GOBIN=$GOPATH/bin
+# flags from ArchLinux package
+export GOFLAGS="-buildmode=pie -trimpath"
+export CGO_LDFLAGS_ALLOW="-Wl,-z,now"
 
 %goinstall -tags libsqlite3 ./...
-CGO_ENABLED=0 %goinstall -tags netgo ./lxd-p2c
-%goinstall -tags agent ./lxd-agent
+CGO_ENABLED=0 %goinstall -tags netgo ./lxd-migrate/...
+%goinstall -tags agent ./lxd-agent/...
+
+# conflict
+mv doc/README.md doc/README.doc.md
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -113,8 +128,8 @@ install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/ini
 # lxd refuses to start containter without this directory
 install -d $RPM_BUILD_ROOT%{_libdir}/%{name}/rootfs
 
-install -p _dist/bin/{lxd,lxd-agent,lxc-to-lxd,lxd-p2c} $RPM_BUILD_ROOT%{_sbindir}
-install -p _dist/bin/{lxc,fuidshift} $RPM_BUILD_ROOT%{_bindir}
+install -p _dist/bin/{lxd,lxd-user,lxd-agent} $RPM_BUILD_ROOT%{_sbindir}
+install -p _dist/bin/{lxc,fuidshift,lxc-to-lxd,lxd-benchmark,lxd-migrate} $RPM_BUILD_ROOT%{_bindir}
 
 # FIXME: it seems that bash completions must be named as command (lxc), so
 # it conflicts with lxc completions (bash-completion-lxc)
@@ -157,10 +172,8 @@ rm -rf $RPM_BUILD_ROOT
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
 %attr(754,root,root) /etc/rc.d/init.d/%{name}
 %attr(755,root,root) %{_bindir}/lxc
-%attr(755,root,root) %{_bindir}/fuidshift
 %attr(755,root,root) %{_sbindir}/lxd
-%attr(755,root,root) %{_sbindir}/lxd-p2c
-%attr(755,root,root) %{_sbindir}/lxc-to-lxd
+%attr(755,root,root) %{_sbindir}/lxd-user
 %{systemdunitdir}/%{name}.service
 %dir %attr(750,root,root) %{_libdir}/%{name}
 %dir %attr(750,root,root) %{_libdir}/%{name}/rootfs
@@ -179,6 +192,13 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_sbindir}/lxd-agent
 
+%files tools
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/fuidshift
+%attr(755,root,root) %{_bindir}/lxc-to-lxd
+%attr(755,root,root) %{_bindir}/lxd-benchmark
+%attr(755,root,root) %{_bindir}/lxd-migrate
+
 %files -n bash-completion-%{name}
 %defattr(644,root,root,755)
 %{bash_compdir}/lxc
diff --git a/glibc2_36.patch b/glibc2_36.patch
new file mode 100644
index 0000000..cfef656
--- /dev/null
+++ b/glibc2_36.patch
@@ -0,0 +1,69 @@
+--- a/shared/idmap/shift_linux.go	2022-03-11 04:52:20.000000000 +0100
++++ b/shared/idmap/shift_linux.go	2022-11-22 09:18:23.513333279 +0100
+@@ -314,7 +314,7 @@
+ static int create_detached_idmapped_mount(const char *path)
+ {
+ 	__do_close int fd_tree = -EBADF, fd_userns = -EBADF;
+-	struct lxc_mount_attr attr = {
++	struct mount_attr attr = {
+ 	    .attr_set		= MOUNT_ATTR_IDMAP,
+ 	    .propagation	= MS_SLAVE,
+ 
+--- a/lxd/include/syscall_wrappers.h	2022-11-22 09:10:03.053333289 +0100
++++ b/lxd/include/syscall_wrappers.h	2022-11-22 09:20:55.586666611 +0100
+@@ -11,7 +11,7 @@
+ #include <sys/syscall.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+-
++#include <sys/mount.h>
+ #include "syscall_numbers.h"
+ 
+ #ifndef CLOSE_RANGE_UNSHARE
+@@ -27,7 +27,7 @@
+ 	return syscall(__NR_close_range, fd, max_fd, flags);
+ }
+ 
+-static inline int open_tree(int dfd, const char *filename, unsigned int flags)
++static inline int xopen_tree(int dfd, const char *filename, unsigned int flags)
+ {
+ 	return syscall(__NR_open_tree, dfd, filename, flags);
+ }
+@@ -42,13 +42,13 @@
+ 	__u64 userns_fd;
+ };
+ 
+-static inline int mount_setattr(int dfd, const char *path, unsigned int flags,
++static inline int xmount_setattr(int dfd, const char *path, unsigned int flags,
+ 				struct lxc_mount_attr *attr, size_t size)
+ {
+ 	return syscall(__NR_mount_setattr, dfd, path, flags, attr, size);
+ }
+ 
+-static inline int move_mount(int from_dfd, const char *from_pathname, int to_dfd,
++static inline int xmove_mount(int from_dfd, const char *from_pathname, int to_dfd,
+ 			     const char *to_pathname, unsigned int flags)
+ {
+ 	return syscall(__NR_move_mount, from_dfd, from_pathname, to_dfd,
+--- a/lxd/main_checkfeature.go	2022-03-11 04:52:20.000000000 +0100
++++ b/lxd/main_checkfeature.go	2022-11-22 10:54:47.506666609 +0100
+@@ -563,7 +563,7 @@
+ static bool kernel_supports_idmapped_mounts(void)
+ {
+ 	__do_close int fd_devnull = -EBADF, fd_tree = -EBADF;
+-	struct lxc_mount_attr attr = {
++	struct mount_attr attr = {
+ 	    .attr_set		= MOUNT_ATTR_IDMAP,
+ 
+ 	};
+--- a/lxd/main_nsexec.go	2022-03-11 04:52:20.000000000 +0100
++++ b/lxd/main_nsexec.go	2022-11-22 10:59:03.776666604 +0100
+@@ -298,7 +298,7 @@
+ int mount_detach_idmap(const char *path, int fd_userns)
+ {
+ 	__do_close int fd_tree = -EBADF;
+-	struct lxc_mount_attr attr = {
++	struct mount_attr attr = {
+ 	    .attr_set		= MOUNT_ATTR_IDMAP,
+ 
+ 	};
diff --git a/lxd.init b/lxd.init
index 1ed4147..1404f8c 100755
--- a/lxd.init
+++ b/lxd.init
@@ -43,14 +43,11 @@ start() {
 	# lxd does not write pidfile, so create one
 	show "Checking lxd daemon status"
 	busy
-	pid=""
-	ntry=0
-	while [ -z "$pid" -a $ntry -lt 5 ]; do
-		[ -z "$pid" ] && sleep 1
-		pid=$(lxc info 2>/dev/null | awk '/server_pid:/{print $2}')
-		[ -n "$pid" ] && echo $pid > $pidfile
-		ntry=$(($ntry+1))
-	done
+	
+	if lxd waitready --timeout=16 2>/dev/null; then
+	    pid=$(lxc info 2>/dev/null | awk '/server_pid:/{print $2}')
+   	    [ -n "$pid" ] && echo $pid > $pidfile
+	fi 
 
 	if [ -n "$pid" ]; then
 		touch /var/lock/subsys/lxd
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lxd.git/commitdiff/158095497d4b3831b1e10199509db9fdfc1ce155



More information about the pld-cvs-commit mailing list