Skip to content
Permalink
Browse files
[Flatpak] Add support for flatpak > 1.1.2
https://bugs.webkit.org/show_bug.cgi?id=194088

Flatpak 1.2 is now out so we need to support that
version now.

Patch by Thibault Saunier <tsaunier@igalia.com> on 2019-02-25
Reviewed by Michael Catanzaro.

* flatpak/flatpakutils.py:
(check_flatpak):
(FlatpakPackages.__init__):
(FlatpakPackages.__detect_packages):
(FlatpakPackages.__detect_packages.in):
(FlatpakRepos.update):

Canonical link: https://commits.webkit.org/209364@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242040 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
thiblahute authored and webkit-commit-queue committed Feb 25, 2019
1 parent 9abae50 commit eee98845110d85b3e99771dafe78b46328c2edfe
Showing 2 changed files with 82 additions and 38 deletions.
@@ -1,3 +1,20 @@
2019-02-25 Thibault Saunier <tsaunier@igalia.com>

[Flatpak] Add support for flatpak > 1.1.2
https://bugs.webkit.org/show_bug.cgi?id=194088

Flatpak 1.2 is now out so we need to support that
version now.

Reviewed by Michael Catanzaro.

* flatpak/flatpakutils.py:
(check_flatpak):
(FlatpakPackages.__init__):
(FlatpakPackages.__detect_packages):
(FlatpakPackages.__detect_packages.in):
(FlatpakRepos.update):

2019-02-25 Zan Dobersek <zdobersek@igalia.com>

[WPE] Bump WPEBackend-fdo Jhbuild package to latest changes
@@ -52,6 +52,8 @@
("flatpak-builder", "0.10.0"),
]

FLATPAK_VERSION = {}

WPE_MANIFEST_MAP = {
"qt": "org.webkit.WPEQT.yaml",
}
@@ -110,7 +112,9 @@ def comparable_version(version):
return tuple(map(int, (version.split("."))))

version = output.decode("utf-8").split(" ")[1].strip("\n")
if comparable_version(version) < comparable_version(required_version):
current = comparable_version(version)
FLATPAK_VERSION[app] = current
if current < comparable_version(required_version):
Console.message("\n%s%s %s required but %s found."
" Please update and try again%s\n", Colors.FAIL,
app, required_version, version, Colors.ENDC)
@@ -260,23 +264,35 @@ def __init__(self, repos, user=True):
self.apps = self.__detect_apps()
self.packages = self.runtimes + self.apps


def __detect_packages(self, *args):
packs = []
package_defs = [rd
for rd in self.flatpak("list", "-d", "--all", *args).split("\n")
if rd]
for package_def in package_defs:
splited_packaged_def = package_def.split()
name, arch, branch = splited_packaged_def[0].split("/")
if FLATPAK_VERSION["flatpak"] < (1, 1, 2):
out = self.flatpak("list", "-d", *args)
package_defs = [line for line in out.split("\n") if line]
for package_def in package_defs:
splited_packaged_def = package_def.split()
name, arch, branch = splited_packaged_def[0].split("/")

# If installed from a file, the package is in no repo
repo_name = splited_packaged_def[1]
repo = self.repos.repos.get(repo_name)

packs.append(FlatpakPackage(name, branch, repo, arch))
else:
out = self.flatpak("list", "--columns=application,arch,branch,origin", *args)
package_defs = [line for line in out.split("\n") if line]
for package_def in package_defs:
name, arch, branch, origin = package_def.split("\t")

# If installed from a file, the package is in no repo
repo_name = splited_packaged_def[1]
repo = self.repos.repos.get(repo_name)
# If installed from a file, the package is in no repo
repo = self.repos.repos.get(origin)

packs.append(FlatpakPackage(name, branch, repo, arch))
packs.append(FlatpakPackage(name, branch, repo, arch))

return packs


def __detect_runtimes(self):
return self.__detect_packages("--runtime")

@@ -297,36 +313,47 @@ def __init__(self, user=True):

def update(self):
self.repos = {}
remotes = [row
for row in self.flatpak("remote-list", "-d").split("\n")
if row]
for repo in remotes:
for components in [repo.split(" "), repo.split("\t")]:
if len(components) == 1:
components = repo.split("\t")
name = components[0]
desc = ""
url = None
for elem in components[1:]:
if not elem:
continue
parsed_url = urlparse(elem)
if parsed_url.scheme:
url = elem
if FLATPAK_VERSION["flatpak"] < (1, 1, 2):
out = self.flatpak("remote-list", "-d")
remotes = [line for line in out.split("\n") if line]
for repo in remotes:
for components in [repo.split(" "), repo.split("\t")]:
if len(components) == 1:
components = repo.split("\t")
name = components[0]
desc = ""
url = None
for elem in components[1:]:
if not elem:
continue
parsed_url = urlparse(elem)
if parsed_url.scheme:
url = elem
break

if desc:
desc += " "
desc += elem

if url:
break

if desc:
desc += " "
desc += elem
if not url:
Console.message("No valid URI found for: %s", repo)
continue

if url:
break

if not url:
Console.message("No valid URI found for: %s", repo)
continue

self.repos[name] = FlatpakRepo(name, url, desc, repos=self)
self.repos[name] = FlatpakRepo(name, url, desc, repos=self)
else:
out = self.flatpak("remote-list", "--columns=name,title,url")
remotes = [line for line in out.split("\n") if line]
for remote in remotes:
name, title, url = remote.split("\t")
parsed_url = urlparse(url)
if not parsed_url.scheme:
Console.message("No valid URI found for: %s", remote)
continue

self.repos[name] = FlatpakRepo(name, url, title, repos=self)

self.packages = FlatpakPackages(self)

0 comments on commit eee9884

Please sign in to comment.