aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2023-11-16 00:12:44 +0100
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2023-11-21 22:00:45 +0100
commit7b95445865b8687eff0f8af678cfd3a4da281066 (patch)
treea6f7b9cffcb9f30d1f5272087f7da68d9a3ecd76 /gnu/packages
parent93fd21717f4cbc4d416b354e6a77c7f8e3bdfe58 (diff)
downloadguix-7b95445865b8687eff0f8af678cfd3a4da281066.tar.gz
guix-7b95445865b8687eff0f8af678cfd3a4da281066.zip
gnu: appstream: Load stemmer in all circumstances.
If the default stemmer language is computed to be "en", such as in a Guix build container, then the stemmer would not be loaded. * gnu/packages/patches/appstream-load-stemmer-early.patch: New patch. * gnu/local.mk (dist_patch_DATA): Register it here. * gnu/packages/freedesktop.scm (appstream) [patches]: Use it here. [#:phases]<disable-failing-tests>: Remove. Change-Id: Iddd6ce5887247df46f670c49f9efc66772c82ff0 Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/freedesktop.scm9
-rw-r--r--gnu/packages/patches/appstream-force-reload-stemmer.patch89
2 files changed, 92 insertions, 6 deletions
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 0aeeadf5a3..25b7998d05 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -148,7 +148,9 @@
"appstream/releases/"
"AppStream-" version ".tar.xz"))
(sha256
- (base32 "1val1b3dggn9g33q2r9q7wsl75a64x4lcvswvkcjjbvakkbj5xyl"))))
+ (base32 "1val1b3dggn9g33q2r9q7wsl75a64x4lcvswvkcjjbvakkbj5xyl"))
+ (patches
+ (search-patches "appstream-force-reload-stemmer.patch"))))
(build-system meson-build-system)
(arguments
(list
@@ -163,11 +165,6 @@
(substitute* "meson.build"
(("/usr/include")
(dirname libstemmer.h))))))
- (add-after 'unpack 'disable-failing-tests
- (lambda _
- (substitute* "tests/test-pool.c"
- (("[ \t]*g_test_add_func \\(\"/AppStream/Stemming.*;")
- ""))))
(add-before 'check 'check-setup
(lambda _
(setenv "HOME" (getcwd)))))))
diff --git a/gnu/packages/patches/appstream-force-reload-stemmer.patch b/gnu/packages/patches/appstream-force-reload-stemmer.patch
new file mode 100644
index 0000000000..a2cf84c8b1
--- /dev/null
+++ b/gnu/packages/patches/appstream-force-reload-stemmer.patch
@@ -0,0 +1,89 @@
+From 32182d7a7a67d0d204cd0a37bd211bfd0177bc27 Mon Sep 17 00:00:00 2001
+Message-ID: <32182d7a7a67d0d204cd0a37bd211bfd0177bc27.1700093066.git.vivien@planete-kraus.eu>
+From: Matthias Klumpp <matthias@tenstral.net>
+Date: Thu, 16 Nov 2023 00:59:15 +0100
+Subject: [PATCH] stemmer: Resolve potential issue where stemmer may never be
+ initialized
+
+If the initial locale was equal to the current stemming language, we may
+never have initialized the stemmer (which could lead to crashes or
+stemming being disabled).
+
+So we force the reload to always happen on initialization.
+CC: #558
+---
+ src/as-stemmer.c | 33 +++++++++++++++++++++------------
+ 1 file changed, 21 insertions(+), 12 deletions(-)
+
+diff --git a/src/as-stemmer.c b/src/as-stemmer.c
+index 63d45267..16ebd09b 100644
+--- a/src/as-stemmer.c
++++ b/src/as-stemmer.c
+@@ -47,6 +47,8 @@ G_DEFINE_TYPE (AsStemmer, as_stemmer, G_TYPE_OBJECT)
+
+ static gpointer as_stemmer_object = NULL;
+
++static void as_stemmer_reload_internal (AsStemmer *stemmer, const gchar *locale, gboolean force);
++
+ /**
+ * as_stemmer_finalize:
+ **/
+@@ -76,21 +78,14 @@ as_stemmer_init (AsStemmer *stemmer)
+
+ /* we don't use the locale in XML, so it can be POSIX */
+ locale = as_get_current_locale_posix ();
+- stemmer->current_lang = as_utils_locale_to_language (locale);
+
+- as_stemmer_reload (stemmer, stemmer->current_lang);
++ /* force a reload for initialization */
++ as_stemmer_reload_internal (stemmer, locale, TRUE);
+ #endif
+ }
+
+-/**
+- * as_stemmer_reload:
+- * @stemmer: A #AsStemmer
+- * @locale: The stemming language as POSIX locale.
+- *
+- * Allows realoading the #AsStemmer with a different language.
+- */
+-void
+-as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
++static void
++as_stemmer_reload_internal (AsStemmer *stemmer, const gchar *locale, gboolean force)
+ {
+ #ifdef HAVE_STEMMING
+ g_autofree gchar *lang = NULL;
+@@ -99,7 +94,7 @@ as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
+ /* check if we need to reload */
+ lang = as_utils_locale_to_language (locale);
+ locker = g_mutex_locker_new (&stemmer->mutex);
+- if (as_str_equal0 (lang, stemmer->current_lang)) {
++ if (!force && as_str_equal0 (lang, stemmer->current_lang)) {
+ g_mutex_locker_free (locker);
+ return;
+ }
+@@ -119,6 +114,20 @@ as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
+ #endif
+ }
+
++/**
++ * as_stemmer_reload:
++ * @stemmer: A #AsStemmer
++ * @locale: The stemming language as POSIX locale.
++ *
++ * Allows realoading the #AsStemmer with a different language.
++ * Does nothing if the stemmer is already using the selected language.
++ */
++void
++as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
++{
++ as_stemmer_reload_internal (stemmer, locale, FALSE);
++}
++
+ /**
+ * as_stemmer_stem:
+ * @stemmer: A #AsStemmer
+--
+2.41.0
+
t/tests/channels.scm?id=5bafc70d1e1daf6a91e8bf29a464263262505f2f'>channels: Make 'validate-pull' call right after clone/pull.Ludovic Courtès This should come before patching, authentication, etc. * guix/channels.scm (latest-channel-instance): Add #:validate-pull parameter and honor it. Return a single value: the instance. (ensure-forward-channel-update): Change 'instance' parameter to 'commit' and adjust accordingly. (latest-channel-instances): Adjust to 'latest-channel-instance' changes. * guix/scripts/pull.scm (warn-about-backward-updates): Change 'instance' parameter to 'commit' and adjust accordingly. * tests/channels.scm ("latest-channel-instances #:validate-pull"): Likewise. 2020-06-16channels: 'latest-channel-instance' authenticates Git checkouts.Ludovic Courtès Fixes <https://bugs.gnu.org/22883>. * guix/channels.scm (<channel>)[introduction]: New field. (<channel-introduction>): New record type. (%guix-channel-introduction): New variable. (%default-channels): Use it. (<channel-metadata>)[keyring-reference]: New field. (%default-keyring-reference): New variable. (read-channel-metadata, read-channel-metadata-from-source): Initialize the 'keyring-reference' field. (commit-short-id, verify-introductory-commit) (authenticate-channel): New procedures. (latest-channel-instance): Call 'authenticate-channel' when CHANNEL has an introduction. * tests/channels.scm (gpg+git-available?, commit-id-string): New procedures. ("authenticate-channel, wrong first commit signer"): ("authenticate-channel, .guix-authorizations"): New tests. * doc/guix.texi (Invoking guix pull): Mention authentication. 2020-05-25channels: 'latest-channel-instances' guards against non-forward updates.Ludovic Courtès * guix/channels.scm (latest-channel-instance): Add #:starting-commit and pass it to 'update-cached-checkout'. Return the commit relation as a second value. (ensure-forward-channel-update): New procedure. (latest-channel-instances): Add #:current-channels and #:validate-pull. [current-commit]: New procedure. Pass #:starting-commit to 'latest-channel-instance'. When the returned relation is true, call VALIDATE-PULL. (latest-channel-derivation): Add #:current-channels and #:validate-pull. Pass them to 'latest-channel-instances*'. * tests/channels.scm ("latest-channel-instances #:validate-pull"): New test. 2020-05-25git: 'update-cached-checkout' returns the commit relation.Ludovic Courtès * guix/git.scm (update-cached-checkout): Add #:starting-commit parameter. Call 'commit-relation' when #:starting-commit is true. Always return the relation or #f as the third value. (latest-repository-commit): Adjust accordingly. * guix/import/opam.scm (get-opam-repository): Likewise. * tests/channels.scm ("latest-channel-instances includes channel dependencies") ("latest-channel-instances excludes duplicate channel dependencies"): Update mock of 'update-cached-checkout' accordingly. 2020-05-07channels: Add mechanism to patch checkouts of the 'guix channel.Ludovic Courtès * guix/channels.scm (<patch>): New record type. (apply-patches): New procedure. (latest-channel-instance)[dot-git?]: New procedure. Use 'update-cached-checkout' and 'add-to-store' instead of 'latest-repository-commit'. Call 'apply-patches' when CHANNEL is the 'guix channel. (%patches): New variable. * guix/git.scm (url+commit->name): Make public. * tests/channels.scm ("latest-channel-instances includes channel dependencies") ("latest-channel-instances excludes duplicate channel dependencies"): Mock 'update-cached-checkout' instead of 'latest-repository-commit'. Wrap body in 'with-store' and pass the store to 'latest-channel-instances'. 2019-09-23channels: Allow news entries to refer to a tag.Ludovic Courtès Suggested by Ricardo Wurmus <rekado@elephly.net>. * guix/channels.scm (<channel-news-entry>)[tag]: New field. (sexp->channel-news-entry): Accept either 'commit' or 'tag' in 'entry' forms. (resolve-channel-news-entry-tag): New procedure. (channel-news-for-commit): Move 'with-repository' form one level higher. Call 'resolve-channel-news-entry-tag' on all the news entries. * guix/tests/git.scm (populate-git-repository): Add clause for 'tag'. * tests/channels.scm ("channel-news, one entry"): Create a tag and add an entry with a tag. Check that the tag is resolved and also visible in the <channel-news-entry> record. * doc/guix.texi (Channels): Mention tags in news entries. 2019-09-23channels: Add support for a news file.Ludovic Courtès * guix/channels.scm (<channel-metadata>)[news-file]: New field. (read-channel-metadata): Set the 'news-file' field. (read-channel-metadata-from-source): Likewise. (<channel-news>, <channel-news-entry>): New record types. (sexp->channel-news-entry, read-channel-news) (channel-news-for-commit): New procedures. * guix/tests/git.scm (populate-git-repository): For 'add', allow CONTENTS to be a procedure. * tests/channels.scm ("channel-news, no news") ("channel-news, one entry"): New tests. * doc/guix.texi (Channels): Document it. 2019-07-19channels: Always provide a <channel-metadata> record.Ludovic Courtès This simplifies the code since one no longer needs to think about whether '.guix-channel' was present. * guix/channels.scm (read-channel-metadata): Always pass a string as the first argument to 'channel-metadata'. (read-channel-metadata-from-source): Always return a <channel-metadata> record. (channel-instance-dependencies): Remove now unneeded 'match'. (standard-module-derivation): Assume DIRECTORY is never #f and contains a leading slash. * tests/channels.scm (channel-metadata-directory) (channel-metadata-dependencies): New procedures. ("channel-instance-metadata returns #f if .guix-channel does not exist"): Remove. ("channel-instance-metadata returns default if .guix-channel does not exist"): New test. (make-instance): Use 'write' instead of 'display' when creating '.guix-channel'. (instance--no-deps): Remove dependencies. (instance--sub-directory): New variable. ("channel-instance-metadata and default dependencies") ("channel-instance-metadata and directory"): New tests. ("latest-channel-instances excludes duplicate channel dependencies"): Expect 'channel-commit' to return a string and adjust accordingly. 2019-07-19channels: Strictly check the version of '.guix-channel'.Ludovic Courtès Until now the 'version' field in '.guix-channel' could be omitted, or it could be any value. * guix/channels.scm (read-channel-metadata): Rename to... (channel-instance-metadata): ... this. (channel-instance-dependencies): Adjust accordingly. (read-channel-metadata): New procedure. Use 'match' to require a 'version' field. Provide proper error handling when the channel sexp is malformed or when given an unsupported version number. (read-channel-metadata-from-source): Use 'catch' and 'system-error-errno' instead of 'file-exists?'. * tests/channels.scm (instance--unsupported-version): New variable. (read-channel-metadata): Rename to... (channel-instance-metadata): ... this. Rename tests accordingly. ("channel-instance-metadata rejects unsupported version"): New test. 2019-01-20inferior: 'gexp->derivation-in-inferior' honors EXP's load path.Ludovic Courtès Previously the imported modules and extensions of EXP would be missing from the load path of 'guix repl'. * guix/inferior.scm (gexp->derivation-in-inferior)[script]: New variable. [trampoline]: Write (primitive-load #$script) to PIPE. Add #$output. * tests/channels.scm ("channel-instances->manifest")[depends?]: Check for requisites rather than direct references. Adjust callers accordingly. 2019-01-20channels: Don't pull from the same channel more than once.Ludovic Courtès Previous 'channel-instance->manifest' would call 'latest-channel-derivation', which could trigger another round of 'latest-repository-commit' for no good reason. * guix/channels.scm (resolve-dependencies): New procedure. (channel-instance-derivations)[edges]: New variable. [instance->derivation]: New procedure. * tests/channels.scm (make-instance): Use 'checkout->channel-instance' instead of 'channel-instance'. ("channel-instances->manifest"): New test. 2018-12-09guix: Add support for channel dependencies.Ricardo Wurmus * guix/channels.scm (<channel-metadata>): New record. (read-channel-metadata, channel-instance-dependencies): New procedures. (latest-channel-instances): Include channel dependencies; add optional argument PREVIOUS-CHANNELS. (channel-instance-derivations): Build derivation for additional channels and add it as dependency to the channel instance derivation. * doc/guix.texi (Channels): Add subsection "Declaring Channel Dependencies". * tests/channels.scm: New file. * Makefile.am (SCM_TESTS): Add it.