#7 Update fuse3.spec to allow flatpak builds
Closed 4 months ago by spot. Opened 2 years ago by jaydoubleu.
rpms/ jaydoubleu/fuse3 rawhide  into  rawhide

file modified
+1
@@ -1,3 +1,4 @@ 

+ *.rpm

  /fuse-3.4.2.tar.gz

  /fuse-3.5.0.tar.gz

  /fuse-3.6.1.tar.gz

file modified
+20 -6
@@ -6,7 +6,11 @@ 

  URL:		http://fuse.sf.net

  Source0:	https://github.com/libfuse/libfuse/archive/fuse-%{version}.tar.gz

  Source1:	fuse.conf

- Patch0:         fuse3-gcc11.patch

+ Patch0:		fuse3-gcc11.patch

+ 

+ %if 0%{?flatpak}

+ %global _udevrulesdir %{_prefix}/lib/udev/rules.d

+ %endif

  

  BuildRequires:	which

  %if ! 0%{?el6}
@@ -80,8 +84,13 @@ 

  %if ! 0%{?__global_ldflags:1}

  %global __global_ldflags ""

  %endif

- %meson -D udevrulesdir=/etc/udev/rules.d

+ %meson -D udevrulesdir=%{_sysconfdir}/udev/rules.d

  %else

+ # Need to be specific for flatpak builds, otherwise it'll create rules

+ # in other directory than /app/etc which will make builds fail.

+ %if 0%{?flatpak}

+ %meson -D udevrulesdir=%{_udevrulesdir}

+ %endif

  %meson

  %endif

  
@@ -94,12 +103,14 @@ 

  %endif

  # don't have root for installation

  meson configure -D useroot=false

+ 

  ninja-build reconfigure

  )

  %meson_build

  

  %install

- export MESON_INSTALL_DESTDIR_PREFIX=%{buildroot}/usr %meson_install

+ # prefix cannot be hardcoded, flatpaks are using /app instead of /usr

+ export MESON_INSTALL_DESTDIR_PREFIX=%{buildroot}/%{_prefix} %meson_install

  find %{buildroot} .

  find %{buildroot} -type f -name "*.la" -exec rm -f {} ';'

  # change from 4755 to 0755 to allow stripping -- fixed later in files
@@ -109,6 +120,10 @@ 

  rm -f %{buildroot}/%{_libdir}/*.a

  # No need to create init-script

  rm -f %{buildroot}%{_sysconfdir}/init.d/fuse3

+ # This path is hardcoded:

+ # https://github.com/libfuse/libfuse/blob/master/util/install_helper.sh#L43

+ # so flatpaks will fail unless we delete it below.

+ rm -f %{buildroot}/etc/init.d/fuse3

  

  %if 0%{?el6} || 0%{?el7}

  # This is in the fuse package on el7 and there's no default on el6
@@ -118,9 +133,6 @@ 

  install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}

  %endif

  

- # Delete pointless udev rules, which do not belong in /usr/lib (brc#748204)

- rm -f %{buildroot}/usr/lib/udev/rules.d/99-fuse3.rules

- 

  %if 0%{?el6} || 0%{?el7}

  %post -p /sbin/ldconfig libs

  %postun -p /sbin/ldconfig libs
@@ -139,6 +151,8 @@ 

  %{_mandir}/man8/*

  %if 0%{?el6}

  %{_sysconfdir}/udev/rules.d/*

+ %else

+ %{_udevrulesdir}/*

  %endif

  

  %files libs

This will allow fedora flatpaks to be built with fuse3 as dependency.

I don't think this is entirely right. Are you sure about the /usr/lib | %{_libdir} change at the bottom of the diff? IIRC, the issue was that the package was dropping this file in /usr/lib regardless of what libdir was...

Hmm perhaps flatpak-module has changed some values but without that removal line it's complaining about unpackaged file.

Hmm the built results are .... interesting.
/me scratching his head..

rebased onto 5165a10

2 years ago

rebased onto ef676d6

2 years ago

So I've made some changes that seem to work both for flatpak and fedora https://koji.fedoraproject.org/koji/taskinfo?taskID=82746385

I would appreciate if you could have a look when you get a chance.

This is still not quite right, but I understand where you are trying to go. I just committed a change to rawhide that does the right things (I think), please check that and let me know if it resolves the flatpak build issues.

Hmm I must say I'm quite confused about this now...

Checking for unpackaged file(s): /usr/lib/rpm/check-files /builddir/build/BUILDROOT/fuse3-3.10.5-3.module+f35+2+99ac73cd.x86_64
error: Installed (but unpackaged) file(s) found:
   /usr/lib/udev/rules.d/99-fuse3.rules
RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/lib/udev/rules.d/99-fuse3.rules
Child return code was: 1
EXCEPTION: [Error()]
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.9/site-packages/mockbuild/util.py", line 600, in do_with_status
    raise exception.Error("Command failed: \n # %s\n%s" % (command, output), child.returncode)
mockbuild.exception.Error: Command failed: 
 # /usr/bin/systemd-nspawn -q -M 79b3e3a675e143e0bbca6e610ba90927 -D /var/lib/mock/module-gnome-boxes-main-3520220217011430-1/root -a -u mockbuild --capability=cap_ipc_lock --bind=/tmp/mock-resolv.xrxu3_it:/etc/resolv.conf --bind=/dev/btrfs-control --bind=/dev/loop-control --bind=/dev/loop0 --bind=/dev/loop1 --bind=/dev/loop2 --bind=/dev/loop3 --bind=/dev/loop4 --bind=/dev/loop5 --bind=/dev/loop6 --bind=/dev/loop7 --bind=/dev/loop8 --bind=/dev/loop9 --bind=/dev/loop10 --bind=/dev/loop11 --console=pipe --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007" --setenv=PS1=<mock-chroot> \s-\v\$  --setenv=LANG=C.UTF-8 --resolv-conf=off bash --login -c /usr/bin/rpmbuild -bb --target x86_64 --nodeps /builddir/build/SPECS/fuse3.spec

This is the error I'm getting from flatpak build. It seems to be ignoring the udevrulesdir ?

Full log: https://gist.githubusercontent.com/JayDoubleu/db2613037aedc3306f7a80325234f0b4/raw/f9d84111f38b9ec866e436c9ad4e89eeb1f6d58d/fuse3-build.log

I think it is not matching the condition so it's building with just %meson instead of the one with specific udevrulesdir directly ?

https://github.com/libfuse/libfuse/blob/bdd2d4110fbc6d2059eb699efad2cca4a7eacccb/util/meson.build#L26

When I just change your commit to :

%build
export LC_ALL=en_US.UTF-8
%if ! 0%{?_vpath_srcdir:1}
%global _vpath_srcdir .
%endif
%if ! 0%{?_vpath_builddir:1}
%global _vpath_builddir build
%endif
%if 0%{?el6}
%if ! 0%{?__global_ldflags:1}
%global __global_ldflags ""
%endif
%meson -D udevrulesdir=%{_udevrulesdir}
%else
%if 0%{?flatpak}
%meson -D udevrulesdir=%{_udevrulesdir}
%else
%meson
%endif
%endif

It builds fine.

Closing this out. Reopen if still needed.

Pull-Request has been closed by spot

4 months ago
Metadata