diff --git a/recipes-containers/lxc/README b/recipes-containers/lxc/README new file mode 100644 index 00000000..e6e3f1af --- /dev/null +++ b/recipes-containers/lxc/README @@ -0,0 +1,23 @@ +install: +-------- + + Install the following packages to your image: + + IMAGE_INSTALL:append = "lxc lxc-networking kernel-modules" + + These will put the core lxc application and networking onto your image. + No other configuration is required for a basic system. + + Note: has only been tested with systemd, sysvinit patches are welcome + + Note: Partially conflicts with packages such as k3s, networking will fail to + start. + +sample test: +----------- + + % lxc-create -n test -t download -- --server us.lxd.images.canonical.com -d alpine -r 3.16 -a amd64 + % lxc-start test + % lxc-console test + + diff --git a/recipes-containers/lxc/files/0001-download-don-t-try-compatbility-index.patch b/recipes-containers/lxc/files/0001-download-don-t-try-compatbility-index.patch new file mode 100644 index 00000000..fee3b61a --- /dev/null +++ b/recipes-containers/lxc/files/0001-download-don-t-try-compatbility-index.patch @@ -0,0 +1,43 @@ +From d69c856f90c752637b33e59fbbcfa31f619e2285 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield +Date: Sun, 14 Aug 2022 22:44:24 -0400 +Subject: [PATCH] download: don't try compatbility index + +This is being mistaken for a valid, non compat index .. and we never +try for the one that exists (the index without a compatibility +extension). So we just drop the compat try for now. + +Signed-off-by: Bruce Ashfield +--- + templates/lxc-download.in | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/templates/lxc-download.in b/templates/lxc-download.in +index 9a3290fbc..216e4dda7 100755 +--- a/templates/lxc-download.in ++++ b/templates/lxc-download.in +@@ -234,9 +234,7 @@ if [ "${DOWNLOAD_LIST_IMAGES}" = "true" ] || [ "${DOWNLOAD_INTERACTIVE}" = "true + DOWNLOAD_INDEX_PATH="/meta/1.0/index-${DOWNLOAD_MODE}" + + echo "Downloading the image index" +- if ! download_file "${DOWNLOAD_INDEX_PATH}.${DOWNLOAD_COMPAT_LEVEL}" "${DOWNLOAD_TEMP}/index" noexit; then +- download_file "${DOWNLOAD_INDEX_PATH}" "${DOWNLOAD_TEMP}/index" normal +- fi ++ download_file "${DOWNLOAD_INDEX_PATH}" "${DOWNLOAD_TEMP}/index" normal + + # Parse it + echo "" +@@ -316,9 +314,7 @@ if [ "${DOWNLOAD_USE_CACHE}" = "false" ]; then + DOWNLOAD_INDEX_PATH="/meta/1.0/index-${DOWNLOAD_MODE}" + + echo "Downloading the image index" +- if ! download_file "${DOWNLOAD_INDEX_PATH}.${DOWNLOAD_COMPAT_LEVEL}" "${DOWNLOAD_TEMP}/index" noexit; then +- download_file "${DOWNLOAD_INDEX_PATH}" "${DOWNLOAD_TEMP}/index" normal +- fi ++ download_file "${DOWNLOAD_INDEX_PATH}" "${DOWNLOAD_TEMP}/index" normal + + # Parse it + while IFS=';' read -r f1 f2 f3 f4 f5 f6; do +-- +2.25.1 + diff --git a/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch b/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch deleted file mode 100644 index a8c76bc8..00000000 --- a/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0cfa202f5d96a35692f063f35bf4706f310b17e4 Mon Sep 17 00:00:00 2001 -From: Jim Somerville -Date: Fri, 25 Sep 2015 15:08:17 -0400 -Subject: [PATCH] logs: optionally use base filenames to report src files - -Message-Id: <4729d0f4c4d1dacd150ddfd7061dda875eb94e34.1443216870.git.Jim.Somerville@windriver.com> - -Problem: Logs are nice in that they report the source file, -routine, and line number where an issue occurs. But the -file is printed as the absolute filename. Users do not -need to see a long spew of path directory names where the package -was built. It just confuses things. - -Solution: Optionally chop off all leading directories so that just -the source filename ie. basename is printed. This is done by -setting a #ifdef LXC_LOG_USE_BASENAME check in the code. That -define is done via the optional --enable-log-src-basename provided -at configure time. - -Using __BASE_FILE__ instead of __FILE__ did not work. It -refers to the file name as presented to the compile -machinery, and that may still be the absolute pathname to -the file. - -Signed-off-by: Jim Somerville - ---- - configure.ac | 9 +++++++++ - src/lxc/log.h | 5 +++++ - 2 files changed, 14 insertions(+) - -diff --git a/configure.ac b/configure.ac -index a3272e9..a2d4c29 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -378,6 +378,15 @@ AC_ARG_ENABLE([examples], - [enable_examples=$enableval], [enable_examples=yes]) - AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"]) - -+# Enable basenames in the logs for source files -+AC_ARG_ENABLE([log-src-basename], -+ [AC_HELP_STRING([--enable-log-src-basename], [Use the shorter source file basename in the logs [default=no]])], -+ [], [enable_log_src_basename=no]) -+ -+if test "x$enable_log_src_basename" = "xyes"; then -+ AC_DEFINE([LXC_LOG_USE_BASENAME], 1, [Enabling shorter src filenames in the logs]) -+fi -+ - # Enable dumping stack traces - AC_ARG_ENABLE([mutex-debugging], - [AS_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])], -diff --git a/src/lxc/log.h b/src/lxc/log.h -index d280656..62cbf4f 100644 ---- a/src/lxc/log.h -+++ b/src/lxc/log.h -@@ -47,8 +47,13 @@ struct lxc_log_locinfo { - int line; - }; - -+#ifdef LXC_LOG_USE_BASENAME -+#define LXC_LOG_LOCINFO_INIT \ -+ { .file = (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), .func = __func__, .line = __LINE__ } -+#else - #define LXC_LOG_LOCINFO_INIT \ - { .file = __FILE__, .func = __func__, .line = __LINE__ } -+#endif - - /* brief logging event object */ - struct lxc_log_event { diff --git a/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch b/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch deleted file mode 100644 index be5dddf1..00000000 --- a/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 85d1e77acbfde2aa1045cfda877a91a9e57c405d Mon Sep 17 00:00:00 2001 -From: Jim Somerville -Date: Tue, 11 Aug 2015 14:05:00 -0400 -Subject: [PATCH] lxc: doc: upgrade to use docbook 3.1 DTD - -docbook2man fails to build the man pages in poky -due to missing the ancient Davenport 3.0 DTD. -Poky meta has the Oasis 3.1 version so upgrade -to use that instead. - -Signed-off-by: Jim Somerville - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 90a4bd4..a3272e9 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -227,7 +227,7 @@ AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"]) - AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"]) - - if test "x$db2xman" = "xdocbook2man"; then -- docdtd="\"-//Davenport//DTD DocBook V3.0//EN\"" -+ docdtd="\"-//OASIS//DTD DocBook V3.1//EN\"" - else - docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\"" - fi diff --git a/recipes-containers/lxc/files/lxc-fix-B-S.patch b/recipes-containers/lxc/files/lxc-fix-B-S.patch deleted file mode 100644 index 7a807b7c..00000000 --- a/recipes-containers/lxc/files/lxc-fix-B-S.patch +++ /dev/null @@ -1,25 +0,0 @@ -From dc2e71f060c25b94f011fce12ef59d2f5ae4e6a9 Mon Sep 17 00:00:00 2001 -From: Dmitry Eremin-Solenikov -Date: Thu, 9 Apr 2015 23:01:48 +0300 -Subject: [PATCH] %% original patch: lxc-fix-B-S.patch - ---- - config/init/upstart/Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/config/init/upstart/Makefile.am b/config/init/upstart/Makefile.am -index 5552d32..186ae3d 100644 ---- a/config/init/upstart/Makefile.am -+++ b/config/init/upstart/Makefile.am -@@ -3,9 +3,9 @@ EXTRA_DIST = lxc.conf lxc-instance.conf lxc-net.conf.in - if INIT_SCRIPT_UPSTART - install-upstart: lxc.conf lxc-instance.conf lxc-net.conf - $(MKDIR_P) $(DESTDIR)$(sysconfdir)/init/ -- $(INSTALL_DATA) lxc.conf $(DESTDIR)$(sysconfdir)/init/ -+ $(INSTALL_DATA) $(srcdir)/lxc.conf $(DESTDIR)$(sysconfdir)/init/ - $(INSTALL_DATA) $(srcdir)/lxc-instance.conf $(DESTDIR)$(sysconfdir)/init/ -- $(INSTALL_DATA) lxc-net.conf $(DESTDIR)$(sysconfdir)/init/ -+ $(INSTALL_DATA) $(srcdir)/lxc-net.conf $(DESTDIR)$(sysconfdir)/init/ - - uninstall-upstart: - rm -f $(DESTDIR)$(sysconfdir)/init/lxc.conf diff --git a/recipes-containers/lxc/files/templates-use-curl-instead-of-wget.patch b/recipes-containers/lxc/files/templates-use-curl-instead-of-wget.patch index f06e5969..3c96c5e0 100644 --- a/recipes-containers/lxc/files/templates-use-curl-instead-of-wget.patch +++ b/recipes-containers/lxc/files/templates-use-curl-instead-of-wget.patch @@ -1,22 +1,22 @@ -From 1db2db7783bd7ec2aa1da86e640019891634c659 Mon Sep 17 00:00:00 2001 -From: Joakim Roubert -Date: Fri, 16 Aug 2019 07:52:48 +0200 -Subject: [PATCH] Use curl instead of wget +From 3e4cb0b738649f7750413cefbcfdb2115213ad0d Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield +Date: Sun, 14 Aug 2022 14:08:56 -0400 +Subject: [PATCH] download: Use curl instead of wget When curl's MIT license is preferable to wget's GPLv3. -Change-Id: I4684ae7569704514fdcc63e0655c556efcaf44f8 Signed-off-by: Joakim Roubert Signed-off-by: Yanfei Xu +Signed-off-by: Bruce Ashfield --- - templates/lxc-download.in | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) + templates/lxc-download.in | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) -Index: git/templates/lxc-download.in -=================================================================== ---- git.orig/templates/lxc-download.in -+++ git/templates/lxc-download.in -@@ -59,9 +59,9 @@ +diff --git a/templates/lxc-download.in b/templates/lxc-download.in +index a62ddf482..690307338 100755 +--- a/templates/lxc-download.in ++++ b/templates/lxc-download.in +@@ -59,9 +59,9 @@ cleanup() { fi } @@ -28,19 +28,16 @@ Index: git/templates/lxc-download.in return 0 fi done -@@ -70,8 +70,9 @@ +@@ -70,7 +70,7 @@ wget_wrapper() { } download_file() { - if ! wget_wrapper --user-agent="lxc/@PACKAGE_VERSION@ compat:${DOWNLOAD_COMPAT_LEVEL}" -T 30 -q "https://${DOWNLOAD_SERVER}/$1" -O "$2" >/dev/null 2>&1; then -- if [ "$3" = "noexit" ]; then -+ if ! curl_wrapper --user-agent="lxc/@PACKAGE_VERSION@ compat:${DOWNLOAD_COMPAT_LEVEL}" -m 30 -s "https://${DOWNLOAD_SERVER}/$1" -o "$2" >/dev/null 2>&1; then -+ if ! curl_wrapper --user-agent="lxc/@PACKAGE_VERSION@ compat:${DOWNLOAD_COMPAT_LEVEL}" -m 30 -s "http://${DOWNLOAD_SERVER}/$1" -o "$2" >/dev/null 2>&1; then -+ if [ "$3" = "noexit" ]; then ++ if ! curl_wrapper --user-agent "lxc/@PACKAGE_VERSION@ compat:${DOWNLOAD_COMPAT_LEVEL}" -m 30 -s "https://${DOWNLOAD_SERVER}/$1" -o "$2" >/dev/null 2>&1; then + if [ "$3" = "noexit" ]; then return 1 else - echo "ERROR: Failed to download https://${DOWNLOAD_SERVER}/$1" 1>&2 -@@ -176,7 +177,7 @@ +@@ -176,7 +176,7 @@ while :; do done # Check for required binaries @@ -49,3 +46,6 @@ Index: git/templates/lxc-download.in if ! command -V "${bin}" >/dev/null 2>&1; then echo "ERROR: Missing required tool: ${bin}" 1>&2 exit 1 +-- +2.25.1 + diff --git a/recipes-containers/lxc/lxc_git.bb b/recipes-containers/lxc/lxc_git.bb index cecb5914..bcc17953 100644 --- a/recipes-containers/lxc/lxc_git.bb +++ b/recipes-containers/lxc/lxc_git.bb @@ -36,48 +36,51 @@ RDEPENDS:${PN}-ptest += "file make gmp nettle gnutls bash libgcc" RDEPENDS:${PN}-networking += "iptables" -SRC_URI = "git://github.com/lxc/lxc.git;branch=stable-4.0;protocol=https \ +SRC_URI = "git://github.com/lxc/lxc.git;branch=master;protocol=https \ file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \ file://run-ptest \ - file://lxc-fix-B-S.patch \ - file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \ - file://logs-optionally-use-base-filenames-to-report-src-fil.patch \ file://templates-actually-create-DOWNLOAD_TEMP-directory.patch \ file://template-make-busybox-template-compatible-with-core-.patch \ file://templates-use-curl-instead-of-wget.patch \ + file://0001-download-don-t-try-compatbility-index.patch \ file://tests-our-init-is-not-busybox.patch \ file://dnsmasq.conf \ file://lxc-net \ " -SRCREV = "5ba5725cb4a210c25707beeca64fde5f561d1c71" -PV = "4.0.12+git${SRCPV}" +SRCREV = "133aa416ca2a5996090ec0e697e253646364d274" +PV = "5.0.1+git${SRCPV}" S = "${WORKDIR}/git" # Let's not configure for the host distro. # -PTEST_CONF = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}" -EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}" +PTEST_CONF = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '-Dtests=true', '', d)}" -EXTRA_OECONF += "--with-init-script=\ -${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit,', '', d)}\ -${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" - -EXTRA_OECONF += "--enable-log-src-basename --disable-werror" +# No meson equivalent for --with-distro +# EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}" +EXTRA_OEMESON += "${PTEST_CONF}" +# No meson equivalent for these yet +# EXTRA_OECONF += "--enable-log-src-basename --disable-werror" PACKAGECONFIG ??= "templates \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'seccomp', 'seccomp', '', d)} \ " -PACKAGECONFIG[doc] = "--enable-doc --enable-api-docs,--disable-doc --disable-api-docs,," -PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath,," -PACKAGECONFIG[apparmor] = "--enable-apparmor,--disable-apparmor,apparmor,apparmor" + +# Meson doesn't seem to be as fine grained as the autotools releases +# PACKAGECONFIG[doc] = "--enable-doc --enable-api-docs,--disable-doc --disable-api-docs,," +PACKAGECONFIG[doc] = "-Dman=true,-Dman=false,," +# No meson equiv found for rpath yet +# PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath,," +PACKAGECONFIG[apparmor] = "-Dapparmor=true,-Dapparmor=false,apparmor,apparmor" PACKAGECONFIG[templates] = ",,, ${PN}-templates" -PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux" -PACKAGECONFIG[seccomp] ="--enable-seccomp,--disable-seccomp,libseccomp,libseccomp" -PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd," +PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,libselinux" +PACKAGECONFIG[seccomp] ="-Dseccomp=true,-Dseccomp=false,libseccomp,libseccomp" +# meson equiv for the unitdir found yet +# PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd," +PACKAGECONFIG[systemd] = "-Dinit-script=systemd,-Dinit-script=sysvinit,systemd," # required by python3 to run setup.py export BUILD_SYS @@ -85,18 +88,18 @@ export HOST_SYS export STAGING_INCDIR export STAGING_LIBDIR -inherit autotools pkgconfig ptest update-rc.d systemd python3native +inherit meson pkgconfig ptest update-rc.d systemd python3native SYSTEMD_PACKAGES = "${PN} ${PN}-networking" -SYSTEMD_SERVICE:${PN} = "lxc.service" +SYSTEMD_SERVICE:${PN} = "lxc.service lxc-monitord.service" SYSTEMD_AUTO_ENABLE:${PN} = "disable" SYSTEMD_SERVICE:${PN}-networking = "lxc-net.service" SYSTEMD_AUTO_ENABLE:${PN}-networking = "enable" -INITSCRIPT_PACKAGES = "${PN} ${PN}-networking" -INITSCRIPT_NAME:${PN} = "lxc-containers" +INITSCRIPT_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', '${PN}', d)} ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', '${PN}-networking',d)}" +INITSCRIPT_NAME:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'lxc-containers', d)}" INITSCRIPT_PARAMS:${PN} = "defaults" -INITSCRIPT_NAME:${PN}-networking = "lxc-net" +INITSCRIPT_NAME:${PN}-networking = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'lxc-net', d)}" INITSCRIPT_PARAMS:${PN}-networking = "defaults" FILES:${PN}-doc = "${mandir} ${infodir}" @@ -117,11 +120,12 @@ FILES:${PN}-networking += " \ ${sysconfdir}/default/lxc-net \ " -CACHED_CONFIGUREVARS += " \ - ac_cv_path_PYTHON='${STAGING_BINDIR_NATIVE}/python3-native/python3' \ - am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \ - am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \ -" +# Not needed for meson +# CACHED_CONFIGUREVARS += " \ +# ac_cv_path_PYTHON='${STAGING_BINDIR_NATIVE}/python3-native/python3' \ +# am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \ +# am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \ +#" do_install:append() { # The /var/cache/lxc directory created by the Makefile @@ -134,8 +138,15 @@ do_install:append() { for i in `grep -l "#! */bin/bash" ${D}${datadir}/lxc/hooks/*`; do \ sed -e 's|#! */bin/bash|#!/bin/sh|' -i $i; done - install -d ${D}${sysconfdir}/init.d - install -m 755 config/init/sysvinit/lxc* ${D}${sysconfdir}/init.d + if "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}"; then + # nothing special for systemd at the moment + true + else + # with meson, these aren't built unless sysvinit is the enabled + # init system. + install -d ${D}${sysconfdir}/init.d + install -m 755 config/init/sysvinit/lxc* ${D}${sysconfdir}/init.d + fi # since python3-native is used for install location this will not be # suitable for the target and we will have to correct the package install