diff options
| author | Liguros - Gitlab CI/CD [master] <gitlab@liguros.net> | 2021-01-27 18:53:03 +0000 |
|---|---|---|
| committer | Liguros - Gitlab CI/CD [master] <gitlab@liguros.net> | 2021-01-27 18:53:03 +0000 |
| commit | 3482ddf943eff7b8848f1fb31350b99ce349e86a (patch) | |
| tree | 9c9bb6ec6679e9dc44a84d87ba611989409b12ca /sys-apps/kmod | |
| parent | 8e8120eabdd28020aa69c7a60505cce2edd20adc (diff) | |
| download | baldeagleos-repo-21.1.3.tar.gz baldeagleos-repo-21.1.3.tar.xz baldeagleos-repo-21.1.3.zip | |
Updating liguros repov21.1.3
Diffstat (limited to 'sys-apps/kmod')
22 files changed, 259 insertions, 2348 deletions
diff --git a/sys-apps/kmod/Manifest b/sys-apps/kmod/Manifest index c32d51e47904..d62d2b683b0a 100644 --- a/sys-apps/kmod/Manifest +++ b/sys-apps/kmod/Manifest @@ -1,3 +1,2 @@ -DIST kmod-25.tar.xz 545416 BLAKE2B 2ad428f70630a1ef509be888a9ebc45f164695365f0f722f5e7793e96b60c035040b4d9a27f926361cea6d665310fc6cc5599ff4aefeda0fae8571c6510a25a7 SHA512 d579cd0cea24a06362a74927b7a3c777e9e01c990306e1032e4781cd441ffe435c70f2c2c4f6ae39eb1d857e622746411d5824d0c0d8bb79f91dc9fa51956252 DIST kmod-26.tar.xz 552032 BLAKE2B 3e596d06b48599bf4919346475a036b058fb18a7b19d39953e24fa943b95fdbe34a29a5062f6b4fe3510e667ae873d3b9ae03b72350fa85ddbb40ca6a7730b34 SHA512 3ca276c6fc13c2dd2220ec528b8dc4ab4edee5d2b22e16b6f945c552e51f74342c01c33a53740e6af8c893d42bd4d6f629cd8fa6e15ef8bd8da30cb003ef0865 DIST kmod-27.tar.xz 548924 BLAKE2B 9f12bf5792d4c867e28e0776c279369c063e84269212e3f699ae6e5e69b8b2b466b5033e43e17ac64d6101592edcf3c34881916afb6ae676b49dc8838dfe1396 SHA512 e0513094935333fca1fb4c3e3493b232507a579ab00a6457cc9ed3e928363d05aad80634fb65a8287a336bf9895194c7be8ddc41bb088a6c2cca44fc1bfbdb6c diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-use-pkcs7-instead-of-cms.patch b/sys-apps/kmod/files/kmod-26-libressl.patch index 85c1edd2a584..cb36ab401c21 100644 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-use-pkcs7-instead-of-cms.patch +++ b/sys-apps/kmod/files/kmod-26-libressl.patch @@ -1,7 +1,7 @@ From 628677e066198d8658d7edd5511a5bb27cd229f5 Mon Sep 17 00:00:00 2001 From: Stefan Strogin <steils@gentoo.org> Date: Sun, 19 May 2019 03:42:01 +0300 -Subject: libkmod-signature: use PKCS#7 instead of CMS +Subject: [PATCH] libkmod-signature: use PKCS#7 instead of CMS Linux uses either PKCS #7 or CMS for signing modules (see scripts/sign-file.c). CMS is not supported by LibreSSL or older OpenSSL, @@ -24,6 +24,8 @@ Changes v1->v2: - Don't use ifdefs for keeping redundant CMS code, just use PKCS #7 both with OpenSSL and LibreSSL. +Upstream-Status: Accepted +[https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit/?id=628677e066198d8658d7edd5511a5bb27cd229f5] Signed-off-by: Stefan Strogin <steils@gentoo.org> --- libkmod/libkmod-signature.c | 37 +++++++++++++++++++------------------ @@ -137,5 +139,5 @@ index 48d0145..4e8748c 100644 } -- -cgit 1.2-0.3.lf.el7 +2.21.0 diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-convert-return-value.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-convert-return-value.patch deleted file mode 100644 index 29e23e1e96b1..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-convert-return-value.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 81dbf2bee644ef035d054e2101fceea86c50e07d Mon Sep 17 00:00:00 2001 -From: Topi Miettinen <toiwoton@gmail.com> -Date: Mon, 23 Dec 2019 18:58:13 +0200 -Subject: libkmod-module: convert return value from system() to errno - -Don't use exit status of a command directly as errno code, callers -will be confused. - -Signed-off-by: Topi Miettinen <toiwoton@gmail.com> ---- - libkmod/libkmod-module.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index 8044a8f..714ee21 100644 ---- a/libkmod/libkmod-module.c -+++ b/libkmod/libkmod-module.c -@@ -980,14 +980,19 @@ static int command_do(struct kmod_module *mod, const char *type, - err = system(cmd); - unsetenv("MODPROBE_MODULE"); - -- if (err == -1 || WEXITSTATUS(err)) { -- ERR(mod->ctx, "Error running %s command for %s\n", -- type, modname); -- if (err != -1) -- err = -WEXITSTATUS(err); -+ if (err == -1) { -+ ERR(mod->ctx, "Could not run %s command '%s' for module %s: %m\n", -+ type, cmd, modname); -+ return -EINVAL; - } - -- return err; -+ if (WEXITSTATUS(err)) { -+ ERR(mod->ctx, "Error running %s command '%s' for module %s: retcode %d\n", -+ type, cmd, modname, WEXITSTATUS(err)); -+ return -EINVAL; -+ } -+ -+ return 0; - } - - struct probe_insert_cb { --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-filter-undefined-linker.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-filter-undefined-linker.patch deleted file mode 100644 index 3fcea4e7761f..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-filter-undefined-linker.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 8aa52bf238daa007712fd828e8ae05cc26178566 Mon Sep 17 00:00:00 2001 -From: Fabrice Fontaine <fontaine.fabrice@gmail.com> -Date: Mon, 18 Nov 2019 22:56:17 +0100 -Subject: Makefile.am: filter -Wl,--no-undefined - -Commit 1d14ef82f4a3be741bcdf6b1c6d51ce9dce43567 does not completely fix -the build with python 3.8 as we still get link failure due to -'-z undefs' being ignored by some versions of ld. - -Indeed, -z undefs was added by commit -97a232d7335f3bd0231fd9cd39455bde1d563922 in upstream binutils, and this -commit was first present in binutils 2.30. -So any toolchain using binutils version older than that won't have --z undefs and will build fail on: - -/home/buildroot/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/mips-linux-gnu/5.3.0/../../../../mips-linux-gnu/bin/ld: warning: -z undefs ignored. - -/home/naourr/work/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/aarch64_be-linux-gnu/7.3.1/../../../../aarch64_be-linux-gnu/bin/ld: warning: -z undefs ignored. - -So filter -Wl,--no-undefined to fix the issue - -Fixes: - - http://autobuild.buildroot.org/results/e9645d9969481b09f507f6e0d0b35faaa283eb60 - - http://autobuild.buildroot.org/results/06a6d865b6b7d8ebd793bde214f4a4c40e0962e1 - -Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> ---- - Makefile.am | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index 8e9c90d..47505c1 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -173,7 +173,10 @@ CPYTHON_MODULE_CFLAGS = \ - $(AM_CFLAGS) -DCPYTHON_COMPILING_IN_PYPY=0 \ - $(PYTHON_NOWARN) $(PYTHON_CFLAGS) \ - -fvisibility=default --CPYTHON_MODULE_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -shared -Wl,-z,undefs -+# Filter -Wl,--no-undefined to fix build with python 3.8 -+comma = , -+CPYTHON_MODULE_LDFLAGS = $(subst -Wl$(comma)--no-undefined,,$(AM_LDFLAGS)) -+CPYTHON_MODULE_LDFLAGS += -module -avoid-version -shared - - if BUILD_PYTHON - pkgpyexec_LTLIBRARIES = \ --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-get-builtin-mods.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-get-builtin-mods.patch deleted file mode 100644 index 4f84a42b74a4..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-get-builtin-mods.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 73eed2aba3cbe18bbda40f18f7bc32e8de1ec81f Mon Sep 17 00:00:00 2001 -From: Alexey Gladkov <gladkov.alexey@gmail.com> -Date: Fri, 8 Nov 2019 18:25:21 +0100 -Subject: libkmod: Add function to get list of built-in modules - -Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com> ---- - libkmod/libkmod-internal.h | 1 + - libkmod/libkmod-module.c | 40 ++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 41 insertions(+) - -diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h -index df01df1..ee4b97b 100644 ---- a/libkmod/libkmod-internal.h -+++ b/libkmod/libkmod-internal.h -@@ -145,6 +145,7 @@ void kmod_module_set_visited(struct kmod_module *mod, bool visited) __attribute_ - void kmod_module_set_builtin(struct kmod_module *mod, bool builtin) __attribute__((nonnull((1)))); - void kmod_module_set_required(struct kmod_module *mod, bool required) __attribute__((nonnull(1))); - bool kmod_module_is_builtin(struct kmod_module *mod) __attribute__((nonnull(1))); -+int kmod_module_get_builtin(struct kmod_ctx *ctx, struct kmod_list **list) __attribute__((nonnull(1, 2))); - - /* libkmod-file.c */ - struct kmod_file *kmod_file_open(const struct kmod_ctx *ctx, const char *filename) _must_check_ __attribute__((nonnull(1,2))); -diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index bffe715..8fbabd2 100644 ---- a/libkmod/libkmod-module.c -+++ b/libkmod/libkmod-module.c -@@ -2866,3 +2866,43 @@ KMOD_EXPORT void kmod_module_dependency_symbols_free_list(struct kmod_list *list - list = kmod_list_remove(list); - } - } -+ -+/** -+ * kmod_module_get_builtin: -+ * @ctx: kmod library context -+ * @list: where to save the builtin module list -+ * -+ * Returns: 0 on success or < 0 otherwise. -+ */ -+int kmod_module_get_builtin(struct kmod_ctx *ctx, struct kmod_list **list) -+{ -+ struct kmod_builtin_iter *iter; -+ int err = 0; -+ -+ iter = kmod_builtin_iter_new(ctx); -+ if (!iter) -+ return -errno; -+ -+ while (kmod_builtin_iter_next(iter)) { -+ struct kmod_module *mod = NULL; -+ char modname[PATH_MAX]; -+ -+ if (!kmod_builtin_iter_get_modname(iter, modname)) { -+ err = -errno; -+ goto fail; -+ } -+ -+ kmod_module_new_from_name(ctx, modname, &mod); -+ kmod_module_set_builtin(mod, true); -+ -+ *list = kmod_list_append(*list, mod); -+ } -+ -+ kmod_builtin_iter_free(iter); -+ return err; -+fail: -+ kmod_builtin_iter_free(iter); -+ kmod_module_unref_list(*list); -+ *list = NULL; -+ return err; -+} --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-ignore-builtin-module.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-ignore-builtin-module.patch deleted file mode 100644 index e9d06b2599a2..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-ignore-builtin-module.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 52a0ba82e1ad180f9f91920db70a758fac49466a Mon Sep 17 00:00:00 2001 -From: Yauheni Kaliuta <yauheni.kaliuta@redhat.com> -Date: Thu, 31 Oct 2019 20:12:53 +0200 -Subject: modprobe: ignore builtin module on recursive removing - -If there are built-in dependencies and any of them is built-in in -the kernel, modprobe -r fails with - -modprobe: FATAL: Module module_name is builtin. - -It makes sense to ignore such dependencies for the case when -removing is called for non-top level module. - -Example: cifs module, it declares bunch of softdeps and the first -one fails on some kernel configs: - -modprobe: FATAL: Module gcm is builtin. - -Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com> ---- - tools/modprobe.c | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -diff --git a/tools/modprobe.c b/tools/modprobe.c -index a9e2331..44cd15c 100644 ---- a/tools/modprobe.c -+++ b/tools/modprobe.c -@@ -353,7 +353,8 @@ static int rmmod_do_remove_module(struct kmod_module *mod) - return err; - } - --static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies); -+static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies, -+ bool ignore_builtin); - - static int rmmod_do_deps_list(struct kmod_list *list, bool stop_on_errors) - { -@@ -361,7 +362,7 @@ static int rmmod_do_deps_list(struct kmod_list *list, bool stop_on_errors) - - kmod_list_foreach_reverse(l, list) { - struct kmod_module *m = kmod_module_get_module(l); -- int r = rmmod_do_module(m, false); -+ int r = rmmod_do_module(m, false, true); - kmod_module_unref(m); - - if (r < 0 && stop_on_errors) -@@ -371,7 +372,8 @@ static int rmmod_do_deps_list(struct kmod_list *list, bool stop_on_errors) - return 0; - } - --static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies) -+static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies, -+ bool ignore_builtin) - { - const char *modname = kmod_module_get_name(mod); - struct kmod_list *pre = NULL, *post = NULL; -@@ -401,8 +403,12 @@ static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies) - } - goto error; - } else if (state == KMOD_MODULE_BUILTIN) { -- LOG("Module %s is builtin.\n", modname); -- err = -ENOENT; -+ if (ignore_builtin) { -+ err = 0; -+ } else { -+ LOG("Module %s is builtin.\n", modname); -+ err = -ENOENT; -+ } - goto error; - } - } -@@ -462,7 +468,7 @@ static int rmmod(struct kmod_ctx *ctx, const char *alias) - - kmod_list_foreach(l, list) { - struct kmod_module *mod = kmod_module_get_module(l); -- err = rmmod_do_module(mod, true); -+ err = rmmod_do_module(mod, true, false); - kmod_module_unref(mod); - if (err < 0) - break; --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-link-against-libcrypto-not-all-of-openssl.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-link-against-libcrypto-not-all-of-openssl.patch deleted file mode 100644 index 20bd6187ddd5..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-link-against-libcrypto-not-all-of-openssl.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 8e266b9eeffa3c1fc4dca0081c0553f8c2a488c0 Mon Sep 17 00:00:00 2001 -From: Dave Reisner <dreisner@archlinux.org> -Date: Wed, 13 Feb 2019 10:27:51 -0500 -Subject: Link against libcrypto, not all of openssl - -In the previous build setup, libkmod.so would link to not just -libcrypto.so, but also libssl.so: - -$ readelf -d /lib/libkmod.so | grep NEEDED - 0x0000000000000001 (NEEDED) Shared library: [liblzma.so.5] - 0x0000000000000001 (NEEDED) Shared library: [libz.so.1] - 0x0000000000000001 (NEEDED) Shared library: [libssl.so.1.1] - 0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.1.1] - 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] - -We don't need any symbols from libssl, though. This patch ensures that -we pass 'libcrypto' to pkgconfig rather than 'openssl', getting only the -library that we need: - -$ readelf -d ./libkmod/.libs/libkmod.so.2.3.4 | grep NEEDED - 0x0000000000000001 (NEEDED) Shared library: [liblzma.so.5] - 0x0000000000000001 (NEEDED) Shared library: [libz.so.1] - 0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.1.1] - 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] ---- - Makefile.am | 6 +++--- - configure.ac | 4 ++-- - 2 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index ddb25f0..758f4f0 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -35,8 +35,8 @@ SED_PROCESS = \ - -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \ - -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \ - -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \ -- -e 's,@openssl_CFLAGS\@,${openssl_CFLAGS},g' \ -- -e 's,@openssl_LIBS\@,${openssl_LIBS},g' \ -+ -e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \ -+ -e 's,@libcrypto_LIBS\@,${libcrypto_LIBS},g' \ - < $< > $@ || rm $@ - - %.pc: %.pc.in Makefile -@@ -89,7 +89,7 @@ libkmod_libkmod_la_DEPENDENCIES = \ - ${top_srcdir}/libkmod/libkmod.sym - libkmod_libkmod_la_LIBADD = \ - shared/libshared.la \ -- ${liblzma_LIBS} ${zlib_LIBS} ${openssl_LIBS} -+ ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS} - - noinst_LTLIBRARIES += libkmod/libkmod-internal.la - libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES) -diff --git a/configure.ac b/configure.ac -index ee72283..dffe278 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -110,12 +110,12 @@ AC_ARG_WITH([openssl], - AS_HELP_STRING([--with-openssl], [handle PKCS7 signatures @<:@default=disabled@:>@]), - [], [with_openssl=no]) - AS_IF([test "x$with_openssl" != "xno"], [ -- PKG_CHECK_MODULES([openssl], [openssl >= 1.1.0]) -+ PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0]) - AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.]) - ], [ - AC_MSG_NOTICE([openssl support not requested]) - ]) --CC_FEATURE_APPEND([with_features], [with_openssl], [OPENSSL]) -+CC_FEATURE_APPEND([with_features], [with_openssl], [LIBCRYPTO]) - - AC_ARG_WITH([bashcompletiondir], - AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]), --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-lookup-aliases-in-modules-builtin-info.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-lookup-aliases-in-modules-builtin-info.patch deleted file mode 100644 index b36421843577..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-lookup-aliases-in-modules-builtin-info.patch +++ /dev/null @@ -1,192 +0,0 @@ -From b866b2165ae6cf18fb26b635f4a7ee57c0334731 Mon Sep 17 00:00:00 2001 -From: Alexey Gladkov <gladkov.alexey@gmail.com> -Date: Fri, 8 Nov 2019 18:25:22 +0100 -Subject: Lookup aliases in the modules.builtin.modinfo - -New modules.builtin.modinfo duplicates modules.builtin in the built-in -module name search. If it exists, then we can use this file, but if not, -then we need to fallback to the old file. - -Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com> ---- - libkmod/libkmod-internal.h | 1 + - libkmod/libkmod-module.c | 10 ++++++-- - libkmod/libkmod.c | 25 ++++++++++++++++++ - libkmod/libkmod.h | 1 + - tools/depmod.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++ - 5 files changed, 98 insertions(+), 2 deletions(-) - -diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h -index ee4b97b..b22ac2a 100644 ---- a/libkmod/libkmod-internal.h -+++ b/libkmod/libkmod-internal.h -@@ -89,6 +89,7 @@ int kmod_lookup_alias_from_config(struct kmod_ctx *ctx, const char *name, struct - int kmod_lookup_alias_from_symbols_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3))); - int kmod_lookup_alias_from_aliases_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3))); - int kmod_lookup_alias_from_moddep_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3))); -+int kmod_lookup_alias_from_kernel_builtin_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3))); - int kmod_lookup_alias_from_builtin_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3))); - bool kmod_lookup_alias_is_builtin(struct kmod_ctx *ctx, const char *name) __attribute__((nonnull(1, 2))); - int kmod_lookup_alias_from_commands(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3))); -diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index 8fbabd2..ee7e6bd 100644 ---- a/libkmod/libkmod-module.c -+++ b/libkmod/libkmod-module.c -@@ -575,10 +575,16 @@ KMOD_EXPORT int kmod_module_new_from_lookup(struct kmod_ctx *ctx, - err = kmod_lookup_alias_from_aliases_file(ctx, alias, list); - CHECK_ERR_AND_FINISH(err, fail, list, finish); - -- DBG(ctx, "lookup modules.builtin %s\n", alias); -- err = kmod_lookup_alias_from_builtin_file(ctx, alias, list); -+ DBG(ctx, "lookup modules.builtin.modinfo %s\n", alias); -+ err = kmod_lookup_alias_from_kernel_builtin_file(ctx, alias, list); - CHECK_ERR_AND_FINISH(err, fail, list, finish); - -+ if (err == 0) { -+ DBG(ctx, "lookup modules.builtin %s\n", alias); -+ err = kmod_lookup_alias_from_builtin_file(ctx, alias, list); -+ CHECK_ERR_AND_FINISH(err, fail, list, finish); -+ } -+ - finish: - DBG(ctx, "lookup %s=%d, list=%p\n", alias, err, *list); - return err; -diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c -index 69fe431..c9d9e2a 100644 ---- a/libkmod/libkmod.c -+++ b/libkmod/libkmod.c -@@ -57,6 +57,7 @@ static struct _index_files { - [KMOD_INDEX_MODULES_DEP] = { .fn = "modules.dep", .prefix = "" }, - [KMOD_INDEX_MODULES_ALIAS] = { .fn = "modules.alias", .prefix = "alias " }, - [KMOD_INDEX_MODULES_SYMBOL] = { .fn = "modules.symbols", .prefix = "alias "}, -+ [KMOD_INDEX_MODULES_BUILTIN_ALIAS] = { .fn = "modules.builtin.alias", .prefix = "" }, - [KMOD_INDEX_MODULES_BUILTIN] = { .fn = "modules.builtin", .prefix = ""}, - }; - -@@ -522,6 +523,30 @@ static char *lookup_builtin_file(struct kmod_ctx *ctx, const char *name) - return line; - } - -+int kmod_lookup_alias_from_kernel_builtin_file(struct kmod_ctx *ctx, -+ const char *name, -+ struct kmod_list **list) -+{ -+ struct kmod_list *l; -+ int ret = kmod_lookup_alias_from_alias_bin(ctx, -+ KMOD_INDEX_MODULES_BUILTIN_ALIAS, -+ name, list); -+ if (ret > 0) { -+ kmod_list_foreach(l, *list) { -+ struct kmod_module *mod = l->data; -+ kmod_module_set_builtin(mod, true); -+ } -+ } else if (ret == -ENOSYS) { -+ /* -+ * If the system does not support this yet, then -+ * there is no need to return an error. -+ */ -+ ret = 0; -+ } -+ -+ return ret; -+} -+ - int kmod_lookup_alias_from_builtin_file(struct kmod_ctx *ctx, const char *name, - struct kmod_list **list) - { -diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h -index 352627e..3cab2e5 100644 ---- a/libkmod/libkmod.h -+++ b/libkmod/libkmod.h -@@ -70,6 +70,7 @@ enum kmod_index { - KMOD_INDEX_MODULES_DEP = 0, - KMOD_INDEX_MODULES_ALIAS, - KMOD_INDEX_MODULES_SYMBOL, -+ KMOD_INDEX_MODULES_BUILTIN_ALIAS, - KMOD_INDEX_MODULES_BUILTIN, - /* Padding to make sure enum is not mapped to char */ - _KMOD_INDEX_PAD = 1U << 31, -diff --git a/tools/depmod.c b/tools/depmod.c -index 391afe9..fbbce10 100644 ---- a/tools/depmod.c -+++ b/tools/depmod.c -@@ -2402,6 +2402,68 @@ static int output_devname(struct depmod *depmod, FILE *out) - return 0; - } - -+static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) -+{ -+ int ret = 0, count = 0; -+ struct index_node *idx; -+ struct kmod_list *l, *builtin = NULL; -+ -+ idx = index_create(); -+ -+ if (idx == NULL) { -+ ret = -ENOMEM; -+ goto fail; -+ } -+ -+ ret = kmod_module_get_builtin(depmod->ctx, &builtin); -+ if (ret < 0) { -+ if (ret == -ENOENT) -+ ret = 0; -+ goto fail; -+ } -+ -+ kmod_list_foreach(l, builtin) { -+ struct kmod_list *ll, *info_list = NULL; -+ struct kmod_module *mod = l->data; -+ const char *modname = kmod_module_get_name(mod); -+ -+ ret = kmod_module_get_info(mod, &info_list); -+ if (ret < 0) -+ goto fail; -+ -+ kmod_list_foreach(ll, info_list) { -+ char alias[PATH_MAX]; -+ const char *key = kmod_module_info_get_key(ll); -+ const char *value = kmod_module_info_get_value(ll); -+ -+ if (!streq(key, "alias")) -+ continue; -+ -+ alias[0] = '\0'; -+ if (alias_normalize(value, alias, NULL) < 0) { -+ WRN("Unmatched bracket in %s\n", value); -+ continue; -+ } -+ -+ index_insert(idx, alias, modname, 0); -+ } -+ -+ kmod_module_info_free_list(info_list); -+ -+ index_insert(idx, modname, modname, 0); -+ count++; -+ } -+ -+ if (count) -+ index_write(idx, out); -+ index_destroy(idx); -+fail: -+ if (builtin) -+ kmod_module_unref_list(builtin); -+ -+ return ret; -+} -+ - static int depmod_output(struct depmod *depmod, FILE *out) - { - static const struct depfile { -@@ -2416,6 +2478,7 @@ static int depmod_output(struct depmod *depmod, FILE *out) - { "modules.symbols", output_symbols }, - { "modules.symbols.bin", output_symbols_bin }, - { "modules.builtin.bin", output_builtin_bin }, -+ { "modules.builtin.alias.bin", output_builtin_alias_bin }, - { "modules.devname", output_devname }, - { } - }; --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-new-parser-for-builtin-mods.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-new-parser-for-builtin-mods.patch deleted file mode 100644 index d04620a1f32b..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-new-parser-for-builtin-mods.patch +++ /dev/null @@ -1,402 +0,0 @@ -From 60084cf1cb24dc3a257976c0d539a4c3ffda5db5 Mon Sep 17 00:00:00 2001 -From: Alexey Gladkov <gladkov.alexey@gmail.com> -Date: Fri, 8 Nov 2019 18:25:20 +0100 -Subject: libkmod: Add parser for modules.builtin.modinfo - -The kernel since version v5.2-rc1 exports information about built-in -modules in the modules.builtin.modinfo. Information is stored in -the same format as in the separate modules (null-terminated string -array). The module name is a prefix for each line. - -$ tr '\0' '\n' < modules.builtin.modinfo -ext4.softdep=pre: crc32c -ext4.license=GPL -ext4.description=Fourth Extended Filesystem -ext4.author=Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others -ext4.alias=fs-ext4 -ext4.alias=ext3 -ext4.alias=fs-ext3 -ext4.alias=ext2 -ext4.alias=fs-ext2 -md_mod.alias=block-major-9-* -md_mod.alias=md -md_mod.description=MD RAID framework -md_mod.license=GPL -md_mod.parmtype=create_on_open:bool -md_mod.parmtype=start_dirty_degraded:int -... - -Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com> ---- - Makefile.am | 1 + - libkmod/libkmod-builtin.c | 329 +++++++++++++++++++++++++++++++++++++++++++++ - libkmod/libkmod-internal.h | 8 ++ - 3 files changed, 338 insertions(+) - create mode 100644 libkmod/libkmod-builtin.c - -diff --git a/Makefile.am b/Makefile.am -index 47505c1..56c9ba6 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -68,6 +68,7 @@ libkmod_libkmod_la_SOURCES = \ - libkmod/libkmod.h \ - libkmod/libkmod-internal.h \ - libkmod/libkmod.c \ -+ libkmod/libkmod-builtin.c \ - libkmod/libkmod-list.c \ - libkmod/libkmod-config.c \ - libkmod/libkmod-index.c \ -diff --git a/libkmod/libkmod-builtin.c b/libkmod/libkmod-builtin.c -new file mode 100644 -index 0000000..98d7365 ---- /dev/null -+++ b/libkmod/libkmod-builtin.c -@@ -0,0 +1,329 @@ -+/* -+ * libkmod - interface to kernel built-in modules -+ * -+ * Copyright (C) 2019 Alexey Gladkov <gladkov.alexey@gmail.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, see <http://www.gnu.org/licenses/>. -+ */ -+ -+#include <sys/types.h> -+#include <sys/stat.h> -+ -+#include <unistd.h> -+#include <stdio.h> -+#include <stdlib.h> -+#include <string.h> -+#include <errno.h> -+ -+#include "libkmod.h" -+#include "libkmod-internal.h" -+ -+#define MODULES_BUILTIN_MODINFO "modules.builtin.modinfo" -+ -+struct kmod_builtin_iter { -+ struct kmod_ctx *ctx; -+ -+ // The file descriptor. -+ int file; -+ -+ // The total size in bytes. -+ ssize_t size; -+ -+ // The offset of current module. -+ off_t pos; -+ -+ // The offset at which the next module is located. -+ off_t next; -+ -+ // Number of strings in the current block. -+ ssize_t nstrings; -+ -+ // Internal buffer and its size. -+ size_t bufsz; -+ char *buf; -+}; -+ -+struct kmod_builtin_iter *kmod_builtin_iter_new(struct kmod_ctx *ctx) -+{ -+ char path[PATH_MAX]; -+ int file, sv_errno; -+ struct stat sb; -+ struct kmod_builtin_iter *iter = NULL; -+ const char *dirname = kmod_get_dirname(ctx); -+ size_t len = strlen(dirname); -+ -+ file = -1; -+ -+ if ((len + 1 + strlen(MODULES_BUILTIN_MODINFO) + 1) >= PATH_MAX) { -+ sv_errno = ENAMETOOLONG; -+ goto fail; -+ } -+ -+ snprintf(path, PATH_MAX, "%s/%s", dirname, MODULES_BUILTIN_MODINFO); -+ -+ file = open(path, O_RDONLY|O_CLOEXEC); -+ if (file < 0) { -+ sv_errno = errno; -+ goto fail; -+ } -+ -+ if (fstat(file, &sb) < 0) { -+ sv_errno = errno; -+ goto fail; -+ } -+ -+ iter = malloc(sizeof(*iter)); -+ if (!iter) { -+ sv_errno = ENOMEM; -+ goto fail; -+ } -+ -+ iter->ctx = ctx; -+ iter->file = file; -+ iter->size = sb.st_size; -+ iter->nstrings = 0; -+ iter->pos = 0; -+ iter->next = 0; -+ iter->bufsz = 0; -+ iter->buf = NULL; -+ -+ return iter; -+fail: -+ if (file >= 0) -+ close(file); -+ -+ errno = sv_errno; -+ -+ return iter; -+} -+ -+void kmod_builtin_iter_free(struct kmod_builtin_iter *iter) -+{ -+ close(iter->file); -+ free(iter->buf); -+ free(iter); -+} -+ -+static off_t get_string(struct kmod_builtin_iter *iter, off_t offset, -+ char **line, size_t *size) -+{ -+ int sv_errno; -+ char *nullp = NULL; -+ size_t linesz = 0; -+ -+ while (!nullp) { -+ char buf[BUFSIZ]; -+ ssize_t sz; -+ size_t partsz; -+ -+ sz = pread(iter->file, buf, BUFSIZ, offset); -+ if (sz < 0) { -+ sv_errno = errno; -+ goto fail; -+ } else if (sz == 0) { -+ offset = 0; -+ break; -+ } -+ -+ nullp = memchr(buf, '\0', (size_t) sz); -+ partsz = (size_t)((nullp) ? (nullp - buf) + 1 : sz); -+ offset += (off_t) partsz; -+ -+ if (iter->bufsz < linesz + partsz) { -+ iter->bufsz = linesz + partsz; -+ iter->buf = realloc(iter->buf, iter->bufsz); -+ -+ if (!iter->buf) { -+ sv_errno = errno; -+ goto fail; -+ } -+ } -+ -+ strncpy(iter->buf + linesz, buf, partsz); -+ linesz += partsz; -+ } -+ -+ if (linesz) { -+ *line = iter->buf; -+ *size = linesz; -+ } -+ -+ return offset; -+fail: -+ errno = sv_errno; -+ return -1; -+} -+ -+bool kmod_builtin_iter_next(struct kmod_builtin_iter *iter) -+{ -+ char *line, *modname; -+ size_t linesz; -+ off_t pos, offset, modlen; -+ -+ modname = NULL; -+ -+ iter->nstrings = 0; -+ offset = pos = iter->next; -+ -+ while (offset < iter->size) { -+ char *dot; -+ off_t len; -+ -+ offset = get_string(iter, pos, &line, &linesz); -+ if (offset <= 0) { -+ if (offset) -+ ERR(iter->ctx, "get_string: %s\n", strerror(errno)); -+ pos = iter->size; -+ break; -+ } -+ -+ dot = strchr(line, '.'); -+ if (!dot) { -+ ERR(iter->ctx, "kmod_builtin_iter_next: unexpected string without modname prefix\n"); -+ pos = iter->size; -+ break; -+ } -+ -+ len = dot - line; -+ -+ if (!modname) { -+ modname = strdup(line); -+ modlen = len; -+ } else if (modlen != len || strncmp(modname, line, len)) { -+ break; -+ } -+ -+ iter->nstrings++; -+ pos = offset; -+ } -+ -+ iter->pos = iter->next; -+ iter->next = pos; -+ -+ free(modname); -+ -+ return (iter->pos < iter->size); -+} -+ -+bool kmod_builtin_iter_get_modname(struct kmod_builtin_iter *iter, -+ char modname[static PATH_MAX]) -+{ -+ int sv_errno; -+ char *line, *dot; -+ size_t linesz, len; -+ off_t offset; -+ -+ if (iter->pos == iter->size) -+ return false; -+ -+ line = NULL; -+ -+ offset = get_string(iter, iter->pos, &line, &linesz); -+ if (offset <= 0) { -+ sv_errno = errno; -+ if (offset) -+ ERR(iter->ctx, "get_string: %s\n", strerror(errno)); -+ goto fail; -+ } -+ -+ dot = strchr(line, '.'); -+ if (!dot) { -+ sv_errno = errno; -+ ERR(iter->ctx, "kmod_builtin_iter_get_modname: unexpected string without modname prefix\n"); -+ goto fail; -+ } -+ -+ len = dot - line; -+ -+ if (len > PATH_MAX) { -+ sv_errno = ENAMETOOLONG; -+ goto fail; -+ } -+ -+ strncpy(modname, line, len); -+ modname[len] = '\0'; -+ -+ return true; -+fail: -+ errno = sv_errno; -+ return false; -+} -+ -+/* array will be allocated with strings in a single malloc, just free *array */ -+ssize_t kmod_builtin_get_modinfo(struct kmod_ctx *ctx, const char *modname, -+ char ***modinfo) -+{ -+ ssize_t count = 0; -+ char *s, *line = NULL; -+ size_t i, n, linesz, modlen, size; -+ off_t pos, offset; -+ -+ char *name = NULL; -+ char buf[PATH_MAX]; -+ -+ struct kmod_builtin_iter *iter = kmod_builtin_iter_new(ctx); -+ -+ if (!iter) -+ return -1; -+ -+ while (!name && kmod_builtin_iter_next(iter)) { -+ if (!kmod_builtin_iter_get_modname(iter, buf)) { -+ count = -errno; -+ goto fail; -+ } -+ -+ if (strcmp(modname, buf)) -+ continue; -+ -+ name = buf; -+ } -+ -+ if (!name) { -+ count = -ENOSYS; -+ goto fail; -+ } -+ -+ modlen = strlen(modname) + 1; -+ count = iter->nstrings; -+ size = iter->next - iter->pos - (modlen * count); -+ -+ *modinfo = malloc(size + sizeof(char *) * (count + 1)); -+ if (!*modinfo) { -+ count = -errno; -+ goto fail; -+ } -+ -+ s = (char *)(*modinfo + count + 1); -+ i = 0; -+ -+ n = 0; -+ offset = pos = iter->pos; -+ -+ while (offset < iter->next) { -+ offset = get_string(iter, pos, &line, &linesz); -+ if (offset <= 0) { -+ count = (offset) ? -errno : -EOF; -+ goto fail; -+ } -+ -+ strcpy(s + i, line + modlen); -+ (*modinfo)[n++] = s + i; -+ i += linesz - modlen; -+ -+ pos = offset; -+ } -+fail: -+ kmod_builtin_iter_free(iter); -+ return count; -+} -diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h -index a65ddd1..df01df1 100644 ---- a/libkmod/libkmod-internal.h -+++ b/libkmod/libkmod-internal.h -@@ -193,3 +193,11 @@ struct kmod_signature_info { - }; - bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signature_info *sig_info) _must_check_ __attribute__((nonnull(1, 2))); - void kmod_module_signature_info_free(struct kmod_signature_info *sig_info) __attribute__((nonnull)); -+ -+/* libkmod-builtin.c */ -+struct kmod_builtin_iter; -+struct kmod_builtin_iter *kmod_builtin_iter_new(struct kmod_ctx *ctx) __attribute__((nonnull(1))); -+void kmod_builtin_iter_free(struct kmod_builtin_iter *iter) __attribute__((nonnull(1))); -+bool kmod_builtin_iter_next(struct kmod_builtin_iter *iter) __attribute__((nonnull(1))); -+bool kmod_builtin_iter_get_modname(struct kmod_builtin_iter *iter, char modname[static PATH_MAX]) __attribute__((nonnull(1, 2))); -+ssize_t kmod_builtin_get_modinfo(struct kmod_ctx *ctx, const char *modname, char ***modinfo) __attribute__((nonnull(1, 2, 3))); --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-print-refcnt-error.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-print-refcnt-error.patch deleted file mode 100644 index c138699cce8a..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-print-refcnt-error.patch +++ /dev/null @@ -1,80 +0,0 @@ -From ea3e508f61251b16567f888042f6c4c60b48a4e0 Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia <ezequiel@collabora.com> -Date: Fri, 8 Mar 2019 17:39:07 -0300 -Subject: tools: Print a message if refcnt attribute is missing - -Currently, check_module_inuse returns a wrong user message -if the kernel is built without module unloading support. - -Fix it by returning a more specific error, in case 'refcnt' -attribute is missing. ---- - tools/remove.c | 9 ++++++--- - tools/rmmod.c | 9 ++++++--- - 2 files changed, 12 insertions(+), 6 deletions(-) - -diff --git a/tools/remove.c b/tools/remove.c -index 07e2cc0..387ef0e 100644 ---- a/tools/remove.c -+++ b/tools/remove.c -@@ -44,7 +44,7 @@ static void help(void) - - static int check_module_inuse(struct kmod_module *mod) { - struct kmod_list *holders; -- int state; -+ int state, ret; - - state = kmod_module_get_initstate(mod); - -@@ -74,12 +74,15 @@ static int check_module_inuse(struct kmod_module *mod) { - return -EBUSY; - } - -- if (kmod_module_get_refcnt(mod) != 0) { -+ ret = kmod_module_get_refcnt(mod); -+ if (ret > 0) { - ERR("Module %s is in use\n", kmod_module_get_name(mod)); - return -EBUSY; -+ } else if (ret == -ENOENT) { -+ ERR("Module unloading is not supported\n"); - } - -- return 0; -+ return ret; - } - - static int do_remove(int argc, char *argv[]) -diff --git a/tools/rmmod.c b/tools/rmmod.c -index bcdea4c..3942e7b 100644 ---- a/tools/rmmod.c -+++ b/tools/rmmod.c -@@ -63,7 +63,7 @@ static void help(void) - - static int check_module_inuse(struct kmod_module *mod) { - struct kmod_list *holders; -- int state; -+ int state, ret; - - state = kmod_module_get_initstate(mod); - -@@ -93,12 +93,15 @@ static int check_module_inuse(struct kmod_module *mod) { - return -EBUSY; - } - -- if (kmod_module_get_refcnt(mod) != 0) { -+ ret = kmod_module_get_refcnt(mod); -+ if (ret > 0) { - ERR("Module %s is in use\n", kmod_module_get_name(mod)); - return -EBUSY; -+ } else if (ret == -ENOENT) { -+ ERR("Module unloading is not supported\n"); - } - -- return 0; -+ return ret; - } - - static int do_rmmod(int argc, char *argv[]) --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-show-information-about-builtin-mods.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-show-information-about-builtin-mods.patch deleted file mode 100644 index 188a238154b9..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-show-information-about-builtin-mods.patch +++ /dev/null @@ -1,149 +0,0 @@ -From e7e2cb61fa9f1db3429d91ef6accff549500d268 Mon Sep 17 00:00:00 2001 -From: Alexey Gladkov <gladkov.alexey@gmail.com> -Date: Fri, 8 Nov 2019 18:25:23 +0100 -Subject: modinfo: Show information about built-in modules - -Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com> ---- - libkmod/libkmod-builtin.c | 2 +- - libkmod/libkmod-module.c | 23 ++++++++++++++++------- - tools/modinfo.c | 39 +++++++++++++++++++++------------------ - 3 files changed, 38 insertions(+), 26 deletions(-) - -diff --git a/libkmod/libkmod-builtin.c b/libkmod/libkmod-builtin.c -index 98d7365..aaec5dd 100644 ---- a/libkmod/libkmod-builtin.c -+++ b/libkmod/libkmod-builtin.c -@@ -275,7 +275,7 @@ ssize_t kmod_builtin_get_modinfo(struct kmod_ctx *ctx, const char *modname, - struct kmod_builtin_iter *iter = kmod_builtin_iter_new(ctx); - - if (!iter) -- return -1; -+ return -errno; - - while (!name && kmod_builtin_iter_next(iter)) { - if (!kmod_builtin_iter_get_modname(iter, buf)) { -diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index ee7e6bd..8044a8f 100644 ---- a/libkmod/libkmod-module.c -+++ b/libkmod/libkmod-module.c -@@ -2286,13 +2286,22 @@ KMOD_EXPORT int kmod_module_get_info(const struct kmod_module *mod, struct kmod_ - - assert(*list == NULL); - -- elf = kmod_module_get_elf(mod); -- if (elf == NULL) -- return -errno; -+ /* remove const: this can only change internal state */ -+ if (kmod_module_is_builtin((struct kmod_module *)mod)) { -+ count = kmod_builtin_get_modinfo(mod->ctx, -+ kmod_module_get_name(mod), -+ &strings); -+ if (count < 0) -+ return count; -+ } else { -+ elf = kmod_module_get_elf(mod); -+ if (elf == NULL) -+ return -errno; - -- count = kmod_elf_get_strings(elf, ".modinfo", &strings); -- if (count < 0) -- return count; -+ count = kmod_elf_get_strings(elf, ".modinfo", &strings); -+ if (count < 0) -+ return count; -+ } - - for (i = 0; i < count; i++) { - struct kmod_list *n; -@@ -2316,7 +2325,7 @@ KMOD_EXPORT int kmod_module_get_info(const struct kmod_module *mod, struct kmod_ - goto list_error; - } - -- if (kmod_module_signature_info(mod->file, &sig_info)) { -+ if (mod->file && kmod_module_signature_info(mod->file, &sig_info)) { - struct kmod_list *n; - - n = kmod_module_info_append(list, "sig_id", strlen("sig_id"), -diff --git a/tools/modinfo.c b/tools/modinfo.c -index 86ac04b..0231bb0 100644 ---- a/tools/modinfo.c -+++ b/tools/modinfo.c -@@ -172,18 +172,33 @@ static int modinfo_do(struct kmod_module *mod) - { - struct kmod_list *l, *list = NULL; - struct param *params = NULL; -- int err; -+ int err, is_builtin; -+ const char *filename = kmod_module_get_path(mod); -+ -+ is_builtin = (filename == NULL); -+ -+ if (is_builtin) { -+ printf("%-16s%s%c", "name:", kmod_module_get_name(mod), separator); -+ filename = "(builtin)"; -+ } - - if (field != NULL && streq(field, "filename")) { -- printf("%s%c", kmod_module_get_path(mod), separator); -+ printf("%s%c", filename, separator); - return 0; - } else if (field == NULL) { - printf("%-16s%s%c", "filename:", -- kmod_module_get_path(mod), separator); -+ filename, separator); - } - - err = kmod_module_get_info(mod, &list); - if (err < 0) { -+ if (is_builtin && err == -ENOENT) { -+ /* -+ * This is an old kernel that does not have a file -+ * with information about built-in modules. -+ */ -+ return 0; -+ } - ERR("could not get modinfo from '%s': %s\n", - kmod_module_get_name(mod), strerror(-err)); - return err; -@@ -276,7 +291,7 @@ static int modinfo_path_do(struct kmod_ctx *ctx, const char *path) - - static int modinfo_alias_do(struct kmod_ctx *ctx, const char *alias) - { -- struct kmod_list *l, *filtered, *list = NULL; -+ struct kmod_list *l, *list = NULL; - int err = kmod_module_new_from_lookup(ctx, alias, &list); - if (err < 0) { - ERR("Module alias %s not found.\n", alias); -@@ -288,26 +303,14 @@ static int modinfo_alias_do(struct kmod_ctx *ctx, const char *alias) - return -ENOENT; - } - -- err = kmod_module_apply_filter(ctx, KMOD_FILTER_BUILTIN, list, &filtered); -- kmod_module_unref_list(list); -- if (err < 0) { -- ERR("Failed to filter list: %m\n"); -- return err; -- } -- -- if (filtered == NULL) { -- ERR("Module %s not found.\n", alias); -- return -ENOENT; -- } -- -- kmod_list_foreach(l, filtered) { -+ kmod_list_foreach(l, list) { - struct kmod_module *mod = kmod_module_get_module(l); - int r = modinfo_do(mod); - kmod_module_unref(mod); - if (r < 0) - err = r; - } -- kmod_module_unref_list(filtered); -+ kmod_module_unref_list(list); - return err; - } - --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-stop-using-dolt.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-stop-using-dolt.patch deleted file mode 100644 index c01fe5ece810..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-stop-using-dolt.patch +++ /dev/null @@ -1,237 +0,0 @@ -From f8b8d7b330433511d19a936ddfc7b7d1af5490b5 Mon Sep 17 00:00:00 2001 -From: Adrian Bunk <bunk@kernel.org> -Date: Wed, 20 Feb 2019 14:22:04 +0200 -Subject: build: Stop using dolt - -This does regress "make -12" from 0.7s to 0.9s on my -Coffee Lake machine, but even on slower hardware this -will not amount to a noticable slowdown. - -On the other hand using dolt can create problems for -people doing cross-compilation, e.g. Yocto has two -hacks just for dolt in kmod: -https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/kmod/kmod.inc?id=a17abae00785c76cfffe5381a22fb2c86b982e82 - -(Lucas: remove leftover entry in Makefile and reformat commit message) ---- - Makefile.am | 2 - - configure.ac | 1 - - m4/dolt.m4 | 181 ----------------------------------------------------------- - 4 files changed, 186 deletions(-) - delete mode 100644 m4/dolt.m4 - -diff --git a/Makefile.am b/Makefile.am -index 758f4f0..c5c2f06 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -415,8 +415,6 @@ distclean-local: $(DISTCLEAN_LOCAL_HOOKS) - buildtest-TESTS: - $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS) - --DISTCLEANFILES += $(DOLT_CLEANFILES) -- - # ------------------------------------------------------------------------------ - # coverage - # ------------------------------------------------------------------------------ -diff --git a/configure.ac b/configure.ac -index dffe278..e885d79 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -17,7 +17,6 @@ AM_MAINTAINER_MODE([enable]) - AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests]) - AM_SILENT_RULES([yes]) - LT_INIT([disable-static pic-only]) --DOLT - - AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by kmod])]) - AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by kmod])]) -diff --git a/m4/dolt.m4 b/m4/dolt.m4 -deleted file mode 100644 -index 775a572..0000000 ---- a/m4/dolt.m4 -+++ /dev/null -@@ -1,181 +0,0 @@ --dnl dolt, a replacement for libtool --dnl Copyright © 2007-2010 Josh Triplett <josh@joshtriplett.org> --dnl Copying and distribution of this file, with or without modification, --dnl are permitted in any medium without royalty provided the copyright --dnl notice and this notice are preserved. --dnl --dnl To use dolt, invoke the DOLT macro immediately after the libtool macros. --dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it --dnl installed when running autoconf on your project. -- --AC_DEFUN([DOLT], [ --AC_REQUIRE([AC_CANONICAL_HOST]) --# dolt, a replacement for libtool --# Josh Triplett <josh@freedesktop.org> --AC_PATH_PROG([DOLT_BASH], [bash]) --AC_MSG_CHECKING([if dolt supports this host]) --dolt_supported=yes --AS_IF([test x$DOLT_BASH = x], [dolt_supported=no]) --AS_IF([test x$GCC != xyes], [dolt_supported=no]) -- --AS_CASE([$host], -- [*-*-linux*|*-*-freebsd*], [pic_options='-fPIC'], -- [*-apple-darwin*], [pic_options='-fno-common'], -- [*mingw*|*nacl*], [pic_options=''] -- [*], [dolt_supported=no] --) --AS_IF([test x$dolt_supported = xno], [ -- AC_MSG_RESULT([no, falling back to libtool]) -- LTCOMPILE='$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)' -- LTCXXCOMPILE='$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)' -- m4_pattern_allow([AM_V_lt]) --], [ -- AC_MSG_RESULT([yes, replacing libtool]) -- --dnl Start writing out doltcompile. -- cat <<__DOLTCOMPILE__EOF__ >doltcompile --#!$DOLT_BASH --__DOLTCOMPILE__EOF__ -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --args=("$[]@") --for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do -- if test x"${args@<:@$arg@:>@}" = x-o ; then -- objarg=$((arg+1)) -- break -- fi --done --if test x$objarg = x ; then -- echo 'Error: no -o on compiler command line' 1>&2 -- exit 1 --fi --lo="${args@<:@$objarg@:>@}" --obj="${lo%.lo}" --if test x"$lo" = x"$obj" ; then -- echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2 -- exit 1 --fi --objbase="${obj##*/}" --__DOLTCOMPILE__EOF__ -- --dnl Write out shared compilation code. -- if test x$enable_shared = xyes; then -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --libobjdir="${obj%$objbase}.libs" --if test ! -d "$libobjdir" ; then -- mkdir_out="$(mkdir "$libobjdir" 2>&1)" -- mkdir_ret=$? -- if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then -- echo "$mkdir_out" 1>&2 -- exit $mkdir_ret -- fi --fi --pic_object="$libobjdir/$objbase.o" --args@<:@$objarg@:>@="$pic_object" --__DOLTCOMPILE__EOF__ -- cat <<__DOLTCOMPILE__EOF__ >>doltcompile -- pic_options="$pic_options" -- if test x\$passthrough = xtrue; then -- pic_options="" -- fi --__DOLTCOMPILE__EOF__ -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --"${args@<:@@@:>@}" $pic_options -DPIC || exit $? --__DOLTCOMPILE__EOF__ -- fi -- --dnl Write out static compilation code. --dnl Avoid duplicate compiler output if also building shared objects. -- if test x$enable_static = xyes; then -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --non_pic_object="$obj.o" --args@<:@$objarg@:>@="$non_pic_object" --__DOLTCOMPILE__EOF__ -- if test x$enable_shared = xyes; then -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $? --__DOLTCOMPILE__EOF__ -- else -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --"${args@<:@@@:>@}" || exit $? --__DOLTCOMPILE__EOF__ -- fi -- fi -- --dnl Write out the code to write the .lo file. --dnl The second line of the .lo file must match "^# Generated by .*libtool" -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --{ --echo "# $lo - a libtool object file" --echo "# Generated by doltcompile, not libtool" --__DOLTCOMPILE__EOF__ -- -- if test x$enable_shared = xyes; then -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --echo "pic_object='.libs/${objbase}.o'" --__DOLTCOMPILE__EOF__ -- else -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --echo pic_object=none --__DOLTCOMPILE__EOF__ -- fi -- -- if test x$enable_static = xyes; then -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --echo "non_pic_object='${objbase}.o'" --__DOLTCOMPILE__EOF__ -- else -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --echo non_pic_object=none --__DOLTCOMPILE__EOF__ -- fi -- -- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile --} > "$lo" --__DOLTCOMPILE__EOF__ -- --dnl Done writing out doltcompile; substitute it for libtool compilation. -- chmod +x doltcompile -- LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)' -- LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)' -- --dnl automake ignores LTCOMPILE and LTCXXCOMPILE when it has separate CFLAGS for --dnl a target, so write out a libtool wrapper to handle that case. --dnl Note that doltlibtool does not handle inferred tags or option arguments --dnl without '=', because automake does not use them. -- cat <<__DOLTLIBTOOL__EOF__ > doltlibtool --#!$DOLT_BASH --__DOLTLIBTOOL__EOF__ -- cat <<'__DOLTLIBTOOL__EOF__' >>doltlibtool --top_builddir_slash="${0%%doltlibtool}" --: ${top_builddir_slash:=./} --args=() --modeok=false --tagok=false --for arg in "$[]@"; do -- case "$arg" in -- --mode=compile) modeok=true ;; -- --tag=CC|--tag=CXX) tagok=true ;; -- --tag=disable-static) tagok=true ;; -- --tag=ASM|--tag=YASM) tagok=true; passthrough=true;; -- --silent|--quiet) ;; -- *) args@<:@${#args[@]}@:>@="$arg" ;; -- esac --done --if $modeok && $tagok ; then -- . ${top_builddir_slash}doltcompile "${args@<:@@@:>@}" --else -- exec ${top_builddir_slash}libtool "$[]@" --fi --__DOLTLIBTOOL__EOF__ -- --dnl Done writing out doltlibtool; substitute it for libtool. -- chmod +x doltlibtool -- LIBTOOL='$(top_builddir)/doltlibtool' -- --DOLT_CLEANFILES="doltlibtool doltcompile" --AC_SUBST(DOLT_CLEANFILES) --]) --AC_SUBST(LTCOMPILE) --AC_SUBST(LTCXXCOMPILE) --# end dolt --]) --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-undef-symbols-check-when-building-python-mods.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-undef-symbols-check-when-building-python-mods.patch deleted file mode 100644 index ad5ebfa9aa2a..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-undef-symbols-check-when-building-python-mods.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 1d14ef82f4a3be741bcdf6b1c6d51ce9dce43567 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni <thomas.petazzoni@bootlin.com> -Date: Thu, 24 Oct 2019 19:47:10 +0200 -Subject: Do not check for undefined symbols when building the Python modules - -kmod's configure.ac uses the -Wl,--no-undefined linker flag to verify -at link time that all symbols of shared libraries are available, and -that there are no undefined symbols. - -This make perfect sense for regular shared libraries. However, for -Python extensions, which will be dlopen()ed inside the Python -interpreter, it makes less sense. - -Since Python 3.8, there is a change in python-config script and -Python's pkg-config file: it no longer links Python extensions with -the libpython library. See -https://docs.python.org/dev/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build -which states: - - On the other hand, pkg-config python3.8 --libs no longer contains - -lpython3.8. C extensions must not be linked to libpython (except on - Android and Cygwin, whose cases are handled by the script); this - change is backward incompatible on purpose. (Contributed by Victor - Stinner in bpo-36721.) - -So, when linking the kmod Python extensions, it currently fails with -numerous unresolved symbols, that were previously provided by -libpython: - -/home/test/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64-buildroot-linux-gnu/7.4.0/../../../../powerpc64-buildroot-linux-gnu/bin/ld: libkmod/python/kmod/.libs/list_la-list.o: in function `__Pyx_PyObject_GetAttrStr': -list.c:(.text.__Pyx_PyObject_GetAttrStr+0x48): undefined reference to `PyObject_GetAttr' -/home/test/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64-buildroot-linux-gnu/7.4.0/../../../../powerpc64-buildroot-linux-gnu/bin/ld: libkmod/python/kmod/.libs/list_la-list.o: in function `__pyx_tp_dealloc_4kmod_4list_ModListItem': -list.c:(.text.__pyx_tp_dealloc_4kmod_4list_ModListItem+0x78): undefined reference to `PyObject_CallFinalizerFromDealloc' -/home/test/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64-buildroot-linux-gnu/7.4.0/../../../../powerpc64-buildroot-linux-gnu/bin/ld: libkmod/python/kmod/.libs/list_la-list.o: in function `__pyx_tp_dealloc_4kmod_4list_ModList': -list.c:(.text.__pyx_tp_dealloc_4kmod_4list_ModList+0x30): undefined reference to `PyErr_Fetch' - -[Complete log at http://autobuild.buildroot.net/results/79a/79a5a0398723e8cfea0d0aa3dec5f7649aee4c63/build-end.log] - -Linking with libpython is no longer recommended: those symbols should -remain unresolved in the Python extensions, as they wil be properly -resolved when the Python extension gets loaded into the Python -interpreter. - -Since we want to keep -Wl,--no-undefined globally in kmod, we leave -the configure.ac file unchanged, and instead, specifically in the -LDFLAGS used to build the Python extensions, we override --Wl,--no-undefined with -Wl,-z,undefs. Ideally, -Wl,--no-undefined is -the same as -Wl,-z,defs, and the effect of these options can be -canceled on the linker command line by a following -Wl,-z,undefs (see -the ld man page for details). - -Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> -Cc: Victor Stinner <victor.stinner@gmail.com> ---- - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index c5c2f06..8e9c90d 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -173,7 +173,7 @@ CPYTHON_MODULE_CFLAGS = \ - $(AM_CFLAGS) -DCPYTHON_COMPILING_IN_PYPY=0 \ - $(PYTHON_NOWARN) $(PYTHON_CFLAGS) \ - -fvisibility=default --CPYTHON_MODULE_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -shared -+CPYTHON_MODULE_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -shared -Wl,-z,undefs - - if BUILD_PYTHON - pkgpyexec_LTLIBRARIES = \ --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-26/fix-from-upstream-use-flags-rather-than-bool-args.patch b/sys-apps/kmod/files/kmod-26/fix-from-upstream-use-flags-rather-than-bool-args.patch deleted file mode 100644 index 5b1f01ad732c..000000000000 --- a/sys-apps/kmod/files/kmod-26/fix-from-upstream-use-flags-rather-than-bool-args.patch +++ /dev/null @@ -1,76 +0,0 @@ -From a6b540deaacd0f24f7ff22f1413f75ee82327622 Mon Sep 17 00:00:00 2001 -From: Lucas De Marchi <lucas.demarchi@intel.com> -Date: Wed, 6 Nov 2019 23:27:28 -0800 -Subject: modprobe: use flags rather than bool args - -It's easier to know what the caller is doing when we pass a named -flag rather than a list of bools. ---- - tools/modprobe.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/tools/modprobe.c b/tools/modprobe.c -index 44cd15c..9387537 100644 ---- a/tools/modprobe.c -+++ b/tools/modprobe.c -@@ -353,8 +353,9 @@ static int rmmod_do_remove_module(struct kmod_module *mod) - return err; - } - --static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies, -- bool ignore_builtin); -+#define RMMOD_FLAG_DO_DEPENDENCIES 0x1 -+#define RMMOD_FLAG_IGNORE_BUILTIN 0x2 -+static int rmmod_do_module(struct kmod_module *mod, int flags); - - static int rmmod_do_deps_list(struct kmod_list *list, bool stop_on_errors) - { -@@ -362,7 +363,7 @@ static int rmmod_do_deps_list(struct kmod_list *list, bool stop_on_errors) - - kmod_list_foreach_reverse(l, list) { - struct kmod_module *m = kmod_module_get_module(l); -- int r = rmmod_do_module(m, false, true); -+ int r = rmmod_do_module(m, RMMOD_FLAG_IGNORE_BUILTIN); - kmod_module_unref(m); - - if (r < 0 && stop_on_errors) -@@ -372,8 +373,7 @@ static int rmmod_do_deps_list(struct kmod_list *list, bool stop_on_errors) - return 0; - } - --static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies, -- bool ignore_builtin) -+static int rmmod_do_module(struct kmod_module *mod, int flags) - { - const char *modname = kmod_module_get_name(mod); - struct kmod_list *pre = NULL, *post = NULL; -@@ -403,7 +403,7 @@ static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies, - } - goto error; - } else if (state == KMOD_MODULE_BUILTIN) { -- if (ignore_builtin) { -+ if (flags & RMMOD_FLAG_IGNORE_BUILTIN) { - err = 0; - } else { - LOG("Module %s is builtin.\n", modname); -@@ -415,7 +415,7 @@ static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies, - - rmmod_do_deps_list(post, false); - -- if (do_dependencies && remove_dependencies) { -+ if ((flags & RMMOD_FLAG_DO_DEPENDENCIES) && remove_dependencies) { - struct kmod_list *deps = kmod_module_get_dependencies(mod); - - err = rmmod_do_deps_list(deps, true); -@@ -468,7 +468,7 @@ static int rmmod(struct kmod_ctx *ctx, const char *alias) - - kmod_list_foreach(l, list) { - struct kmod_module *mod = kmod_module_get_module(l); -- err = rmmod_do_module(mod, true, false); -+ err = rmmod_do_module(mod, RMMOD_FLAG_DO_DEPENDENCIES); - kmod_module_unref(mod); - if (err < 0) - break; --- -cgit 1.2-0.3.lf.el7 - diff --git a/sys-apps/kmod/files/kmod-27-depmod-do-not-output-.bin-to-stdout.patch b/sys-apps/kmod/files/kmod-27-depmod-do-not-output-.bin-to-stdout.patch new file mode 100644 index 000000000000..dc776b515bc0 --- /dev/null +++ b/sys-apps/kmod/files/kmod-27-depmod-do-not-output-.bin-to-stdout.patch @@ -0,0 +1,53 @@ +From 53b30aeba2dedae9f5558f560231d9462e063dfc Mon Sep 17 00:00:00 2001 +From: Lucas De Marchi <lucas.demarchi@intel.com> +Date: Thu, 5 Mar 2020 13:33:10 -0800 +Subject: depmod: do not output .bin to stdout + +index_write() relies on fseek/ftell to manage the position to which we +are write and thus needs the file stream to support it. + +Right now when trying to write the index to stdout we fail with: + + depmod: tools/depmod.c:416: index_write: Assertion `initial_offset >= 0' failed. + Aborted (core dumped) + +We have no interest in outputting our index to stdout, so just skip it +like is done with other indexes. + +While at it, add/remove some newlines to improve readability. + +Reported-by: Yanko Kaneti <yaneti@declera.com> +Fix: b866b2165ae6 ("Lookup aliases in the modules.builtin.modinfo") +--- + tools/depmod.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/tools/depmod.c b/tools/depmod.c +index fbbce10..875e314 100644 +--- a/tools/depmod.c ++++ b/tools/depmod.c +@@ -2408,8 +2408,10 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) + struct index_node *idx; + struct kmod_list *l, *builtin = NULL; + +- idx = index_create(); ++ if (out == stdout) ++ return 0; + ++ idx = index_create(); + if (idx == NULL) { + ret = -ENOMEM; + goto fail; +@@ -2456,7 +2458,9 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) + + if (count) + index_write(idx, out); ++ + index_destroy(idx); ++ + fail: + if (builtin) + kmod_module_unref_list(builtin); +-- +cgit 1.2.3-1.el7 + diff --git a/sys-apps/kmod/files/zstd-support-27.patch b/sys-apps/kmod/files/zstd-support-27.patch new file mode 100644 index 000000000000..86738da9a104 --- /dev/null +++ b/sys-apps/kmod/files/zstd-support-27.patch @@ -0,0 +1,187 @@ +diff --git a/Makefile.am b/Makefile.am +index 8eadb99..a471c55 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -90,7 +90,7 @@ libkmod_libkmod_la_DEPENDENCIES = \ + ${top_srcdir}/libkmod/libkmod.sym + libkmod_libkmod_la_LIBADD = \ + shared/libshared.la \ +- ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS} ++ ${libzstd_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS} + + noinst_LTLIBRARIES += libkmod/libkmod-internal.la + libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES) +diff --git a/configure.ac b/configure.ac +index 4a65d6b..30aaa1d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -83,6 +83,17 @@ AC_ARG_WITH([rootlibdir], + [], [with_rootlibdir=$libdir]) + AC_SUBST([rootlibdir], [$with_rootlibdir]) + ++AC_ARG_WITH([zstd], ++ AS_HELP_STRING([--with-zstd], [handle Zstd-compressed modules @<:@default=disabled@:>@]), ++ [], [with_zstd=no]) ++AS_IF([test "x$with_zstd" != "xno"], [ ++ PKG_CHECK_MODULES([libzstd], [libzstd >= 1.4.4]) ++ AC_DEFINE([ENABLE_ZSTD], [1], [Enable Zstd for modules.]) ++], [ ++ AC_MSG_NOTICE([Zstd support not requested]) ++]) ++CC_FEATURE_APPEND([with_features], [with_zstd], [ZSTD]) ++ + AC_ARG_WITH([xz], + AS_HELP_STRING([--with-xz], [handle Xz-compressed modules @<:@default=disabled@:>@]), + [], [with_xz=no]) +@@ -307,7 +318,7 @@ AC_MSG_RESULT([ + tools: ${enable_tools} + python bindings: ${enable_python} + logging: ${enable_logging} +- compression: xz=${with_xz} zlib=${with_zlib} ++ compression: zstd=${with_zstd} xz=${with_xz} zlib=${with_zlib} + debug: ${enable_debug} + coverage: ${enable_coverage} + doc: ${enable_gtk_doc} +diff --git a/libkmod/libkmod-file.c b/libkmod/libkmod-file.c +index 5eeba6a..2575b01 100644 +--- a/libkmod/libkmod-file.c ++++ b/libkmod/libkmod-file.c +@@ -32,7 +32,9 @@ + #ifdef ENABLE_ZLIB + #include <zlib.h> + #endif +- ++#ifdef ENABLE_ZSTD ++#include <zstd.h> ++#endif + #include <shared/util.h> + + #include "libkmod.h" +@@ -45,6 +47,9 @@ struct file_ops { + }; + + struct kmod_file { ++#ifdef ENABLE_ZSTD ++ bool zstd_used; ++#endif + #ifdef ENABLE_XZ + bool xz_used; + #endif +@@ -60,6 +65,79 @@ struct kmod_file { + struct kmod_elf *elf; + }; + ++#ifdef ENABLE_ZSTD ++static int zstd_uncompress(ZSTD_DStream *strm, struct kmod_file *file) { ++ uint8_t in_buf[BUFSIZ], out_buf[BUFSIZ]; ++ ZSTD_outBuffer output = { out_buf, sizeof(out_buf), 0 }; ++ ZSTD_inBuffer input = { in_buf, 0, 0 }; ++ void *p = NULL; ++ int ret = 0; ++ size_t total = 0; ++ ++ while(true) { ++ size_t sz; ++ if (input.pos == input.size) { ++ ssize_t rdret = read(file->fd, in_buf, sizeof(in_buf)); ++ if (rdret < 0) { ++ ret = -errno; ++ goto out; ++ } ++ input.size = rdret; ++ input.pos = 0; ++ } ++ if (input.size == 0) { ++ break; ++ } ++ sz = ZSTD_decompressStream(strm, &output, &input); ++ if (ZSTD_isError(sz)) { ++ ret = -1; ++ goto out; ++ } ++ if (output.pos == output.size || sz == 0) { ++ size_t write_size = output.pos; ++ char *tmp = realloc(p, total + write_size); ++ if (tmp == NULL) { ++ ret = -errno; ++ goto out; ++ } ++ memcpy(tmp + total, out_buf, write_size); ++ total += write_size; ++ p = tmp; ++ if (output.pos == output.size) { ++ output.pos = 0; ++ } ++ } ++ } ++ file->zstd_used = true; ++ file->memory = p; ++ file->size = total; ++ return 0; ++out: ++ free(p); ++ return ret; ++} ++ ++static int load_zstd(struct kmod_file *file) ++{ ++ ZSTD_DStream* strm = ZSTD_createDStream(); ++ int ret; ++ ZSTD_initDStream(strm); ++ ++ ret = zstd_uncompress(strm, file); ++ ZSTD_freeDStream(strm); ++ return ret; ++} ++ ++static void unload_zstd(struct kmod_file *file) ++{ ++ if (!file->zstd_used) ++ return; ++ free(file->memory); ++} ++ ++static const char magic_zstd[] = {0x28, 0xb5, 0x2f, 0xfd}; ++#endif ++ + #ifdef ENABLE_XZ + static void xz_uncompress_belch(struct kmod_file *file, lzma_ret ret) + { +@@ -238,6 +316,9 @@ static const struct comp_type { + const char *magic_bytes; + const struct file_ops ops; + } comp_types[] = { ++#ifdef ENABLE_ZSTD ++ {sizeof(magic_zstd), magic_zstd, {load_zstd, unload_zstd}}, ++#endif + #ifdef ENABLE_XZ + {sizeof(magic_xz), magic_xz, {load_xz, unload_xz}}, + #endif +diff --git a/shared/util.c b/shared/util.c +index fd2028d..b487b5f 100644 +--- a/shared/util.c ++++ b/shared/util.c +@@ -45,6 +45,9 @@ static const struct kmod_ext { + #endif + #ifdef ENABLE_XZ + {".ko.xz", sizeof(".ko.xz") - 1}, ++#endif ++#ifdef ENABLE_ZSTD ++ {".ko.zst", sizeof(".ko.zst") - 1}, + #endif + { } + }; +diff --git a/testsuite/test-util.c b/testsuite/test-util.c +index 5e25e58..621446b 100644 +--- a/testsuite/test-util.c ++++ b/testsuite/test-util.c +@@ -156,6 +156,9 @@ static int test_path_ends_with_kmod_ext(const struct test *t) + #endif + #ifdef ENABLE_XZ + { "/bla.ko.xz", true }, ++#endif ++#ifdef ENABLE_ZSTD ++ { "/bla.ko.zst", true }, + #endif + { "/bla.ko.x", false }, + { "/bla.ko.", false }, diff --git a/sys-apps/kmod/kmod-25.ebuild b/sys-apps/kmod/kmod-25.ebuild deleted file mode 100644 index a09bd7d51f1b..000000000000 --- a/sys-apps/kmod/kmod-25.ebuild +++ /dev/null @@ -1,190 +0,0 @@ -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -PYTHON_COMPAT=( python2_7 python3_{6,7,8,9,10} ) - -inherit bash-completion-r1 ltprune multilib python-r1 - -if [[ ${PV} == 9999* ]]; then - EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/kernel/${PN}/${PN}.git" - inherit autotools git-r3 -else - SRC_URI="mirror://kernel/linux/utils/kernel/kmod/${P}.tar.xz" - KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86" - inherit libtool -fi - -DESCRIPTION="library and tools for managing linux kernel modules" -HOMEPAGE="https://git.kernel.org/?p=utils/kernel/kmod/kmod.git" - -LICENSE="LGPL-2" -SLOT="0" -IUSE="debug doc lzma python static-libs +tools zlib" - -# Upstream does not support running the test suite with custom configure flags. -# I was also told that the test suite is intended for kmod developers. -# So we have to restrict it. -# See bug #408915. -RESTRICT="test" - -# Block systemd below 217 for -static-nodes-indicate-that-creation-of-static-nodes-.patch -RDEPEND="!sys-apps/module-init-tools - !sys-apps/modutils - !<sys-apps/openrc-0.13.8 - !<sys-apps/systemd-216-r3 - lzma? ( >=app-arch/xz-utils-5.0.4-r1 ) - python? ( ${PYTHON_DEPS} ) - zlib? ( >=sys-libs/zlib-1.2.6 )" #427130 -DEPEND="${RDEPEND} - doc? ( dev-util/gtk-doc ) - lzma? ( virtual/pkgconfig ) - python? ( - dev-python/cython[${PYTHON_USEDEP}] - virtual/pkgconfig - ) - zlib? ( virtual/pkgconfig )" -if [[ ${PV} == 9999* ]]; then - DEPEND="${DEPEND} - dev-libs/libxslt" -fi - -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" - -DOCS="NEWS README TODO" - -src_prepare() { - default - - if [ ! -e configure ]; then - if use doc; then - gtkdocize --copy --docdir libkmod/docs || die - else - touch libkmod/docs/gtk-doc.make - fi - eautoreconf - else - elibtoolize - fi - - # Restore possibility of running --enable-static wrt #472608 - sed -i \ - -e '/--enable-static is not supported by kmod/s:as_fn_error:echo:' \ - configure || die -} - -src_configure() { - local myeconfargs=( - --bindir="${EPREFIX}/bin" - --enable-shared - --with-bashcompletiondir="$(get_bashcompdir)" - --with-rootlibdir="${EPREFIX}/$(get_libdir)" - $(use_enable debug) - $(use_enable doc gtk-doc) - $(use_enable static-libs static) - $(use_enable tools) - $(use_with lzma xz) - $(use_with zlib) - ) - - local ECONF_SOURCE="${S}" - - kmod_configure() { - mkdir -p "${BUILD_DIR}" || die - run_in_build_dir econf "${myeconfargs[@]}" "$@" - } - - BUILD_DIR="${WORKDIR}/build" - kmod_configure --disable-python - - if use python; then - python_foreach_impl kmod_configure --enable-python - fi -} - -src_compile() { - emake -C "${BUILD_DIR}" - - if use python; then - local native_builddir=${BUILD_DIR} - - python_compile() { - emake -C "${BUILD_DIR}" -f Makefile -f - python \ - VPATH="${native_builddir}:${S}" \ - native_builddir="${native_builddir}" \ - libkmod_python_kmod_{kmod,list,module,_util}_la_LIBADD='$(PYTHON_LIBS) $(native_builddir)/libkmod/libkmod.la' \ - <<< 'python: $(pkgpyexec_LTLIBRARIES)' - } - - python_foreach_impl python_compile - fi -} - -src_install() { - emake -C "${BUILD_DIR}" DESTDIR="${D}" install - einstalldocs - - if use python; then - local native_builddir=${BUILD_DIR} - - python_install() { - emake -C "${BUILD_DIR}" DESTDIR="${D}" \ - VPATH="${native_builddir}:${S}" \ - install-pkgpyexecLTLIBRARIES \ - install-dist_pkgpyexecPYTHON - } - - python_foreach_impl python_install - fi - - prune_libtool_files --modules - - if use tools; then - local bincmd sbincmd - for sbincmd in depmod insmod lsmod modinfo modprobe rmmod; do - dosym ../bin/kmod /sbin/${sbincmd} - done - - # These are also usable as normal user - for bincmd in lsmod modinfo; do - dosym kmod /bin/${bincmd} - done - fi - - cat <<-EOF > "${T}"/usb-load-ehci-first.conf - softdep uhci_hcd pre: ehci_hcd - softdep ohci_hcd pre: ehci_hcd - EOF - - insinto /lib/modprobe.d - doins "${T}"/usb-load-ehci-first.conf #260139 - - newinitd "${FILESDIR}"/kmod-static-nodes-r1 kmod-static-nodes -} - -pkg_postinst() { - if [[ -L ${EROOT%/}/etc/runlevels/boot/static-nodes ]]; then - ewarn "Removing old conflicting static-nodes init script from the boot runlevel" - rm -f "${EROOT%/}"/etc/runlevels/boot/static-nodes - fi - - # Add kmod to the runlevel automatically if this is the first install of this package. - if [[ -z ${REPLACING_VERSIONS} ]]; then - if [[ ! -d ${EROOT%/}/etc/runlevels/sysinit ]]; then - mkdir -p "${EROOT%/}"/etc/runlevels/sysinit - fi - if [[ -x ${EROOT%/}/etc/init.d/kmod-static-nodes ]]; then - ln -s /etc/init.d/kmod-static-nodes "${EROOT%/}"/etc/runlevels/sysinit/kmod-static-nodes - fi - fi - - if [[ -e ${EROOT%/}/etc/runlevels/sysinit ]]; then - if [[ ! -e ${EROOT%/}/etc/runlevels/sysinit/kmod-static-nodes ]]; then - ewarn - ewarn "You need to add kmod-static-nodes to the sysinit runlevel for" - ewarn "kernel modules to have required static nodes!" - ewarn "Run this command:" - ewarn "\trc-update add kmod-static-nodes sysinit" - fi - fi -} diff --git a/sys-apps/kmod/kmod-26-r3.ebuild b/sys-apps/kmod/kmod-26-r3.ebuild deleted file mode 100644 index e48326709af9..000000000000 --- a/sys-apps/kmod/kmod-26-r3.ebuild +++ /dev/null @@ -1,211 +0,0 @@ -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -PYTHON_COMPAT=( python2_7 python3_{6,7,8,9,10} ) - -inherit bash-completion-r1 multilib python-r1 - -if [[ ${PV} == 9999* ]]; then - EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/kernel/${PN}/${PN}.git" - inherit autotools git-r3 -else - SRC_URI="mirror://kernel/linux/utils/kernel/kmod/${P}.tar.xz" - KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86" - inherit libtool -fi - -DESCRIPTION="library and tools for managing linux kernel modules" -HOMEPAGE="https://git.kernel.org/?p=utils/kernel/kmod/kmod.git" - -LICENSE="LGPL-2" -SLOT="0" -IUSE="debug doc libressl +lzma pkcs7 -python static-libs +tools zlib" - -# Upstream does not support running the test suite with custom configure flags. -# I was also told that the test suite is intended for kmod developers. -# So we have to restrict it. -# See bug #408915. -RESTRICT="test" - -# Block systemd below 217 for -static-nodes-indicate-that-creation-of-static-nodes-.patch -RDEPEND="!sys-apps/module-init-tools - !sys-apps/modutils - !<sys-apps/openrc-0.13.8 - !<sys-apps/systemd-216-r3 - lzma? ( >=app-arch/xz-utils-5.0.4-r1 ) - python? ( ${PYTHON_DEPS} ) - pkcs7? ( - !libressl? ( >=dev-libs/openssl-1.1.0:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - zlib? ( >=sys-libs/zlib-1.2.6 )" #427130 -DEPEND="${RDEPEND} - doc? ( dev-util/gtk-doc ) - lzma? ( virtual/pkgconfig ) - python? ( - dev-python/cython[${PYTHON_USEDEP}] - virtual/pkgconfig - ) - zlib? ( virtual/pkgconfig )" -if [[ ${PV} == 9999* ]]; then - DEPEND="${DEPEND} - dev-libs/libxslt" -fi - -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" - -DOCS="NEWS README TODO" - -PATCHES=( - "${FILESDIR}/${P}/fix-from-upstream-link-against-libcrypto-not-all-of-openssl.patch" - "${FILESDIR}/${P}/fix-from-upstream-stop-using-dolt.patch" - "${FILESDIR}/${P}/fix-from-upstream-print-refcnt-error.patch" - "${FILESDIR}/${P}/fix-from-upstream-use-pkcs7-instead-of-cms.patch" - "${FILESDIR}/${P}/fix-from-upstream-undef-symbols-check-when-building-python-mods.patch" - "${FILESDIR}/${P}/fix-from-upstream-ignore-builtin-module.patch" - "${FILESDIR}/${P}/fix-from-upstream-use-flags-rather-than-bool-args.patch" - "${FILESDIR}/${P}/fix-from-upstream-filter-undefined-linker.patch" - "${FILESDIR}/${P}/fix-from-upstream-new-parser-for-builtin-mods.patch" - "${FILESDIR}/${P}/fix-from-upstream-get-builtin-mods.patch" - "${FILESDIR}/${P}/fix-from-upstream-lookup-aliases-in-modules-builtin-info.patch" - "${FILESDIR}/${P}/fix-from-upstream-show-information-about-builtin-mods.patch" - "${FILESDIR}/${P}/fix-from-upstream-convert-return-value.patch" -) - -src_prepare() { - default - - if [[ ! -e configure ]] ; then - if use doc; then - gtkdocize --copy --docdir libkmod/docs || die - else - touch libkmod/docs/gtk-doc.make - fi - eautoreconf - else - elibtoolize - fi - - # Restore possibility of running --enable-static wrt #472608 - sed -i \ - -e '/--enable-static is not supported by kmod/s:as_fn_error:echo:' \ - configure || die -} - -src_configure() { - local myeconfargs=( - --bindir="${EPREFIX}/bin" - --enable-shared - --with-bashcompletiondir="$(get_bashcompdir)" - --with-rootlibdir="${EPREFIX}/$(get_libdir)" - $(use_enable debug) - $(use_enable doc gtk-doc) - $(use_enable static-libs static) - $(use_enable tools) - $(use_with lzma xz) - $(use_with pkcs7 openssl) - $(use_with zlib) - ) - - local ECONF_SOURCE="${S}" - - kmod_configure() { - mkdir -p "${BUILD_DIR}" || die - run_in_build_dir econf "${myeconfargs[@]}" "$@" - } - - BUILD_DIR="${WORKDIR}/build" - kmod_configure --disable-python - - if use python; then - python_foreach_impl kmod_configure --enable-python - fi -} - -src_compile() { - emake -C "${BUILD_DIR}" - - if use python; then - local native_builddir=${BUILD_DIR} - - python_compile() { - emake -C "${BUILD_DIR}" -f Makefile -f - python \ - VPATH="${native_builddir}:${S}" \ - native_builddir="${native_builddir}" \ - libkmod_python_kmod_{kmod,list,module,_util}_la_LIBADD='$(PYTHON_LIBS) $(native_builddir)/libkmod/libkmod.la' \ - <<< 'python: $(pkgpyexec_LTLIBRARIES)' - } - - python_foreach_impl python_compile - fi -} - -src_install() { - emake -C "${BUILD_DIR}" DESTDIR="${D}" install - einstalldocs - - if use python; then - local native_builddir=${BUILD_DIR} - - python_install() { - emake -C "${BUILD_DIR}" DESTDIR="${D}" \ - VPATH="${native_builddir}:${S}" \ - install-pkgpyexecLTLIBRARIES \ - install-dist_pkgpyexecPYTHON - } - - python_foreach_impl python_install - fi - - find "${ED}" -name "*.la" -delete || die - - if use tools; then - local cmd - for cmd in depmod insmod modprobe rmmod; do - dosym ../bin/kmod /sbin/${cmd} - done - - # These are also usable as normal user - for cmd in lsmod modinfo; do - dosym kmod /bin/${cmd} - done - fi - - cat <<-EOF > "${T}"/usb-load-ehci-first.conf - softdep uhci_hcd pre: ehci_hcd - softdep ohci_hcd pre: ehci_hcd - EOF - - insinto /lib/modprobe.d - doins "${T}"/usb-load-ehci-first.conf #260139 - - newinitd "${FILESDIR}"/kmod-static-nodes-r1 kmod-static-nodes -} - -pkg_postinst() { - if [[ -L ${EROOT%/}/etc/runlevels/boot/static-nodes ]]; then - ewarn "Removing old conflicting static-nodes init script from the boot runlevel" - rm -f "${EROOT%/}"/etc/runlevels/boot/static-nodes - fi - - # Add kmod to the runlevel automatically if this is the first install of this package. - if [[ -z ${REPLACING_VERSIONS} ]]; then - if [[ ! -d ${EROOT%/}/etc/runlevels/sysinit ]]; then - mkdir -p "${EROOT%/}"/etc/runlevels/sysinit - fi - if [[ -x ${EROOT%/}/etc/init.d/kmod-static-nodes ]]; then - ln -s /etc/init.d/kmod-static-nodes "${EROOT%/}"/etc/runlevels/sysinit/kmod-static-nodes - fi - fi - - if [[ -e ${EROOT%/}/etc/runlevels/sysinit ]]; then - if [[ ! -e ${EROOT%/}/etc/runlevels/sysinit/kmod-static-nodes ]]; then - ewarn - ewarn "You need to add kmod-static-nodes to the sysinit runlevel for" - ewarn "kernel modules to have required static nodes!" - ewarn "Run this command:" - ewarn "\trc-update add kmod-static-nodes sysinit" - fi - fi -} diff --git a/sys-apps/kmod/kmod-27-r1.ebuild b/sys-apps/kmod/kmod-27-r3.ebuild index 3e093018153c..4a64e0694ac7 100644 --- a/sys-apps/kmod/kmod-27-r1.ebuild +++ b/sys-apps/kmod/kmod-27-r3.ebuild @@ -12,7 +12,7 @@ if [[ ${PV} == 9999* ]]; then inherit git-r3 else SRC_URI="https://www.kernel.org/pub/linux/utils/kernel/kmod/${P}.tar.xz" - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86" #inherit libtool fi @@ -21,7 +21,7 @@ HOMEPAGE="https://git.kernel.org/?p=utils/kernel/kmod/kmod.git" LICENSE="LGPL-2" SLOT="0" -IUSE="debug doc libressl +lzma pkcs7 python static-libs +tools zlib" +IUSE="debug doc libressl +lzma pkcs7 python static-libs +tools +zlib +zstd" # Upstream does not support running the test suite with custom configure flags. # I was also told that the test suite is intended for kmod developers. @@ -35,6 +35,7 @@ RDEPEND="!sys-apps/module-init-tools !<sys-apps/openrc-0.13.8 !<sys-apps/systemd-216-r3 lzma? ( >=app-arch/xz-utils-5.0.4-r1 ) + zstd? ( >=app-arch/zstd-1.4.0 ) python? ( ${PYTHON_DEPS} ) pkcs7? ( !libressl? ( >=dev-libs/openssl-1.1.0:0= ) @@ -63,6 +64,10 @@ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" DOCS="NEWS README TODO" +PATCHES=( "${FILESDIR}"/${P}-depmod-do-not-output-.bin-to-stdout.patch + "${FILESDIR}"/zstd-support-27.patch +) + src_prepare() { default @@ -97,6 +102,7 @@ src_configure() { $(use_with lzma xz) $(use_with pkcs7 openssl) $(use_with zlib) + $(use_with zstd) ) local ECONF_SOURCE="${S}" @@ -192,7 +198,7 @@ pkg_postinst() { fi if [[ -e ${EROOT}/etc/runlevels/sysinit ]]; then - if [[ ! -e ${EROOT}/etc/runlevels/sysinit/kmod-static-nodes ]]; then + if ! has_version sys-apps/systemd && [[ ! -e ${EROOT}/etc/runlevels/sysinit/kmod-static-nodes ]]; then ewarn ewarn "You need to add kmod-static-nodes to the sysinit runlevel for" ewarn "kernel modules to have required static nodes!" diff --git a/sys-apps/kmod/kmod-27.ebuild b/sys-apps/kmod/kmod-27.ebuild deleted file mode 100644 index 3323884a996c..000000000000 --- a/sys-apps/kmod/kmod-27.ebuild +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{6,7,8,9,10} ) - -inherit autotools bash-completion-r1 multilib python-r1 - -if [[ ${PV} == 9999* ]]; then - EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/kernel/${PN}/${PN}.git" - inherit git-r3 -else - SRC_URI="https://www.kernel.org/pub/linux/utils/kernel/kmod/${P}.tar.xz" - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86" - #inherit libtool -fi - -DESCRIPTION="library and tools for managing linux kernel modules" -HOMEPAGE="https://git.kernel.org/?p=utils/kernel/kmod/kmod.git" - -LICENSE="LGPL-2" -SLOT="0" -IUSE="debug doc libressl +lzma pkcs7 python static-libs +tools zlib" - -# Upstream does not support running the test suite with custom configure flags. -# I was also told that the test suite is intended for kmod developers. -# So we have to restrict it. -# See bug #408915. -RESTRICT="test" - -# Block systemd below 217 for -static-nodes-indicate-that-creation-of-static-nodes-.patch -RDEPEND="!sys-apps/module-init-tools - !sys-apps/modutils - !<sys-apps/openrc-0.13.8 - !<sys-apps/systemd-216-r3 - lzma? ( >=app-arch/xz-utils-5.0.4-r1 ) - python? ( ${PYTHON_DEPS} ) - pkcs7? ( - !libressl? ( >=dev-libs/openssl-1.1.0:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - zlib? ( >=sys-libs/zlib-1.2.6 )" #427130 -DEPEND="${RDEPEND}" -BDEPEND=" - doc? ( - dev-util/gtk-doc - dev-util/gtk-doc-am - ) - lzma? ( virtual/pkgconfig ) - python? ( - dev-python/cython[${PYTHON_USEDEP}] - virtual/pkgconfig - ) - zlib? ( virtual/pkgconfig ) -" -if [[ ${PV} == 9999* ]]; then - DEPEND="${DEPEND} - dev-libs/libxslt" -fi - -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" - -DOCS="NEWS README TODO" - -src_prepare() { - default - - if [[ ! -e configure ]] || use doc ; then - if use doc; then - cp "${EROOT}"/usr/share/aclocal/gtk-doc.m4 m4 || die - gtkdocize --copy --docdir libkmod/docs || die - else - touch libkmod/docs/gtk-doc.make - fi - eautoreconf - else - elibtoolize - fi - - # Restore possibility of running --enable-static wrt #472608 - sed -i \ - -e '/--enable-static is not supported by kmod/s:as_fn_error:echo:' \ - configure || die -} - -src_configure() { - local myeconfargs=( - --bindir="${EPREFIX}/bin" - --enable-shared - --with-bashcompletiondir="$(get_bashcompdir)" - --with-rootlibdir="${EPREFIX}/$(get_libdir)" - $(use_enable debug) - $(usex doc '--enable-gtk-doc' '') - $(use_enable static-libs static) - $(use_enable tools) - $(use_with lzma xz) - $(use_with pkcs7 openssl) - $(use_with zlib) - ) - - local ECONF_SOURCE="${S}" - - kmod_configure() { - mkdir -p "${BUILD_DIR}" || die - run_in_build_dir econf "${myeconfargs[@]}" "$@" - } - - BUILD_DIR="${WORKDIR}/build" - kmod_configure --disable-python - - if use python; then - python_foreach_impl kmod_configure --enable-python - fi -} - -src_compile() { - emake -C "${BUILD_DIR}" - - if use python; then - local native_builddir=${BUILD_DIR} - - python_compile() { - emake -C "${BUILD_DIR}" -f Makefile -f - python \ - VPATH="${native_builddir}:${S}" \ - native_builddir="${native_builddir}" \ - libkmod_python_kmod_{kmod,list,module,_util}_la_LIBADD='$(PYTHON_LIBS) $(native_builddir)/libkmod/libkmod.la' \ - <<< 'python: $(pkgpyexec_LTLIBRARIES)' - } - - python_foreach_impl python_compile - fi -} - -src_install() { - emake -C "${BUILD_DIR}" DESTDIR="${D}" install - einstalldocs - - if use python; then - local native_builddir=${BUILD_DIR} - - python_install() { - emake -C "${BUILD_DIR}" DESTDIR="${D}" \ - VPATH="${native_builddir}:${S}" \ - install-pkgpyexecLTLIBRARIES \ - install-dist_pkgpyexecPYTHON - } - - python_foreach_impl python_install - fi - - find "${ED}" -type f -name "*.la" -delete || die - - if use tools; then - local cmd - for cmd in depmod insmod modprobe rmmod; do - dosym ../bin/kmod /sbin/${cmd} - done - - # These are also usable as normal user - for cmd in lsmod modinfo; do - dosym kmod /bin/${cmd} - done - fi - - cat <<-EOF > "${T}"/usb-load-ehci-first.conf - softdep uhci_hcd pre: ehci_hcd - softdep ohci_hcd pre: ehci_hcd - EOF - - insinto /lib/modprobe.d - doins "${T}"/usb-load-ehci-first.conf #260139 - - newinitd "${FILESDIR}"/kmod-static-nodes-r1 kmod-static-nodes -} - -pkg_postinst() { - if [[ -L ${EROOT}/etc/runlevels/boot/static-nodes ]]; then - ewarn "Removing old conflicting static-nodes init script from the boot runlevel" - rm -f "${EROOT}"/etc/runlevels/boot/static-nodes - fi - - # Add kmod to the runlevel automatically if this is the first install of this package. - if [[ -z ${REPLACING_VERSIONS} ]]; then - if [[ ! -d ${EROOT}/etc/runlevels/sysinit ]]; then - mkdir -p "${EROOT}"/etc/runlevels/sysinit - fi - if [[ -x ${EROOT}/etc/init.d/kmod-static-nodes ]]; then - ln -s /etc/init.d/kmod-static-nodes "${EROOT}"/etc/runlevels/sysinit/kmod-static-nodes - fi - fi - - if [[ -e ${EROOT}/etc/runlevels/sysinit ]]; then - if [[ ! -e ${EROOT}/etc/runlevels/sysinit/kmod-static-nodes ]]; then - ewarn - ewarn "You need to add kmod-static-nodes to the sysinit runlevel for" - ewarn "kernel modules to have required static nodes!" - ewarn "Run this command:" - ewarn "\trc-update add kmod-static-nodes sysinit" - fi - fi -} diff --git a/sys-apps/kmod/kmod-9999.ebuild b/sys-apps/kmod/kmod-9999.ebuild deleted file mode 100644 index 2be15dc2dbf5..000000000000 --- a/sys-apps/kmod/kmod-9999.ebuild +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{6,7,8,9,10} ) - -inherit autotools bash-completion-r1 multilib python-r1 - -if [[ ${PV} == 9999* ]]; then - EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/kernel/${PN}/${PN}.git" - inherit git-r3 -else - SRC_URI="https://www.kernel.org/pub/linux/utils/kernel/kmod/${P}.tar.xz" - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86" - #inherit libtool -fi - -DESCRIPTION="library and tools for managing linux kernel modules" -HOMEPAGE="https://git.kernel.org/?p=utils/kernel/kmod/kmod.git" - -LICENSE="LGPL-2" -SLOT="0" -IUSE="debug doc libressl lzma pkcs7 python static-libs +tools zlib" - -# Upstream does not support running the test suite with custom configure flags. -# I was also told that the test suite is intended for kmod developers. -# So we have to restrict it. -# See bug #408915. -RESTRICT="test" - -# Block systemd below 217 for -static-nodes-indicate-that-creation-of-static-nodes-.patch -RDEPEND="!sys-apps/module-init-tools - !sys-apps/modutils - !<sys-apps/openrc-0.13.8 - !<sys-apps/systemd-216-r3 - lzma? ( >=app-arch/xz-utils-5.0.4-r1 ) - python? ( ${PYTHON_DEPS} ) - pkcs7? ( - !libressl? ( >=dev-libs/openssl-1.1.0:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - zlib? ( >=sys-libs/zlib-1.2.6 )" #427130 -DEPEND="${RDEPEND}" -BDEPEND=" - doc? ( - dev-util/gtk-doc - dev-util/gtk-doc-am - ) - lzma? ( virtual/pkgconfig ) - python? ( - dev-python/cython[${PYTHON_USEDEP}] - virtual/pkgconfig - ) - zlib? ( virtual/pkgconfig ) -" -if [[ ${PV} == 9999* ]]; then - DEPEND="${DEPEND} - dev-libs/libxslt" -fi - -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" - -DOCS="NEWS README TODO" - -src_prepare() { - default - - if [[ ! -e configure ]] || use doc ; then - if use doc; then - cp "${EROOT}"/usr/share/aclocal/gtk-doc.m4 m4 || die - gtkdocize --copy --docdir libkmod/docs || die - else - touch libkmod/docs/gtk-doc.make - fi - eautoreconf - else - elibtoolize - fi - - # Restore possibility of running --enable-static wrt #472608 - sed -i \ - -e '/--enable-static is not supported by kmod/s:as_fn_error:echo:' \ - configure || die -} - -src_configure() { - local myeconfargs=( - --bindir="${EPREFIX}/bin" - --enable-shared - --with-bashcompletiondir="$(get_bashcompdir)" - --with-rootlibdir="${EPREFIX}/$(get_libdir)" - $(use_enable debug) - $(usex doc '--enable-gtk-doc' '') - $(use_enable static-libs static) - $(use_enable tools) - $(use_with lzma xz) - $(use_with pkcs7 openssl) - $(use_with zlib) - ) - - local ECONF_SOURCE="${S}" - - kmod_configure() { - mkdir -p "${BUILD_DIR}" || die - run_in_build_dir econf "${myeconfargs[@]}" "$@" - } - - BUILD_DIR="${WORKDIR}/build" - kmod_configure --disable-python - - if use python; then - python_foreach_impl kmod_configure --enable-python - fi -} - -src_compile() { - emake -C "${BUILD_DIR}" - - if use python; then - local native_builddir=${BUILD_DIR} - - python_compile() { - emake -C "${BUILD_DIR}" -f Makefile -f - python \ - VPATH="${native_builddir}:${S}" \ - native_builddir="${native_builddir}" \ - libkmod_python_kmod_{kmod,list,module,_util}_la_LIBADD='$(PYTHON_LIBS) $(native_builddir)/libkmod/libkmod.la' \ - <<< 'python: $(pkgpyexec_LTLIBRARIES)' - } - - python_foreach_impl python_compile - fi -} - -src_install() { - emake -C "${BUILD_DIR}" DESTDIR="${D}" install - einstalldocs - - if use python; then - local native_builddir=${BUILD_DIR} - - python_install() { - emake -C "${BUILD_DIR}" DESTDIR="${D}" \ - VPATH="${native_builddir}:${S}" \ - install-pkgpyexecLTLIBRARIES \ - install-dist_pkgpyexecPYTHON - } - - python_foreach_impl python_install - fi - - find "${ED}" -type f -name "*.la" -delete || die - - if use tools; then - local cmd - for cmd in depmod insmod modprobe rmmod; do - dosym ../bin/kmod /sbin/${cmd} - done - - # These are also usable as normal user - for cmd in lsmod modinfo; do - dosym kmod /bin/${cmd} - done - fi - - cat <<-EOF > "${T}"/usb-load-ehci-first.conf - softdep uhci_hcd pre: ehci_hcd - softdep ohci_hcd pre: ehci_hcd - EOF - - insinto /lib/modprobe.d - doins "${T}"/usb-load-ehci-first.conf #260139 - - newinitd "${FILESDIR}"/kmod-static-nodes-r1 kmod-static-nodes -} - -pkg_postinst() { - if [[ -L ${EROOT}/etc/runlevels/boot/static-nodes ]]; then - ewarn "Removing old conflicting static-nodes init script from the boot runlevel" - rm -f "${EROOT}"/etc/runlevels/boot/static-nodes - fi - - # Add kmod to the runlevel automatically if this is the first install of this package. - if [[ -z ${REPLACING_VERSIONS} ]]; then - if [[ ! -d ${EROOT}/etc/runlevels/sysinit ]]; then - mkdir -p "${EROOT}"/etc/runlevels/sysinit - fi - if [[ -x ${EROOT}/etc/init.d/kmod-static-nodes ]]; then - ln -s /etc/init.d/kmod-static-nodes "${EROOT}"/etc/runlevels/sysinit/kmod-static-nodes - fi - fi - - if [[ -e ${EROOT}/etc/runlevels/sysinit ]]; then - if [[ ! -e ${EROOT}/etc/runlevels/sysinit/kmod-static-nodes ]]; then - ewarn - ewarn "You need to add kmod-static-nodes to the sysinit runlevel for" - ewarn "kernel modules to have required static nodes!" - ewarn "Run this command:" - ewarn "\trc-update add kmod-static-nodes sysinit" - fi - fi -} diff --git a/sys-apps/kmod/metadata.xml b/sys-apps/kmod/metadata.xml index b9a1eae5389b..d9f218199f50 100644 --- a/sys-apps/kmod/metadata.xml +++ b/sys-apps/kmod/metadata.xml @@ -10,8 +10,13 @@ </maintainer> <use> <flag name="lzma">Enable support for XZ compressed modules</flag> + <flag name="pkcs7">Enable PKCS#7 signature parsing for modinfo.</flag> <flag name="tools">Install module loading/unloading tools.</flag> <flag name="zlib">Enable support for gzipped modules</flag> + <flag name="zstd">Enable support for ZSTD compressed modules</flag> </use> - <origin>kit-fixups</origin> +<upstream> + <remote-id type="cpe">cpe:/a:kernel:kmod</remote-id> +</upstream> + <origin>calculatelinux-overlay</origin> </pkgmetadata> |
