Skip to content

Commit

Permalink
Canary: Enable again
Browse files Browse the repository at this point in the history
Canary is now built on the GNOME SDK/Runtime.

Fixes #2385

Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1674>
  • Loading branch information
philn authored and Marge Bot committed Nov 18, 2024
1 parent b4dae87 commit 872ccb6
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 189 deletions.
11 changes: 3 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,11 @@ canary:
tags:
- flatpak
variables:
SDK_REPO: 'https://software.igalia.com/flatpak-refs/webkit-sdk.flatpakrepo'
BUNDLE: 'epiphany-canary.flatpak'
script:
# TODO: Switch to debug? 5GB downloads though.
- python3 generate-canary-manifest.py --release
- flatpak remote-add --user --if-not-exists webkit-sdk ${SDK_REPO}
- export SCCACHE_NO_DAEMON=1
- export SCCACHE_START_SERVER=0
- flatpak-builder --user --install-deps-from=webkit-sdk --disable-rofiles-fuse --repo=repo canary_flatpak_app org.gnome.Epiphany.Canary.json
- flatpak build-bundle repo ${BUNDLE} --runtime-repo=${SDK_REPO} org.gnome.Epiphany.Canary
- python3 generate-canary-manifest.py
- flatpak-builder --user --disable-rofiles-fuse --repo=repo canary_flatpak_app org.gnome.Epiphany.Canary.json
- flatpak build-bundle repo --runtime-repo=${RUNTIME_REPO} ${BUNDLE} org.gnome.Epiphany.Canary
- tar cf canary-repo.tar repo/
- rm -rf canary-repo canary_flatpak_app org.gnome.Epiphany.Canary.json webkitgtk.zip

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ is via [Flatpak](https://www.flatpak.org/). You may:
flavor of Epiphany is more likely to be **very unstable** because the code
being built comes directly from WebKit's git main branch and Epiphany's git
master branch. Epiphany Canary can be installed by executing the following
flatpak commands in a terminal:
flatpak command in a terminal:

```shell
flatpak --user remote-add --if-not-exists webkit https://software.igalia.com/flatpak-refs/webkit-sdk.flatpakrepo
flatpak --user install https://nightly.gnome.org/repo/appstream/org.gnome.Epiphany.Canary.flatpakref
```

Expand Down
62 changes: 18 additions & 44 deletions generate-canary-manifest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2021 Igalia S.L.
# Copyright (C) 2021-2024 Igalia S.L.
#
# This file is part of Epiphany.
#
Expand All @@ -16,40 +16,21 @@
# You should have received a copy of the GNU General Public License
# along with Epiphany. If not, see <http://www.gnu.org/licenses/>.

from html.parser import HTMLParser
import argparse
import hashlib
import json
import os
import re
import sys
import urllib.request

ZIP_FILE = "webkitgtk.zip"
ARCHIVE_FILE = "webkitgtk.zip"

# FIXME: Might be worth adding some JSON file listing builds on the servers.
class MyHTMLParser(HTMLParser):
builds = []
def handle_starttag(self, tag, attrs):
if tag != "a":
return
for (name, value) in attrs:
if name == "href" and (value.startswith("release") or value.startswith("debug")) and '%40main' in value:
self.builds.append(value)

def download_zipped_build(build_type, verbose):
url = f"https://webkitgtk4-{build_type}.igalia.com/built-products/"
with urllib.request.urlopen(url) as page_fd:
parser = MyHTMLParser()
parser.feed(page_fd.read().decode("utf-8"))
try:
latest = parser.builds[-1]
except IndexError:
print(f"No build found in {url}")
return ("", "")
def download_nightly_build(verbose):
url = "https://webkitgtk.org/built-products/x86_64/release/nightly/GNOMEWebCanary"
with urllib.request.urlopen(f"{url}/LAST-IS") as fd:
latest = fd.read().strip().decode('utf8')

print(f"Downloading build {latest} from {url}")
zip_file = open(ZIP_FILE, "wb")
archive = open(ARCHIVE_FILE, "wb")

def update(blocks, bs, size):
done = int(50 * blocks * bs / size)
Expand All @@ -60,30 +41,23 @@ def update(blocks, bs, size):
if verbose:
args.append(update)

urllib.request.urlretrieve(f"{url}/{latest}", ZIP_FILE, *args)
h = hashlib.new('sha256')
with open(ZIP_FILE, "rb") as f:
h.update(f.read())
archive_url = f"{url}/{latest}"
urllib.request.urlretrieve(archive_url, ARCHIVE_FILE, *args)

shasum_url = archive_url.replace('.zip', '.sha256sum')
with urllib.request.urlopen(shasum_url) as fd:
output = fd.read().strip()
checksum = output.split(b' ')[0].decode('utf8')

checksum = h.hexdigest()
return (ZIP_FILE, checksum)
return (ARCHIVE_FILE, checksum)

def main(args):
parser = argparse.ArgumentParser()
type_group = parser.add_mutually_exclusive_group()
type_group.add_argument("--debug", help="Download a debug build.",
dest='build_type', action="store_const", const="Debug")
type_group.add_argument("--release", help="Download a release build.",
dest='build_type', action="store_const", const="Release")
parser.add_argument("--verbose", help="Show progress bar.", action=argparse.BooleanOptionalAction, default=False)

if len(args) == 0:
parser.print_help(sys.stderr)
return 1

parsed, _ = parser.parse_known_args(args=args)
zip_filename, checksum = download_zipped_build(parsed.build_type.lower(), parsed.verbose)
if not zip_filename:
archive_filename, checksum = download_nightly_build(parsed.verbose)
if not archive_filename:
return 2

manifest_path = "org.gnome.Epiphany.Canary.json"
Expand All @@ -92,7 +66,7 @@ def main(args):
pwd = os.path.abspath(os.curdir)
for module in json_input['modules']:
if module['name'] == 'webkitgtk':
path = os.path.join(pwd, zip_filename)
path = os.path.join(pwd, archive_filename)
module['sources'] = [{'type': 'archive', 'url': f'file://{path}', 'sha256': checksum,
'strip-components': 0}]
elif module['name'] == 'epiphany':
Expand Down
Loading

0 comments on commit 872ccb6

Please sign in to comment.