mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-03-04 16:01:24 +00:00
Support for positive and negative sublayers
Calculate positive and negative package lists for sublayers
This commit is contained in:
parent
a9908e0c9d
commit
f3dadf1091
@ -311,7 +311,13 @@ case $PROJECT in
|
||||
layered)
|
||||
PASSES="install-minimal install live"
|
||||
add_task install-minimal minimal standard ubuntu-desktop-minimal
|
||||
# LANG PASS for minimal
|
||||
add_layered_pass_delta install-minimal desktop-minimal-default-languages '^desktop-minimal-(?!default-languages)[^.]+$'
|
||||
add_layered_pass_delta install-minimal desktop-minimal-default-languages 'nolangpacks' # none (if no default langpack is selected)
|
||||
add_task install ubuntu-desktop
|
||||
# LANG PASS for install
|
||||
add_layered_pass_delta install desktop-default-languages '^desktop-(?!default-languages|minimal|common)[^.]+$'
|
||||
add_layered_pass_delta install desktop-default-languages 'nolangpacks' # none (if no default langpack is selected)
|
||||
LIVE_TASK='ubuntu-live'
|
||||
;;
|
||||
*)
|
||||
|
@ -643,3 +643,59 @@ add_package ()
|
||||
echo "$pkg" >> "config/package-lists/livecd-rootfs.list.chroot_$pass"
|
||||
done
|
||||
}
|
||||
|
||||
list_packages_from_seed () {
|
||||
# Store all packages for a given seed, including its seed dependency
|
||||
# $1: Name of the seed to expand to a package list
|
||||
|
||||
local all_seeds="$(inheritance $1)"
|
||||
|
||||
for seed in $all_seeds; do
|
||||
head -n-2 config/germinate-output/${seed}.seed|tail -n+3|awk '{print $1}'
|
||||
done|sort -u
|
||||
}
|
||||
|
||||
add_layered_pass() {
|
||||
# Add a layer to an existing pass based on seeds matching a regexp
|
||||
# $1 base pass
|
||||
# $2 seeds (regexp)
|
||||
|
||||
for seed in $(ls config/germinate-output/|grep -P "$2"); do
|
||||
pass=${1}_${seed}
|
||||
list_packages_from_seed ${seed} >> config/package-lists/livecd-rootfs.list.chroot_$pass
|
||||
done
|
||||
}
|
||||
|
||||
add_layered_pass_delta() {
|
||||
# Add a layer to an existing pass based on delta between seeds matching a regexp and a base seed
|
||||
# $1 base pass
|
||||
# $2 base seed
|
||||
# $3 seeds to remove from base seed (regexp). If empty, a no-<base-seed> sublayer is generated.
|
||||
|
||||
local seed_regexp="$3"
|
||||
if [ -z "${seed_regexp}" ]; then
|
||||
substract_package_lists ${2} "" >> config/package-lists/livecd-rootfs.removal-list.chroot_${1}_no-{$2}
|
||||
return
|
||||
fi
|
||||
|
||||
for seed in $(ls config/germinate-output/|grep -P "$seed_regexp"); do
|
||||
pass=${1}_${seed}
|
||||
substract_package_lists ${2} ${seed} >> config/package-lists/livecd-rootfs.removal-list.chroot_$pass
|
||||
done
|
||||
}
|
||||
|
||||
substract_package_lists() {
|
||||
# Substract a package list from another
|
||||
#
|
||||
# $1 source package list
|
||||
# $2 Package list to substract from source package list
|
||||
local list1=$(mktemp)
|
||||
local list2=$(mktemp)
|
||||
|
||||
list_packages_from_seed $1 > list1
|
||||
list_packages_from_seed $2 > list2
|
||||
comm -23 list1 list2
|
||||
|
||||
rm list1
|
||||
rm list2
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ create_chroot_pass() {
|
||||
|
||||
# Handle direct sublayer of current one
|
||||
# Extract the name of the pass corresponding to the sublayer
|
||||
for subpass in $(ls config/package-lists/*.list.chroot_${pass}_* 2>/dev/null | sed -e "s/.*list\.chroot_\(${pass}_[^_]\+\).*/\1/"); do
|
||||
for subpass in $(ls config/package-lists/*list.chroot_${pass}_* 2>/dev/null | sed -e "s/.*list\.chroot_\(${pass}_[^_]\+\).*/\1/"); do
|
||||
lowerlayers_for_subpass="chroot.${pass}:${lowerlayers}"
|
||||
lowerlayers_for_subpass="${lowerlayers_for_subpass%:}"
|
||||
create_chroot_pass "${subpass}" "${pass}" "${lowerlayers_for_subpass}" "" ${*}
|
||||
|
Loading…
x
Reference in New Issue
Block a user