flathub / org.flatpak.Builder

16 stars 14 forks source link

Fails to rename desktop file when used with Flatpak 1.10.x #71

Open wjt opened 2 years ago

wjt commented 2 years ago

I tried building an app using org.flatpak.Builder 1.2.2 on an Endless OS system with Flatpak 1.10.7 (matching Debian Bullseye). It fails when renaming the desktop file in an unexpected way.

Given the following manifest:

{
    "app-id": "uk.me.wjt.FlatpakBuilderTest",
    "runtime": "org.freedesktop.Platform",
    "runtime-version": "21.08",
    "sdk": "org.freedesktop.Sdk",
    "command": "/bin/true",
    "rename-desktop-file": "test.desktop",
    "modules": [
        {
            "name": "test",
            "buildsystem": "simple",
            "sources": [
                {
                    "type": "file",
                    "path": "test.desktop"
                }
            ],
            "build-commands": [
                "install -D -t /app/share/applications test.desktop"
            ]
        }
    ]
}

and the following test.desktop:

[Desktop Entry]
Name=Test
Exec=true

Then with flatpak-builder 1.0.12 (from Debian Bullseye) the build succeeds, but with org.flatpak.Builder 1.2.2 it fails as follows:

Emptying app dir '_app'
Downloading sources
Starting build of uk.me.wjt.FlatpakBuilderTest
Cache hit for test, skipping build
Cache miss, checking out last cache hit
Cleaning up
Renaming test.desktop to uk.me.wjt.FlatpakBuilderTest.desktop
Error: Error moving file /sysroot/home/wjt/tmp/fbtest/.flatpak-builder/rofiles/rofiles-lZv3CH/files/share/applications/test.desktop: No such file or directory
wjt commented 2 years ago

https://github.com/wjt/flatpak-builder-issue-71 has the files above for ease of testing.

wjt commented 2 years ago

--verbose is not much more helpful:

$ org.flatpak.Builder --verbose  --force-clean _app uk.me.wjt.FlatpakBuilderTest.json 
FB: Running: git config --get user.email
FB: Running: git config --get user.name
Emptying app dir '_app'
FB: Running 'flatpak info --arch=x86_64 --show-commit org.freedesktop.Sdk 21.08' on host
FB: host_command_exited_cb 91854 0

FB: Running 'flatpak info --show-location --arch=x86_64 org.freedesktop.Sdk 21.08' on host
FB: host_command_exited_cb 91857 0

FB: Running 'flatpak info --arch=x86_64 --show-commit org.freedesktop.Platform 21.08' on host
FB: host_command_exited_cb 91860 0

Downloading sources
Starting build of uk.me.wjt.FlatpakBuilderTest
Cache hit for test, skipping build
Cache miss, checking out last cache hit
Cleaning up
FB: Mounting read-only fs: rofiles-fuse /sysroot/home/wjt/tmp/flatpak-builder-issue-71/_app /sysroot/home/wjt/tmp/flatpak-builder-issue-71/.flatpak-builder/rofiles/rofiles-lZv3CH
Renaming test.desktop to uk.me.wjt.FlatpakBuilderTest.desktop
Error: Error moving file /sysroot/home/wjt/tmp/flatpak-builder-issue-71/.flatpak-builder/rofiles/rofiles-lZv3CH/files/share/applications/test.desktop: No such file or directory
FB: Unmounting read-only fs: fusermount -uz /sysroot/home/wjt/tmp/flatpak-builder-issue-71/.flatpak-builder/rofiles/rofiles-lZv3CH

My working theory is that f-b 1.2 is not compatible with flatpak 1.10, but I wonder whether it should be.

The context is that periodically people wonder whether we should stop baking flatpak-builder (and its somewhat large dependencies, like git, elfutils, etc.) into the Endless OS ostree, and instead direct the small subset of people who actually need it to this Flatpak. However this quick experiment suggests that we can't do this and the belief that having mutually-contemporary versions of flatpak and flatpak-builder is a good idea.

wjt commented 2 years ago

I tried building and running 1.2.2 on the host (rather than as a flatpak) and it works fine. The plot thickens

nanonyme commented 2 years ago

I hope we didn't hit yet another dependency on host flatpak, see https://github.com/flathub/org.flatpak.Builder/issues/13#issuecomment-656758046. It's possible that there is some dependency between flatpak in sandbox and flatpak in host.

wjt commented 2 years ago

I now have matching Flatpak versions between host and this Flatpak, and get a slightly different failure at exactly the same spot:

wjt@camille:~/tmp/flatpak-builder-issue-71 (main)$ flatpak --version
Flatpak 1.12.4
wjt@camille:~/tmp/flatpak-builder-issue-71 (main)$ flatpak run --command=flatpak org.flatpak.Builder --version
Flatpak 1.12.4
wjt@camille:~/tmp/flatpak-builder-issue-71 (main)$ org.flatpak.Builder --version
flatpak-builder 1.2.2
wjt@camille:~/tmp/flatpak-builder-issue-71 (main)$ org.flatpak.Builder --verbose --force-clean _app uk.me.wjt.FlatpakBuilderTest.json 
FB: Running: git config --get user.email
FB: Running: git config --get user.name
Emptying app dir '_app'
FB: Running 'flatpak info --arch=x86_64 --show-commit org.freedesktop.Sdk 21.08' on host
FB: host_command_exited_cb 3785 0

FB: Running 'flatpak info --show-location --arch=x86_64 org.freedesktop.Sdk 21.08' on host
FB: host_command_exited_cb 3788 0

FB: Running 'flatpak info --arch=x86_64 --show-commit org.freedesktop.Platform 21.08' on host
FB: host_command_exited_cb 3791 0

Downloading sources
Starting build of uk.me.wjt.FlatpakBuilderTest
Cache hit for test, skipping build
Cache hit for cleanup, skipping
Cache miss, checking out last cache hit
Finishing app
FB: Mounting read-only fs: rofiles-fuse /sysroot/home/wjt/tmp/flatpak-builder-issue-71/_app /sysroot/home/wjt/tmp/flatpak-builder-issue-71/.flatpak-builder/rofiles/rofiles-lZv3CH
FB: Running: flatpak build-finish --command=/bin/true /sysroot/home/wjt/tmp/flatpak-builder-issue-71/.flatpak-builder/rofiles/rofiles-lZv3CH
error: Build directory /sysroot/home/wjt/tmp/flatpak-builder-issue-71/.flatpak-builder/rofiles/rofiles-lZv3CH not initialized
Error: Child process exited with code 1
FB: Unmounting read-only fs: fusermount -uz /sysroot/home/wjt/tmp/flatpak-builder-issue-71/.flatpak-builder/rofiles/rofiles-lZv3CH
bbhtt commented 8 months ago

Is this still relevant? 1.2.2 is pretty old by now and renames were worked on by @hfiguiere recently which is in org.flatpak.Builder right now.

I cannot reproduce the bug from the manifest and desktop file in the first post.

wjt commented 8 months ago

I can!

wjt@camille:flatpak-builder-issue-71 (main)$ ostree --version # for rofiles-fuse
libostree:
 Version: '2023.5'
 Features:
  - libcurl
  - libsoup3
  - gpgme
  - ex-fsverity
  - libarchive
  - selinux
  - avahi
  - libmount
  - systemd
  - release
  - p2p
wjt@camille:flatpak-builder-issue-71 (main)$ flatpak --version
Flatpak 1.14.4
wjt@camille:flatpak-builder-issue-71 (main)$ flatpak-builder --version
flatpak-builder 1.2.3
wjt@camille:flatpak-builder-issue-71 (main)$ org.flatpak.Builder --version
flatpak-builder 1.4.1
wjt@camille:flatpak-builder-issue-71 (main)$ org.flatpak.Builder --install --force-clean --user _app uk.me.wjt.FlatpakBuilderTest.json 
Emptying app dir '_app'
Downloading sources
Starting build of uk.me.wjt.FlatpakBuilderTest
Cache hit for test, skipping build
Cache miss, checking out last cache hit
Cleaning up
Renaming test.desktop to uk.me.wjt.FlatpakBuilderTest.desktop
Error: Error moving file /sysroot/home/wjt/src/wjt/flatpak-builder-issue-71/.flatpak-builder/rofiles/rofiles-kqp9q8/files/share/applications/test.desktop: No such file or directory
wjt@camille:flatpak-builder-issue-71 (main)$ flatpak-builder --install --force-clean --user _app uk.me.wjt.FlatpakBuilderTest.json 
[… it succeeds …]
Installing app/uk.me.wjt.FlatpakBuilderTest/x86_64/master
Pruning cache
izissise commented 5 months ago

I have the same issue on ubuntu

flatpak-builder --version
flatpak-builder 1.2.2