Help me to create FLATPAK of my program

From what I understand by reading the documentation the flatpak build-export command creates a local repository, I have to use the flatpak build-bundle command to create the flatpak package, but I tried command:

flatpak build-bundle '/home/enrico/MEGA/Informatica/Programming/C/Qt Creator/Linux/LaMiaVideoteca/Setup/Release 2.45/FLATPAK/lamiavideoteca/lamiavideoteca.flatpak' lamiavideoteca.flatpak org.tarro.lamiavideoteca.flatpak

but it doesn’t work, it gives me

error: Refspec 'app/org.tarro.lamiavideoteca.flatpak/x86_64/master' not found

There’s just no one who can tell me how to do the latter. I’m very close to the solution. In short, this is the official website to ask for help on how to create flatpaks… right?

This is a community forum, people will answer when they find the time. You have to be patient.


But you already have the correct command syntax, now you just have to understand the error message, the documentation could be improved in this instance:

flatpak build-bundle LOCATION FILENAME NAME [BRANCH]

LOCATION is the repository from flatpak build-export or from flatpak-builder --repo=<REPO> (your location is the correct one).

FILENAME is just the output filename, whatever you define.

NAME is actually the application id. You just have to enter exactly your id (case-sensitive). Your id doesn’t (& shouldn’t) contain the .flatpak suffix, that’s why your application is not found.


Additionally you could set:

--runtime-repo=URL
The URL for a .flatpakrepo file that contains the information about the repository that supplies the runtimes required by the app.

The documentation I’ve linked (Single-file bundles) contains an example with the correct url to set.

You should sign your bundle with your GPG key but I don’t know the correct procedure for this.

Thank you for answering me. I’m not in a hurry and I thought people were tired of replying to me. I changed the name of the repo to lamiavideotecarepo. I tried with the following command:

> flatpak build-bundle '/home/enrico/MEGA/Informatica/Programming/C/Qt Creator/Linux/LaMiaVideoteca/Setup/Release 2.45/FLATPAK/lamiavideoteca/lamiavideotecarepo' lamiavideoteca.flatpak org.tarro.lamiavideoteca

but I get:

error: ‘/home/enrico/MEGA/Informatica/Programming/C/Qt Creator/Linux/LaMiaVideoteca/Setup/Release 2.45/FLATPAK/lamiavideoteca/lamiavideotecarepo’ is not a valid repository

Yet the command I used to create the local repo should be right: `

> flatpak build-export lamiavideotecarepo build-dir org.tarro.lamiavideoteca

Most likely your path to the repo is not correct, that’s the error you get if the repo-folder does not exist.

Check the files of the repository, they should look like in the screenshot (Figura 3b):

ls ‘/home/enrico/MEGA/Informatica/Programming/C/Qt Creator/Linux/LaMiaVideoteca/Setup/Release 2.45/FLATPAK/lamiavideoteca/lamiavideotecarepo’

But you can just avoid the whole absolute path & just use lamiavideotecarepo instead (if everything is inside the current working directory).

Check the app in the repository:

cat lamiavideotecarepo/summary

find lamiavideotecarepo/refs/heads/app

Both should contain your app id. That’s the id you should be able to build the bundle for.

You have changed the branch name from master to org.tarro.lamiavideoteca. Then you must add it as last parameter to build-bundle (without the brackets).

But you should use a better branch name like stable, main, master or something like that.

yeeeeeeeeeesssssssssssssssss!!!


Thanks very thanks…May you be blessed…
I’ll have to try it and there will probably be some problems (things like gnome integration) but I’ll look at it calmly… is it normal that the .flatpak weighs only 25 megabytes despite the build-dir weighing about 75 megabytes?

RESOLVED

For anyone who sees this post in the future, I’ll recap what I did to compile the .flatpak file.
I created a manifest file in the directory where the binaries related to my program were located which I called org.tarro.lamiavideoteca.yml, inside this file I wrote:

id: org.tarro.lamiavideoteca
runtime: org.kde.Platform 
runtime-version: '6.6' 
sdk: org.kde.Sdk 
command: LaMiaVideoteca 
modules: 
  - name: LaMiaVideoteca 
    buildsystem: simple 
    
    sources: 
      - type: file 
        path: LaMiaVideoteca 
      - type: file 
        path: BluRay4KUHD 
      - type: file 
        path: BluRayDisc 
      - type: file 
        path: 'BluRayHD&UHD' 
      - type: file 
        path: 'DVD&BluRayDisc' 
      - type: file 
        path: DVDVideo 
      - type: file 
        path: LaMiaVideoteca.ico 
      - type: file 
        path: rimuoviimmagine.png 
      - type: file 
        path: VHS 
      - type: file 
        path: lamiavideoteca.db 
      - type: dir
        path: /home/enrico/MEGA/Informatica/Programmazione/C/Qt Creator/Linux/LaMiaVideoteca/Setup/Release 2.45/FLATPAK/lamiavideoteca
        
               
    build-commands: 
      - mkdir /app/lib
      - mkdir /app/share
      - mkdir /app/bin
      - mkdir /app/bin/Copertine
      - install -D LaMiaVideoteca /app/bin/LaMiaVideoteca 
      - install -T BluRay4KUHD /app/bin/BluRay4KUHD 
      - install -T BluRayDisc /app/bin/BluRayDisc 
      - install -T 'BluRayHD&UHD' /app/bin/'BluRayHD&UHD' 
      - install -T 'DVD&BluRayDisc' /app/bin/'DVD&BluRayDisc' 
      - install -T DVDVideo /app/bin/DVDVideo 
      - install -T LaMiaVideoteca.ico /app/bin/LaMiaVideoteca.ico 
      - install -T rimuoviimmagine.png /app/bin/rimuoviimmagine.png 
      - install -T VHS /app/bin/VHS 
      - install -T lamiavideoteca.db /app/bin/lamiavideoteca.db 
      - cp -r lib/* /app/lib
      - cp -r share/* /app/share
      - cp -r Copertine/* /app/bin/Copertine
        
             
finish-args:
  # X11 + XShm access
  - --share=ipc
  - --socket=x11
  - --socket=fallback-x11
  # Wayland access
  - --socket=wayland
  # GPU acceleration if needed
  - --device=dri
  # Needs to save files locally
  - --filesystem=host

Still inside this directory I opened in terminal and issued these three commands:

flatpak-builder build-dir org.tarro.lamiavideoteca.yml

flatpak build-export lamiavideotecarepo build-dir stable

(this command creates a folder which is nothing other than the local repository)

flatpak build-bundle lamiavideotecarepo lamiavideoteca.flatpak org.tarro.lamiavideoteca stable

(this command actually creates the .flatpak file)

I hope the post can help someone in the future. Thanks