From 0175b22e2fb5c1864cfc3ce39b14d60f5e1ef27f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Dec 2025 18:52:12 +0000 Subject: [PATCH 1/5] Initial plan From eea100febea7623285ec4600608128caebc2e139 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Dec 2025 18:59:43 +0000 Subject: [PATCH 2/5] Add support for metainfo.xml with symlink for backward compatibility Co-authored-by: probonopd <2480569+probonopd@users.noreply.github.com> --- src/appimagetool.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/appimagetool.c b/src/appimagetool.c index 3033dcb..88cd5c3 100644 --- a/src/appimagetool.c +++ b/src/appimagetool.c @@ -857,18 +857,38 @@ main (int argc, char *argv[]) /* Check if AppStream upstream metadata is present in source AppDir */ if(! no_appstream){ - char application_id[PATH_MAX]; - sprintf (application_id, "%s", basename(desktop_file)); - replacestr(application_id, ".desktop", ".appdata.xml"); - gchar *appdata_path = g_build_filename(source, "/usr/share/metainfo/", application_id, NULL); - if (! g_file_test(appdata_path, G_FILE_TEST_IS_REGULAR)){ + char appdata_id[PATH_MAX]; + char metainfo_id[PATH_MAX]; + sprintf (appdata_id, "%s", basename(desktop_file)); + replacestr(appdata_id, ".desktop", ".appdata.xml"); + sprintf (metainfo_id, "%s", basename(desktop_file)); + replacestr(metainfo_id, ".desktop", ".metainfo.xml"); + gchar *appdata_path = g_build_filename(source, "/usr/share/metainfo/", appdata_id, NULL); + gchar *metainfo_path = g_build_filename(source, "/usr/share/metainfo/", metainfo_id, NULL); + gboolean appdata_exists = g_file_test(appdata_path, G_FILE_TEST_IS_REGULAR); + gboolean metainfo_exists = g_file_test(metainfo_path, G_FILE_TEST_IS_REGULAR); + + if (! appdata_exists && ! metainfo_exists){ fprintf (stderr, "WARNING: AppStream upstream metadata is missing, please consider creating it\n"); - fprintf (stderr, " in usr/share/metainfo/%s\n", application_id); + fprintf (stderr, " in usr/share/metainfo/%s\n", metainfo_id); fprintf (stderr, " Please see https://www.freedesktop.org/software/appstream/docs/chap-Quickstart.html#sect-Quickstart-DesktopApps\n"); fprintf (stderr, " for more information or use the generator at\n"); fprintf (stderr, " https://docs.appimage.org/packaging-guide/optional/appstream.html#using-the-appstream-generator\n"); } else { - fprintf (stderr, "AppStream upstream metadata found in usr/share/metainfo/%s\n", application_id); + /* Create symlink if only one of the files exists, to ensure both paths work */ + if (appdata_exists && ! metainfo_exists) { + fprintf (stderr, "Creating %s symlink to %s for compatibility\n", metainfo_id, appdata_id); + int res = symlink(appdata_id, metainfo_path); + if(res) + fprintf (stderr, "WARNING: Could not create symlink %s\n", metainfo_path); + } else if (metainfo_exists && ! appdata_exists) { + fprintf (stderr, "Creating %s symlink to %s for compatibility\n", appdata_id, metainfo_id); + int res = symlink(metainfo_id, appdata_path); + if(res) + fprintf (stderr, "WARNING: Could not create symlink %s\n", appdata_path); + } + + fprintf (stderr, "AppStream upstream metadata found in usr/share/metainfo/%s\n", (metainfo_exists ? metainfo_id : appdata_id)); /* Use ximion's appstreamcli to make sure that desktop file and appdata match together */ if(g_find_program_in_path ("appstreamcli")) { char *args[] = { @@ -888,7 +908,7 @@ main (int argc, char *argv[]) char *args[] = { "appstream-util", "validate-relax", - appdata_path, + (metainfo_exists ? metainfo_path : appdata_path), NULL }; g_print("Trying to validate AppStream information with the appstream-util tool\n"); From 960de36da50993e165bb26f5a2d63aed7fff057d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Dec 2025 19:01:53 +0000 Subject: [PATCH 3/5] Improve error messages with strerror(errno) for symlink failures Co-authored-by: probonopd <2480569+probonopd@users.noreply.github.com> --- src/appimagetool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/appimagetool.c b/src/appimagetool.c index 88cd5c3..4f61462 100644 --- a/src/appimagetool.c +++ b/src/appimagetool.c @@ -880,12 +880,12 @@ main (int argc, char *argv[]) fprintf (stderr, "Creating %s symlink to %s for compatibility\n", metainfo_id, appdata_id); int res = symlink(appdata_id, metainfo_path); if(res) - fprintf (stderr, "WARNING: Could not create symlink %s\n", metainfo_path); + fprintf (stderr, "WARNING: Could not create symlink %s: %s\n", metainfo_path, strerror(errno)); } else if (metainfo_exists && ! appdata_exists) { fprintf (stderr, "Creating %s symlink to %s for compatibility\n", appdata_id, metainfo_id); int res = symlink(metainfo_id, appdata_path); if(res) - fprintf (stderr, "WARNING: Could not create symlink %s\n", appdata_path); + fprintf (stderr, "WARNING: Could not create symlink %s: %s\n", appdata_path, strerror(errno)); } fprintf (stderr, "AppStream upstream metadata found in usr/share/metainfo/%s\n", (metainfo_exists ? metainfo_id : appdata_id)); From af814f613a276350274cdf7fe497ddca0fc3072a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Dec 2025 19:03:40 +0000 Subject: [PATCH 4/5] Final verification completed Co-authored-by: probonopd <2480569+probonopd@users.noreply.github.com> --- _codeql_detected_source_root | 1 + 1 file changed, 1 insertion(+) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file From 03989861149cffd01a9c5593126416961d0e238e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Dec 2025 19:04:04 +0000 Subject: [PATCH 5/5] Remove codeql artifact Co-authored-by: probonopd <2480569+probonopd@users.noreply.github.com> --- _codeql_detected_source_root | 1 - 1 file changed, 1 deletion(-) delete mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root deleted file mode 120000 index 945c9b4..0000000 --- a/_codeql_detected_source_root +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file