# # libtune.spec - "spec" file for the libtune library # # %define base_kernel %(rpm -q --queryformat='%{VERSION}' kernel-headers | awk -F"." '{print $1 "." $2 "." $3}') %if "0%{?dist}" != "0" %define distro_string %(echo '%{dist}' | cut -c2-) %else %define distro_string default %endif %if 0%{fedora} %define family fc %endif Name: libtune Version: 0.14 Release: 1%{?dist} Summary: Library that Standardizes the Access to Kernel Tunables Group: System Environment/Libraries License: LGPLv2 URL: http://libtune.sourceforge.net Source: %{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: tunables-base-data = %{version} Requires: tunables-distro-data = %{version} BuildRequires: kernel >= 2.6.15 BuildRequires: bison >= 1.75 BuildRequires: flex >= 2.5.3 BuildRequires: libtool BuildRequires: kernel-headers BuildRequires: redhat-lsb %description The libtune library aims at providing a standard API to unify the various ways Linux developers have to access kernel tunables, system information and resource consumptions. This API is built on top of the existing mechanisms (in order not to break backward compatibility), and can be used by the applications to manipulate the information and tunables from the kernel. Using a single interface you can get the value of a tunable wherever it is located (sysfs or procfs), whether its value is the unique content of a file or a field within a file. This is also true for setting a tunable value. This package supplies only the library. %package devel Summary: Libtune development Group: System Environment/Libraries License: LGPLv2 Requires: %{name} = %{version} Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig %description devel This package supplies the header files to use with the library, as well as the header files used to generate the tunables databases. It also supplies the scripts needed for manipulating the tunables databases. %package -n tunables-base-data-%{base_kernel} Summary: Kernel-dependent tunables database Group: System Environment/Libraries License: GPLv2 Provides: tunables-base-data = %{version} %description -n tunables-base-data-%{base_kernel} This package supplies the tunables database for kernel release %{base_kernel} %package -n tunables-distro-data Summary: Distro-dependent tunables database Group: System Environment/Libraries License: GPLv2 Requires: tunables-base-data = %{version} %description -n tunables-distro-data This package supplies the tunables database for %{distro_string} distro %prep %setup -q %build export CFLAGS="%{optflags}" make -C lib %{?_smp_mflags} make -C scripts %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_includedir} make -C include install INSTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_libdir} make -C lib install INSTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_datadir}/libtune mkdir -p $RPM_BUILD_ROOT/%{_bindir} mkdir -p $RPM_BUILD_ROOT/%{_initrddir} cd $RPM_BUILD_ROOT/%{_sysconfdir} ln -s rc.d/init.d init.d cd - make -C scripts install INSTDIR=$RPM_BUILD_ROOT # # This is done to avoid delivering the symlinks in /etc/rc.d/rc*.d in the # %files section: the symlinks are rebuilt during post install # rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/init.d rm -rf $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/rc[3-5].d # # Build the database against the installed kernel / family # make -C db KVERSION=%{base_kernel} DISTRO_STRING=%{distro_string} \ FAMILY=%{family} make -C db KVERSION=%{base_kernel} DISTRO_STRING=%{distro_string} \ FAMILY=%{family} install INSTDIR=$RPM_BUILD_ROOT make -C templates install INSTDIR=$RPM_BUILD_ROOT db/libtuncleandb $RPM_BUILD_ROOT/%{_datadir}/libtune/tundb_kernel \ $RPM_BUILD_ROOT/%{_datadir}/libtune/tundb_distro %clean rm -rf $RPM_BUILD_ROOT %post -p /sbin/ldconfig %post devel if [ -x %{_libdir}/lsb/install_initd ] then %{_libdir}/lsb/install_initd %{_initrddir}/chtunedb else /sbin/chkconfig --add chtunedb fi /sbin/ldconfig %post -n tunables-base-data-%{base_kernel} /usr/share/libtune/bin/libtune_upgrade.sh post basedbs/base-%{base_kernel} \ tundb_kernel %post -n tunables-distro-data /usr/share/libtune/bin/libtune_upgrade.sh post \ distrodbs/distro-%{distro_string} tundb_distro %preun devel # # There's no need to stop chtunedb before deleting it: it is not a daemon # if [ -x %{_libdir}/lsb/remove_initd ] then %{_libdir}/lsb/remove_initd %{_initrddir}/chtunedb else /sbin/chkconfig --del chtunedb fi %preun -n tunables-base-data-%{base_kernel} /usr/share/libtune/bin/libtune_upgrade.sh prekernel %preun -n tunables-distro-data /usr/share/libtune/bin/libtune_upgrade.sh predistro %postun -p /sbin/ldconfig %postun devel -p /sbin/ldconfig %files %defattr(-,root,root) %{_libdir}/libtune.so.* %doc COPYING lib/LGPL ChangeLog %files devel %defattr(-,root,root) %{_includedir}/libtune.h %{_libdir}/libtune.so %{_datadir}/libtune/bin/get_current_distro.sh %{_initrddir}/chtunedb %{_bindir}/get_tunedb %{_datadir}/libtune/templates %{_datadir}/libtune/bin/add_distro.sh %{_datadir}/libtune/bin/add_kernel.sh %{_bindir}/add_tunable %{_datadir}/libtune/bin/add_tunable.awk %{_datadir}/libtune/bin/add_tunable.sh %{_datadir}/libtune/bin/contents_attributes %{_datadir}/libtune/bin/name_attributes %{_datadir}/libtune/bin/new_tunable.awk %{_datadir}/libtune/bin/new_tunable.sh %{_bindir}/remove_tunable %{_datadir}/libtune/bin/remove_tunable.awk %{_datadir}/libtune/bin/remove_tunable.sh %{_datadir}/libtune/bin/rpm_constants.sh %{_datadir}/libtune/bin/scripts_constants.sh %{_datadir}/libtune/bin/scripts_lib.sh %{_datadir}/libtune/bin/strategy_routines %{_datadir}/libtune/basedbs/base-%{base_kernel}/libtuninitdb_base.h %{_datadir}/libtune/distrodbs/distro-%{distro_string}/libtuninitdb_distro.h %doc %{_datadir}/libtune/doc/README %doc templates/GPL %files -n tunables-base-data-%{base_kernel} %defattr(-,root,root) %{_datadir}/libtune/basedbs/base-%{base_kernel}/tundb_kernel %{_datadir}/libtune/bin/libtune_upgrade.sh %doc %{_datadir}/libtune/doc/README %files -n tunables-distro-data %defattr(-,root,root) %{_datadir}/libtune/distrodbs/distro-%{distro_string}/tundb_distro %doc %{_datadir}/libtune/doc/README %changelog * Tue Oct 23 2007 Nadia Derbey 0.14-1 - introduced a default DB for fc, a default DB for SuSE and default "other" DB. - Added support for fc9. - bug fix in db/Makefile. - new libtune interfaces for tun_set() and tun_get(). * Tue Oct 23 2007 Nadia Derbey 0.13-4 - Changed the tunables DB to be built against the buildroot dist tag. If the tunables DB for that dist tag is not supported by the library, a default DB will be built. * Fri Oct 05 2007 Nadia Derbey 0.13-3 - Added support for fc8 * Fri Sep 28 2007 Nadia Derbey 0.13-2 - Added redhat-lsb as a buildrequire * Mon Sep 03 2007 Nadia Derbey 0.13-1 - Added kernel-headers as a buildrequire - Changed the way of computing the base_kernel and distro_string variables - Added support for kernels up to 2.6.23 in the libtune database * Tue Aug 28 2007 Nadia Derbey 0.12-3 - Removed the libtune.a and libtune.la files from the package. - Removed gcc from the BuildRequires. - Fixed a bug in the library. * Thu Jun 14 2007 Nadia Derbey 0.12-2 - Changed the spec file to be able to build in mock: the kernel package is not delivered in mock, only kernel-headers is available. - Moved get_tunedb to devel package * Mon Jan 25 2007 Nadia Derbey 0.12-1 - Changed the spec file to build the kernel tunables database for the defined one (base_kernel): it is presently extracted from the installed kernel release, but it can be hard-coded too, if needed (ala iproute / kernel-devel) - Fixed a bug in the specfile: the fedora release was harcoded to FC5!!! - Added support for FC7 / 2.6.19 in the libtune database * Mon Nov 27 2006 Nadia Derbey 0.11-1 - Added the dist tag - the db directory has been revisited: kernel tunables DB's and distro tunables DB's are now completely independent: this enables to deliver a kernel tunables DB for any kernel supported together with a given distro release. - Changed the spec file to build only 1 kernel tunables database and 1 distro tunables database (those the RPM is built against) - Changes in the spec file and in the sources to enable a more LSB compliant init script - Removed the /etc/rc.d/rc*.d/S*chtunedb from the delivery since the links are rebuilt by chkconfig * Thu Nov 9 2006 Nadia Derbey 0.10-3 - Fixed lib/Makefile in order for the rpm to be buildable on a 64-bit release - Fixed the licensing issues in the specfile as well as in various source files. * Mon Oct 23 2006 Nadia Derbey 0.10-2 - Many fixes in the specfile (see https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=210007) * Mon Sep 18 2006 Nadia Derbey 0.10-1 - The tunables DB is now a shared object (mapped file) - The original package is now delivered in several packages * Mon Jun 05 2006 Nadia Derbey 0.9-1 - Added support for some new tunables - Enhanced add_support.sh script