265 Commits

Author SHA1 Message Date
Emil Velikov
069869f1cf shell-completion/*/insmod: add bash/fish/zsh completion
A few inline todos and some odd fish behaviour as mentioned inline.
Otherwise things just work :-)

v2:
 - use e(x)clusive answers for fish, tweak force string

v3:
 - wire the completions to the autotools build

v4:
 - use SPDX style copyright statements

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/138
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-22 16:11:57 -05:00
Emil Velikov
76fbadb158 shell-completion/*/rmmod: add bash/fish/zsh completion
v2:
 - use e(x)clusive answers for fish, tweak force string

v3:
 - wire the completions to the autotools build

v4:
 - use SPDX style copyright statements

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/138
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-22 16:11:57 -05:00
Emil Velikov
257034a4e1 shell-completion/*/lsmod: add bash/fish/zsh completion
Note that completions are explicitly aimed to be simple, depending on as
little as possible shell specific helpers.

The goal is that people unfamiliar with these can extend them with zero
ramp-up. Doing things efficiently or "properly" is somewhat secondary.

v2:
 - wire the completions to the autotools build

v3:
 - use SPDX style copyright statements

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/138
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-22 16:11:57 -05:00
Lucas De Marchi
aa9f6d89e7 build: Fix KDIR again
KDIR is not related to the what we configure in kmod's build. It's only
used in kmod to locate where the distro's kernel source/headers is,
which may be different from what we are configuring the (under
development) kmod with.

Remove the setting from meson/autotools and figure it out inside the
module-playground Makefile what should be used. For advanced use cases,
KDIR= can be passed to override the location.

For our own tests, which includes testing with a different module_directory,
scripts/setup-rootfs.sh will copy the module to the desired location
according to the map defined in the script.

Fixes: 27ff72732666 ("testsuite: correct the default KDIR")
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/125
2024-09-11 14:39:10 -05:00
Lucas De Marchi
0bd6f4f4cd meson: normalize s/check/test/
The testsuite is executed by calling the 'test' target in meson, as
opposed to 'check' with autotools. Let's normalize it aligned to the new
build system.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-06 14:46:28 -05:00
Emil Velikov
41c799c844 meson: add test for gtkdoc coverage
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/94
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-06 14:38:27 -05:00
Emil Velikov
59eadafbb3 meson: add support for building the gtk-doc pages
v2:
 - track the version.xml dependency

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/94
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-06 14:38:27 -05:00
Emil Velikov
25206a6001 meson: allow building the manpages
Not as brief as the pipeline and pattern matching that (auto)make can
do, although it's fully functional ;-)

v2:
 - move man/meson.build
 - move script under scripts/

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:54 -05:00
Emil Velikov
555b091890 meson: add support for the testsuite
Currently the stale tracking of modules/rootfs is non-existent and I
cannot quite find a way to fix that.

In addition, there is a long standing meson bug where the tests and by
extension their dependencies are always build even when annotated as
`build_by_default : false`. To workaround that, a new option is
introduced `build-tests`, defaulting to false.

Apart from that, all tests run and pass \o/

v2:
 - split from top-level meson.build to subdir one
 - add to EXTRA_DIST
 - scripts are in scripts/
 - add option to enable building tests
 - error out if building without tools

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:54 -05:00
Emil Velikov
a6f4723241 meson: add support for the tools
Nothing too spectacular, apart from a few meson quirks:
 - one can use both_libraries() alas, "install: true" will also install
   the static library, which we do not want
 - need to workaround kmod.pc empty variables, introduced in 1.4.0
 - wrapper script is needed for the symlink creation - see wrapper
   script for details
 - resulting binary exports optarg/optind/stderr/stdout and more

v2:
 - add kmod bash-completion hunk

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:54 -05:00
Emil Velikov
370141c146 meson: introduce meson, covering libkmod.so
The meson build system has been getting popularity, but for us that
means coverage and sanitisers OOTB et al.

The current patch, handles only libkmod.so and libkmod.pc. The rest will
follow-up.

Notable changes comparing against the autoconf:
 - more consistent dirnames
 - omit printing bash completion dir and compiler flags from summary
 - debug toggle is renamed to debug-messages
 - a few [C,LD]FLAGS were omitted - they're provided by meson itself
 - libkmod.pc has the more complete Requires.private over Libs.private
 - use the symver for libkmod.so, omit the version-info magic

Note: The minimal meson version is 0.60.0 akin to systemd and mesa.

v2:
 - use gnu11, list both LGPL and GPL licenses
 - add meson files to EXTRA_DIST
 - add temporary stdndupa workaround
 - move kmod bash-completion to later patch

v3:
 - switch to meson 0.60.0
 - remove stdndupa workaround

Loosely based on the work by: Dave Reisner <dreisner@archlinux.org>

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:54 -05:00
Emil Velikov
59f40b8225 testsuite: split out setup-modules.sh
So that we can reuse it from the upcoming meson build.

v2:
 - shellcheck fixes, add TODO, move to scripts/

v3:
 - set MAKEFLAGS="-j$(nproc)" if empty

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:16 -05:00
Emil Velikov
be7a4bee3c testsuite: move setup-rootfs.sh to scripts/
There will be a few more scripts incoming, so let's give them a
dedicated location.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:16 -05:00
Emil Velikov
27ff727326 testsuite: correct the default KDIR
Honor the user-provided module directory. At the moment things work,
because distros have compatibility /lib -> /usr/lib symlink.

While in there, avoid the use of deprecated backtick (shell) notation.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:12:33 -05:00
Emil Velikov
31dcadee26 testsuite: split-out Kbuild from Makefile
The former is used by the kernel build system, while the latter is our
convenience wrapper. Split the two to indicate the distinction and make
things easier to parse.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:12:33 -05:00
Emil Velikov
b558d4279f testsuite: temporary drop cross compilation test, remove binaries
The idea behind the test is that modinfo should work with foreign
modules - be that CPU architecture, endianess, bit width or otherwise.

On the other hand, having binary modules baked into the repo isn't great
since they can may be outdated wrt their in-tree source code, may
trigger warnings by various tools (the Debian linter flags them as
"source-not-available") and in general it's better if they're actually
generated via the in-tree Makefile.arch file.

Remove the binaries and temporarily drop the tests. We'll add proper
cross-compilation and re-enable them at a later stage.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:12:33 -05:00
Emil Velikov
332b63b4d8 build: swap ABS_TOP_BUILDDIR for TOOLS_DIR
All the remaining instances are used to track the tools directory (aka
the local symlinks to kmod). Rename accordingly and include the tools
sub-directory.

Similar to the OVERRIDE_LIBDIR change earlier, this is build system
specific layout, which shouldn't be in the tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
ae0c0c4c89 testsuite/path: match the full rootpath
Our expectation is that the (full) rootpath is present, otherwise we
prepend it ourselves. Drop the ABS_TOP_BUILDDIR instance.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
e13674d075 build: set OVERRIDE_LIBDIR in the build system
The path is build-system specific, so set it there. Shortly we'll be
adding a meson build, where the value will be different.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
6297b07d89 build: pass MODULE_DIRECTORY as arg to setup-rootfs.sh
... just like the other 5 args passed to the script.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
d70d2f45c6 build: fixup testsuite LDFLAGS
Add the leading '-' for avoid-version, otherwise the module gets
versioned.

Drop the -export-dynamic, since the modules are built with
-fvisibility=hidden everything but the explicitly exported symbol is not
exported.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
8271549f72 build: alphabetically sort tests
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
678e79ec05 build: alphabetically sort sources
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
fdcb656eff testsuite: remove cached modules and --disable-test-modules
The option was added for distributions/maintainers lacking the linux
headers, while running the test-suite. It also aimed to resolve
licensing and "source-not-included" issues around the cached modules.

At a glance, it seems like only Debian is using the option these days,
Arch is using "any" linux headers available, while Fedora and Gentoo do
not run `make check` all together.

Debian's linter is complaining about "source-is-missing" and
"source-contains-prebuilt-binary", where the maintainer had to disable
those.

Removing the cache will make ^^ obsolete, while also simplifying the
check target. A nice side effect is making the (compressed) release
tarball 20% smaller.

Distributions are welcome to do something like Arch or not run the
target all together.

We are already running it in CI for Arch, Debian, Fedora and Ubuntu,
where more can be added as needed.

Effectively this reverts commit 23603f1f837caeff45c6960722c2cad690db801d

Lintian overrides:
8d6fc9e90b

Arch reference:
b2d37d2bcc

The autopkgtest's copy of lsmod, ideally should use SPDX license
identifiers like we did in kmod v33.

Autopkgtest lsmod:
11793a49f6

Cc: Marco d'Itri <md@linux.it>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
[ Fixup flag being passed in CI ]
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
7a3947d8d3 build: remove --with-rootlibdir toggle
At a glance this option was introduced with distributions migrating from
/lib to /usr/lib.

Checking with Debian, Arch, Alpine, Fedora and Gentoo - only Debian and
Alpine set it. In the former - it's explicitly set to the default
(libdir), while the latter uses /lib and /usr/lib respectively.

Looking at the implementation itself, we don't adjust the libkmod.pc
which lists libdir, while libkmod.so is installed in rootlibdir.

Considering the negligible user base and somewhat broken state, drop the
option.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:11:16 -05:00
Lucas De Marchi
dcc1c3284a build: Set AM_DISTCHECK_CONFIGURE_FLAGS
Follow the usual approach for flags in autotools: Set the AM_ variant
so the user may set the non-AM variant that is appended. This is needed
to pass additional flags from the configure to the configure call done
while creating the dist tarball if something doesn't match the default.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/78
2024-08-17 12:01:25 -05:00
Lucas De Marchi
633c9ff6c7 testsuite: Rename test-user
First version of the patches implementing weakdep called them "user
dep", hence the name of the test. That doesn't make sense anymore after
the rename.  Rename the test accordingly.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/75
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-16 16:47:33 -05:00
Lucas De Marchi
e193aeb99a kmod 33
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-13 12:14:13 -05:00
Lucas De Marchi
b8d3be5e52 build: Add s-o-b to release commit
Once upon a time kmod didn't use s-o-b. Now that it does, better to also
add it to the release commit.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/66
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-10 11:09:51 -05:00
Lucas De Marchi
d84631afc2 libkmod: Move zstd-related functions to separate file
Move zstd-related function to a separate file so it's easier to isolate
the dependency on each decompression library.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/58
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-07-26 13:41:47 -05:00
Lucas De Marchi
24d78fed15 libkmod: Move zlib-related functions to separate file
Move zlib-related function to a separate file so it's easier to isolate
the dependency on each decompression library.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/58
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-07-26 13:41:24 -05:00
Lucas De Marchi
929ca4c92a libkmod: Move xz-related functions to separate file
Move xz-related function to a separate file so it's easier to isolate
the dependency on each decompression library.

Declare struct kmod_file in a shared libkmod-internal-file.h that will
be included only by sources implementing kmod_file decompression
routines.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/58
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-07-26 13:41:13 -05:00
Lucas De Marchi
d4d3df1089 build: Always run distcheck with all compression libraries
Make sure to pass enable all compression libraries so all sources are
included.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/58
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-07-26 13:40:46 -05:00
Lucas De Marchi
8434a0bd93 build: Add mod-weakdep.c to EXTRA_DIST
Fix distcheck failure:
	make[5]: *** No rule to make target
	'/home/runner/work/kmod/kmod/build/kmod-32/_build/sub/testsuite/module-playground/mod-weakdep.o',
	needed by
	'/home/runner/work/kmod/kmod/build/kmod-32/_build/sub/testsuite/module-playground/'.
	Stop.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-07-09 08:38:00 -05:00
Jose Ignacio Tornos Martinez
d06712b514 testsuite: add tests for weak dependencies
The following tests to verify weak dependencies have been implemented:
1) modprobe test to check that related weakdep modules are not loaded
   due to being a weakdep.
2) depmod test to check weakdep output.
3) user test to check that configuration files with weakdep are parsed
   correctly and related weakdep modules can be read correctly from user
   applications.

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Link: https://lore.kernel.org/r/20240530070836.9438-1-jtornosm@redhat.com
[ Minor whitespace issues and define MODULE_WEAKDEP if it's not defined
  already ]
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-06-14 14:16:17 -05:00
Mike Gilbert
e4130a46dd Install kmod.pc in ${datadir}/pkgconfig
The data in this file isn't related to installed libraries, so put it in
an abi-neutral location.

pkg.m4 provides macros that also allow the user to override the location
with configure switches.

Bug: https://bugs.gentoo.org/926431
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-03-12 10:30:13 -05:00
Lucas De Marchi
c5054b2150 build: Allow to install over dirty dir
Before commit e98cef6f3f8c ("make: install/uninstall tools symlinks to
kmod") it was possible to call `make install DESTDIR=<dir>` multiple
times. Use `ln -sf` so the symlink is always re-created.

It would be preferred to remove install in an empty dir, but there's
not a bad consequence of re-using the same, so let the user decide.
Fixes the following errors while installing for the second time:

	ln: failed to create symbolic link '/tmp/inst/usr/bin/insmod': File exists
	ln: failed to create symbolic link '/tmp/inst/usr/bin/lsmod': File exists
	ln: failed to create symbolic link '/tmp/inst/usr/bin/rmmod': File exists
	ln: failed to create symbolic link '/tmp/inst/usr/bin/depmod': File exists
	ln: failed to create symbolic link '/tmp/inst/usr/bin/modprobe': File exists
	ln: failed to create symbolic link '/tmp/inst/usr/bin/modinfo': File exists
	make[3]: *** [Makefile:2679: install-exec-hook] Error 1
	make[2]: *** [Makefile:2553: install-exec-am] Error 2
	make[1]: *** [Makefile:2439: install-am] Error 2
	make: *** [Makefile:1848: install-recursive] Error 1

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Closes: https://github.com/kmod-project/kmod/issues/35
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://lore.kernel.org/r/20240306145804.135709-1-lucas.de.marchi@gmail.com
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-03-07 08:21:07 -06:00
Lucas De Marchi
41faa59711 kmod 32 2024-03-05 21:27:42 -06:00
Emil Velikov
dc2440ee31 Remove unmaintained experimental tools
The kmod insert/remove tools were introduced back in 2015. Since then
they have recieved zero attention, unlike the insmod/rmmod variants.

Glancing around - neither of the following distributions (Arch, Fedora,
Gentoo, Debian) build them, so we're safe to say they have no users.

Remove them and alongside it the --enable-experimental toggle, which no
longer controls anything.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://lore.kernel.org/r/20240212-rm-experimental-v1-1-b97ab3004ae3@gmail.com
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-02-20 16:10:55 -06:00
Emil Velikov
e98cef6f3f make: install/uninstall tools symlinks to kmod
Currently we create symlinks like modprobe (pointing to kmod), during
the normal `make` build. Although those were never installed.

Add a few lines in the install-exec-hook, to ensure they're present at
`make install` time. Thus one can actually use those without additional
changes. As an added bonus, distributions can drop the similar hunk from
their packaging.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
[ Use a relative symlink ]
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-02-06 11:31:16 -06:00
Lucas De Marchi
1043f6f023 testsuite: drop mkosi
It's not being actively used, so drop it.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-02-02 12:54:04 -06:00
Lucas De Marchi
594f102cf5 Drop python bindings
Python bindings are not well maintained. Currently it's just broken when
trying to build with cython 3.0.8:

	make --no-print-directory all-recursive
	Making all in .
	  CYTHON  libkmod/python/kmod/kmod.c

	Error compiling Cython file:
	------------------------------------------------------------
	...
	# details.
	#
	# You should have received a copy of the GNU Lesser General Public License
	# along with python-kmod.  If not, see <http://www.gnu.org/licenses/>.

	cimport _libkmod_h
		^

Nothing really touched those bindings for 10 years already.
I postponed the removal since they were at least building, but that just
changed. So let's drop it and allow any interested people to give it
a better life outside of libkmod.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-02-02 12:54:04 -06:00
Michal Suchanek
9d1fb317c8 libkmod, depmod, modprobe: Make directory for kernel modules configurable
Now that modprobe.d is searched under ${prefix}/lib, allow a complete
transition to files only under ${prefix} by adding a ${module_directory}
configuration. This specifies the directory where to search for kernel
modules and should match the location where the kernel/distro installs
them.

With this distributions that do not want to ship files in /lib can also
move kernel modules to /usr while others can keep them in /lib.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Link: https://lore.kernel.org/r/a3765f4e8ae3ce29c0847a0132d4a8d51ad040a9.1699618135.git.msuchanek@suse.de
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2023-12-06 09:53:05 -06:00
Michal Suchanek
ecef7c1316 kmod: Add pkgconfig file with kmod compile time configuration
Show distconfdir (where system configuration files are searched/to be
installed), sysconfdir (where user configuration files are searched),
module compressions, and module signatures supported.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Link: https://lore.kernel.org/r/468b3f572d3b84f25bb53ec8fcb15ed4871914d4.1689681454.git.msuchanek@suse.de
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2023-10-17 12:27:59 -05:00
Michal Suchanek
8463809f8a libkmod, depmod: Load modprobe.d, depmod.d from ${prefix}/lib.
There is an ongoing effort to limit use of files outside of /usr (or
${prefix} on general). Currently all modprobe.d paths are hardcoded to
outside of $prefix. Teach kmod to load modprobe.d from ${prefix}/lib.

On some distributions /usr/lib and /lib are the same directory because
of a compatibility symlink, and it is possible to craft configuration
files with sideeffects that would behave differently when loaded twice.
However, the override semantic ensures that one 'overrides' the other,
and only one configuration file of the same name is loaded from any of
the search directories.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Link: https://lore.kernel.org/r/a290343ce32e2a3c25b134e4f27c13b26e06c9e0.1689681454.git.msuchanek@suse.de
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2023-10-17 12:27:59 -05:00
Lucas De Marchi
aff617ea87 kmod 31 2023-09-29 09:18:37 -05:00
Emil Velikov
e4c1a5b299 configure: manage libkmod.pc.in and version.py.in via AC_CONFIG_FILES
Replace the manual sed command, build rules and dist/clean for using
AC_CONFIG_FILES. It does the exact same thing, with an added bonus...

Currently we're missing version.py.in in the EXTRA_DIST. Thus a simple
"touch Makefile" should retrigger the regeneration of version.py. Which
would presumably fail, since the input file isn't in the distribution
tarball.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2023-02-21 16:35:42 -08:00
Lucas De Marchi
3d38e322f9 testsuite: Handle different sysconfdir
Instead of skipping tests if sysconfdir isn't /etc, just handle it
during the rootfs setup logic.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-02-10 14:29:28 -08:00
Lucas De Marchi
184a070733 testsuite: Move setup-rootfs logic from Makefile to script
It's easier to implement the logic outside of the Makefile, so rename
the populate-modules.sh script to setup-rootfs.sh and move the
additional logic from the makefile to the script.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-02-10 14:27:27 -08:00
Dimitri John Ledkov
09ad860552 build: enable building & running tests from a subdir
During dpkg build, in a subdir, it is currently not possible to run
tests. Building testsuite/modules due to non-existance of the
testsuite directory under the build dir. Thus create it, when it is
not there.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
2022-06-30 09:55:55 -07:00