b7e9ca
%global flatpak_version 1.0.2
b7e9ca
%global flatpak_builder_version 1.0.0
b7e9ca
%global ostree_version 2018.8
0202c3
0202c3
Name:           flatpak
b7e9ca
Version:        %{flatpak_version}
4f7afe
Release:        5%{?dist}
0202c3
Summary:        Application deployment framework for desktop apps
0202c3
0202c3
License:        LGPLv2+
0202c3
URL:            http://flatpak.org/
0202c3
Source0:        https://github.com/flatpak/flatpak/releases/download/%{version}/%{name}-%{version}.tar.xz
0202c3
Source1:        https://github.com/ostreedev/ostree/releases/download/v%{ostree_version}/libostree-%{ostree_version}.tar.xz
b7e9ca
Source2:        https://github.com/flatpak/flatpak-builder/releases/download/%{flatpak_builder_version}/flatpak-builder-%{flatpak_builder_version}.tar.xz
b7e9ca
b7e9ca
# Avoid dbus activating systemd services on the session bus (we don't have a
b7e9ca
# user bus, and I'm pretty sure we don't have systemd --user)
b7e9ca
Patch0:         no-user-systemd.patch
b7e9ca
# Make sure our resulting binaries always have the rpath set to the bundled
b7e9ca
# ostree directory
b7e9ca
Patch1:         flatpak-ostree-bundle.patch
66b0f8
# https://bugzilla.redhat.com/show_bug.cgi?id=1675433
66b0f8
Patch2:         flatpak-1.0.2-CVE-2019-5736.patch
4f7afe
# https://bugzilla.redhat.com/show_bug.cgi?id=1700651
4f7afe
Patch3:         flatpak-1.0.2-CVE-2019-10063.patch
b7e9ca
b7e9ca
BuildRequires:  pkgconfig(appstream-glib)
0202c3
BuildRequires:  pkgconfig(fuse)
0202c3
BuildRequires:  pkgconfig(gio-unix-2.0)
0202c3
BuildRequires:  pkgconfig(gobject-introspection-1.0) >= 1.40.0
0202c3
BuildRequires:  pkgconfig(json-glib-1.0)
0202c3
BuildRequires:  pkgconfig(libarchive) >= 2.8.0
0202c3
BuildRequires:  pkgconfig(libelf) >= 0.8.12
0202c3
BuildRequires:  pkgconfig(libsoup-2.4)
b7e9ca
BuildRequires:  pkgconfig(libxml-2.0) >= 2.4
0202c3
BuildRequires:  pkgconfig(polkit-gobject-1)
0202c3
BuildRequires:  pkgconfig(libseccomp)
0202c3
BuildRequires:  pkgconfig(liblzma)
b7e9ca
BuildRequires:  pkgconfig(yaml-0.1)
0202c3
BuildRequires:  pkgconfig(xau)
0202c3
BuildRequires:  pkgconfig(e2p)
0202c3
BuildRequires:  automake, autoconf, libtool, gettext-devel, gtk-doc
0202c3
BuildRequires:  bison
0202c3
BuildRequires:  docbook-dtds
0202c3
BuildRequires:  docbook-style-xsl
0202c3
BuildRequires:  intltool
0202c3
BuildRequires:  libattr-devel
0202c3
BuildRequires:  libcap-devel
0202c3
BuildRequires:  libdwarf-devel
0202c3
BuildRequires:  gpgme-devel
0202c3
BuildRequires:  systemd
b7e9ca
BuildRequires:  /usr/bin/eu-strip
0202c3
BuildRequires:  /usr/bin/xmlto
0202c3
BuildRequires:  /usr/bin/xsltproc
b7e9ca
# Bundled ostree BRs:
b7e9ca
BuildRequires:  pkgconfig(zlib)
b7e9ca
BuildRequires:  pkgconfig(libcurl)
b7e9ca
BuildRequires:  openssl-devel
b7e9ca
BuildRequires:  pkgconfig(mount)
b7e9ca
BuildRequires:  pkgconfig(libsystemd)
0202c3
0202c3
# libostree bundling
0202c3
# https://fedoraproject.org/wiki/EPEL:Packaging_Autoprovides_and_Requires_Filtering
0202c3
# We're using RPATH to pick up our bundled version
0202c3
%filter_from_requires /libostree-1/d
0202c3
0202c3
# And ensure we don't add a Provides
0202c3
%{?filter_setup:
0202c3
%filter_provides_in %{_libdir}/%{name}/.*
0202c3
%filter_setup
0202c3
}
0202c3
# And for now we manually inject this dep; surprisingly the
0202c3
# command line doesn't currently link to the public libflatpak
0202c3
# library.
0202c3
Requires:       %{name}-libs = %{version}-%{release}
0202c3
b7e9ca
# Make sure the document portal is installed
b7e9ca
%if 0%{?fedora} || 0%{?rhel} > 7
b7e9ca
Recommends:     xdg-desktop-portal > 0.10
b7e9ca
# Remove in F30.
b7e9ca
Conflicts:      xdg-desktop-portal < 0.10
b7e9ca
%else
b7e9ca
Requires:       xdg-desktop-portal > 0.10
b7e9ca
%endif
b7e9ca
0202c3
%description
0202c3
flatpak is a system for building, distributing and running sandboxed desktop
0202c3
applications on Linux. See https://wiki.gnome.org/Projects/SandboxedApps for
0202c3
more information.
0202c3
0202c3
%package builder
b7e9ca
# Override to the version of the bundled flatpak-builder.
b7e9ca
Version:        %{flatpak_builder_version}
0202c3
Summary:        Build helper for %{name}
0202c3
License:        LGPLv2+
b7e9ca
# Overridden, as the macro expands to the version of this subpackage.
b7e9ca
Requires:       %{name}%{?_isa} = %{flatpak_version}-%{release}
0202c3
Requires:       /usr/bin/bzip2
0202c3
Requires:       /usr/bin/bzr
0202c3
Requires:       /usr/bin/git
0202c3
Requires:       /usr/bin/patch
0202c3
Requires:       /usr/bin/strip
b7e9ca
Requires:       /usr/bin/svn
0202c3
Requires:       /usr/bin/tar
0202c3
Requires:       /usr/bin/unzip
0202c3
0202c3
%description builder
0202c3
flatpak-builder is a tool that makes it easy to build applications and their
0202c3
dependencies by automating the configure && make && make install steps.
0202c3
0202c3
%package devel
b7e9ca
# Overriden, to reset the version macro back to that of the base package.
b7e9ca
Version:        %{flatpak_version}
0202c3
Summary:        Development files for %{name}
0202c3
License:        LGPLv2+
0202c3
Requires:       %{name}%{?_isa} = %{version}-%{release}
0202c3
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
0202c3
0202c3
%description devel
0202c3
This package contains the pkg-config file and development headers for %{name}.
0202c3
0202c3
%package libs
0202c3
Summary:        Libraries for %{name}
0202c3
License:        LGPLv2+
0202c3
# Drop if using an external ostree-libs.
0202c3
Requires:       %{name}%{?_isa} = %{version}-%{release}
0202c3
0202c3
%description libs
0202c3
This package contains libflatpak.
0202c3
0202c3
0202c3
%prep
b7e9ca
%setup -q -a 1 -a 2
0202c3
%patch0 -p1
0202c3
%patch1 -p1
66b0f8
%patch2 -p1
4f7afe
%patch3 -p1
0202c3
0202c3
0202c3
%build
0202c3
cd libostree-%{ostree_version}
0202c3
 %configure \
0202c3
           --disable-silent-rules \
0202c3
           --disable-gtk-doc \
0202c3
           --disable-man \
0202c3
           --disable-rofiles-fuse \
0202c3
           --without-libmount \
0202c3
           --disable-introspection \
0202c3
           --without-selinux \
0202c3
           --without-dracut \
e6d61d
           LIBS=-lgpg-error \
e6d61d
           CPPFLAGS="$CPPFLAGS -DDISABLE_OTMPFILE"
0202c3
%make_build V=1
0202c3
cd ..
0202c3
0202c3
mkdir -p root/lib/pkgconfig
0202c3
ROOT=`pwd`/root
0202c3
0202c3
mv libostree-%{ostree_version}/.libs/libostree-1.so* root/lib
0202c3
ls -al root/lib/libostree*
0202c3
ln -s `pwd`/libostree-%{ostree_version}/src/libostree root/include
0202c3
0202c3
cat > root/lib/pkgconfig/ostree-1.pc <
0202c3
Name: OSTree
0202c3
Description: Git for operating system binaries
0202c3
Version: %{ostree_version}
0202c3
Requires: gio-unix-2.0
0202c3
Libs: -L$ROOT/lib -Wl,-rpath=%{_libdir}/flatpak -lostree-1
0202c3
Cflags: -I$ROOT/include
0202c3
EOF
0202c3
rm -f configure
0202c3
gtkdocize
0202c3
autoreconf -f -i -s
0202c3
export PKG_CONFIG_PATH=$ROOT/lib/pkgconfig
0202c3
(if ! test -x configure; then NOCONFIGURE=1 ./autogen.sh; CONFIGFLAGS=--enable-gtk-doc; fi;
0202c3
 # User namespace support is sufficient.
0202c3
 # Generate consistent IDs between runs to avoid multilib problems.
0202c3
 export XMLTO_FLAGS="--stringparam generate.consistent.ids=1"
0202c3
 %configure \
b7e9ca
            --with-priv-mode=none \
0202c3
            --enable-docbook-docs \
0202c3
            --disable-introspection $CONFIGFLAGS)
0202c3
%make_build V=1
0202c3
sed -i s/ostree-1// %{name}.pc
0202c3
b7e9ca
cd flatpak-builder-%{flatpak_builder_version}
b7e9ca
cat > flatpak <
b7e9ca
#!/bin/sh
b7e9ca
echo %{flatpak_version}
b7e9ca
EOF
b7e9ca
chmod +x ./flatpak
b7e9ca
 %configure \
b7e9ca
           --with-dwarf-header=%{_includedir}/libdwarf \
b7e9ca
           --disable-silent-rules \
b7e9ca
           FLATPAK=./flatpak
b7e9ca
%make_build CFLAGS+=-std=c99 V=1
b7e9ca
b7e9ca
0202c3
%install
0202c3
mkdir -p %{buildroot}%{_datadir}/gtk-doc/html/flatpak
0202c3
%make_install
0202c3
install -d %{buildroot}%{_libdir}/flatpak
0202c3
mv root/lib/libostree-1.so* %{buildroot}%{_libdir}/flatpak
e6d61d
# Work around https://bugzilla.redhat.com/show_bug.cgi?id=1392354
e6d61d
install -d %{buildroot}/%{_pkgdocdir}
e6d61d
if test -d %{buildroot}/%{_docdir}/%{name}; then
e6d61d
    mv %{buildroot}/%{_docdir}/%{name}/* %{buildroot}/%{_pkgdocdir}
e6d61d
    rmdir %{buildroot}/%{_docdir}/%{name}/
e6d61d
fi
e6d61d
install -t %{buildroot}/%{_pkgdocdir} -pm 644 NEWS README.md
0202c3
# The system repo is not installed by the flatpak build system.
0202c3
install -d %{buildroot}%{_localstatedir}/lib/flatpak
0202c3
install -d %{buildroot}%{_sysconfdir}/flatpak/remotes.d
0202c3
rm -f %{buildroot}%{_libdir}/libflatpak.la
b7e9ca
# We don't have python3 and flatpak introspection is disabled
b7e9ca
rm %{buildroot}%{_bindir}/flatpak-bisect
b7e9ca
rm %{buildroot}%{_bindir}/flatpak-coredumpctl
b7e9ca
b7e9ca
cd flatpak-builder-%{flatpak_builder_version}
b7e9ca
%make_install
b7e9ca
cd ..
0202c3
%find_lang %{name}
0202c3
b7e9ca
0202c3
%post
0202c3
# Create an (empty) system-wide repo.
0202c3
flatpak remote-list --system &> /dev/null || :
0202c3
0202c3
%post libs -p /sbin/ldconfig
0202c3
0202c3
%postun libs -p /sbin/ldconfig
0202c3
0202c3
0202c3
%files -f %{name}.lang
0202c3
%license COPYING
0202c3
# Comply with the packaging guidelines about not mixing relative and absolute
0202c3
# paths in doc.
0202c3
%doc %{_pkgdocdir}
0202c3
%{_bindir}/flatpak
0202c3
%{_datadir}/bash-completion
0202c3
%{_datadir}/dbus-1/interfaces/org.freedesktop.Flatpak.xml
b7e9ca
%{_datadir}/dbus-1/interfaces/org.freedesktop.portal.Flatpak.xml
0202c3
%{_datadir}/dbus-1/services/org.freedesktop.Flatpak.service
b7e9ca
%{_datadir}/dbus-1/services/org.freedesktop.portal.Flatpak.service
0202c3
%{_datadir}/dbus-1/system-services/org.freedesktop.Flatpak.SystemHelper.service
0202c3
# Co-own directory.
0202c3
%{_datadir}/gdm/env.d
0202c3
%{_datadir}/%{name}
0202c3
%{_datadir}/polkit-1/actions/org.freedesktop.Flatpak.policy
0202c3
%{_datadir}/polkit-1/rules.d/org.freedesktop.Flatpak.rules
b7e9ca
%{_datadir}/zsh/site-functions
0202c3
%{_libexecdir}/flatpak-dbus-proxy
b7e9ca
%{_libexecdir}/flatpak-portal
0202c3
%{_libexecdir}/flatpak-session-helper
0202c3
%{_libexecdir}/flatpak-system-helper
0202c3
%attr(04755,root,root) %{_libexecdir}/flatpak-bwrap
0202c3
0202c3
%dir %{_localstatedir}/lib/flatpak
0202c3
%{_mandir}/man1/%{name}*.1*
0202c3
%{_mandir}/man5/%{name}-metadata.5*
0202c3
%{_mandir}/man5/flatpak-flatpakref.5*
0202c3
%{_mandir}/man5/flatpak-flatpakrepo.5*
b7e9ca
%{_mandir}/man5/flatpak-installation.5*
b7e9ca
%{_mandir}/man5/flatpak-remote.5*
0202c3
%exclude %{_mandir}/man1/flatpak-builder.1*
0202c3
%{_sysconfdir}/dbus-1/system.d/org.freedesktop.Flatpak.SystemHelper.conf
0202c3
%{_sysconfdir}/flatpak/remotes.d
0202c3
%{_sysconfdir}/profile.d/flatpak.sh
0202c3
%{_unitdir}/flatpak-system-helper.service
b7e9ca
%{_userunitdir}/flatpak-portal.service
0202c3
%{_userunitdir}/flatpak-session-helper.service
0202c3
# Co-own directory.
0202c3
%{_userunitdir}/dbus.service.d
0202c3
0202c3
%files builder
b7e9ca
%doc %{_docdir}/flatpak-builder
0202c3
%{_bindir}/flatpak-builder
0202c3
%{_mandir}/man1/flatpak-builder.1*
b7e9ca
%{_mandir}/man5/flatpak-manifest.5*
0202c3
0202c3
%files devel
0202c3
%{_datadir}/gtk-doc/
0202c3
%{_includedir}/%{name}/
0202c3
%{_libdir}/libflatpak.so
0202c3
%{_libdir}/pkgconfig/%{name}.pc
0202c3
0202c3
%files libs
0202c3
%license COPYING
0202c3
%{_libdir}/flatpak/libostree-1.so*
0202c3
%{_libdir}/libflatpak.so.*
0202c3
0202c3
0202c3
%changelog
4f7afe
* Mon Apr 29 2019 David King <dking@redhat.com> - 1.0.2-5
4f7afe
- Fix IOCSTI sandbox bypass (#1700651)
4f7afe
66b0f8
* Fri Feb 15 2019 David King <dking@redhat.com> - 1.0.2-4
66b0f8
- Tweak /proc sandbox patch (#1675433)
66b0f8
66b0f8
* Wed Feb 13 2019 David King <dking@redhat.com> - 1.0.2-3
66b0f8
- Do not mount /proc in root sandbox (#1675433)
66b0f8
b7e9ca
* Thu Sep 13 2018 Kalev Lember <klember@redhat.com> - 1.0.2-2
b7e9ca
- Update to 1.0.2 (#1570030)
b7e9ca
b7e9ca
* Wed Sep 12 2018 Kalev Lember <klember@redhat.com> - 1.0.1-1
b7e9ca
- Update to 1.0.1 (#1570030)
b7e9ca
b7e9ca
* Mon Jun 04 2018 David King <dking@redhat.com> - 0.10.4-2
b7e9ca
- Fix subpackage versions (#1585604)
b7e9ca
b7e9ca
* Fri Jun 01 2018 David King <dking@redhat.com> - 0.10.4-1
b7e9ca
- Rebase to 0.10.4 (#1570030)
e929c9
e6d61d
* Mon Dec 11 2017 David King <dking@redhat.com> - 0.8.8-3
e6d61d
- Disable O_TMPFILE in libglnx (#1520311)
e6d61d
e6d61d
* Fri Nov 10 2017 Ray Strode <rstrode@redhat.com> - 0.8.8-2
0202c3
- Fix crasher in xdg-desktop-portal
e6d61d
  Resolves: #1503579
0202c3
- Tweak spec file so it still builds even though we need to
0202c3
  autoreconf.
0202c3
e6d61d
* Wed Nov 01 2017 David King <dking@redhat.com> - 0.8.8-1
e6d61d
- Update to 0.8.8 (#1500800)
e6d61d
e6d61d
* Tue Aug 01 2017 Colin Walters <walters@verbum.org> - 0.8.7-3
0202c3
- Fix libostree bundling:
0202c3
  Ensure we do not Provide or Require libostree.
0202c3
  Move the shared library into flatpak-libs so flatpak always
0202c3
  depends on it.
0202c3
  Keep the shared library filename as libostree, but put it
0202c3
  under a private directory.  Renaming the file on disk did not
0202c3
  really do much since the dynamic linker and RPM work from the
0202c3
  soname.
0202c3
  Resolves: #1476905
e6d61d
e6d61d
* Tue Aug 01 2017 Colin Walters <walters@verbum.org> - 0.8.7-2
0202c3
- Tweak build to work both with and without BZ#1392354
0202c3
0202c3
* Tue Jun 20 2017 Kalev Lember <klember@redhat.com> - 0.8.7-1
0202c3
- Update to 0.8.7
0202c3
- Resolves: #1391018
0202c3
0202c3
* Tue Apr  4 2017 Alexander Larsson <alexl@redhat.com> - 0.8.5-2
0202c3
- Add libostree use-after-free patch
0202c3
- Resolves: #1391018
0202c3
0202c3
* Mon Apr 03 2017 Kalev Lember <klember@redhat.com> - 0.8.5-1
0202c3
- Update to 0.8.5
0202c3
- Resolves: #1391018
0202c3
0202c3
* Fri Mar 10 2017 David King <dking@redhat.com> - 0.8.4-2
0202c3
- Sync bzip2 dependency with Fedora package
0202c3
- Make the libs subpackage depend on the base package for libostree
0202c3
- Fix multilib issues with XML-based documentation
0202c3
0202c3
* Fri Mar 10 2017 Kalev Lember <klember@redhat.com> - 0.8.4-1
0202c3
- Update to 0.8.4
0202c3
- Resolves: #1391018
0202c3
0202c3
* Wed Feb 22 2017 Kalev Lember <klember@redhat.com> - 0.8.3-4
0202c3
- Remove ExcludeArch ppc now that we have libseccomp there
0202c3
- Resolves: #1391018
0202c3
0202c3
* Fri Feb 17 2017 Alexander Larsson <alexl@redhat.com> - 0.8.3-3
0202c3
- ExcludeArch 32bit ppc which doesn't have libseccomp
0202c3
- Resolves: #1391018
0202c3
0202c3
* Fri Feb 17 2017 Alexander Larsson <alexl@redhat.com> - 0.8.3-2
0202c3
- Added pkgconfig(e2p) build dependency
0202c3
- Resolves: #1391018
0202c3
0202c3
* Fri Feb 17 2017 Alexander Larsson <alexl@redhat.com> - 0.8.3-1
0202c3
- Bundle ostree and bubblewrap
0202c3
- Resolves: #1391018
0202c3
0202c3
* Tue Feb 14 2017 Kalev Lember <klember@redhat.com> - 0.8.3-1
0202c3
- Update to 0.8.3
0202c3
0202c3
* Fri Jan 27 2017 Kalev Lember <klember@redhat.com> - 0.8.2-1
0202c3
- Update to 0.8.2
0202c3
0202c3
* Wed Jan 18 2017 David King <amigadave@amigadave.com> - 0.8.1-1
0202c3
- Update to 0.8.1
0202c3
0202c3
* Tue Dec 20 2016 Kalev Lember <klember@redhat.com> - 0.8.0-1
0202c3
- Update to 0.8.0
0202c3
0202c3
* Tue Nov 29 2016 David King <amigadave@amigadave.com> - 0.6.14-2
0202c3
- Add a patch to fix a GNOME Software crash
0202c3
- Silence repository listing during post
0202c3
0202c3
* Tue Nov 29 2016 Kalev Lember <klember@redhat.com> - 0.6.14-1
0202c3
- Update to 0.6.14
0202c3
0202c3
* Wed Oct 26 2016 David King <amigadave@amigadave.com> - 0.6.13-2
0202c3
- Add empty /etc/flatpak/remotes.d
0202c3
0202c3
* Tue Oct 25 2016 David King <amigadave@amigadave.com> - 0.6.13-1
0202c3
- Update to 0.6.13
0202c3
0202c3
* Thu Oct 06 2016 David King <amigadave@amigadave.com> - 0.6.12-1
0202c3
- Update to 0.6.12
0202c3
0202c3
* Tue Sep 20 2016 Kalev Lember <klember@redhat.com> - 0.6.11-1
0202c3
- Update to 0.6.11
0202c3
- Set minimum ostree and bubblewrap versions
0202c3
0202c3
* Mon Sep 12 2016 David King <amigadave@amigadave.com> - 0.6.10-1
0202c3
- Update to 0.6.10
0202c3
0202c3
* Tue Sep 06 2016 David King <amigadave@amigadave.com> - 0.6.9-2
0202c3
- Look for bwrap in PATH
0202c3
0202c3
* Thu Aug 25 2016 David King <amigadave@amigadave.com> - 0.6.9-1
0202c3
- Update to 0.6.9
0202c3
0202c3
* Mon Aug 01 2016 David King <amigadave@amigadave.com> - 0.6.8-1
0202c3
- Update to 0.6.8 (#1361823)
0202c3
0202c3
* Thu Jul 21 2016 David King <amigadave@amigadave.com> - 0.6.7-2
0202c3
- Use system bubblewrap
0202c3
0202c3
* Fri Jul 01 2016 David King <amigadave@amigadave.com> - 0.6.7-1
0202c3
- Update to 0.6.7
0202c3
0202c3
* Thu Jun 23 2016 David King <amigadave@amigadave.com> - 0.6.6-1
0202c3
- Update to 0.6.6
0202c3
0202c3
* Fri Jun 10 2016 David King <amigadave@amigadave.com> - 0.6.5-1
0202c3
- Update to 0.6.5
0202c3
0202c3
* Wed Jun 01 2016 David King <amigadave@amigadave.com> - 0.6.4-1
0202c3
- Update to 0.6.4
0202c3
0202c3
* Tue May 31 2016 David King <amigadave@amigadave.com> - 0.6.3-1
0202c3
- Update to 0.6.3
0202c3
- Move bwrap to main package
0202c3
0202c3
* Tue May 24 2016 David King <amigadave@amigadave.com> - 0.6.2-1
0202c3
- Rename from xdg-app to flatpak (#1337434)