From 9672b88d2a984ff33434002c595b2168f91f15e4 Mon Sep 17 00:00:00 2001 From: Marko Ratkaj Date: Wed, 18 Oct 2017 09:49:54 +0200 Subject: [PATCH] lxc: bump to 2.1.0 Bump LXC package from 1.1.5 to 2.1.0. Version 2.x includes many improvements and optimizations. https://linuxcontainers.org/lxc/news/ Some tools like lxc-top are rewritten in C and are no longer broken and dependent on lua. Signed-off-by: Marko Ratkaj --- utils/lxc/Config.in | 15 +++++++ utils/lxc/Makefile | 22 ++++------ utils/lxc/patches/001-compile.patch | 11 +++++ utils/lxc/patches/002-compile.patch | 10 +++++ utils/lxc/patches/003-compile.patch | 11 +++++ utils/lxc/patches/010-compile.patch | 16 ++++--- utils/lxc/patches/015-getline.patch | 2 +- utils/lxc/patches/020-lxc-checkconfig.patch | 12 +++--- .../025-remove-unsupported-option.patch | 17 +++++--- utils/lxc/patches/030-lxc-download.patch | 43 ------------------- utils/lxc/patches/035-fix-undefined-lfd.patch | 20 --------- 11 files changed, 84 insertions(+), 95 deletions(-) create mode 100644 utils/lxc/patches/001-compile.patch create mode 100644 utils/lxc/patches/002-compile.patch create mode 100644 utils/lxc/patches/003-compile.patch delete mode 100644 utils/lxc/patches/030-lxc-download.patch delete mode 100644 utils/lxc/patches/035-fix-undefined-lfd.patch diff --git a/utils/lxc/Config.in b/utils/lxc/Config.in index 618fde0a0..bab69d159 100644 --- a/utils/lxc/Config.in +++ b/utils/lxc/Config.in @@ -7,6 +7,13 @@ config LXC_KERNEL_OPTIONS select KERNEL_CGROUPS select KERNEL_NAMESPACES select KERNEL_LXC_MISC + select KERNEL_CGROUP_SCHED + select KERNEL_FAIR_GROUP_SCHED + select KERNEL_RT_GROUP_SCHED + select KERNEL_CGROUP_CPUACCT + select KERNEL_MEMCG + select KERNEL_MEMCG_KMEM + select KERNEL_CPUSETS help Select needed kernel options for LXC related utilities. Options include cgroups, namespaces and other miscellaneous options. These @@ -34,4 +41,12 @@ config LXC_SECCOMP Build LXC with support for seccomp filters. Select libseccomp which also pulls-in the needed kernel features. +config LXC_NETWORKING + bool "Enable networking support for LXC containers" + default n + select PACKAGE_kmod-veth + select PACKAGE_kmod-macvlan + help + Enable "veth pair device" and "macvlan" + endmenu diff --git a/utils/lxc/Makefile b/utils/lxc/Makefile index 0862cc30b..53f52c3ea 100644 --- a/utils/lxc/Makefile +++ b/utils/lxc/Makefile @@ -8,15 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lxc -PKG_VERSION:=1.1.5 -PKG_RELEASE:=3 +PKG_VERSION:=2.1.0 +PKG_RELEASE:=1 PKG_LICENSE:=LGPL-2.1+ BSD-2-Clause GPL-2.0 -PKG_MAINTAINER:=Luka Perkov +PKG_MAINTAINER:=Marko Ratkaj PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://linuxcontainers.org/downloads/lxc/ -PKG_HASH:=9588ad1b04e114ee7370f690c65131e28098b28d2521d97c73557d11897ed0be +PKG_SOURCE_URL:=https://linuxcontainers.org/downloads/lxc/ +PKG_HASH:=394407305a409eb1f95fe06e7718acfe89b1d5df267b0c6aafb1d714e2038de2 PKG_BUILD_DEPENDS:=lua PKG_BUILD_PARALLEL:=1 @@ -27,24 +27,20 @@ PKG_FIXUP:=autoreconf include $(INCLUDE_DIR)/package.mk LXC_APPLETS_BIN += \ - attach autostart cgroup clone config console create destroy device \ + attach autostart cgroup copy config console create destroy device \ execute freeze info monitor snapshot start stop unfreeze unshare \ - usernsexec wait + usernsexec wait top ls LXC_APPLETS_LIB += \ monitord user-nic LXC_SCRIPTS += \ - checkconfig ls top + checkconfig DEPENDS_APPLETS = +libpthread +libcap +liblxc DEPENDS_create = +lxc-configs +lxc-hooks +lxc-templates +flock -DEPENDS_ls = +lxc-config -DEPENDS_top = +lxc-lua +luafilesystem @BROKEN - - define Package/lxc/Default SECTION:=utils CATEGORY:=Utilities @@ -118,7 +114,7 @@ endef define Package/lxc-lua $(call Package/lxc/Default) TITLE:=LXC Lua bindings - DEPENDS:= lxc +liblua +liblxc +luafilesystem + DEPENDS:= lxc +liblua +liblxc endef define Package/lxc-init diff --git a/utils/lxc/patches/001-compile.patch b/utils/lxc/patches/001-compile.patch new file mode 100644 index 000000000..052a5dcd4 --- /dev/null +++ b/utils/lxc/patches/001-compile.patch @@ -0,0 +1,11 @@ +--- a/src/lxc/storage/overlay.c ++++ b/src/lxc/storage/overlay.c +@@ -747,7 +747,7 @@ int ovl_mkdir(const struct mntent *mntent, const struct lxc_rootfs *rootfs, + char lxcpath[MAXPATHLEN]; + char **opts; + int ret; +- size_t arrlen, dirlen, i, len, rootfslen; ++ size_t arrlen, i, len, rootfslen, dirlen = 0; + int fret = -1; + char *rootfs_dir = NULL, *rootfs_path = NULL, *upperdir = NULL, + *workdir = NULL; diff --git a/utils/lxc/patches/002-compile.patch b/utils/lxc/patches/002-compile.patch new file mode 100644 index 000000000..9a98777f7 --- /dev/null +++ b/utils/lxc/patches/002-compile.patch @@ -0,0 +1,10 @@ +--- a/src/lxc/storage/aufs.h ++++ b/src/lxc/storage/aufs.h +@@ -24,7 +24,6 @@ + #ifndef __LXC_AUFS_H + #define __LXC_AUFS_H + +-#define _GNU_SOURCE + #include + #include + #include diff --git a/utils/lxc/patches/003-compile.patch b/utils/lxc/patches/003-compile.patch new file mode 100644 index 000000000..408d5e845 --- /dev/null +++ b/utils/lxc/patches/003-compile.patch @@ -0,0 +1,11 @@ +--- a/src/lxc/confile_utils.c ++++ b/src/lxc/confile_utils.c +@@ -690,7 +690,7 @@ bool parse_limit_value(const char **value, unsigned long *res) + char *endptr = NULL; + + if (strncmp(*value, "unlimited", sizeof("unlimited") - 1) == 0) { +- *res = RLIM_INFINITY; ++ *res = (unsigned long)RLIM_INFINITY; + *value += sizeof("unlimited") - 1; + return true; + } diff --git a/utils/lxc/patches/010-compile.patch b/utils/lxc/patches/010-compile.patch index 6f12c382a..903e4cd7b 100644 --- a/utils/lxc/patches/010-compile.patch +++ b/utils/lxc/patches/010-compile.patch @@ -1,19 +1,20 @@ --- a/configure.ac +++ b/configure.ac -@@ -31,30 +31,6 @@ AC_CANONICAL_HOST - AM_PROG_CC_C_O - AC_GNU_SOURCE +@@ -47,34 +47,6 @@ AC_GNU_SOURCE + LT_INIT + AC_SUBST([LIBTOOL_DEPS]) -# Detect the distribution. This is used for the default configuration and -# for some distro-specific build options. -AC_MSG_CHECKING([host distribution]) --AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, paldo, openmandriva or pardus.])) +-AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, plamo, paldo, openmandriva, pardus, sparclinux, altlinux.])) -if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then - with_distro=`lsb_release -is` -fi -if test "z$with_distro" = "z"; then - AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat") - AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle") +- AC_CHECK_FILE(/etc/sparclinux-release,with_distro="sparclinux") - AC_CHECK_FILE(/etc/centos-release,with_distro="centos") - AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora") - AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") @@ -21,13 +22,16 @@ - AC_CHECK_FILE(/etc/debian_version,with_distro="debian") - AC_CHECK_FILE(/etc/arch-release,with_distro="arch") - AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware") +- AC_CHECK_FILE(/etc/plamo-version,with_distro="plamo") - AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware") - AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva") - AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva") - AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus") +- AC_CHECK_FILE(/etc/altlinux-release,with_distro="altlinux") +- AC_CHECK_FILE(/etc/pld-release,with_distro="pld") -fi -with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'` - - if test "z$with_distro" = "z"; then - with_distro="unknown" + if test "z$with_distro" = "zforsparc"; then + with_distro="sparclinux" fi diff --git a/utils/lxc/patches/015-getline.patch b/utils/lxc/patches/015-getline.patch index 2dfaa9bea..c91e010c5 100644 --- a/utils/lxc/patches/015-getline.patch +++ b/utils/lxc/patches/015-getline.patch @@ -1,6 +1,6 @@ --- a/src/lxc/utils.h +++ b/src/lxc/utils.h -@@ -41,11 +41,7 @@ extern int mkdir_p(const char *dir, mode +@@ -59,11 +59,7 @@ extern int mkdir_p(const char *dir, mode_t mode); extern char *get_rundir(void); /* Define getline() if missing from the C library */ diff --git a/utils/lxc/patches/020-lxc-checkconfig.patch b/utils/lxc/patches/020-lxc-checkconfig.patch index 272f76b05..0e644ea47 100644 --- a/utils/lxc/patches/020-lxc-checkconfig.patch +++ b/utils/lxc/patches/020-lxc-checkconfig.patch @@ -1,8 +1,8 @@ ---- a/src/lxc/lxc-checkconfig.in -+++ b/src/lxc/lxc-checkconfig.in -@@ -4,6 +4,17 @@ +--- a/src/lxc/tools/lxc-checkconfig.in ++++ b/src/lxc/tools/lxc-checkconfig.in +@@ -3,6 +3,17 @@ + # Allow environment variables to override config : ${CONFIG:=/proc/config.gz} - : ${GREP:=zgrep} : ${MODNAME:=configs} +: ${ZGREP:=zgrep} +: ${GUNZIP:=gunzip} @@ -16,5 +16,5 @@ + GREP=grep +fi - SETCOLOR_SUCCESS="printf \\033[1;32m" - SETCOLOR_FAILURE="printf \\033[1;31m" + CAT="cat" + diff --git a/utils/lxc/patches/025-remove-unsupported-option.patch b/utils/lxc/patches/025-remove-unsupported-option.patch index cb0a9f0d2..b20870890 100644 --- a/utils/lxc/patches/025-remove-unsupported-option.patch +++ b/utils/lxc/patches/025-remove-unsupported-option.patch @@ -1,19 +1,24 @@ --- a/templates/lxc-download.in +++ b/templates/lxc-download.in -@@ -494,15 +494,7 @@ fi +@@ -505,20 +505,7 @@ fi # Unpack the rootfs echo "Unpacking the rootfs" -EXCLUDES="" -excludelist=$(relevant_file excludes) -if [ -f "${excludelist}" ]; then -- while read line; do -- EXCLUDES="$EXCLUDES --exclude=$line" -- done < $excludelist +- while read -r line; do +- EXCLUDES="${EXCLUDES} --exclude=${line}" +- done < "${excludelist}" -fi - +-# Do not surround ${EXCLUDES} by quotes. This does not work. The solution could +-# use array but this is not POSIX compliant. The only POSIX compliant solution +-# is to use a function wrapper, but the latter can't be used here as the args +-# are dynamic. We thus need to ignore the warning brought by shellcheck. +-# shellcheck disable=SC2086 -tar --anchored ${EXCLUDES} --numeric-owner -xpJf \ +tar --numeric-owner -xpJf \ - ${LXC_CACHE_PATH}/rootfs.tar.xz -C ${LXC_ROOTFS} + "${LXC_CACHE_PATH}/rootfs.tar.xz" -C "${LXC_ROOTFS}" - mkdir -p ${LXC_ROOTFS}/dev/pts/ + mkdir -p "${LXC_ROOTFS}/dev/pts/" diff --git a/utils/lxc/patches/030-lxc-download.patch b/utils/lxc/patches/030-lxc-download.patch deleted file mode 100644 index 295bae0aa..000000000 --- a/utils/lxc/patches/030-lxc-download.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/templates/lxc-download.in -+++ b/templates/lxc-download.in -@@ -39,7 +39,7 @@ DOWNLOAD_LIST_IMAGES="false" - DOWNLOAD_MODE="system" - DOWNLOAD_READY_GPG="false" - DOWNLOAD_RELEASE= --DOWNLOAD_SERVER="images.linuxcontainers.org" -+DOWNLOAD_SERVER="virtualwrt.org/containers/" - DOWNLOAD_SHOW_GPG_WARNING="true" - DOWNLOAD_SHOW_HTTP_WARNING="true" - DOWNLOAD_TARGET="system" -@@ -257,14 +257,6 @@ for bin in tar xz wget; do - fi - done - --# Check for GPG --if [ "$DOWNLOAD_VALIDATE" = "true" ]; then -- if ! type gpg >/dev/null 2>&1; then -- echo "ERROR: Missing recommended tool: gpg" 1>&2 -- echo "You can workaround this by using --no-validate." 1>&2 -- exit 1 -- fi --fi - - # Check that we have all variables we need - if [ -z "$LXC_NAME" ] || [ -z "$LXC_PATH" ] || [ -z "$LXC_ROOTFS" ]; then -@@ -456,16 +448,9 @@ if [ "$DOWNLOAD_USE_CACHE" = "false" ]; - echo "Downloading the rootfs" - download_file $DOWNLOAD_URL/rootfs.tar.xz \ - ${DOWNLOAD_TEMP}/rootfs.tar.xz normal -- download_sig $DOWNLOAD_URL/rootfs.tar.xz.asc \ -- ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc normal -- gpg_validate ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc -- - echo "Downloading the metadata" - download_file $DOWNLOAD_URL/meta.tar.xz \ - ${DOWNLOAD_TEMP}/meta.tar.xz normal -- download_sig $DOWNLOAD_URL/meta.tar.xz.asc \ -- ${DOWNLOAD_TEMP}/meta.tar.xz.asc normal -- gpg_validate ${DOWNLOAD_TEMP}/meta.tar.xz.asc - - if [ -d $LXC_CACHE_PATH ]; then - rm -Rf $LXC_CACHE_PATH diff --git a/utils/lxc/patches/035-fix-undefined-lfd.patch b/utils/lxc/patches/035-fix-undefined-lfd.patch deleted file mode 100644 index 42e194c33..000000000 --- a/utils/lxc/patches/035-fix-undefined-lfd.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/src/lxc/bdev.c -+++ b/src/lxc/bdev.c -@@ -1939,7 +1939,7 @@ static int find_free_loopdev(int *retfd, - - static int loop_mount(struct bdev *bdev) - { -- int lfd, ffd = -1, ret = -1; -+ int lfd = -1, ffd = -1, ret = -1; - struct loop_info64 lo; - char loname[100]; - -@@ -1977,7 +1977,7 @@ out: - if (ffd > -1) - close(ffd); - if (ret < 0) { -- close(lfd); -+ if (lfd > -1) close(lfd); - bdev->lofd = -1; - } - return ret;