[1/4] misc: support building flatpak images
diff mbox series

Message ID 157784176718.1372453.6932244685934321782.stgit@magnolia
State New
Headers show
Series
  • xfsprogs: packaging cleanups
Related show

Commit Message

Darrick J. Wong Jan. 1, 2020, 1:22 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Poke the system until it supports building flatpaks.  Maybe.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 bootstrap  |   12 ++++++++++++
 flatpak.sh |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100755 bootstrap
 create mode 100755 flatpak.sh

Comments

Christoph Hellwig Jan. 7, 2020, 2:20 p.m. UTC | #1
On Tue, Dec 31, 2019 at 05:22:47PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Poke the system until it supports building flatpaks.  Maybe.

Why would we want to support such a fucked up package delivery
mechanism?
Darrick J. Wong Jan. 7, 2020, 7:35 p.m. UTC | #2
On Tue, Jan 07, 2020 at 06:20:35AM -0800, Christoph Hellwig wrote:
> On Tue, Dec 31, 2019 at 05:22:47PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Poke the system until it supports building flatpaks.  Maybe.
> 
> Why would we want to support such a fucked up package delivery
> mechanism?

In theory we could use it as a means to distribute uptodate xfs_repair
so that anyone with a problem that their distro's copy of xfs_repair
can't or won't fix can try upstream without having to build xfsprogs
themselves.

Though I wonder how many people in that situation are running some
colorful linux distribution but are too stingy to pay for a support
contract.... :)

Also, can you elaborate on 'fucked up package delivery mechanism'?

Admittedly I'm /not/ volunteering to maintain a xfs_repair flatpak, so
perhaps I should just drop this whole thing.

--D
Christoph Hellwig Jan. 8, 2020, 8:59 a.m. UTC | #3
On Tue, Jan 07, 2020 at 11:35:37AM -0800, Darrick J. Wong wrote:
> In theory we could use it as a means to distribute uptodate xfs_repair
> so that anyone with a problem that their distro's copy of xfs_repair
> can't or won't fix can try upstream without having to build xfsprogs
> themselves.

And someone would allow a random weirdo package format access to their
disks?

> Also, can you elaborate on 'fucked up package delivery mechanism'?

It completely messes up how the system is supposed to work, and not your
are in a maze of unssuportable package versions just like npm.

Patch
diff mbox series

diff --git a/bootstrap b/bootstrap
new file mode 100755
index 00000000..d403cf58
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,12 @@ 
+#!/bin/bash -x
+
+libtoolize
+automake --add-missing
+aclocal -I m4
+autoconf
+make configure
+libtoolize
+automake --add-missing
+aclocal -I m4
+autoconf
+make configure
diff --git a/flatpak.sh b/flatpak.sh
new file mode 100755
index 00000000..a1ec916e
--- /dev/null
+++ b/flatpak.sh
@@ -0,0 +1,55 @@ 
+#!/bin/bash -xe
+
+if [ "$1" = "--help" ]; then
+	echo "Usage: $0 [branch] [build]"
+	echo "Build xfsprogs flatpak from the given branch."
+fi
+
+branch="$1"
+test -z "${branch}" && branch=master
+build="$2"
+test -z "${build}" && build=release
+
+if [ "${build}" = "debug" ]; then
+	config_opts=', "--disable-lto"'
+fi
+
+cat > flatpak.ini << ENDL
+[Application]
+name=org.xfs.progs
+runtime=org.freedesktop.Platform/$(uname -m)/18.08
+
+[Context]
+devices=all;
+ENDL
+
+cat > org.xfs.progs.json << ENDL
+{
+    "app-id": "org.xfs.progs",
+    "runtime": "org.freedesktop.Platform",
+    "runtime-version": "18.08",
+    "sdk": "org.freedesktop.Sdk",
+    "command": "/app/sbin/xfs_repair",
+    "metadata": "flatpak.ini",
+    "modules": [
+        {
+            "name": "xfsprogs",
+            "buildsystem": "autotools",
+            "config-opts": ["--enable-shared=no" ${config_opts} ],
+            "sources": [
+                {
+                    "type": "git",
+                    "path": "${PWD}/",
+                    "branch": "${branch}"
+                }
+            ]
+        }
+    ]
+}
+ENDL
+
+flatpak-builder --repo=repo build-dir org.xfs.progs.json --force-clean
+flatpak build-bundle repo xfsprogs.flatpak org.xfs.progs
+echo build done, run:
+echo flatpak install xfsprogs.flatpak
+echo flatpak run org.xfs.progs