Flatpak-Builder: Where to put and add meta data and license files?

Hello Everyone :slight_smile:

So i have my first app I’d like to distribute via flathub/flatpak.

I’ve created a new folder “pickycolors_flatpak” for that. It contains files like Executable (PickyColors), CHANGELOG and LICENSE an icons folder and several other files (yml, xml, *.desktop). But when i try to install them via the yml file, flatpak-builder fails like that:

Running: install -Dm755 PickyColors /app/bin/PickyColors
Running: install -Dm644 LICENSE /app/share/licenses/digital.sector7.pickycolors/LICENSE
install: cannot stat 'LICENSE': No such file or directory
Error: module PickyColors: Child process exited with code 1

I also tried creating an xml file for meta data but of course the problem is also the same with that one.

Here’s my digital.sector7.PickyColors.yml content:

id: digital.sector7.pickycolors
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: PickyColors
modules:
  - name: PickyColors
    buildsystem: simple
    build-commands:
      - install -Dm755 PickyColors /app/bin/PickyColors
      - install -Dm644 LICENSE /app/share/licenses/digital.sector7.pickycolors/LICENSE
      - install -Dm644 CHANGELOG /app/share/doc/digital.sector7.pickycolors/CHANGELOG
      - install -Dm644 digital.sector7.pickycolors.appdata.xml /app/share/metainfo/digital.sector7.pickycolors.appdata.xml
    sources:
      - type: file
        path: PickyColors
  - name: icons
    buildsystem: simple
    build-commands:
      - install -Dm644 icons/icon-16.png /app/share/icons/hicolor/16x16/apps/pickycolors.png
      - install -Dm644 icons/icon-32.png /app/share/icons/hicolor/32x32/apps/pickycolors.png
      - install -Dm644 icons/icon-64.png /app/share/icons/hicolor/64x64/apps/pickycolors.png
      - install -Dm644 icons/icon-128.png /app/share/icons/hicolor/128x128/apps/pickycolors.png
      - install -Dm644 icons/icon-256.png /app/share/icons/hicolor/256x256/apps/pickycolors.png
      - install -Dm644 icons/icon-512.png /app/share/icons/hicolor/512x512/apps/pickycolors.png
      - install -Dm644 icons/icon-1024.png /app/share/icons/hicolor/1024x1024/apps/pickycolors.png

As you can see in the build-commands, there’s also the line to the xml file where i defined meta data like author, description, license (prop) and screenshots. I tried either with only the xml line (without LICENSE and CHANGELOG) or without the xml and only LICENSE and CHANGELOG). Everytime i run the flatpak builder it ends up with the message above. Strange is that the executable “PickyColors” doesn’t raise that “file not found” problem, but the others do even though they’re all located at the same place and should very much be found. Or is the message regarding the place it wants the files to be copied to?

If it helps, that would be the xml files content:

<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
  <id>digital.sector7.pickycolors</id>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>Proprietary</project_license>
  <name>PickyColors</name>
  <summary>A cross-platform project-based color picker app.</summary>
  <description>
    <p>
      PickyColors is a cross-platform project-based color picker app that helps designers pick, manage, and store colors effectively for different projects.
    </p>
    <p>
      Features:
      <ul>
        <li>Create projects and project categories</li>
        <li>Create a color list for each category</li>
        <li>Use the color picker to adjust the color, or pick a color from your desktop</li>
      </ul>
    </p>
    <p>
      Future updates will include interface improvements, slider indicators, and a feedback system for bugs and feature requests.
    </p>
  </description>
  <developer_name>Oli Gerber &lt;my-email-address&gt;</developer_name>
  <url type="homepage">https://sector7.digital</url>
  <screenshots>
    <screenshot type="default">
      <image>https://flatpak.sector7.digital/screens/icon-1024.png</image>
    </screenshot>
    <screenshot>
      <image>https://flatpak.sector7.digital/screens/appscreen-01.png</image>
    </screenshot>
    <screenshot>
      <image>https://flatpak.sector7.digital/screens/appscreen-02.png</image>
    </screenshot>
  </screenshots>
</component>

Any help would be greatly appreciated, couldn’t find any information online so far and I’ve wasted soon more time on building and packaging for deb apt and now flat than building the app itself…

Thanks everyone and have a great time :wink:

Best,
Oli

The flatpak gets build in a sandbox, you have to provide all files as sources to make them available inside it.

In your manifest you’ve only defined PickyColors as the single file source & therefore it’s the only file being found.

The same issue will occur in the icons module where you’ve defined no source at all.

1 Like

Thanks so much. Now i removed license/changelog and only used the xml appdata file and after adding it to sources it didn’t show the error any longer. yet for the icons, this seems not to work. I’ve tried adding every single icons via “path: icons/icon-16.png” (type:file) and also just adding the directory like “path: icons (type:dir)” and combined those as well like below, but it drops the file not found error again for the icon-16.png. Here’s the changes i tried for the icons:

modules:
  - name: PickyColors
    buildsystem: simple
    build-commands:
      - install -Dm755 PickyColors /app/bin/PickyColors
      - install -Dm644 digital.sector7.pickycolors.appdata.xml /app/share/metainfo/digital.sector7.pickycolors.appdata.xml
    sources:
      - type: file
        path: PickyColors
      - type: file
        path: digital.sector7.pickycolors.appdata.xml
  - name: icons
    buildsystem: simple
    build-commands:
      - install -Dm644 icons/icon-16.png /app/share/icons/hicolor/16x16/apps/pickycolors.png
      - install -Dm644 icons/icon-32.png /app/share/icons/hicolor/32x32/apps/pickycolors.png
      - install -Dm644 icons/icon-64.png /app/share/icons/hicolor/64x64/apps/pickycolors.png
      - install -Dm644 icons/icon-128.png /app/share/icons/hicolor/128x128/apps/pickycolors.png
      - install -Dm644 icons/icon-256.png /app/share/icons/hicolor/256x256/apps/pickycolors.png
      - install -Dm644 icons/icon-512.png /app/share/icons/hicolor/512x512/apps/pickycolors.png
      - install -Dm644 icons/icon-1024.png /app/share/icons/hicolor/1024x1024/apps/pickycolors.png
    sources:
      - type: dir
        path: icons
      - type: file
        path: icons/icon-16.png
      - type: file
        path: icons/icon-32.png
      - type: file
        path: icons/icon-64.png
      - type: file
        path: icons/icon-128.png
      - type: file
        path: icons/icon-256.png
      - type: file
        path: icons/icon-512.png
      - type: file
        path: icons/icon-1024.png

Can’t see any other type that could match except maybe “extra-data”, but seems file and dir respectively are just fine. :slight_smile:

Here’s the command and it’s output currently:

flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo --install builddir digital.sector7.PickyColors.yml
Dependency Sdk: org.freedesktop.Sdk 23.08
Updating org.freedesktop.Sdk/x86_64/23.08

Nothing to do.
Dependency Runtime: org.freedesktop.Platform 23.08
Updating org.freedesktop.Platform/x86_64/23.08

Nothing to do.
Downloading sources
Starting build of digital.sector7.pickycolors
Cache hit for PickyColors, skipping build
Cache miss, checking out last cache hit
========================================================================
Building module icons in /home/sector7/PycharmProjects/pickycolors-flatpak/.flatpak-builder/build/icons-4
========================================================================
Running: install -Dm644 icons/icon-16.png /app/share/icons/hicolor/16x16/apps/pickycolors.png
install: cannot stat 'icons/icon-16.png': No such file or directory
Error: module icons: Child process exited with code 1

where do you think it find he icons if you don’t tell?

btw all of that should be part of the build system instead.