mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-09-04 12:34:08 +00:00
Add nascent support for a ship-live pool for more images
This commit is contained in:
parent
d79eb2cb9c
commit
74eaafa0c0
@ -175,8 +175,8 @@ add_task ()
|
||||
fi
|
||||
|
||||
for task; do
|
||||
./config/expand-task config/germinate-output $FLAVOUR $task packages >> "$pkg_file"
|
||||
./config/expand-task config/germinate-output $FLAVOUR $task snaps >> "$snap_file"
|
||||
./config/expand-task config/germinate-output $FLAVOUR $task packages $ARCH >> "$pkg_file"
|
||||
./config/expand-task config/germinate-output $FLAVOUR $task snaps $ARCH >> "$snap_file"
|
||||
done
|
||||
|
||||
for file in $pkg_file $snap_file; do
|
||||
@ -188,6 +188,52 @@ add_task ()
|
||||
done
|
||||
}
|
||||
|
||||
add_task_pool ()
|
||||
{
|
||||
local pass="$1"
|
||||
local task="$2"
|
||||
shift
|
||||
local task_pkgs
|
||||
|
||||
if [ ! -e config/germinate-output/structure ]; then
|
||||
echo "add_task_pool too soon" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -pv config/{gnupg,indices,hooks}
|
||||
for component in $COMPONENTS; do
|
||||
(cd config/indices && \
|
||||
wget $MIRROR/indices/override.$SUITE.$component && \
|
||||
wget $MIRROR/indices/override.$SUITE.extra.$component \
|
||||
)
|
||||
done
|
||||
|
||||
for task; do
|
||||
task_pkgs=$(./config/expand-task config/germinate-output $FLAVOUR $task packages $ARCH)
|
||||
echo "!!!!!" >&2
|
||||
echo $FLAVOUR >&2
|
||||
echo $task >&2
|
||||
echo $task_pkgs >&2
|
||||
cat > config/hooks/100-livefs-pool.chroot <<EOF
|
||||
#!/bin/sh
|
||||
case \${PASS:-} in
|
||||
*.live)
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
mkdir -p /var/lib/livefs-pool/pool/ &&
|
||||
cd /var/lib/livefs-pool/pool/ &&
|
||||
echo "Downloading $task_pkgs" &&
|
||||
apt-get -y download $task_pkgs &&
|
||||
echo "Download of pool complete"
|
||||
EOF
|
||||
chmod +x config/hooks/100-livefs-pool.chroot
|
||||
done
|
||||
}
|
||||
|
||||
add_package ()
|
||||
{
|
||||
# Adds a pass named pass_name composed of packages to install
|
||||
@ -720,6 +766,9 @@ common_layered_desktop_image() {
|
||||
add_task ${LIVE_PREFIX}live "$LIVE_TASK"
|
||||
add_package ${LIVE_PREFIX}live casper
|
||||
|
||||
# Add the ship-live seed to /var/lib/livefs-pool
|
||||
add_task_pool ${LIVE_PREFIX}live ship-live
|
||||
|
||||
# If Dracut is enabled, ensure it is removed in the live layer
|
||||
# casper still depends on initramfs-tools
|
||||
if [ -n "$NEEDS_DRACUT" ]; then
|
||||
|
@ -10,6 +10,7 @@ p.add_argument('output_dir')
|
||||
p.add_argument('flavour')
|
||||
p.add_argument('task')
|
||||
p.add_argument('what', choices=['packages', 'snaps'])
|
||||
p.add_argument('arch', default='amd64')
|
||||
args = p.parse_args()
|
||||
|
||||
if args.what == 'snaps':
|
||||
@ -66,7 +67,27 @@ def getTaskName(task_headers, flavour, seedname):
|
||||
return seedname
|
||||
|
||||
|
||||
for seedtext in glob.glob(f'{args.output_dir}/*.seedtext'):
|
||||
# An item in a Germinate seed
|
||||
packages = set()
|
||||
seed_pattern = re.compile(r'^\s*\*\s+(?P<raw_pkg>.+?)(?=\s+(?:\[[^\]]+\]|#)|\s*$)(?:\s+\[(?P<arch>[^\]]+)\])?(?:\s+#.*)?\s*$')
|
||||
def print_seed_item(line):
|
||||
m = seed_pattern.match(line)
|
||||
|
||||
if m:
|
||||
arch_tag = m.group("arch")
|
||||
if arch_tag and args.arch not in arch_tag.split():
|
||||
return
|
||||
|
||||
raw_pkg = m.group("raw_pkg")
|
||||
if args.what == "snaps" and "(classic)" in raw_pkg:
|
||||
raw_pkg += "/classic"
|
||||
|
||||
# Remove e.g. surrounding slashes from entries
|
||||
printable_m = re.match(r"^/\^(.*)\$/?$", raw_pkg)
|
||||
packages.add(m.group(1) if printable_m else raw_pkg)
|
||||
|
||||
passed = False
|
||||
for seedtext in glob.glob(f"{args.output_dir}/*.seedtext"):
|
||||
hs = parseTaskHeaders(open(seedtext))
|
||||
if not hs:
|
||||
continue
|
||||
@ -75,12 +96,16 @@ for seedtext in glob.glob(f'{args.output_dir}/*.seedtext'):
|
||||
if tn != args.task:
|
||||
continue
|
||||
for seed in getTaskSeeds(hs, seedname):
|
||||
for line in open(f'{args.output_dir}/{seed}{ext}'):
|
||||
if re.match('^[a-z0-9]', line):
|
||||
name = line.split()[0]
|
||||
if args.what == 'snaps' and '(classic)' in line:
|
||||
name += '/classic'
|
||||
print(name)
|
||||
for line in open(f"{args.output_dir}/{seed}{ext}"):
|
||||
print_seed_item(line)
|
||||
passed = True
|
||||
break
|
||||
else:
|
||||
raise Exception("did not find task %r" % (args.task,))
|
||||
|
||||
if not passed and not packages:
|
||||
if args.task != "ship-live" or not os.path.exists(f"{args.output_dir}/{args.task}.seedtext"):
|
||||
raise Exception(f"Unable to find {args.task}")
|
||||
|
||||
for line in open(f"{args.output_dir}/{args.task}.seedtext"):
|
||||
print_seed_item(line)
|
||||
|
||||
print(" ".join(packages))
|
||||
|
Loading…
x
Reference in New Issue
Block a user