mirror of
https://github.com/sudoxnym/fdroiddata.git
synced 2026-04-14 19:46:54 +00:00
gitlab-ci: only run fdroid build on changed build entries
This commit is contained in:
parent
626bcdb8d1
commit
8d99dfd3c6
2 changed files with 56 additions and 2 deletions
|
|
@ -150,7 +150,6 @@ fdroid build:
|
|||
|
||||
- bash fdroidserver/buildserver/provision-apt-get-install http://deb.debian.org/debian
|
||||
- apt-get dist-upgrade
|
||||
- apt-get install sudo # TODO REMOVE ME once merged https://gitlab.com/fdroid/fdroidserver/-/merge_requests/753
|
||||
|
||||
# install fdroidserver from git, with deps from Debian, until fdroidserver
|
||||
# is stable enough to include all the things needed here
|
||||
|
|
@ -162,7 +161,12 @@ fdroid build:
|
|||
- apt-get purge fdroidserver
|
||||
|
||||
- export GRADLE_USER_HOME=$PWD/.gradle
|
||||
- fdroid build --verbose --on-server --latest --no-tarball --no-refresh $CHANGED
|
||||
# each `fdroid build --on-server` run expects sudo, then uninstalls it
|
||||
- for build in `./tools/find-changed-builds.py`; do
|
||||
set -x;
|
||||
apt-get install sudo;
|
||||
fdroid build --verbose --on-server --no-tarball $build;
|
||||
done
|
||||
|
||||
|
||||
# issuebot needs secrets to run, so it has to run under the 'fdroid'
|
||||
|
|
|
|||
50
tools/find-changed-builds.py
Executable file
50
tools/find-changed-builds.py
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import difflib
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import yaml
|
||||
from colorama import Fore, Style
|
||||
|
||||
changed = set(os.getenv('CHANGED').split(' '))
|
||||
changed.discard('')
|
||||
|
||||
for appid in sorted(changed):
|
||||
metadata_file = 'metadata/%s.yml' % appid
|
||||
diff = subprocess.check_output(
|
||||
('git diff --no-color --diff-filter=d FETCH_HEAD...HEAD -- ' + metadata_file).split(' '),
|
||||
)
|
||||
|
||||
with open(metadata_file) as fp:
|
||||
current = yaml.safe_load(fp)
|
||||
cmd = 'git apply --reverse'
|
||||
p = subprocess.run(cmd.split(' '), input=diff, stdout=subprocess.DEVNULL)
|
||||
if p.returncode:
|
||||
print(Fore.RED + ('ERROR: %s: %d' % (cmd, p.returncode)) + Style.RESET_ALL,
|
||||
file=sys.stderr)
|
||||
sys.exit(p.returncode)
|
||||
with open(metadata_file) as fp:
|
||||
previous = yaml.safe_load(fp)
|
||||
cmd = 'git apply'
|
||||
p = subprocess.run(cmd.split(' '), input=diff, stdout=subprocess.DEVNULL)
|
||||
if p.returncode:
|
||||
print(Fore.RED + ('ERROR: %s: %d' % (cmd, p.returncode)) + Style.RESET_ALL,
|
||||
file=sys.stderr)
|
||||
sys.exit(p.returncode)
|
||||
|
||||
to_build = []
|
||||
previous_builds = dict()
|
||||
for build in previous['Builds']:
|
||||
previous_builds[build['versionCode']] = build
|
||||
|
||||
for build in current['Builds']:
|
||||
vc = build['versionCode']
|
||||
if vc not in previous_builds:
|
||||
to_build.append(vc)
|
||||
continue
|
||||
if build != previous_builds[vc]:
|
||||
to_build.append(vc)
|
||||
|
||||
for vc in to_build:
|
||||
print('%s:%d' % (appid, vc), end=' ')
|
||||
Loading…
Reference in a new issue