summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Moschny <thm@fedoraproject.org>2013-09-02 00:04:53 +0200
committerThomas Moschny <thm@fedoraproject.org>2013-09-02 00:04:53 +0200
commit6eecaff69c8a63e029b46c79b744d629e5f75f5b (patch)
tree0305d10a84719c8df05f97286bd291941f0f64c1
parent98d2d401d03f04bd57bd60871b719ff0f94e5cea (diff)
downloadlxc-6eecaff69c8a63e029b46c79b744d629e5f75f5b.tar.gz
lxc-6eecaff69c8a63e029b46c79b744d629e5f75f5b.tar.xz
lxc-6eecaff69c8a63e029b46c79b744d629e5f75f5b.zip
Update to 0.9.0.
- Make the -libs subpackage installable on its own: - Move files needed by the libraries to the subpackage. - Let packages depend on -libs. - Add rsync as dependency to the templates package. - Add (optional) subpackages for Python3 and Lua bindings. - Add upstream patches for the Fedora template. - Define and use the _pkgdocdir macro, also fixing rhbz#1001235. - Update License tag.
-rw-r--r--.gitignore1
-rw-r--r--lxc-0.8.0-fedora-template.patch28
-rw-r--r--lxc-0.9.0-fedora-template.patch385
-rw-r--r--lxc-0.9.0-lua-5.2.patch39
-rw-r--r--lxc.spec189
-rw-r--r--sources2
6 files changed, 588 insertions, 56 deletions
diff --git a/.gitignore b/.gitignore
index dcabd0e..fca6aaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ lxc-0.7.2.tar.gz
/lxc-0.7.4.2.tar.gz
/lxc-0.7.5.tar.gz
/lxc-0.8.0.tar.gz
+/lxc-0.9.0.tar.gz
diff --git a/lxc-0.8.0-fedora-template.patch b/lxc-0.8.0-fedora-template.patch
deleted file mode 100644
index dd2b928..0000000
--- a/lxc-0.8.0-fedora-template.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-commit 29e18143a07ffab7e85cb8db4dc39d394f0c6ea0
-Author: Maximilian Seesslen <mes@seesslen.net>
-Date: Fri Jan 4 16:36:07 2013 +0100
-
- fixed RELEASE_URL for fedora releases higher than 16
-
- The Url for the fedora-release RPM changed in release 17.
-
- Signed-off-by: Maximilian Seesslen <mes@seesslen.net>
- Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
-
-diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
-index 366e776..684bb9c 100644
---- a/templates/lxc-fedora.in
-+++ b/templates/lxc-fedora.in
-@@ -149,7 +149,11 @@ download_fedora()
- echo "Failed to get a mirror"
- continue
- fi
-- RELEASE_URL="$MIRROR_URL/Packages/fedora-release-$release-1.noarch.rpm"
-+ if [ "$release" -gt "16" ]; then
-+ RELEASE_URL="$MIRROR_URL/Packages/f/fedora-release-$release-1.noarch.rpm"
-+ else
-+ RELEASE_URL="$MIRROR_URL/Packages/fedora-release-$release-1.noarch.rpm"
-+ fi
- echo "Fetching from $RELEASE_URL"
- curl -f "$RELEASE_URL" > $INSTALL_ROOT/fedora-release-$release.noarch.rpm
- if [ $? -ne 0 ]; then
diff --git a/lxc-0.9.0-fedora-template.patch b/lxc-0.9.0-fedora-template.patch
new file mode 100644
index 0000000..48eff32
--- /dev/null
+++ b/lxc-0.9.0-fedora-template.patch
@@ -0,0 +1,385 @@
+diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
+index 684bb9c..841af16 100644
+--- a/templates/lxc-fedora.in
++++ b/templates/lxc-fedora.in
+@@ -26,18 +26,69 @@
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ #Configurations
+-arch=$(arch)
++arch=$(uname -m)
+ cache_base=@LOCALSTATEDIR@/cache/lxc/fedora/$arch
+ default_path=@LXCPATH@
+ root_password=root
+
+ # is this fedora?
+-[ -f /etc/fedora-release ] && is_fedora=true
++# Alow for weird remixes like the Raspberry Pi
++#
++# Use the Mitre standard CPE identifier for the release ID if possible...
++# This may be in /etc/os-release or /etc/system-release-cpe. We
++# should be able to use EITHER. Give preference to /etc/os-release for now.
++
++if [ -e /etc/os-release ]
++then
++# This is a shell friendly configuration file. We can just source it.
++# What we're looking for in here is the ID, VERSION_ID and the CPE_NAME
++ . /etc/os-release
++ echo "Host CPE ID from /etc/os-release: ${CPE_NAME}"
++fi
++
++if [ "${CPE_NAME}" = "" -a -e /etc/system-release-cpe ]
++then
++ CPE_NAME=$(head -n1 /etc/system-release-cpe)
++ CPE_URI=$(expr ${CPE_NAME} : '\([^:]*:[^:*]\)')
++ if [ "${CPE_URI}" != "cpe:/o" ]
++ then
++ CPE_NAME=
++ else
++ echo "Host CPE ID from /etc/system-release-cpe: ${CPE_NAME}"
++ # Probably a better way to do this but sill remain posix
++ # compatible but this works, shrug...
++ # Must be nice and not introduce convenient bashisms here.
++ ID=$(expr ${CPE_NAME} : '[^:]*:[^:]*:[^:]*:\([^:]*\)')
++ VERSION_ID=$(expr ${CPE_NAME} : '[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\)')
++ fi
++fi
+
+-if [ "$arch" = "i686" ]; then
+- arch=i386
++if [ ${CPE_NAME} != "" -a ${ID} = "fedora" -a ${VERSION_ID} != "" ]
++then
++ fedora_host_ver=${VERSION_ID}
++ is_fedora=true
++elif [ -e /etc/redhat-release ]
++then
++ # Only if all other methods fail, try to parse the redhat-release file.
++ fedora_host_ver=$( sed -e '/^Fedora /!d' -e 's/Fedora.*\srelease\s*\([0-9][0-9]*\)\s.*/\1/' < /etc/redhat-release )
++ if [ "$fedora_host_ver" != "" ]
++ then
++ is_fedora=true
++ fi
+ fi
+
++# Map a few architectures to their generic Fedora repository archs.
++# The two ARM archs are a bit of a guesstimate for the v5 and v6
++# archs. V6 should have hardware floating point (Rasberry Pi).
++# The "arm" arch is safer (no hardware floating point). So
++# there may be cases where we "get it wrong" for some v6 other
++# than RPi.
++case "$arch" in
++i686) arch=i386 ;;
++armv3l|armv4l|armv5l) arch=arm ;;
++armv6l|armv7l|armv8l) arch=armhfp ;;
++esac
++
+ configure_fedora()
+ {
+
+@@ -50,7 +101,7 @@ configure_fedora()
+ DEVICE=eth0
+ BOOTPROTO=dhcp
+ ONBOOT=yes
+-HOSTNAME=${name}
++HOSTNAME=${utsname}
+ NM_CONTROLLED=no
+ TYPE=Ethernet
+ MTU=${MTU}
+@@ -59,12 +110,18 @@ EOF
+ # set the hostname
+ cat <<EOF > ${rootfs_path}/etc/sysconfig/network
+ NETWORKING=yes
+-HOSTNAME=${name}
++HOSTNAME=${utsname}
+ EOF
+
++ # set hostname on systemd Fedora systems
++ if [ $release -gt 14 ]; then
++ echo "${utsname}" > ${rootfs_path}/etc/hostname
++ fi
++
+ # set minimal hosts
+ cat <<EOF > $rootfs_path/etc/hosts
+-127.0.0.1 localhost $name
++127.0.0.1 localhost.localdomain localhost $utsname
++::1 localhost6.localdomain6 localhost6
+ EOF
+
+ dev_path="${rootfs_path}/dev"
+@@ -118,10 +175,27 @@ configure_fedora_systemd()
+ {
+ unlink ${rootfs_path}/etc/systemd/system/default.target
+ touch ${rootfs_path}/etc/fstab
+- chroot ${rootfs_path} ln -s /dev/null //etc/systemd/system/udev.service
++ chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/udev.service
+ chroot ${rootfs_path} ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
+ #dependency on a device unit fails it specially that we disabled udev
+- sed -i 's/After=dev-%i.device/After=/' ${rootfs_path}/lib/systemd/system/getty\@.service
++ # sed -i 's/After=dev-%i.device/After=/' ${rootfs_path}/lib/systemd/system/getty\@.service
++ #
++ # Actually, the After=dev-%i.device line does not appear in the
++ # Fedora 17 or Fedora 18 systemd getty\@.service file. It may be left
++ # over from an earlier version and it's not doing any harm. We do need
++ # to disable the "ConditionalPathExists=/dev/tty0" line or no gettys are
++ # started on the ttys in the container. Lets do it in an override copy of
++ # the service so it can still pass rpm verifies and not be automatically
++ # updated by a new systemd version. -- mhw /\/\|=mhw=|\/\/
++
++ sed -e 's/^ConditionPathExists=/# ConditionPathExists=/' \
++ -e 's/After=dev-%i.device/After=/' \
++ < ${rootfs_path}/lib/systemd/system/getty\@.service \
++ > ${rootfs_path}/etc/systemd/system/getty\@.service
++ # Setup getty service on the 4 ttys we are going to allow in the
++ # default config. Number should match lxc.tty
++ ( cd ${rootfs_path}/etc/systemd/system/getty.target.wants
++ for i in 1 2 3 4 ; do ln -sf ../getty\@.service getty@tty${i}.service; done )
+ }
+
+ download_fedora()
+@@ -142,27 +216,53 @@ download_fedora()
+ MIRRORLIST_URL="http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$release&arch=$arch"
+
+ DOWNLOAD_OK=no
+- for trynumber in 1 2 3; do
++
++ # We're splitting the old loop into two loops plus a directory retrival.
++ # First loop... Try and retrive a mirror list with retries and a slight
++ # delay between attempts...
++ for trynumber in 1 2 3 4; do
+ [ $trynumber != 1 ] && echo "Trying again..."
+- MIRROR_URL=$(curl -s -S -f "$MIRRORLIST_URL" | head -n2 | tail -n1)
+- if [ $? -ne 0 ] || [ -z "$MIRROR_URL" ]; then
+- echo "Failed to get a mirror"
+- continue
+- fi
++ # This code is mildly "brittle" in that it assumes a certain
++ # page format and parsing HTML. I've done worse. :-P
++ MIRROR_URLS=$(curl -s -S -f "$MIRRORLIST_URL" | sed -e '/^http:/!d' -e '2,6!d')
++ if [ $? -eq 0 ] && [ -n "$MIRROR_URLS" ]
++ then
++ break
++ fi
++
++ echo "Failed to get a mirror on try $trynumber"
++ sleep 3
++ done
++
++ # This will fall through if we didn't get any URLS above
++ for MIRROR_URL in ${MIRROR_URLS}
++ do
+ if [ "$release" -gt "16" ]; then
+- RELEASE_URL="$MIRROR_URL/Packages/f/fedora-release-$release-1.noarch.rpm"
++ RELEASE_URL="$MIRROR_URL/Packages/f"
+ else
+- RELEASE_URL="$MIRROR_URL/Packages/fedora-release-$release-1.noarch.rpm"
++ RELEASE_URL="$MIRROR_URL/Packages/"
+ fi
+- echo "Fetching from $RELEASE_URL"
+- curl -f "$RELEASE_URL" > $INSTALL_ROOT/fedora-release-$release.noarch.rpm
++
++ echo "Fetching rpm name from $RELEASE_URL..."
++ # This code is mildly "brittle" in that it assumes a certain directory
++ # page format and parsing HTML. I've done worse. :-P
++ RELEASE_RPM=$(curl -L -f "$RELEASE_URL" | sed -e "/fedora-release-${release}-/!d" -e 's/.*<a href=\"//' -e 's/\">.*//' )
++ if [ $? -ne 0 -o "${RELEASE_RPM}" = "" ]; then
++ echo "Failed to identify fedora release rpm."
++ continue
++ fi
++
++ echo "Fetching fedora release rpm from ${RELEASE_URL}/${RELEASE_RPM}......"
++ curl -L -f "${RELEASE_URL}/${RELEASE_RPM}" > ${INSTALL_ROOT}/${RELEASE_RPM}
+ if [ $? -ne 0 ]; then
+- echo "Failed to download fedora release rpm"
++ echo "Failed to download fedora release rpm ${RELEASE_RPM}."
+ continue
+ fi
++
+ DOWNLOAD_OK=yes
+ break
+ done
++
+ if [ $DOWNLOAD_OK != yes ]; then
+ echo "Aborting"
+ return 1
+@@ -170,7 +270,7 @@ download_fedora()
+
+ mkdir -p $INSTALL_ROOT/var/lib/rpm
+ rpm --root $INSTALL_ROOT --initdb
+- rpm --root $INSTALL_ROOT -ivh $INSTALL_ROOT/fedora-release-$release.noarch.rpm
++ rpm --root $INSTALL_ROOT -ivh ${INSTALL_ROOT}/${RELEASE_RPM}
+ $YUM install $PKG_LIST
+
+ if [ $? -ne 0 ]; then
+@@ -248,10 +348,13 @@ copy_configuration()
+ mkdir -p $config_path
+ grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config
+ cat <<EOF >> $config_path/config
+-lxc.utsname = $name
++lxc.utsname = $utsname
+ lxc.tty = 4
+ lxc.pts = 1024
+ lxc.mount = $config_path/fstab
++lxc.cap.drop = sys_module mac_admin mac_override sys_time
++
++lxc.autodev = $auto_dev
+
+ # When using LXC with apparmor, uncomment the next line to run unconfined:
+ #lxc.aa_profile = unconfined
+@@ -272,7 +375,7 @@ lxc.cgroup.devices.allow = c 1:8 rwm
+ lxc.cgroup.devices.allow = c 136:* rwm
+ lxc.cgroup.devices.allow = c 5:2 rwm
+ # rtc
+-lxc.cgroup.devices.allow = c 254:0 rwm
++lxc.cgroup.devices.allow = c 254:0 rm
+ EOF
+
+ cat <<EOF > $config_path/fstab
+@@ -313,21 +416,23 @@ usage()
+ cat <<EOF
+ usage:
+ $1 -n|--name=<container_name>
+- [-p|--path=<path>] [-c|--clean] [-R|--release=<Fedora_release>] [-A|--arch=<arch of the container>]
++ [-p|--path=<path>] [-c|--clean] [-R|--release=<Fedora_release>] [--fqdn=<network name of container>] [-A|--arch=<arch of the container>]
+ [-h|--help]
+ Mandatory args:
+ -n,--name container name, used to as an identifier for that container from now on
+ Optional args:
+- -p,--path path to where the container rootfs will be created, defaults to @LXCPATH@. The container config will go under @LXCPATH@ in that case
++ -p,--path path to where the container will be created, defaults to @LXCPATH@. The container config will go under @LXCPATH@ in that case
++ --rootfs path for actual rootfs.
+ -c,--clean clean the cache
+- -R,--release Fedora release for the new container. if the host is Fedora, then it will defaultto the host's release.
++ -R,--release Fedora release for the new container. if the host is Fedora, then it will default to the host's release.
++ --fqdn fully qualified domain name (FQDN) for DNS and system naming
+ -A,--arch NOT USED YET. Define what arch the container will be [i686,x86_64]
+ -h,--help print this help
+ EOF
+ return 0
+ }
+
+-options=$(getopt -o hp:n:cR: -l help,path:,name:,clean,release: -- "$@")
++options=$(getopt -o hp:n:cR: -l help,path:,rootfs:,name:,clean,release:,fqdn: -- "$@")
+ if [ $? -ne 0 ]; then
+ usage $(basename $0)
+ exit 1
+@@ -339,9 +444,11 @@ do
+ case "$1" in
+ -h|--help) usage $0 && exit 0;;
+ -p|--path) path=$2; shift 2;;
++ --rootfs) rootfs=$2; shift 2;;
+ -n|--name) name=$2; shift 2;;
+ -c|--clean) clean=$2; shift 2;;
+ -R|--release) release=$2; shift 2;;
++ --fqdn) utsname=$2; shift 2;;
+ --) shift 1; break ;;
+ *) break ;;
+ esac
+@@ -352,6 +459,29 @@ if [ ! -z "$clean" -a -z "$path" ]; then
+ exit 0
+ fi
+
++if [ -z "${utsname}" ]; then
++ utsname=${name}
++fi
++
++# This follows a standard "resolver" convention that an FQDN must have
++# at least two dots or it is considered a local relative host name.
++# If it doesn't, append the dns domain name of the host system.
++#
++# This changes one significant behavior when running
++# "lxc_create -n Container_Name" without using the
++# --fqdn option.
++#
++# Old behavior:
++# utsname and hostname = Container_Name
++# New behavior:
++# utsname and hostname = Container_Name.Domain_Name
++
++if [ $(expr "$utsname" : '.*\..*\.') = 0 ]; then
++ if [ -n "$(dnsdomainname)" ]; then
++ utsname=${utsname}.$(dnsdomainname)
++ fi
++fi
++
+ needed_pkgs=""
+ type yum >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+@@ -365,33 +495,43 @@ fi
+
+ if [ -n "$needed_pkgs" ]; then
+ echo "Missing commands: $needed_pkgs"
+- echo "Please install these using \"sudo apt-get install $needed_pkgs\""
++ echo "Please install these using \"sudo yum install $needed_pkgs\""
+ exit 1
+ fi
+
+ if [ -z "$path" ]; then
+- path=$default_path
++ path=$default_path/$name
+ fi
+
+ if [ -z "$release" ]; then
+- if [ "$is_fedora" ]; then
+- release=$(cat /etc/fedora-release |awk '/^Fedora/ {print $3}')
++ if [ "$is_fedora" -a "$fedora_host_ver" ]; then
++ release=$fedora_host_ver
+ else
+- echo "This is not a fedora host and release missing, defaulting to 14. use -R|--release to specify release"
+- release=14
++ echo "This is not a fedora host and release missing, defaulting to 18. use -R|--release to specify release"
++ release=18
+ fi
+ fi
+
++# Fedora 15 and above run systemd. We need autodev enabled to keep
++# systemd from causing problems.
++if [ $release -gt 14 ]; then
++ auto_dev="1"
++else
++ auto_dev="0"
++fi
++
+ if [ "$(id -u)" != "0" ]; then
+ echo "This script should be run as 'root'"
+ exit 1
+ fi
+
+
+-rootfs_path=$path/$name/rootfs
+-# check for 'lxc.rootfs' passed in through default config by lxc-create
+-if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
+- rootfs_path=`grep 'lxc.rootfs =' $path/config | awk -F= '{ print $2 }'`
++if [ -z "$rootfs_path" ]; then
++ rootfs_path=$path/rootfs
++ # check for 'lxc.rootfs' passed in through default config by lxc-create
++ if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
++ rootfs_path=`grep 'lxc.rootfs =' $path/config | awk -F= '{ print $2 }'`
++ fi
+ fi
+ config_path=$default_path/$name
+ cache=$cache_base/$release
+@@ -427,13 +567,20 @@ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+
+-type /bin/systemd >/dev/null 2>&1
+-if [ $? -ne 0 ]; then
+- configure_fedora_init
+-else
++# If the systemd configuration directory exists - set it up for what we need.
++if [ -d ${rootfs_path}/etc/systemd/system ]
++then
+ configure_fedora_systemd
+ fi
+
++# This configuration (rc.sysinit) is not inconsistent with the systemd stuff
++# above and may actually coexist on some upgraded systems. Let's just make
++# sure that, if it exists, we update this file, even if it's not used...
++if [ -f ${rootfs_path}/etc/rc.sysinit ]
++then
++ configure_fedora_init
++fi
++
+ if [ ! -z $clean ]; then
+ clean || exit 1
+ exit 0
diff --git a/lxc-0.9.0-lua-5.2.patch b/lxc-0.9.0-lua-5.2.patch
new file mode 100644
index 0000000..e48a1c2
--- /dev/null
+++ b/lxc-0.9.0-lua-5.2.patch
@@ -0,0 +1,39 @@
+diff -up lxc-0.9.0/src/lua-lxc/lxc.lua.orig lxc-0.9.0/src/lua-lxc/lxc.lua
+--- lxc-0.9.0/src/lua-lxc/lxc.lua.orig 2013-02-18 08:47:43.000000000 +0100
++++ lxc-0.9.0/src/lua-lxc/lxc.lua 2013-09-01 23:51:05.582938966 +0200
+@@ -282,7 +282,7 @@ function container:stat_get_ints(control
+ table.insert(result, val)
+ end
+ end
+- return unpack(result)
++ return table.unpack(result)
+ end
+
+ -- read an integer from a cgroup file
+diff -up lxc-0.9.0/src/lua-lxc/Makefile.am.orig lxc-0.9.0/src/lua-lxc/Makefile.am
+--- lxc-0.9.0/src/lua-lxc/Makefile.am.orig 2013-04-05 11:45:22.000000000 +0200
++++ lxc-0.9.0/src/lua-lxc/Makefile.am 2013-09-01 23:51:05.581938980 +0200
+@@ -1,7 +1,7 @@
+ if ENABLE_LUA
+
+-luadir=$(datadir)/lua/5.1
+-sodir=$(libdir)/lua/5.1/lxc
++luadir=$(datadir)/lua/5.2
++sodir=$(libdir)/lua/5.2/lxc
+
+ lua_SCRIPTS=lxc.lua
+
+diff -up lxc-0.9.0/src/lua-lxc/Makefile.in.orig lxc-0.9.0/src/lua-lxc/Makefile.in
+--- lxc-0.9.0/src/lua-lxc/Makefile.in.orig 2013-04-05 11:48:20.000000000 +0200
++++ lxc-0.9.0/src/lua-lxc/Makefile.in 2013-09-01 23:51:18.384762328 +0200
+@@ -230,8 +230,8 @@ target_alias = @target_alias@
+ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+-@ENABLE_LUA_TRUE@luadir = $(datadir)/lua/5.1
+-@ENABLE_LUA_TRUE@sodir = $(libdir)/lua/5.1/lxc
++@ENABLE_LUA_TRUE@luadir = $(datadir)/lua/5.2
++@ENABLE_LUA_TRUE@sodir = $(libdir)/lua/5.2/lxc
+ @ENABLE_LUA_TRUE@lua_SCRIPTS = lxc.lua
+ @ENABLE_LUA_TRUE@core_so_SOURCES = core.c
+ @ENABLE_LUA_TRUE@AM_CFLAGS = -I$(top_srcdir)/src $(LUA_CFLAGS) -DVERSION=\"$(VERSION)\" -DLXCPATH=\"$(LXCPATH)\"
diff --git a/lxc.spec b/lxc.spec
index 680e752..060a725 100644
--- a/lxc.spec
+++ b/lxc.spec
@@ -1,16 +1,40 @@
+%if 0%{?fedora} || 0%{?rhel} > 6
+%global with_python3 1
+%endif
+
+%global with_lua 1
+%if 0%{?fedora} > 19
+%global luaver 5.2
+%else
+%global luaver 5.1
+%endif
+%global lualibdir %{_libdir}/lua/%{luaver}
+%global luapkgdir %{_datadir}/lua/%{luaver}
+
Name: lxc
-Version: 0.8.0
-Release: 3%{?dist}
+Version: 0.9.0
+Release: 1%{?dist}
Summary: Linux Resource Containers
Group: Applications/System
-License: LGPLv2+
+License: LGPLv2+ and GPLv2
URL: http://lxc.sourceforge.net
Source0: http://lxc.sourceforge.net/download/lxc/%{name}-%{version}.tar.gz
-Patch0: lxc-0.8.0-fedora-template.patch
+Patch0: lxc-0.9.0-fedora-template.patch
+# only used on Fedora > 19
+Patch1: lxc-0.9.0-lua-5.2.patch
BuildRequires: docbook-utils
+Buildrequires: docbook2X
BuildRequires: kernel-headers
BuildRequires: libcap-devel
BuildRequires: libtool
+%if 0%{?with_python3}
+BuildRequires: python3-devel >= 3.2
+%endif
+%if 0%{?with_lua}
+BuildRequires: lua-devel
+%endif
+
+%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
%description
Linux Resource Containers provide process and resource isolation without the
@@ -20,7 +44,6 @@ overhead of full virtualization.
%package libs
Summary: Runtime library files for %{name}
Group: System Environment/Libraries
-Requires: %{name} = %{version}-%{release}
%description libs
Linux Resource Containers provide process and resource isolation without the
@@ -29,16 +52,59 @@ overhead of full virtualization.
The %{name}-libs package contains libraries for running %{name} applications.
+%if 0%{?with_python3}
+%package -n python3-%{name}
+Summary: Python binding for %{name}
+Group: System Environment/Libraries
+
+%description -n python3-%{name}
+Linux Resource Containers provide process and resource isolation without the
+overhead of full virtualization.
+
+The python3-%{name} package contains the Python3 binding for %{name}.
+
+%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}_lxc\\..*\\.so
+
+
+%package extra
+Summary: Extra tools for %{name}
+Group: Applications/System
+Requires: python3-%{name}%{?_isa} = %{version}-%{release}
+
+%description extra
+Linux Resource Containers provide process and resource isolation without the
+overhead of full virtualization.
+
+This package contains tools needing the Python3 bindings.
+%endif
+
+
+%if 0%{?with_lua}
+%package -n lua-%{name}
+Summary: Lua binding for %{name}
+Group: System Environment/Libraries
+Requires: lua-filesystem
+
+%description -n lua-%{name}
+Linux Resource Containers provide process and resource isolation without the
+overhead of full virtualization.
+
+The lua-%{name} package contains the Lua binding for %{name}.
+
+%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}core\\.so\\.0
+%endif
+
+
%package templates
Summary: Templates for %{name}
Group: System Environment/Libraries
-Requires: %{name} = %{version}-%{release}
+Requires: %{name}-libs%{?_isa} = %{version}-%{release}
# needed for lxc-busybox
Requires: busybox
# needed for lxc-debian
Requires: dpkg
# needed for lxc-debian, lxc-ubuntu:
-Requires: debootstrap
+Requires: debootstrap rsync
# needed for lxc-sshd
Requires: openssh-server dhclient
@@ -47,13 +113,13 @@ Requires: openssh-server dhclient
Linux Resource Containers provide process and resource isolation without the
overhead of full virtualization.
-The %{name}-template package contains templates for creating containers.
+The %{name}-templates package contains templates for creating containers.
%package devel
Summary: Development files for %{name}
Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
+Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: pkgconfig
%description devel
@@ -67,19 +133,32 @@ developing applications that use %{name}.
%package doc
Summary: Documentation for %{name}
Group: Documentation
-Requires: %{name} = %{version}-%{release}
+BuildArch: noarch
%description doc
This package contains documentation for %{name}.
%prep
-%setup -q
+%setup -q -n %{name}-%{version}
%patch0 -p1
-
+%if 0%{?with_lua} && 0%{?fedora} > 19
+%patch1 -p1
+%endif
%build
-%configure --enable-doc --disable-rpath --disable-apparmor
+%configure --with-distro=fedora \
+ --enable-doc \
+ --docdir=%{_pkgdocdir} \
+ --disable-rpath \
+ --disable-apparmor \
+%if 0%{?with_python3}
+ --enable-python \
+%endif
+%if 0%{?with_lua}
+ --enable-lua \
+%endif
+# intentionally blank line
make %{?_smp_mflags}
@@ -87,6 +166,12 @@ make %{?_smp_mflags}
%{make_install}
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}
+%if 0%{?with_lua}
+chmod -x %{buildroot}%{luapkgdir}/lxc.lua
+%endif
+
+mkdir -p %{buildroot}%{_pkgdocdir}
+cp -a AUTHORS COPYING README %{buildroot}%{_pkgdocdir}
%check
@@ -100,21 +185,60 @@ make check
%files
-%doc AUTHORS COPYING README
%{_bindir}/%{name}-*
-%{_mandir}/man*/%{name}*
-%{_sharedstatedir}/%{name}
+%{_mandir}/man1/%{name}*
+%{_datadir}/%{name}/lxc.functions
+%if 0%{?with_python3}
+%exclude %{_bindir}/%{name}-device
+%exclude %{_bindir}/%{name}-ls
+%exclude %{_bindir}/%{name}-start-ephemeral
+%exclude %{_mandir}/man1/%{name}-device*
+%exclude %{_mandir}/man1/%{name}-ls*
+%exclude %{_mandir}/man1/%{name}-start-ephemeral*
+%else
+%{_bindir}/%{name}-ls
+%{_mandir}/man1/%{name}-ls*
+%endif
%files libs
-%doc AUTHORS COPYING
-%dir %{_datadir}/lxc
-%dir %{_datadir}/lxc/templates
+%dir %{_datadir}/%{name}
+%dir %{_datadir}/%{name}/templates
+%{_datadir}/%{name}/hooks
%{_libdir}/liblxc.so.*
-%dir %{_libdir}/lxc
-%{_libdir}/lxc/rootfs
-%dir %{_libexecdir}/lxc
-%{_libexecdir}/lxc/lxc-init
+%{_libdir}/%{name}
+%{_libexecdir}/%{name}
+%{_sharedstatedir}/%{name}
+%dir %{_sysconfdir}/%{name}
+%config(noreplace) %{_sysconfdir}/%{name}/default.conf
+%{_mandir}/man5/%{name}*
+%{_mandir}/man7/%{name}*
+%dir %{_pkgdocdir}
+%{_pkgdocdir}/AUTHORS
+%{_pkgdocdir}/COPYING
+%{_pkgdocdir}/README
+
+
+%if 0%{?with_python3}
+%files -n python3-%{name}
+%{python3_sitearch}/*
+
+
+%files extra
+%{_bindir}/%{name}-device
+%{_bindir}/%{name}-ls
+%{_bindir}/%{name}-start-ephemeral
+%{_mandir}/man1/%{name}-device*
+%{_mandir}/man1/%{name}-ls*
+%{_mandir}/man1/%{name}-start-ephemeral*
+%endif
+
+
+%if 0%{?with_lua}
+%files -n lua-%{name}
+%{lualibdir}/%{name}
+%{luapkgdir}/%{name}.lua
+%endif
%files templates
@@ -123,8 +247,6 @@ make check
%exclude %{_datadir}/lxc/templates/lxc-altlinux
# needs pacman
%exclude %{_datadir}/lxc/templates/lxc-archlinux
-# probably outdated
-%exclude %{_datadir}/lxc/templates/lxc-lenny
# needs zypper
%exclude %{_datadir}/lxc/templates/lxc-opensuse
# needs ubuntu-cloudimg-query
@@ -138,10 +260,24 @@ make check
%files doc
-%{_docdir}/%{name}
+%dir %{_pkgdocdir}
+# README, AUTHORS and COPYING intentionally duplicated because -doc
+# can be installed on its own.
+%{_pkgdocdir}/*
%changelog
+* Sun Sep 1 2013 Thomas Moschny <thomas.moschny@gmx.de> - 0.9.0-1
+- Update to 0.9.0.
+- Make the -libs subpackage installable on its own:
+ - Move files needed by the libraries to the subpackage.
+ - Let packages depend on -libs.
+- Add rsync as dependency to the templates package.
+- Add (optional) subpackages for Python3 and Lua bindings.
+- Add upstream patches for the Fedora template.
+- Define and use the _pkgdocdir macro, also fixing rhbz#1001235.
+- Update License tag.
+
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
@@ -198,4 +334,3 @@ make check
* Sat Jul 25 2009 Silas Sewell <silas@sewell.ch> - 0.6.3-1
- Initial package
-
diff --git a/sources b/sources
index 64e11a1..f960493 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-7304fa57146ce687f749b5df876bb20d lxc-0.8.0.tar.gz
+8552a4479090616f4bc04d8473765fc9 lxc-0.9.0.tar.gz