Quellcode durchsuchen

feat: gio: resource type for GIO plugin modules (all four shims, resource finder, manifest); .usmignore build artifacts

clanker vor 1 Woche
Ursprung
Commit
792202c8d0

+ 4 - 0
.usmignore

@@ -0,0 +1,4 @@
+# build directories never belong in the source package
+builddir*/
+install-builddir/
+installer/dist/

+ 1 - 1
MANIFEST.usm

@@ -30,7 +30,7 @@
       "lib:libglib-2.0.so.0",
       "lib:libgobject-2.0.so.0",
       "lib:libgio-2.0.so.0",
-      "lib:libgiognutls.so",
+      "gio:libgiognutls.so",
       "lib:libinvercargill-1.so",
       "lib:libinvercargill-json.so",
       "lib:libc.so.6",

+ 1 - 0
README.md

@@ -83,6 +83,7 @@ USM supports several flags that modify the build and installation behavior:
 - "vapi": Vala API: file name in /
 - "gir": GObject introspection: file name locatable in /usr/share/gir
 - "typelib": GObject typelib: file name locatable in /usr/lib64/girepository-1.0, /usr/lib/girepository-1.0, /lib64/girepository-1.0, or /lib/girepository-1.0
+- "gio": GIO plugin module: module filename locatable in /usr/lib64/gio/modules, /usr/lib/gio/modules or `/usr/lib/<multiarch-triple>/gio/modules`
 - "tag": A USM system tag, dot seperated with ".tag" appended, i.e. "hello.world" would be locatable in /usr/share/usm-tags/hello/world.tag
 
 ## Source Repositories (Repo.usmr)

+ 5 - 0
slopdocs/structure.usm.manifest.resource-types.md

@@ -100,6 +100,11 @@ Location: `/usr/lib64/girepository-1.0`, `/usr/lib/girepository-1.0`, `/lib64/gi
 Used for: GObject typelib files
 Example: `typelib:MyApp-1.0.typelib`
 
+### gio
+Location: `/usr/lib64/gio/modules`, `/usr/lib/gio/modules`, or `/usr/lib/<multiarch-triple>/gio/modules`
+Used for: GIO plugin modules (the name is the module filename)
+Example: `gio:libgiognutls.so`
+
 ### tag
 Location: `/usr/share/usm-tags/[hierarchical-path].tag`
 Used for: USM system tags

+ 5 - 2
spm/apk/usm-spm-apk

@@ -29,8 +29,8 @@
 # repositories only -- same semantics as the dnf helper's repo-only
 # sack); installed-dependency-count is the overlap of that closure with
 # the installed database (`apk info`). Residual resource types (inc:,
-# vapi:, gir:, typelib:, res:, cfg:, man:, info:, locale:, libexec:,
-# rootpath:, tag:) are resolved against the installed database only via
+# vapi:, gir:, typelib:, gio:, res:, cfg:, man:, info:, locale:,
+# libexec:, rootpath:, tag:) are resolved against the installed database only via
 # `apk info -W`/directory sampling: APKINDEX carries no file lists, so
 # files of not-yet-installed packages are unresolvable and land in
 # "not-found" (documented limitation, the same offline stance as the
@@ -228,6 +228,9 @@ handle_ref() {
         typelib)
             record_file_owner "$_hr_ref" "/usr/lib/girepository-1.0/$_hr_res"
             ;;
+        gio)
+            record_file_owner "$_hr_ref" "/usr/lib/gio/modules/$_hr_res"
+            ;;
         res)
             record_file_owner "$_hr_ref" "/usr/share/$_hr_res"
             ;;

+ 3 - 0
spm/apt/usm-spm-apt

@@ -31,6 +31,7 @@ preferring x86_64 and following the machine architecture otherwise:
                         executables under /usr/bin; no /usr/libexec tree)
     lib               -> /usr/lib/<triple>/<soname> and /lib/<triple>/<soname>
                          (usr-merge: both path forms appear across suites)
+    gio               -> /usr/lib/<triple>/gio/modules/<module>
     pc                -> /usr/lib/<triple>/pkgconfig/<n> and /usr/share/pkgconfig/<n>
     inc               -> /usr/include/<P> prefix
     typelib           -> /usr/lib/<triple>/girepository-1.0/<n>
@@ -216,6 +217,8 @@ def translate_ref(ref):
             exact("/usr/lib/%s/%s" % (TRIPLE, resource)),
             exact("/lib/%s/%s" % (TRIPLE, resource)),
         ]
+    if prefix == "gio":
+        return [exact("/usr/lib/%s/gio/modules/%s" % (TRIPLE, resource))]
     if prefix == "pc":
         return [
             exact("/usr/lib/%s/pkgconfig/%s" % (TRIPLE, resource)),

+ 2 - 0
spm/dnf/usm-spm-dnf

@@ -144,6 +144,8 @@ def translate_ref(ref):
             ("provides", resource),
             ("file", "/usr/lib64/" + resource),
         ]
+    if prefix == "gio":
+        return [("file", "/usr/lib64/gio/modules/" + resource)]
     if prefix == "pc":
         return [
             ("file", "/usr/share/pkgconfig/" + resource),

+ 5 - 0
spm/emerge/usm-spm-emerge

@@ -91,6 +91,10 @@ FILE_ROOTS = {
         "/lib64/girepository-1.0",
         "/lib/girepository-1.0",
     ],
+    "gio": [
+        "/usr/lib64/gio/modules",
+        "/usr/lib/gio/modules",
+    ],
     "res": ["/usr/share"],
     "cfg": ["/etc"],
     "man": ["/usr/share/man"],
@@ -201,6 +205,7 @@ EXCEPTIONS = {
     "lib:libbrotlicommon.so.1": "app-arch/brotli",
     "lib:libffi.so.8": "dev-libs/libffi",
     "lib:libpcre2-8.so.0": "dev-libs/libpcre2",
+    "gio:libgiognutls.so": "net-libs/glib-networking",
     "lib:libc.so.6": "sys-libs/glibc",
     "lib:libm.so.6": "sys-libs/glibc",
     "lib:libblkid.so.1": "sys-apps/util-linux",

+ 2 - 0
src/lib/Paths.vala

@@ -96,6 +96,8 @@ namespace Usm {
                     return Path.build_filename(destination, prefix, "share", "gir-1.0");
                 case Usm.ResourceType.TYPELIB:
                     return Path.build_filename(destination, prefix, lib, "girepository-1.0");
+                case Usm.ResourceType.GIO_MODULE:
+                    return Path.build_filename(destination, prefix, lib, "gio", "modules");
                 case Usm.ResourceType.TAG:
                     return Path.build_filename(destination, prefix, tags);
                 default:

+ 25 - 0
src/lib/ResourceFinder.vala

@@ -38,6 +38,8 @@ namespace Usm {
                     return locate_canonlib(resource_ref);
                 case ResourceType.CANONICAL_LIBRARY_RESOURCE:
                     return locate_canonlibres(resource_ref);
+                case ResourceType.GIO_MODULE:
+                    return locate_gio(resource_ref);
                 case ResourceType.INFO_PAGE:
                     return locate_info(resource_ref);
                 case ResourceType.MANUAL_PAGE:
@@ -190,6 +192,29 @@ namespace Usm {
             return null;
         }
 
+        private string? locate_gio(ResourceRef resource) {
+            var search = Iterate.these("/usr/lib64/gio/modules", "/usr/lib/gio/modules");
+            // Debian-style multiarch keeps GIO modules in
+            // /usr/lib/<triple>/gio/modules, which no fixed path covers:
+            // enumerate whatever multiarch directories exist
+            try {
+                foreach(var entry in Iterate.directory("/usr/lib")) {
+                    if(entry.contains("-linux-")) {
+                        search = search.concat(Wrap.array(new string[] { @"/usr/lib/$entry/gio/modules" }));
+                    }
+                }
+            }
+            catch(FileError e) {
+            }
+            foreach (var path in search) {
+                var file = File.new_build_filename(paths.destination, path, resource.resource);
+                if(file.query_exists()) {
+                    return file.get_path();
+                }
+            }
+            return null;
+        }
+
         private string? locate_app(ResourceRef resource) {
             var file = File.new_build_filename("/usr/share/applications", resource.resource);
             return file.query_exists() ? file.get_path() : null;

+ 7 - 0
src/lib/ResourceRef.vala

@@ -15,6 +15,8 @@ namespace Usm {
         LIBRARY_EXECUTABLE,
         CANONICAL_LIBRARY,
         CANONICAL_LIBRARY_RESOURCE,
+        /** GIO plugin module: the module filename, locatable in a gio/modules directory */
+        GIO_MODULE,
         INFO_PAGE,
         MANUAL_PAGE,
         LOCALE,
@@ -52,6 +54,8 @@ namespace Usm {
                     return "canonlib";
                 case ResourceType.CANONICAL_LIBRARY_RESOURCE:
                     return "canonlibres";
+                case ResourceType.GIO_MODULE:
+                    return "gio";
                 case ResourceType.INFO_PAGE:
                     return "info";
                 case ResourceType.MANUAL_PAGE:
@@ -103,6 +107,8 @@ namespace Usm {
                     return ResourceType.CANONICAL_LIBRARY;
                 case "canonlibres":
                     return ResourceType.CANONICAL_LIBRARY_RESOURCE;
+                case "gio":
+                    return ResourceType.GIO_MODULE;
                 case "info":
                     return ResourceType.INFO_PAGE;
                 case "man":
@@ -142,6 +148,7 @@ namespace Usm {
                 LIBRARY_RESOURCE,
                 CANONICAL_LIBRARY,
                 CANONICAL_LIBRARY_RESOURCE,
+                GIO_MODULE,
                 INFO_PAGE,
                 MANUAL_PAGE,
                 LOCALE,

+ 15 - 0
src/tests/TestMain.vala

@@ -218,6 +218,20 @@ namespace Usm.Tests {
         Usm.Util.delete_tree(config_dir.get_path());
     }
 
+    // ---- GIO module resource type ------------------------------------------------
+
+    void test_gio_module_ref() throws Error {
+        var resource_ref = new Usm.ResourceRef("gio:libgiognutls.so");
+        check(resource_ref.resource_type == Usm.ResourceType.GIO_MODULE, "gio: parses as a GIO module ref");
+        check(resource_ref.resource == "libgiognutls.so", "the gio: name is the module filename");
+        check(Usm.ResourceType.GIO_MODULE.to_string() == "gio", "gio round-trips through to_string");
+        check(resource_ref.to_string() == "gio:libgiognutls.so", "the GIO module ref round-trips");
+
+        var located = new Usm.ResourceFinder().locate_resource(resource_ref);
+        check(located != null && located.has_suffix("/gio/modules/libgiognutls.so"),
+            "the ResourceFinder locates libgiognutls.so in a gio/modules directory");
+    }
+
     // ---- Dependency-phase model -------------------------------------------------
 
     /** Minimal manifest with the given "depends" section verbatim. */
@@ -1164,6 +1178,7 @@ exit 1
             test_data_package_validation();
             test_data_package_from_file();
             test_configuration_system_package_manager();
+            test_gio_module_ref();
         }
         catch(Error e) {
             failures++;