Skip to content

Conversation

@Rosalie241
Copy link

This adds support for metainfo.xml, appdata.xml is still supported though.

see https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#spec-component-location

@probonopd
Copy link
Member

Thanks @Rosalie241. Not sure we want this ambiguity in AppImages, though. After all, if we allow 2 different file paths in AppImages, then all tools that verify AppImages or integrate them into the system would have to check 2 different file paths as well.

@Rosalie241
Copy link
Author

Thanks @Rosalie241. Not sure we want this ambiguity in AppImages, though. After all, if we allow 2 different file paths in AppImages, then all tools that verify AppImages or integrate them into the system would have to check 2 different file paths as well.

Tools which want to support normal desktop applications that provide a metainfo/appdata.xml file will also have to check 2 paths though, so I'm not sure if it's a big problem, but I've updated my application (RMG) to use the new metainfo.xml file according to the freedesktop appstream documentation, and now the appimagetool cannot find the appstream data, which isn't ideal either.

@probonopd
Copy link
Member

Maybe we should just put in a symlink? That would be backwards compatible.

@Rosalie241
Copy link
Author

That could be an option but I'm not sure how to do that with the APIs available.

@probonopd
Copy link
Member

Something roughly along these lines?

package main

import (
	"fmt"
	"log"
	"os"
)

func main() {
	metainfoPath := "usr/share/metainfo/metainfo.xml"
	appdataPath := "usr/share/metainfo/appdata.xml"

	// Check if metainfo.xml exists
	if _, err := os.Stat(metainfoPath); os.IsNotExist(err) {
		fmt.Println(metainfoPath, "does not exist, creating symlink to", appdataPath)

		// Create symlink from appdata.xml to metainfo.xml
		if err := os.Symlink(appdataPath, metainfoPath); err != nil {
			log.Fatalf("Failed to create symlink from %s to %s: %v", appdataPath, metainfoPath, err)
		} else {
			fmt.Println("Symlink created from", appdataPath, "to", metainfoPath)
		}
	} else {
		fmt.Println(metainfoPath, "exists")
	}

	// Check if appdata.xml exists
	if _, err := os.Stat(appdataPath); os.IsNotExist(err) {
		fmt.Println(appdataPath, "does not exist, creating symlink to", metainfoPath)

		// Create symlink from metainfo.xml to appdata.xml
		if err := os.Symlink(metainfoPath, appdataPath); err != nil {
			log.Fatalf("Failed to create symlink from %s to %s: %v", metainfoPath, appdataPath, err)
		} else {
			fmt.Println("Symlink created from", metainfoPath, "to", appdataPath)
		}
	} else {
		fmt.Println(appdataPath, "exists")
	}
}

@AsciiWolf
Copy link

AsciiWolf commented Nov 12, 2025

FWIW, the "appdata.xml" suffix is deprecated and not used anymore by upstream. It is still supported for backwards compatibility, but should not be used for newer projects/packages.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the newer .metainfo.xml AppStream metadata file format while maintaining backward compatibility with the older .appdata.xml format. According to the freedesktop.org AppStream specification, both formats are valid, but metainfo.xml is the current standard.

Key Changes:

  • Check for both .appdata.xml and .metainfo.xml files in the metainfo directory
  • Prefer .metainfo.xml in warning messages when neither file is found
  • Use whichever file exists when validating with appstream-util

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +836 to +838
gboolean metadata_exist = g_file_test(metainfo_path, G_FILE_TEST_IS_REGULAR);

if (! appdata_exist && ! metadata_exist){
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable naming inconsistency: metadata_exist should be named metainfo_exist to match the pattern used for metainfo_id and metainfo_path. The current name could cause confusion since "metadata" is a generic term, while "metainfo" specifically refers to the .metainfo.xml file type being checked.

Suggested change
gboolean metadata_exist = g_file_test(metainfo_path, G_FILE_TEST_IS_REGULAR);
if (! appdata_exist && ! metadata_exist){
gboolean metainfo_exist = g_file_test(metainfo_path, G_FILE_TEST_IS_REGULAR);
if (! appdata_exist && ! metainfo_exist){

Copilot uses AI. Check for mistakes.
@probonopd
Copy link
Member

Please try whether #121 resolves this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants