Error msg :
…
Priming desktop-stellarium
Priming stellarium
‘grade’ property not specified: defaulting to ‘stable’.
Failed to generate desktop file: Invalid desktop file ‘$SNAP/usr/share/applications/stellarium.desktop’: does not exist (defined in the app ‘stellarium’).
Build failed
.yaml entry :
...
apps:
stellarium:
command: bin/desktop-launch $SNAP/usr/bin/stellarium-daily
desktop: $SNAP/usr/share/applications/stellarium.desktop
plugs: [desktop, wayland, x11, unity7, opengl, network, network-bind, audio-playback, home]
parts:
stellarium:
plugin: cmake
source: https://github.com/Stellarium/stellarium.git
source-type: git
source-depth : 1
after : [desktop-stellarium]
.....
NB : The location of the .desktop file is under /usr/share/applications/stellarium.desktop when installed through apt
Don’t prefix the path with $SNAP/
:
apps:
stelarium:
desktop: usr/share/applications/stellarium.desktop
Priming stellarium
'grade' property not specified: defaulting to 'stable'.
Failed to generate desktop file: Invalid desktop file 'usr/share/applications/stellarium.desktop': does not exist (defined in the app 'stellarium').
Build failed
You need to copy the desktop file into your snap, one way or the other. See Desktop files for menu integration:
There are three methods to tell snapcraft which desktop entry files to use.
After detail reading of the error log it is found that location of .Desktop file is /share/… and /share lies outside the /usr folder. Hence used external metainfo and build-override. Snap doesn’t recognize .Desktop file and associated icons which lies outside of /usr
parse-info: [share/metainfo/stellarium.appdata.xml] #appstream info
after : [desktop-stellarium]
override-build: | #added to show app in launcher menu
snapcraftctl build
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/applications
cp ../src/data/stellarium.desktop $SNAPCRAFT_PART_INSTALL/usr/share/applications
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/16x16/apps
cp ../src/data/icons/16x16/stellarium.png $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/16x16/apps
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/32x32/apps
cp ../src/data/icons/32x32/stellarium.png $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/32x32/apps
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/48x48/apps
cp ../src/data/icons/48x48/stellarium.png $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/48x48/apps
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/64x64/apps
cp ../src/data/icons/64x64/stellarium.png $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/64x64/apps
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/128x128/apps
cp ../src/data/icons/128x128/stellarium.png $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/128x128/apps
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/256x256/apps
cp ../src/data/icons/256x256/stellarium.png $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/256x256/apps
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/512x512/apps
cp ../src/data/icons/512x512/stellarium.png $SNAPCRAFT_PART_INSTALL/usr/share/icons/hicolor/512x512/apps
Is there any way to force snap to use .desktop file outside /usr but inside /share/applications/ ?