live-build/expand-task: Fix expansion of tasks with non-flavour specific name (e.g. "minimal") when building a non-Ubuntu flavour.

add-new-budgie
Michael Hudson-Doyle 2 years ago
parent 01b851e162
commit 734da44d00

2
debian/changelog vendored

@ -2,6 +2,8 @@ livecd-rootfs (2.838) UNRELEASED; urgency=medium
* auto/config: Set FLAVOUR appropriately for flavours added since the * auto/config: Set FLAVOUR appropriately for flavours added since the
expand-task branch was created. expand-task branch was created.
* live-build/expand-task: Fix expansion of tasks with non-flavour specific
name (e.g. "minimal") when building a non-Ubuntu flavour.
-- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 17 May 2023 13:24:43 +1200 -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 17 May 2023 13:24:43 +1200

@ -35,25 +35,6 @@ def parseTaskHeaders(seedtext):
task_headers[key.lower()] = value.strip() task_headers[key.lower()] = value.strip()
return task_headers return task_headers
def getTaskName(task_headers, flavour, seedname, primary_flavour):
"""Work out the name of the Task to be generated from this seed.
If there is a Task-Name header, it wins; otherwise, seeds with a
Task-Per-Derivative header are honoured for all flavours and put in
an appropriate namespace, while other seeds are only honoured for
the first flavour and have archive-global names.
"""
if "name" in task_headers:
return task_headers["name"]
elif "per-derivative" in task_headers:
return "%s-%s" % (flavour, seedname)
elif primary_flavour:
return seedname
else:
return None
def getTaskSeeds(task_headers, seedname): def getTaskSeeds(task_headers, seedname):
"""Return the list of seeds used to generate a task from this seed. """Return the list of seeds used to generate a task from this seed.
@ -66,13 +47,31 @@ def getTaskSeeds(task_headers, seedname):
return sorted(scan_seeds) return sorted(scan_seeds)
# end copy/paste from ubuntu-archive-publishing's generate_extra_overrides. # end copy/paste from ubuntu-archive-publishing's generate_extra_overrides.
# This is not quite the same as the one in generate_extra_overrides,
# because for seeds that do not have flavour specific names, the Task
# override is only generated for the Ubuntu flavour rather than
# redundantly doing it for each flavour.
def getTaskName(task_headers, flavour, seedname):
"""Work out the name of the Task to be generated from this seed.
If there is a Task-Name header, it wins; otherwise, seeds with a
Task-Per-Derivative get put in an appropriate namespace. Other seeds
have a task name that matches the seed name.
"""
if "name" in task_headers:
return task_headers["name"]
elif "per-derivative" in task_headers:
return "%s-%s" % (flavour, seedname)
else:
return seedname
for seedtext in glob.glob(f'{args.output_dir}/*.seedtext'): for seedtext in glob.glob(f'{args.output_dir}/*.seedtext'):
hs = parseTaskHeaders(open(seedtext)) hs = parseTaskHeaders(open(seedtext))
if not hs: if not hs:
continue continue
seedname = os.path.splitext(os.path.basename(seedtext))[0] seedname = os.path.splitext(os.path.basename(seedtext))[0]
tn = getTaskName(hs, args.flavour, seedname, args.flavour == 'ubuntu') tn = getTaskName(hs, args.flavour, seedname)
if tn != args.task: if tn != args.task:
continue continue
for seed in getTaskSeeds(hs, seedname): for seed in getTaskSeeds(hs, seedname):

Loading…
Cancel
Save