Commit 37e68d94 authored by Guido Gunther's avatar Guido Gunther
Browse files

Merge branch 'board-variant' into 'master'

librem5-devkit-flash-image: choose a specific board variant

See merge request Librem5/librem5-devkit-tools!62
parents bd32c996 30d9b3ba
......@@ -27,7 +27,8 @@ except ImportError:
from urllib.parse import urljoin
JENKINS = 'https://arm01.puri.sm'
TYPE = 'devkit'
BOARD_TYPE = 'devkit'
BOARD_VARIANT = 'current'
DIST = 'buster+ci'
IMAGE = 'devkit.img'
META_YAML = 'files/meta.yml'
......@@ -181,15 +182,15 @@ def download_image(url, target, attempts):
verify_image(target, meta)
def find_image(jobname, type, dist):
def find_image(jobname, type, variant, dist):
server = jenkins.Jenkins(JENKINS)
logging.info("Looking for {} {} image".format(type, dist))
logging.info("Looking for {} {} {} image".format(type, variant, dist))
info = server.get_job_info(jobname)
for build in info['builds']:
resp = requests.get(build['url'] + '/api/json')
resp.raise_for_status()
json = resp.json()
if (json['description'].startswith(type + ' ') and
if (json['description'].startswith(variant + ' ' + type) and
dist in json['description'] and
json['result'] == 'SUCCESS'):
found = json
......@@ -254,6 +255,8 @@ def main():
parser.add_argument('--download-attempts', type=int, default=10,
help="Maximum number of attempts to resume "
"devkit image download. 0-unlimited")
parser.add_argument('--variant', choices=['legacy', 'current', 'next'], default=BOARD_VARIANT,
help='Variant of the board to download ( legacy, current, next )')
group = parser.add_argument_group(title='Testing and debugging options')
group.add_argument('--debug', action="store_true", default=False,
......@@ -272,7 +275,7 @@ def main():
# Check available downloads upfront so it's less likely we fail
# later:
image_ref = find_image(args.image_job, TYPE, args.dist)
image_ref = find_image(args.image_job, BOARD_TYPE, args.variant, args.dist)
if image_ref:
image_ref['ts'] = datetime.datetime.fromtimestamp(image_ref['timestamp'] / 1000).strftime('%c')
logging.info("Found disk image Build {id} '{description}' from {ts}".format(**image_ref))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment