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