mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-05-04 23:31:31 +00:00
Moved back config helper functions to config
Moved back config specific functions from functions to config
This commit is contained in:
parent
42d1d77612
commit
3b21bd9a2e
@ -59,6 +59,98 @@ BINARY_HOOKS=
|
|||||||
|
|
||||||
APT_OPTIONS=" --yes -oDebug::pkgDepCache::AutoInstall=yes "
|
APT_OPTIONS=" --yes -oDebug::pkgDepCache::AutoInstall=yes "
|
||||||
|
|
||||||
|
add_task ()
|
||||||
|
{
|
||||||
|
local pass="$1"
|
||||||
|
shift
|
||||||
|
local task
|
||||||
|
local snap_list_file
|
||||||
|
local snap_list_files
|
||||||
|
local curseed
|
||||||
|
|
||||||
|
# The removal of direct task installation support from live-build
|
||||||
|
# poses some problems. If the chroot has multiarch configured - for
|
||||||
|
# example, if we're building for amd64 - then dumpavail will show
|
||||||
|
# foreign-architecture packages which will have their own Task
|
||||||
|
# lines, but which we don't want to install. (Compare
|
||||||
|
# PackageContainerInterface::FromTask in apt, which restricts task
|
||||||
|
# expansion to the native architecture.) We therefore restrict our
|
||||||
|
# search to stanzas with Architecture: $ARCH or all.
|
||||||
|
#
|
||||||
|
# However, even this may not be accurate enough. At the moment I
|
||||||
|
# have no idea what happens if an Architecture: all package has
|
||||||
|
# different Task fields on different architectures. This is
|
||||||
|
# probably a lurking timebomb that we need to fix. In the meantime,
|
||||||
|
# the Architecture restriction at least saves us from abject
|
||||||
|
# failure.
|
||||||
|
#
|
||||||
|
# We want as well to grab the snap list for each PASS. Resolve for all
|
||||||
|
# given task, and deduplicate them to generate snaps for the PASS.
|
||||||
|
|
||||||
|
for task; do
|
||||||
|
# We need a ridiculous number of backslashes to protect
|
||||||
|
# parentheses from eval.
|
||||||
|
echo "!chroot chroot apt-cache dumpavail | grep-dctrl -nsPackage \\\\\\( -XFArchitecture $ARCH -o -XFArchitecture all \\\\\\) -a -wFTask $task" >> "config/package-lists/livecd-rootfs.list.chroot_$pass"
|
||||||
|
|
||||||
|
curseed=$(seed_from_task ${task})
|
||||||
|
if [ -z "${curseed}" ]; then
|
||||||
|
echo "W: No seed matching task ${task}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
snap_list_file="config/package-lists/seed.${curseed}.snaplist.full"
|
||||||
|
snap_from_seed "${curseed}" $snap_list_file
|
||||||
|
if [ -e "$snap_list_file" ]; then
|
||||||
|
snap_list_files="${snap_list_files} $snap_list_file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# The snap list is one line, and could be duplicated between seeds via inheritance.
|
||||||
|
# Uniquely sort them and store them back in one line.
|
||||||
|
if [ -n "${snap_list_files}" ]; then
|
||||||
|
cat ${snap_list_files}|xargs -n1|sort -u > "config/package-lists/livecd-rootfs.snaplist.chroot_${pass}.full"
|
||||||
|
rm ${snap_list_files}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_package ()
|
||||||
|
{
|
||||||
|
local pass="$1"
|
||||||
|
shift
|
||||||
|
local pkg
|
||||||
|
|
||||||
|
for pkg; do
|
||||||
|
echo "$pkg" >> "config/package-lists/livecd-rootfs.list.chroot_$pass"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
add_chroot_hook ()
|
add_chroot_hook ()
|
||||||
{
|
{
|
||||||
CHROOT_HOOKS="${CHROOT_HOOKS:+$CHROOT_HOOKS }$1"
|
CHROOT_HOOKS="${CHROOT_HOOKS:+$CHROOT_HOOKS }$1"
|
||||||
|
@ -581,69 +581,6 @@ seed_from_task ()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add_task ()
|
|
||||||
{
|
|
||||||
local pass="$1"
|
|
||||||
shift
|
|
||||||
local task
|
|
||||||
local snap_list_file
|
|
||||||
local snap_list_files
|
|
||||||
local curseed
|
|
||||||
|
|
||||||
# The removal of direct task installation support from live-build
|
|
||||||
# poses some problems. If the chroot has multiarch configured - for
|
|
||||||
# example, if we're building for amd64 - then dumpavail will show
|
|
||||||
# foreign-architecture packages which will have their own Task
|
|
||||||
# lines, but which we don't want to install. (Compare
|
|
||||||
# PackageContainerInterface::FromTask in apt, which restricts task
|
|
||||||
# expansion to the native architecture.) We therefore restrict our
|
|
||||||
# search to stanzas with Architecture: $ARCH or all.
|
|
||||||
#
|
|
||||||
# However, even this may not be accurate enough. At the moment I
|
|
||||||
# have no idea what happens if an Architecture: all package has
|
|
||||||
# different Task fields on different architectures. This is
|
|
||||||
# probably a lurking timebomb that we need to fix. In the meantime,
|
|
||||||
# the Architecture restriction at least saves us from abject
|
|
||||||
# failure.
|
|
||||||
#
|
|
||||||
# We want as well to grab the snap list for each PASS. Resolve for all
|
|
||||||
# given task, and deduplicate them to generate snaps for the PASS.
|
|
||||||
|
|
||||||
for task; do
|
|
||||||
# We need a ridiculous number of backslashes to protect
|
|
||||||
# parentheses from eval.
|
|
||||||
echo "!chroot chroot apt-cache dumpavail | grep-dctrl -nsPackage \\\\\\( -XFArchitecture $ARCH -o -XFArchitecture all \\\\\\) -a -wFTask $task" >> "config/package-lists/livecd-rootfs.list.chroot_$pass"
|
|
||||||
|
|
||||||
curseed=$(seed_from_task ${task})
|
|
||||||
if [ -z "${curseed}" ]; then
|
|
||||||
echo "W: No seed matching task ${task}"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
snap_list_file="config/package-lists/seed.${curseed}.snaplist.full"
|
|
||||||
snap_from_seed "${curseed}" $snap_list_file
|
|
||||||
if [ -e "$snap_list_file" ]; then
|
|
||||||
snap_list_files="${snap_list_files} $snap_list_file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# The snap list is one line, and could be duplicated between seeds via inheritance.
|
|
||||||
# Uniquely sort them and store them back in one line.
|
|
||||||
if [ -n "${snap_list_files}" ]; then
|
|
||||||
cat ${snap_list_files}|xargs -n1|sort -u > "config/package-lists/livecd-rootfs.snaplist.chroot_${pass}.full"
|
|
||||||
rm ${snap_list_files}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
add_package ()
|
|
||||||
{
|
|
||||||
local pass="$1"
|
|
||||||
shift
|
|
||||||
local pkg
|
|
||||||
|
|
||||||
for pkg; do
|
|
||||||
echo "$pkg" >> "config/package-lists/livecd-rootfs.list.chroot_$pass"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
list_packages_from_seed () {
|
list_packages_from_seed () {
|
||||||
# Store all packages for a given seed, including its seed dependency
|
# Store all packages for a given seed, including its seed dependency
|
||||||
# $1: Name of the seed to expand to a package list
|
# $1: Name of the seed to expand to a package list
|
||||||
@ -655,35 +592,6 @@ list_packages_from_seed () {
|
|||||||
done|sort -u
|
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_package_lists() {
|
||||||
# Substract a package list from another
|
# Substract a package list from another
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user