[cgmanager-devel] [PATCH] add .spec for rpm build, minor packaging fixes

Serge Hallyn serge.hallyn at ubuntu.com
Tue Feb 4 19:42:02 UTC 2014


Quoting Dwight Engen (dwight.engen at oracle.com):
> - use pkginclude_HEADERS so that make install puts the header in
>   /usr/include/cgmanager/cgmanger-client.h instead of directly in
>   /usr/include. We'll need to fix the path used in lxc.

Hm, right now in the ubuntu package they are in
/usr/include/cgmanager-client.  This is the sort of area where I haven't
a clue.  Is /usr/include better?

(I'll apply after I get an answer to this)

> - put libcgmanager.pc in $(libdir) see here for why:
>   https://lists.linuxcontainers.org/pipermail/lxc-devel/2012-September/002643.html

I have a feeling lxc will briefly fail to build on ubuntu with
--enable-cgmanager, but it seems like the right thing to do.

> - fix make -j by adding cgmanager and cgproxy as deps for building
>   their manpage since help2man runs them to generate it

<nod>

> - add libnih and libnih-dbus to .pc as requires so
>   pkg-config --libs libcgmanger outputs them

<nod>.  Should libdbus-1-dev also be added?

btw, cgman*a*ger *really* is hard to type isn't it.  I shoulda
called it cgmgr.

> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Thanks, Dwight.

> ---
>  .gitignore            |  4 +++
>  Makefile.am           | 13 +++++---
>  cgmanager.spec.in     | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  configure.ac          |  2 +-
>  libcgmanager.pc.in.in |  1 +
>  5 files changed, 106 insertions(+), 6 deletions(-)
>  create mode 100644 cgmanager.spec.in
> 
> diff --git a/.gitignore b/.gitignore
> index c4bf296..5ee61a4 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -17,6 +17,7 @@ Makefile
>  
>  aclocal.m4
>  autom4te.cache
> +cgmanager.spec
>  configure
>  config.log
>  config.status
> @@ -42,3 +43,6 @@ cgproxy
>  
>  org.linuxcontainers.cgmanager.c
>  org.linuxcontainers.cgmanager.h
> +
> +cgmanager.8
> +cgproxy.8
> diff --git a/Makefile.am b/Makefile.am
> index c87e03f..92f062c 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -26,7 +26,7 @@ sbin_PROGRAMS = cgmanager cgproxy
>  
>  lib_LTLIBRARIES = libcgmanager.la
>  
> -include_HEADERS = cgmanager-client.h
> +pkginclude_HEADERS = cgmanager-client.h
>  
>  man_MANS = cgproxy.8 cgmanager.8
>  
> @@ -34,9 +34,9 @@ libcgmanager.pc: libcgmanager.pc.in
>  	sed -e 's|[@]LIBCGMANAGER_VERSION_DOTTED[@]|$(LIBCGMANAGER_VERSION_DOTTED)|g' \
>  		$< > $@
>  
> -EXTRA_DIST = libcgmanager.pc.in.in tests
> +EXTRA_DIST = libcgmanager.pc.in.in cgmanager.spec tests
>  
> -pkgconfigdir = $(prefix)/lib/pkgconfig
> +pkgconfigdir = $(libdir)/pkgconfig
>  pkgconfig_DATA = libcgmanager.pc
>  
>  $(manager_files_OUTPUTS): org.linuxcontainers.cgmanager.xml
> @@ -78,10 +78,10 @@ libcgmanager_la_LDFLAGS = -E \
>  libcgmanager_la_LIBADD = \
>  	$(DBUS_LIBS) $(NIH_CFLAGS) $(NIH_DBUS_CFLAGS)
>  
> -cgmanager.8: cgmanager.c
> +cgmanager.8: cgmanager.c cgmanager
>  	$(HELP2MAN) -s 8 -I cgmanager.man.add -N ./cgmanager > cgmanager.8
>  
> -cgproxy.8: cgmanager-proxy.c
> +cgproxy.8: cgmanager-proxy.c cgproxy
>  	$(HELP2MAN) -s 8 -I cgproxy.man.add -N ./cgproxy > cgproxy.8
>  
>  install-exec-local:
> @@ -90,3 +90,6 @@ install-exec-local:
>  	for f in *.sh; do \
>  	install -c -m 755 $$f $(DESTDIR)/usr/share/cgmanager/tests; \
>  	done
> +
> +rpm: dist
> +	rpmbuild --clean -ta ${distdir}.tar.gz
> diff --git a/cgmanager.spec.in b/cgmanager.spec.in
> new file mode 100644
> index 0000000..10827fd
> --- /dev/null
> +++ b/cgmanager.spec.in
> @@ -0,0 +1,92 @@
> +#
> +# cgmanager: cgroup manager daemon
> +#
> +# Copyright (C) 2013 Oracle
> +#
> +# Authors:
> +# Dwight Engen <dwight.engen at oracle.com>
> +#
> +# This library is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU Lesser General Public
> +# License as published by the Free Software Foundation; either
> +# version 2.1 of the License, or (at your option) any later version.
> +#
> +# This library is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +# Lesser General Public License for more details.
> +#
> +# You should have received a copy of the GNU Lesser General Public
> +# License along with this library; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> +
> +Name: @PACKAGE@
> +Version: @PACKAGE_VERSION@
> +Release: 1%{?dist}
> +URL: http://cgmanager.linuxcontainers.org
> +Source: http://cgmanager.linuxcontainers.org/downloads/%{name}-%{version}.tar.gz
> +Summary: Linux cgroup manager
> +Group: Applications/System
> +License: LGPLv2+
> +BuildRoot: %{_tmppath}/%{name}-%{version}-build
> +Requires: dbus libnih libnih-dbus
> +BuildRequires: libnih-devel dbus-devel help2man
> +
> +%description
> +CGManager is a central privileged daemon that manages all your cgroups for
> +you through a simple DBus API.  It's designed to work with nested LXC
> +containers as well as accepting unprivileged requests including resolving
> +user namespaces UIDs/GIDs.
> +
> +%package	libs
> +Summary:	Shared library files for %{name}
> +Group:		System Environment/Libraries
> +%description	libs
> +The %{name}-libs package contains libraries for running %{name} applications.
> +
> +%package	devel
> +Summary:	Development library for %{name}
> +Group:		Development/Libraries
> +Requires:	%{name} = %{version}-%{release}, pkgconfig
> +%description	devel
> +The %{name}-devel package contains header files and library needed for
> +development with %{name}.
> +
> +%prep
> +%setup -q -n %{name}-%{version}
> +%build
> +PATH=$PATH:/usr/sbin:/sbin %configure $args
> +make %{?_smp_mflags}
> +
> +%install
> +rm -rf %{buildroot}
> +make install DESTDIR=%{buildroot}
> +find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
> +
> +%clean
> +rm -rf %{buildroot}
> +
> +%post
> +%post   libs -p /sbin/ldconfig
> +%postun libs -p /sbin/ldconfig
> +
> +%files
> +%defattr(-,root,root)
> +%{_sbindir}/*
> +%{_mandir}/man8/*
> +%{_datadir}/%{name}/*
> +
> +%files libs
> +%defattr(-,root,root)
> +%{_libdir}/*.so.*
> +
> +%files devel
> +%defattr(-,root,root)
> +%{_includedir}/%{name}/*
> +%{_libdir}/*.a
> +%{_libdir}/*.so
> +%{_libdir}/pkgconfig/*
> +
> +%changelog
> +* Tue Feb 04 2014 Dwight Engen <dwight.engen at oracle.com> - 0.19
> +- created
> diff --git a/configure.ac b/configure.ac
> index 66773e3..bc25985 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -5,7 +5,7 @@ AC_INIT([cgmanager], [0.19], [cgmanager-devel at lists.linuxcontainers.org])
>  
>  AC_GNU_SOURCE
>  AC_CONFIG_HEADERS([config.h])
> -AC_CONFIG_FILES([Makefile libcgmanager.pc.in])
> +AC_CONFIG_FILES([Makefile libcgmanager.pc.in cgmanager.spec])
>  
>  AM_INIT_AUTOMAKE
>  
> diff --git a/libcgmanager.pc.in.in b/libcgmanager.pc.in.in
> index f688c50..a7b4d2a 100644
> --- a/libcgmanager.pc.in.in
> +++ b/libcgmanager.pc.in.in
> @@ -6,5 +6,6 @@ includedir=@includedir@
>  Name: libcgmanager
>  Description: cgroup manager library
>  Version: @LIBCGMANAGER_VERSION_DOTTED@
> +Requires: libnih libnih-dbus
>  Libs: -L${libdir} -lcgmanager
>  Cflags: -I${includedir}
> -- 
> 1.8.5.3
> 
> _______________________________________________
> cgmanager-devel mailing list
> cgmanager-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/cgmanager-devel


More information about the cgmanager-devel mailing list