Merge ~mwhudson/ubuntu-cdimage:local-artifacts into ubuntu-cdimage:main

Proposed by Michael Hudson-Doyle
Status: Needs review
Proposed branch: ~mwhudson/ubuntu-cdimage:local-artifacts
Merge into: ubuntu-cdimage:main
Diff against target: 53 lines (+17/-0)
2 files modified
lib/cdimage/build.py (+1/-0)
lib/cdimage/livefs.py (+16/-0)
Reviewer Review Type Date Requested Status
Ubuntu CD Image Team Pending
Review via email: mp+456803@code.launchpad.net

Commit message

add a way to use a local download of a livefs

Description of the change

A slightly prettied up version of the hacks I've always been using to run cdimage locally.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

fwiw I've built an ISO with this (and a hack to mirror.py)

934febf... by Michael Hudson-Doyle

fix unbound local in build_image_set_locked

Unmerged commits

934febf... by Michael Hudson-Doyle

fix unbound local in build_image_set_locked

Succeeded
[SUCCEEDED] run-tests:0 (build)
[SUCCEEDED] lint:0 (build)
12 of 2 results
c1af884... by Michael Hudson-Doyle

add a way to use a local download of a livefs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/cdimage/build.py b/lib/cdimage/build.py
2index e60da8d..58baceb 100644
3--- a/lib/cdimage/build.py
4+++ b/lib/cdimage/build.py
5@@ -636,6 +636,7 @@ def build_image_set_locked(config, options):
6 config.limit_arches(live_successful)
7 else:
8 tracker_set_rebuild_status(config, [0, 1], 2)
9+ builds = []
10
11 if not is_live_fs_only(config):
12 sync_local_mirror(config)
13diff --git a/lib/cdimage/livefs.py b/lib/cdimage/livefs.py
14index 45265be..0f12c94 100644
15--- a/lib/cdimage/livefs.py
16+++ b/lib/cdimage/livefs.py
17@@ -23,6 +23,7 @@ from gzip import GzipFile
18 import io
19 import os
20 import re
21+import shutil
22 import subprocess
23 from textwrap import dedent
24 import time
25@@ -613,6 +614,9 @@ def live_output_directory(config):
26
27
28 def download_live_items(config, builds, arch, item):
29+ if config['CDIMAGE_LOCAL_LIVEFS_ARTIFACTS']:
30+ return True
31+
32 output_dir = live_output_directory(config)
33 found = False
34
35@@ -708,6 +712,18 @@ def download_live_filesystems(config, builds):
36 output_dir = live_output_directory(config)
37 osextras.mkemptydir(output_dir)
38
39+ if config["CDIMAGE_LOCAL_LIVEFS_ARTIFACTS"]:
40+ assert len(config.arches) == 1
41+ arch = config.arches[0]
42+ artifacts_dir = config["CDIMAGE_LOCAL_LIVEFS_ARTIFACTS"]
43+ for srcname in os.listdir(artifacts_dir):
44+ destname = srcname.replace(
45+ f'livecd.{config["PROJECT"]}.', f'{arch}.')
46+ srcpath = os.path.join(artifacts_dir, srcname)
47+ destpath = os.path.join(output_dir, destname)
48+ logger.info("copying %r to %r", srcpath, destpath)
49+ shutil.copy(srcpath, destpath)
50+
51 if (config["CDIMAGE_LIVE"] or config["CDIMAGE_SQUASHFS_BASE"] or
52 config["CDIMAGE_PREINSTALLED"]):
53 got_image = False

Subscribers

People subscribed via source and target branches