]> git.ipfire.org Git - pakfire.git/commitdiff
package: Fix storing strings in repository
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 22:22:44 +0000 (22:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 22:22:44 +0000 (22:22 +0000)
We tried to store all strings directly in the pool (I think) which is
not what libsolv liked. Any SOLV files written could not be re-read
which is fixed by this change which gives libsolv the chance to store
its strings wherever it wants.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/package.c

index 04986af6ecd5a7289dc8494df9416ab1e1505862..cac9d95de516c3cf1707af102f69c8d2d9d9f2de 100644 (file)
@@ -337,10 +337,12 @@ static const char* pakfire_package_get_string(struct pakfire_package* pkg, int k
 static void pakfire_package_set_string(struct pakfire_package* pkg, int key, const char* value) {
        Solvable* s = get_solvable(pkg);
 
-       if (!value)
-               value = "";
+       // Unset on empty string
+       if (!value || !*value)
+               solvable_unset(s, key);
 
-       solvable_set_poolstr(s, key, value);
+       // Store string
+       solvable_set_str(s, key, value);
 }
 
 static char** pakfire_package_get_string_array(struct pakfire_package* pkg, Id key) {