[kmod] Initital import (769832)

Jon Masters jcm at fedoraproject.org
Fri Dec 23 07:13:02 UTC 2011


commit d6f4ce67e532af0015d53ed88c5b2208e8da565d
Author: Jon Masters <jcm at jonmasters.org>
Date:   Fri Dec 23 02:12:52 2011 -0500

    Initital import (769832)

 .gitignore                   |    1 +
 kmod-2-with-rootlibdir.patch |  106 ++++++++++++++++++++++++++++++++++
 kmod.spec                    |  130 ++++++++++++++++++++++++++++++++++++++++++
 sources                      |    1 +
 4 files changed, 238 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..1e83d75 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/kmod-2.tar.xz
diff --git a/kmod-2-with-rootlibdir.patch b/kmod-2-with-rootlibdir.patch
new file mode 100644
index 0000000..2b14661
--- /dev/null
+++ b/kmod-2-with-rootlibdir.patch
@@ -0,0 +1,106 @@
+diff -urNp kmod-2_orig/configure kmod-2/configure
+--- kmod-2_orig/configure	2011-12-20 20:48:00.170160687 -0500
++++ kmod-2/configure	2011-12-22 19:39:11.899001373 -0500
+@@ -621,6 +621,7 @@ required_private_libs
+ zlib_libs
+ BUILD_TOOLS_FALSE
+ BUILD_TOOLS_TRUE
++rootlibdir
+ rootprefix
+ OTOOL64
+ OTOOL
+@@ -745,6 +746,7 @@ with_gnu_ld
+ with_sysroot
+ enable_libtool_lock
+ with_rootprefix
++with_rootlibdir
+ enable_tools
+ enable_logging
+ enable_zlib
+@@ -1405,6 +1407,7 @@ Optional Packages:
+                         (or the compiler's sysroot if not specified).
+   --with-rootprefix=DIR   rootfs directory prefix for config files and kernel
+                           modules
++  --with-rootlibdir=DIR   rootfs directory to install shared libraries
+ 
+ Some influential environment variables:
+   CC          C compiler command
+@@ -13233,6 +13236,17 @@ fi
+ rootprefix=$with_rootprefix
+ 
+ 
++
++# Check whether --with-rootlibdir was given.
++if test "${with_rootlibdir+set}" = set; then :
++  withval=$with_rootlibdir;
++else
++  with_rootlibdir=$libdir
++fi
++
++rootlibdir=$with_rootlibdir
++
++
+ # Check whether --enable-tools was given.
+ if test "${enable_tools+set}" = set; then :
+   enableval=$enable_tools;
+@@ -15828,6 +15842,7 @@ fi
+ 	rootprefix:		${rootprefix}
+ 	sysconfdir:		${sysconfdir}
+ 	libdir:			${libdir}
++	rootlibdir:		${rootlibdir}
+ 	includedir:		${includedir}
+ 	bindir:			${bindir}
+ 
+@@ -15848,6 +15863,7 @@ $as_echo "
+ 	rootprefix:		${rootprefix}
+ 	sysconfdir:		${sysconfdir}
+ 	libdir:			${libdir}
++	rootlibdir:		${rootlibdir}
+ 	includedir:		${includedir}
+ 	bindir:			${bindir}
+ 
+diff -urNp kmod-2_orig/configure.ac kmod-2/configure.ac
+--- kmod-2_orig/configure.ac	2011-12-20 20:36:37.036701029 -0500
++++ kmod-2/configure.ac	2011-12-22 19:39:11.980007591 -0500
+@@ -32,6 +32,11 @@ AC_ARG_WITH([rootprefix],
+         [], [with_rootprefix=""])
+ AC_SUBST([rootprefix], [$with_rootprefix])
+ 
++AC_ARG_WITH([rootlibdir],
++        AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
++        [], [with_rootlibdir=$libdir])
++AC_SUBST([rootlibdir], [$with_rootlibdir])
++
+ AC_ARG_ENABLE([tools],
+         AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
+ 	[], enable_tools=yes)
+@@ -134,6 +139,7 @@ AC_MSG_RESULT([
+ 	rootprefix:		${rootprefix}
+ 	sysconfdir:		${sysconfdir}
+ 	libdir:			${libdir}
++	rootlibdir:		${rootlibdir}
+ 	includedir:		${includedir}
+ 	bindir:			${bindir}
+ 
+diff -urNp kmod-2_orig/Makefile.am kmod-2/Makefile.am
+--- kmod-2_orig/Makefile.am	2011-12-20 20:36:21.337897292 -0500
++++ kmod-2/Makefile.am	2011-12-22 19:39:11.980007591 -0500
+@@ -53,6 +53,18 @@ libkmod_libkmod_la_LIBADD = @zlib_libs@
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = libkmod/libkmod.pc
+ 
++install-exec-hook:
++	if test "$(libdir)" != "$(rootlibdir)"; then \
++		mkdir -p $(DESTDIR)$(rootlibdir) && \
++		so_img_name=$$(readlink $(DESTDIR)$(libdir)/libkmod.so) && \
++		so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \
++		ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \
++		mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \
++	fi
++
++uninstall-hook:
++	rm -f $(DESTDIR)$(rootlibdir)/libkmod.so*
++
+ if BUILD_TOOLS
+ bin_PROGRAMS = tools/kmod-insmod tools/kmod-rmmod tools/kmod-lsmod \
+ 	tools/kmod-modprobe tools/kmod-modinfo
diff --git a/kmod.spec b/kmod.spec
new file mode 100644
index 0000000..e60cdd6
--- /dev/null
+++ b/kmod.spec
@@ -0,0 +1,130 @@
+Name:		kmod
+Version:	2
+Release:	4%{?dist}
+Summary:	Linux kernel module management utilities
+
+Group:		System Environment/Kernel
+License:	GPLv2+
+#TODO:		Change the following URLs once there is wiki write access
+#URL:		http://modules.wiki.kernel.org/
+URL:		http://git.profusion.mobi/cgit.cgi/kmod.git/
+#TODO:		The following URL will be moving to kernel.org eventually
+Source0:	http://packages.profusion.mobi/kmod/%{name}-%{version}.tar.xz
+Patch0:		kmod-2-with-rootlibdir.patch
+Exclusiveos:	Linux
+
+BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+BuildRequires:	zlib-devel chrpath
+
+# TODO: Investigate the following and determine prefered policy guide
+# Fedora Renaming/Replacing Existing Packages policy (review/FIXME)
+#Provides:	module-init-tools = 4.0-1
+#Obsoletes:	module-init-tools < 4.0-1
+
+%description
+The kmod package provides various programs needed for automatic
+loading and unloading of modules under 2.6, 3.x, and later kernels, as well
+as other module management programs. Device drivers and filesystems are two
+examples of loaded and unloaded modules.
+
+%package libs
+Summary:	Libraries to handle kernel module loading and unloading
+License:	LGPLv2+
+Group:		System Environment/Libraries
+
+%description libs
+The kmod-libs package provides runtime libraries for any application that
+wishes to load or unload Linux kernel modules from the running system.
+
+%package devel
+Summary:	Header files for kmod development
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description devel
+The kmod-devel package provides header files used for development of
+applications that wish to load or unload Linux kernel modules.
+
+
+%prep
+%setup -q
+%patch0 -p1 -b .rootlibdir
+
+
+%build
+# Initially configure into /sbin in line with existing tools. This may well
+# move into /usr as part of the planned changes to filesystem layout soon.
+%configure --disable-static --bindir=/bin --with-rootlibdir=/%{_lib}
+make %{?_smp_mflags}
+# TODO: add a doc target here
+
+%install
+rm -rf $RPM_BUILD_ROOT
+# TODO: Initially these are installed in /sbin like module-init-tools
+# TODO: That *cannot* change for the moment (but explicitly noted here)
+make install DESTDIR=$RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la
+
+# TODO: Fix the upstream rpath issues to avoid doing this (just for now)
+chrpath --delete $RPM_BUILD_ROOT/bin/kmod-insmod
+chrpath --delete $RPM_BUILD_ROOT/bin/kmod-lsmod
+chrpath --delete $RPM_BUILD_ROOT/bin/kmod-modinfo
+chrpath --delete $RPM_BUILD_ROOT/bin/kmod-modprobe
+chrpath --delete $RPM_BUILD_ROOT/bin/kmod-rmmod
+
+mkdir -p $RPM_BUILD_ROOT/etc
+mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
+
+# New configuration files we ship (if any) should go into /lib/modprobe.d
+# in order to allow the local sysadmin to customize /etc/modprobe.d
+# NOTE: These do not use macros because we always want "/lib" (no multilib)
+mkdir -p $RPM_BUILD_ROOT/lib
+mkdir -p $RPM_BUILD_ROOT/lib/modprobe.d
+
+mkdir -p $RPM_BUILD_ROOT/etc/depmod.d
+# We used to create a depmod "dist.conf" but do not use that any more
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post libs -p /sbin/ldconfig
+
+%postun libs -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+# TODO: Add documentation files and man pages
+%dir %{_sysconfdir}/depmod.d
+%dir %{_sysconfdir}/modprobe.d
+# NOTE: always /lib even on systems with /lib64 (there is no macro available)
+%dir /lib/modprobe.d
+/bin/kmod-insmod
+/bin/kmod-lsmod
+/bin/kmod-modinfo
+/bin/kmod-modprobe
+/bin/kmod-rmmod
+%doc NEWS README TODO COPYING
+
+%files libs
+/%{_lib}/libkmod.so*
+
+%files devel
+%{_includedir}/libkmod.h
+%{_libdir}/pkgconfig/libkmod.pc
+/%{_libdir}/libkmod.so*
+
+%changelog
+* Thu Dec 22 2011 Jon Masters <jcm at jonmasters.org> - 2-4
+- There is no generic macro for non-multilib "/lib", hardcode like others
+
+* Thu Dec 22 2011 Jon Masters <jcm at jonmasters.org> - 2-3
+- Update package incorporating fixes from initial review feedback
+- Cleaups to SPEC, rpath, documentation, library and binary locations
+
+* Thu Dec 22 2011 Jon Masters <jcm at jonmasters.org> - 2-2
+- Update package for posting to wider test audience (initial review submitted)
+
+* Thu Dec 22 2011 Jon Masters <jcm at jonmasters.org> - 2-1
+- Initial Fedora package for module-init-tools replacement (kmod) library
diff --git a/sources b/sources
index e69de29..8573957 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+6017364434377f6724f749d7a28c5d7a  kmod-2.tar.xz


More information about the scm-commits mailing list