mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 04:23:21 +00:00
contrib: Adjust flatpak build for moving to flathub
Pull the based json file from https://github.com/flathub/org.freedesktop.fwupd And modify it as necessary (for changes in master)
This commit is contained in:
parent
53b49458b6
commit
d22f215a70
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "contrib/flatpak"]
|
||||
path = contrib/flatpak
|
||||
url = https://github.com/flathub/org.freedesktop.fwupd
|
@ -9,4 +9,4 @@ RUN dnf --enablerepo=updates-testing -y update
|
||||
RUN mkdir /build
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
CMD ["./contrib/ci/flatpak.sh"]
|
||||
CMD ["./contrib/ci/flatpak.py"]
|
||||
|
106
contrib/ci/flatpak.py
Executable file
106
contrib/ci/flatpak.py
Executable file
@ -0,0 +1,106 @@
|
||||
#!/usr/bin/python3
|
||||
import subprocess
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
|
||||
def prepare (target):
|
||||
#clone the flatpak json
|
||||
cmd = ['git', 'submodule', 'update', 'contrib/flatpak']
|
||||
subprocess.run (cmd, check=True)
|
||||
|
||||
#clone the submodules for that
|
||||
cmd = ['git', 'submodule', 'update', '--init', 'shared-modules/']
|
||||
subprocess.run (cmd, cwd='contrib/flatpak', check=True)
|
||||
|
||||
#parse json
|
||||
if os.path.isdir ('build'):
|
||||
shutil.rmtree ('build')
|
||||
data = {}
|
||||
with open ('contrib/flatpak/org.freedesktop.fwupd.json', 'r') as rfd:
|
||||
data = json.load (rfd)
|
||||
platform = 'runtime/%s/x86_64/%s' % (data['runtime'], data['runtime-version'])
|
||||
sdk = 'runtime/%s/x86_64/%s' % (data['sdk'], data['runtime-version'])
|
||||
num_modules = len (data['modules'])
|
||||
|
||||
#update to build from master
|
||||
data["branch"] = "master"
|
||||
has_libxmlb = False
|
||||
for index in range(0, num_modules):
|
||||
module = data['modules'][index]
|
||||
if type (module) != dict or not 'name' in module:
|
||||
continue
|
||||
name = module['name']
|
||||
if 'libxmlb' in name:
|
||||
has_libxmlb = True
|
||||
continue
|
||||
if not 'fwupd' in name:
|
||||
continue
|
||||
data['modules'][index]['sources'][0].pop ('url')
|
||||
data['modules'][index]['sources'][0].pop ('sha256')
|
||||
data['modules'][index]['sources'][0]['type'] = 'dir'
|
||||
data['modules'][index]['sources'][0]['skip'] = [".git"]
|
||||
data['modules'][index]['sources'][0]['path'] = ".."
|
||||
|
||||
#add libxmlb (This should be dropped when new release to flathub)
|
||||
if not has_libxmlb:
|
||||
print ("Adding libxmlb into json")
|
||||
libxmlb = {'name': 'libxmlb',
|
||||
'buildsystem': 'meson',
|
||||
'config-opts': [
|
||||
"-Dintrospection=false",
|
||||
"-Dgtkdoc=false",
|
||||
"-Dtests=false",
|
||||
"--sysconfdir=/app/etc",
|
||||
"--localstatedir=/var/data"
|
||||
],
|
||||
'cleanup': ['/libexec/xb-tool'],
|
||||
'sources': [{
|
||||
"type": "archive",
|
||||
"url": "https://people.freedesktop.org/~hughsient/releases/libxmlb-0.1.3.tar.xz",
|
||||
"sha256": "b609a95d078ab956231a43fd082382b386ed2f90e3fe5e8b785c4278a1b4787e"
|
||||
}]
|
||||
}
|
||||
data['modules'].insert(num_modules-1, libxmlb)
|
||||
|
||||
#write json
|
||||
os.mkdir('build')
|
||||
with open (target, 'w') as wfd:
|
||||
json.dump(data, wfd, indent=4)
|
||||
os.symlink ('../contrib/flatpak/shared-modules','build/shared-modules')
|
||||
|
||||
# install the runtimes (parsed from json!)
|
||||
repo = 'flathub'
|
||||
repo_url = 'https://dl.flathub.org/repo/flathub.flatpakrepo'
|
||||
print ("Installing dependencies")
|
||||
cmd = ['flatpak', 'remote-add', '--if-not-exists', repo, repo_url]
|
||||
subprocess.run (cmd, check=True)
|
||||
cmd = ['flatpak', 'install', '--assumeyes', repo, sdk]
|
||||
subprocess.run (cmd, check=True)
|
||||
cmd = ['flatpak', 'install', '--assumeyes', repo, platform]
|
||||
subprocess.run (cmd, check=True)
|
||||
|
||||
|
||||
def build (target):
|
||||
cmd = ['flatpak-builder', '--repo=repo', '--force-clean', '--disable-rofiles-fuse', 'build-dir', target]
|
||||
subprocess.run (cmd, check=True)
|
||||
cmd = ['flatpak', 'build-bundle', 'repo', 'fwupd.flatpak', 'org.freedesktop.fwupd']
|
||||
subprocess.run (cmd, check=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
t = os.path.join ('build', 'org.freedesktop.fwupd.json')
|
||||
prepare (t)
|
||||
build (t)
|
||||
|
||||
# to run from the builddir:
|
||||
# sudo flatpak-builder --run build-dir org.freedesktop.fwupd.json /app/libexec/fwupd/fwupdtool get-devices
|
||||
|
||||
# install the single file bundle
|
||||
# flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
# flatpak install fwupd.flatpak
|
||||
|
||||
# to run a shell in the same environment that flatpak sees:
|
||||
# flatpak run --command=sh --devel org.freedesktop.fwupd
|
||||
|
||||
# to run fwupdtool as root:
|
||||
# sudo flatpak run org.freedesktop.fwupd --verbose get-devices
|
@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# install the runtimes
|
||||
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
flatpak install --assumeyes flathub runtime/org.gnome.Sdk/x86_64/3.30
|
||||
flatpak install --assumeyes flathub runtime/org.gnome.Platform/x86_64/3.30
|
||||
|
||||
# build the repo
|
||||
flatpak-builder --repo=repo --force-clean --disable-rofiles-fuse build-dir contrib/org.freedesktop.fwupd.json
|
||||
|
||||
# show the files that were included
|
||||
tree build-dir
|
||||
|
||||
# build a single file bundle
|
||||
flatpak build-bundle repo fwupd.flatpak org.freedesktop.fwupd
|
||||
|
||||
# make available as a deliverable
|
||||
cp fwupd.flatpak dist
|
||||
|
||||
# to run from the builddir:
|
||||
# sudo flatpak-builder --run build-dir org.freedesktop.fwupd.json /app/libexec/fwupd/fwupdtool get-devices
|
||||
|
||||
# install the single file bundle
|
||||
# flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
# flatpak install fwupd.flatpak
|
||||
|
||||
# to run a shell in the same environment that flatpak sees:
|
||||
# flatpak run --command=sh --devel org.freedesktop.fwupd
|
||||
|
||||
# to run fwupdtool as root:
|
||||
# sudo flatpak run org.freedesktop.fwupd --verbose get-devices
|
1
contrib/flatpak
Submodule
1
contrib/flatpak
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 3e60bea4e74e4143bb2524762092e3d6e1e8930f
|
@ -1,5 +0,0 @@
|
||||
all:
|
||||
python3 setup.py build
|
||||
|
||||
install:
|
||||
python3 setup.py install --prefix=/app ${ARGS}
|
@ -1,276 +0,0 @@
|
||||
{
|
||||
"app-id": "org.freedesktop.fwupd",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "3.30",
|
||||
"branch": "master",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"command": "/app/libexec/fwupd/fwupdtool",
|
||||
"finish-args": [
|
||||
"--device=all",
|
||||
"--filesystem=/boot",
|
||||
"--filesystem=/sys",
|
||||
"--filesystem=xdg-download",
|
||||
"--share=network",
|
||||
"--system-talk-name=org.freedesktop.fwupd",
|
||||
"--system-talk-name=org.freedesktop.UPower"
|
||||
],
|
||||
"build-options": {
|
||||
"cflags": "-O2 -g",
|
||||
"cxxflags": "-O2 -g"
|
||||
},
|
||||
"cleanup": [
|
||||
"*.a",
|
||||
"*.la",
|
||||
"/include",
|
||||
"/lib/girepository-1.0",
|
||||
"/lib/pkgconfig",
|
||||
"/share/bash-completion",
|
||||
"/share/dbus-1/system-services",
|
||||
"/share/gir-1.0",
|
||||
"/share/gtk-doc",
|
||||
"/share/info",
|
||||
"/share/man",
|
||||
"/share/pkgconfig"
|
||||
],
|
||||
"modules": [
|
||||
{
|
||||
/* not using shared-modules as we need gudev */
|
||||
"name": "udev",
|
||||
"rm-configure": true,
|
||||
"config-opts": [
|
||||
"--disable-hwdb",
|
||||
"--disable-logging",
|
||||
"--disable-introspection",
|
||||
"--disable-keymap",
|
||||
"--disable-mtd_probe"
|
||||
],
|
||||
"cleanup": [
|
||||
"/etc/udev",
|
||||
"/libexec/*",
|
||||
"/share/gtk-doc/html/libudev/",
|
||||
"/sbin/udevadm"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "http://kernel.org/pub/linux/utils/kernel/hotplug/udev-175.tar.bz2",
|
||||
"sha256": "4c7937fe5a1521316ea571188745b9a00a9fdf314228cffc53a7ba9e5968b7ab"
|
||||
},
|
||||
{
|
||||
"type": "script",
|
||||
"dest-filename": "autogen.sh",
|
||||
"commands": [
|
||||
"autoreconf -vfi"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libusb",
|
||||
"config-opts": [
|
||||
"--disable-static"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.tar.bz2",
|
||||
"sha256": "75aeb9d59a4fdb800d329a545c2e6799f732362193b465ea198f2aa275518157"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gusb",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"-Ddocs=false",
|
||||
"-Dvapi=false",
|
||||
"-Dtests=false"
|
||||
],
|
||||
"cleanup": [
|
||||
"/bin/gusbcmd"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://people.freedesktop.org/~hughsient/releases/libgusb-0.3.0.tar.xz",
|
||||
"sha256": "d8e7950f99b6ae4c3e9b8c65f3692b9635289e6cff8de40c4af41b2e9b348edc"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "efivar",
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"make prefix=/app libdir=/app/lib",
|
||||
"make install prefix=/app libdir=/app/lib"
|
||||
],
|
||||
"cleanup": [
|
||||
"/bin/efivar"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://github.com/rhboot/efivar/releases/download/35/efivar-35.tar.bz2",
|
||||
"sha256": "1e033dc5d099a44fd473b0887dbcc4b105613efab0fb3c5df9f111ea5d147394"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libsmbios_c",
|
||||
"only-arches": [
|
||||
"x86_64"
|
||||
],
|
||||
"config-opts": [
|
||||
"--disable-doxygen",
|
||||
"--disable-graphviz",
|
||||
"--disable-python"
|
||||
],
|
||||
"cleanup": [
|
||||
"/sbin/smbios*",
|
||||
"/share/locale/*/LC_MESSAGES/libsmbios.mo"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://github.com/dell/libsmbios/archive/v2.4.2.tar.gz",
|
||||
"sha256": "ebfe18415e24bbec06d0a9ea1066c8dcd82982555373712713d7e194138650de"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gnu-efi",
|
||||
"only-arches": [
|
||||
"aarch64",
|
||||
"x86_64"
|
||||
],
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"make",
|
||||
"make PREFIX=/app install"
|
||||
],
|
||||
"no-autogen": true,
|
||||
"cleanup": [
|
||||
"/bin/efivar"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "http://superb-dca2.dl.sourceforge.net/project/gnu-efi/gnu-efi-3.0.9.tar.bz2",
|
||||
"sha256": "6715ea7eae1c7e4fc5041034bd3f107ec2911962ed284a081e491646b12277f0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "python3-olefile",
|
||||
"only-arches": [
|
||||
"aarch64",
|
||||
"x86_64"
|
||||
],
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} olefile"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "file",
|
||||
"url": "https://pypi.python.org/packages/35/17/c15d41d5a8f8b98cc3df25eb00c5cee76193114c78e5674df6ef4ac92647/olefile-0.44.zip",
|
||||
"sha256": "61f2ca0cd0aa77279eb943c07f607438edf374096b66332fae1ee64a6f0f73ad"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "python3-pillow",
|
||||
"only-arches": [
|
||||
"aarch64",
|
||||
"x86_64"
|
||||
],
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} Pillow"
|
||||
],
|
||||
"cleanup": [
|
||||
"/bin/*.py"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "file",
|
||||
"url": "https://pypi.python.org/packages/93/73/66854f63b1941aad9af18a1de59f9cf95ad1a87c801540222e332f6688d7/Pillow-4.1.1.tar.gz",
|
||||
"sha256": "00b6a5f28d00f720235a937ebc2f50f4292a5c7e2d6ab9a8b26153b625c4f431"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libxmlb",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"-Dintrospection=false",
|
||||
"-Dgtkdoc=false",
|
||||
"-Dtests=false",
|
||||
"--sysconfdir=/app/etc",
|
||||
"--localstatedir=/var/data"
|
||||
],
|
||||
"cleanup": [
|
||||
"/libexec/xb-tool"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://people.freedesktop.org/~hughsient/releases/libxmlb-0.1.3.tar.xz",
|
||||
"sha256": "b609a95d078ab956231a43fd082382b386ed2f90e3fe5e8b785c4278a1b4787e"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fwupd",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"-Dconsolekit=false",
|
||||
"-Ddaemon=false",
|
||||
"-Dgpg=false",
|
||||
"-Dgtkdoc=false",
|
||||
"-Dintrospection=false",
|
||||
"-Dman=false",
|
||||
"-Dpkcs7=false",
|
||||
"-Dsystemd=false",
|
||||
"-Dtests=false",
|
||||
"-Defi-includedir=/app/include/efi",
|
||||
"-Defi-ldsdir=/app/lib",
|
||||
"-Defi-libdir=/app/lib",
|
||||
"--sysconfdir=/app/etc",
|
||||
"--localstatedir=/var/data"
|
||||
],
|
||||
"build-options" : {
|
||||
"arch": {
|
||||
"i386": {
|
||||
"config-opts": [
|
||||
"-Dplugin_dell=false",
|
||||
"-Dplugin_uefi=false"
|
||||
]
|
||||
},
|
||||
"arm": {
|
||||
"config-opts": [
|
||||
"-Dplugin_dell=false",
|
||||
"-Dplugin_uefi=false"
|
||||
]
|
||||
},
|
||||
"aarch64": {
|
||||
"config-opts": [
|
||||
"-Dplugin_dell=false"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"cleanup": [
|
||||
"/etc/dbus-1/system.d/org.freedesktop.fwupd.conf",
|
||||
"/share/fwupd/remotes.d/vendor"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "dir",
|
||||
"skip": [".git"],
|
||||
"path": ".."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -128,7 +128,7 @@ def install_flatpak (directory, verbose, uninstall):
|
||||
else:
|
||||
output = None
|
||||
#look for dependencies
|
||||
dep = 'org.gnome.Platform/x86_64/3.28'
|
||||
dep = 'org.gnome.Platform/x86_64/3.30'
|
||||
repo = 'flathub'
|
||||
repo_url = 'https://flathub.org/repo/flathub.flatpakrepo'
|
||||
cmd = ['flatpak', 'info', dep]
|
||||
|
@ -85,8 +85,23 @@ def download_cab_file (directory, uri):
|
||||
subprocess.run (cmd, cwd=directory, check=True)
|
||||
|
||||
def download_flatpak (directory):
|
||||
cmd = ['wget', 'https://people.freedesktop.org/~hughsient/temp/fwupd.flatpak', '-O', 'fwupd.flatpak']
|
||||
if 'DEBUG' in os.environ:
|
||||
dep = 'org.freedesktop.fwupd'
|
||||
flatpak_dir = os.path.join(os.getenv('HOME'),'.local', 'share', 'flatpak')
|
||||
verbose = 'DEBUG' in os.environ
|
||||
|
||||
#check if we have installed locally already or not
|
||||
if not os.path.exists (os.path.join (flatpak_dir, 'app', dep)):
|
||||
# install into local user's repo
|
||||
cmd = ['flatpak', 'install', '--user',
|
||||
'https://www.flathub.org/repo/appstream/org.freedesktop.fwupd.flatpakref', '--no-deps', '-y']
|
||||
if verbose:
|
||||
print(cmd)
|
||||
subprocess.run (cmd, cwd=directory, check=True)
|
||||
|
||||
# generate a bundle
|
||||
repo = os.path.join(flatpak_dir, 'repo')
|
||||
cmd = ['flatpak', 'build-bundle', repo, 'fwupd.flatpak', dep, 'stable']
|
||||
if verbose:
|
||||
print(cmd)
|
||||
subprocess.run (cmd, cwd=directory, check=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user