General packaging improvements.

- Include sysvinit resp. systemd support for autostart of containers.
- Do not list explicit requirements for templates.
- Add missing dependency on lxc-lua for lxc-top.
- Include apidocs.
This commit is contained in:
Thomas Moschny 2014-08-08 11:12:32 +02:00
parent b414f891d9
commit e82df9eb33
3 changed files with 123 additions and 36 deletions

1
.gitignore vendored
View File

@ -5,4 +5,5 @@ lxc-0.7.2.tar.gz
/lxc-0.8.0.tar.gz
/lxc-0.9.0.tar.gz
/lxc-1.0.3.tar.gz
/lxc-1.0.4.tar.gz
/lxc-1.0.5.tar.gz

22
lxc-1.0.4-fix-init.patch Normal file
View File

@ -0,0 +1,22 @@
diff -up lxc-1.0.4/config/init/sysvinit/lxc.in.orig lxc-1.0.4/config/init/sysvinit/lxc.in
--- lxc-1.0.4/config/init/sysvinit/lxc.in.orig 2014-07-05 17:47:14.143145522 +0200
+++ lxc-1.0.4/config/init/sysvinit/lxc.in 2014-07-05 18:01:40.053721615 +0200
@@ -2,13 +2,15 @@
#
# lxc Start/Stop LXC autoboot containers
#
-# chkconfig: 345 99 01
+# chkconfig: - 99 01
# description: Starts/Stops all LXC containers configured for autostart.
#
### BEGIN INIT INFO
# Provides: lxc
-# Default-Start: 3 4 5
-# Default-Stop: 0 1 6
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
+# Default-Start:
+# Default-Stop:
# Short-Description: Bring up/down LXC autostart containers
# Description: Bring up/down LXC autostart containers
### END INIT INFO

136
lxc.spec
View File

@ -2,6 +2,14 @@
%global with_python3 1
%endif
%if 0%{?fedora} || 0%{?rhel} >= 7
%global with_systemd 1
%endif
%if 0%{?fedora} || ( 0%{?rhel} >= 7 && %{_arch} != ppc64 )
%global with_seccomp 1
%endif
%if 0%{?fedora} > 19
%global luaver 5.2
%else
@ -12,23 +20,32 @@
Name: lxc
Version: 1.0.5
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Linux Resource Containers
Group: Applications/System
License: LGPLv2+ and GPLv2
URL: http://linuxcontainers.org
Source0: http://linuxcontainers.org/downloads/%{name}-%{version}.tar.gz
Patch0: lxc-1.0.4-fix-init.patch
BuildRequires: docbook-utils
Buildrequires: docbook2X
Buildrequires: doxygen
BuildRequires: kernel-headers
BuildRequires: libselinux-devel
%if 0%{?with_seccomp}
BuildRequires: libseccomp-devel
%endif # with_seccomp
BuildRequires: libcap-devel
BuildRequires: libtool
BuildRequires: lua-devel
%if 0%{?with_python3}
BuildRequires: python3-devel >= 3.2
%endif
%endif # with_python3
%if 0%{?with_systemd}
BuildRequires: systemd
%endif # with_systemd
# for lxc-top
Requires: lua-%{name}%{?_isa} = %{version}-%{release}
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
@ -40,9 +57,16 @@ overhead of full virtualization.
%package libs
Summary: Runtime library files for %{name}
Group: System Environment/Libraries
%if 0%{?with_systemd}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): chkconfig
Requires(preun): initscripts, chkconfig
Requires(postun): initscripts
%endif # with_systemd
%description libs
Linux Resource Containers provide process and resource isolation without the
@ -75,7 +99,7 @@ Linux Resource Containers provide process and resource isolation without the
overhead of full virtualization.
This package contains tools needing the Python3 bindings.
%endif
%endif # with_python3
%package -n lua-%{name}
@ -96,14 +120,14 @@ The lua-%{name} package contains the Lua binding for %{name}.
Summary: Templates for %{name}
Group: System Environment/Libraries
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 rsync
# needed for lxc-sshd
Requires: openssh-server dhclient
# Note: Requirements for the template scripts (busybox, dpkg,
# debootstrap, rsync, openssh-server, dhclient, apt, pacman, zypper,
# ubuntu-cloudimg-query etc...) are not explicitly mentioned here:
# their presence varies wildly on supported Fedora/EPEL releases and
# archs, and they are in most cases needed for a single template
# only. Also, the templates normally fail graciously when such a tool
# is missing. Moving each template to its own subpackage on the other
# hand would be overkill.
%description templates
@ -137,19 +161,32 @@ This package contains documentation for %{name}.
%prep
%setup -q
%setup -q -n %{name}-%{version}
%patch0 -p1
%build
%configure --with-distro=fedora \
--enable-doc \
--enable-api-docs \
--disable-silent-rules \
--docdir=%{_pkgdocdir} \
--disable-rpath \
--disable-apparmor \
--disable-cgmanager \
--enable-selinux \
%if 0%{?with_seccomp}
--enable-seccomp \
%endif # with_seccomp
--enable-lua \
%if 0%{?with_python3}
--enable-python \
%endif
%endif # with_python3
%if 0%{?with_systemd}
--with-init-script=systemd \
%else
--with-init-script=sysvinit \
%endif # with_systemd
# intentionally blank line
make %{?_smp_mflags}
@ -158,27 +195,16 @@ 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}
mkdir -p %{buildroot}%{_pkgdocdir}/api
cp -a doc/api/html/* %{buildroot}%{_pkgdocdir}/api/
# cache dir
mkdir -p %{buildroot}%{_localstatedir}/cache/%{name}
# move templates with extra dependencies
# - lxc-altlinux needs apt
# - lxc-archlinux needs pacman
# - lxc-opensuse needs zypper
# - lxc-ubuntu-cloud needs ubuntu-cloudimg-query
mkdir -p %{buildroot}%{_pkgdocdir}/templates
for t in altlinux archlinux opensuse ubuntu-cloud ; do
mv %{buildroot}%{_datadir}/%{name}/templates/%{name}-$t \
%{buildroot}%{_pkgdocdir}/templates
done
%check
make check
@ -186,23 +212,46 @@ make check
%post libs
/sbin/ldconfig
%if 0%{?with_systemd}
%systemd_post %{name}.service
%else
/sbin/chkconfig --add %{name}
%endif # with_systemd
%preun libs
%if 0%{?with_systemd}
%systemd_preun %{name}.service
%else
if [ $1 -eq 0 ]; then
/sbin/service %{name} stop > /dev/null 2>&1
/sbin/chkconfig --del %{name}
fi
%endif # with_systemd
%postun libs
/sbin/ldconfig
%if 0%{?with_systemd}
%systemd_postun %{name}.service
%else
if [ $1 -ge 1 ]; then
/sbin/service %{name} condrestart > /dev/null 2>&1 || :
fi
%endif # with_systemd
%files
%{_bindir}/%{name}-*
%{_mandir}/man1/%{name}*
%{_mandir}/*/man1/%{name}*
%{_datadir}/%{name}/lxc.functions
# in lxc-libs:
%exclude %{_bindir}/%{name}-autostart
%exclude %{_mandir}/man1/%{name}-autostart*
%exclude %{_mandir}/*/man1/%{name}-autostart*
%exclude %{_mandir}/man1/%{name}-user-nic*
%exclude %{_mandir}/*/man1/%{name}-user-nic*
%{_datadir}/%{name}/%{name}.functions
%if 0%{?with_python3}
%exclude %{_bindir}/%{name}-device
%exclude %{_bindir}/%{name}-ls
@ -210,9 +259,9 @@ make check
%exclude %{_mandir}/man1/%{name}-device*
%exclude %{_mandir}/man1/%{name}-ls*
%exclude %{_mandir}/man1/%{name}-start-ephemeral*
%else
%{_bindir}/%{name}-ls
%{_mandir}/man1/%{name}-ls*
%exclude %{_mandir}/*/man1/%{name}-device*
%exclude %{_mandir}/*/man1/%{name}-ls*
%exclude %{_mandir}/*/man1/%{name}-start-ephemeral*
%endif
%dir %{_sysconfdir}/bash_completion.d/
%{_sysconfdir}/bash_completion.d/%{name}
@ -223,14 +272,20 @@ make check
%dir %{_datadir}/%{name}/templates
%dir %{_datadir}/%{name}/config
%{_datadir}/%{name}/hooks
%{_datadir}/%{name}/%{name}-patch.py*
%{_libdir}/liblxc.so.*
%{_libdir}/%{name}
%{_libexecdir}/%{name}
# fixme: should be in libexecdir?
%{_sbindir}/init.%{name}
%{_bindir}/%{name}-autostart
%{_sharedstatedir}/%{name}
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/default.conf
%{_mandir}/man1/%{name}-autostart*
%{_mandir}/*/man1/%{name}-autostart*
%{_mandir}/man1/%{name}-user-nic*
%{_mandir}/*/man1/%{name}-user-nic*
%{_mandir}/man5/%{name}*
%{_mandir}/man7/%{name}*
%{_mandir}/*/man5/%{name}*
@ -239,10 +294,12 @@ make check
%{_pkgdocdir}/AUTHORS
%{_pkgdocdir}/COPYING
%{_pkgdocdir}/README
%if 0%{?with_systemd}
%{_unitdir}/%{name}.service
%else
%{_sysconfdir}/rc.d/init.d/%{name}
%endif # with_systemd
%dir %{_localstatedir}/cache/%{name}
# fixme:
%exclude %{_datadir}/%{name}/%{name}-patch.py*
%if 0%{?with_python3}
@ -257,7 +314,10 @@ make check
%{_mandir}/man1/%{name}-device*
%{_mandir}/man1/%{name}-ls*
%{_mandir}/man1/%{name}-start-ephemeral*
%endif
%{_mandir}/*/man1/%{name}-device*
%{_mandir}/*/man1/%{name}-ls*
%{_mandir}/*/man1/%{name}-start-ephemeral*
%endif # with_python3
%files -n lua-%{name}
@ -268,7 +328,6 @@ make check
%files templates
%{_datadir}/%{name}/templates/lxc-*
%{_datadir}/%{name}/config/*
%{_pkgdocdir}/templates
%files devel
@ -282,10 +341,15 @@ make check
# README, AUTHORS and COPYING intentionally duplicated because -doc
# can be installed on its own.
%{_pkgdocdir}/*
%exclude %{_pkgdocdir}/templates
%changelog
* Fri Aug 8 2014 Thomas Moschny <thomas.moschny@gmx.de> - 1.0.5-2
- Include sysvinit resp. systemd support for autostart of containers.
- Do not list explicit requirements for templates.
- Add missing dependency on lxc-lua for lxc-top.
- Include apidocs.
* Fri Aug 8 2014 Peter Robinson <pbrobinson@fedoraproject.org> 1.0.5-1
- Update to 1.0.5