|
@@ -435,13 +435,9 @@ public static Invercargill.DataStructures.Vector<string> autoprovides_scan_tree(
|
|
|
// Removing the file
|
|
// Removing the file
|
|
|
var file = folder.get_child(info.get_name());
|
|
var file = folder.get_child(info.get_name());
|
|
|
var true_path = file.get_path().substring(install_root.length);
|
|
var true_path = file.get_path().substring(install_root.length);
|
|
|
- var type = paths.get_suggested_resource_type(true_path);
|
|
|
|
|
- if(type == Usm.ResourceType.ROOT_PATH) {
|
|
|
|
|
- provides.add("rootpath:" + true_path);
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- provides.add(@"$type:$(file.get_basename())");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ var type = get_local_resource_type(true_path);
|
|
|
|
|
+ var relative_path = get_relative_path_for_type(true_path, type);
|
|
|
|
|
+ provides.add(@"$type:$relative_path");
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
else if (info.get_file_type() == FileType.DIRECTORY) {
|
|
else if (info.get_file_type() == FileType.DIRECTORY) {
|
|
@@ -452,4 +448,188 @@ public static Invercargill.DataStructures.Vector<string> autoprovides_scan_tree(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return provides;
|
|
return provides;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+private static string get_local_resource_type(string path) {
|
|
|
|
|
+ // Remove leading slash if present
|
|
|
|
|
+ string clean_path = path.has_prefix("/") ? path.substring(1) : path;
|
|
|
|
|
+
|
|
|
|
|
+ // Check for known resource type patterns
|
|
|
|
|
+ if (clean_path.has_prefix("usr/bin/")) {
|
|
|
|
|
+ return "bin";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/sbin/")) {
|
|
|
|
|
+ return "sbin";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/lib/") || clean_path.has_prefix("usr/lib64/")) {
|
|
|
|
|
+ return "lib";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/libexec/")) {
|
|
|
|
|
+ return "libexec";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/include/")) {
|
|
|
|
|
+ return "inc";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/")) {
|
|
|
|
|
+ // Check for specific subdirectories under share
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/applications/")) {
|
|
|
|
|
+ return "app";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/info/")) {
|
|
|
|
|
+ return "info";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/man/")) {
|
|
|
|
|
+ return "man";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/locale/")) {
|
|
|
|
|
+ return "locale";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/vala/vapi/") || clean_path.has_prefix("usr/share/vala-0.56/vapi/")) {
|
|
|
|
|
+ return "vapi";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/gir-1.0/")) {
|
|
|
|
|
+ return "gir";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/usm-tags/")) {
|
|
|
|
|
+ return "tag";
|
|
|
|
|
+ }
|
|
|
|
|
+ // Default for other share files
|
|
|
|
|
+ return "res";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/lib/pkgconfig/") || clean_path.has_prefix("usr/lib64/pkgconfig/") || clean_path.has_prefix("usr/share/pkgconfig/")) {
|
|
|
|
|
+ return "pc";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/lib64/girepository-1.0/") || clean_path.has_prefix("usr/lib/girepository-1.0/") ||
|
|
|
|
|
+ clean_path.has_prefix("lib64/girepository-1.0/") || clean_path.has_prefix("lib/girepository-1.0/")) {
|
|
|
|
|
+ return "typelib";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("etc/")) {
|
|
|
|
|
+ return "cfg";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("opt/")) {
|
|
|
|
|
+ return "opt";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Default to "res" for files that would previously be ROOT_PATH
|
|
|
|
|
+ // This handles files like "/usr/share/my-app/resource.xml"
|
|
|
|
|
+ return "res";
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+private static string get_relative_path_for_type(string path, string type) {
|
|
|
|
|
+ // Remove leading slash if present
|
|
|
|
|
+ string clean_path = path.has_prefix("/") ? path.substring(1) : path;
|
|
|
|
|
+
|
|
|
|
|
+ // Extract relative path based on resource type
|
|
|
|
|
+ switch (type) {
|
|
|
|
|
+ case "bin":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/bin/")) {
|
|
|
|
|
+ return clean_path.substring("usr/bin/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "sbin":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/sbin/")) {
|
|
|
|
|
+ return clean_path.substring("usr/sbin/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "lib":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/lib/")) {
|
|
|
|
|
+ return clean_path.substring("usr/lib/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/lib64/")) {
|
|
|
|
|
+ return clean_path.substring("usr/lib64/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "libexec":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/libexec/")) {
|
|
|
|
|
+ return clean_path.substring("usr/libexec/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "inc":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/include/")) {
|
|
|
|
|
+ return clean_path.substring("usr/include/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "app":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/applications/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/applications/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "info":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/info/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/info/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "man":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/man/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/man/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "locale":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/locale/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/locale/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "vapi":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/vala/vapi/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/vala/vapi/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/vala-0.56/vapi/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/vala-0.56/vapi/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "gir":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/gir-1.0/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/gir-1.0/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "tag":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/usm-tags/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/usm-tags/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "pc":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/lib/pkgconfig/")) {
|
|
|
|
|
+ return clean_path.substring("usr/lib/pkgconfig/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/lib64/pkgconfig/")) {
|
|
|
|
|
+ return clean_path.substring("usr/lib64/pkgconfig/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/pkgconfig/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/pkgconfig/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "typelib":
|
|
|
|
|
+ if (clean_path.has_prefix("usr/lib64/girepository-1.0/")) {
|
|
|
|
|
+ return clean_path.substring("usr/lib64/girepository-1.0/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("usr/lib/girepository-1.0/")) {
|
|
|
|
|
+ return clean_path.substring("usr/lib/girepository-1.0/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("lib64/girepository-1.0/")) {
|
|
|
|
|
+ return clean_path.substring("lib64/girepository-1.0/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clean_path.has_prefix("lib/girepository-1.0/")) {
|
|
|
|
|
+ return clean_path.substring("lib/girepository-1.0/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "cfg":
|
|
|
|
|
+ if (clean_path.has_prefix("etc/")) {
|
|
|
|
|
+ return clean_path.substring("etc/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "opt":
|
|
|
|
|
+ if (clean_path.has_prefix("opt/")) {
|
|
|
|
|
+ return clean_path.substring("opt/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "res":
|
|
|
|
|
+ // For res type, extract from /usr/share/ or just return the path if no prefix
|
|
|
|
|
+ if (clean_path.has_prefix("usr/share/")) {
|
|
|
|
|
+ return clean_path.substring("usr/share/".length);
|
|
|
|
|
+ }
|
|
|
|
|
+ return clean_path;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Default case - return the path as-is
|
|
|
|
|
+ return clean_path;
|
|
|
}
|
|
}
|