From 3e34faaa7046ff86cedc3ffd52ebc130c938adde Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lallement Date: Wed, 31 Oct 2018 16:37:32 +0100 Subject: [PATCH] Moved add_task and add_package to functions in order to be available in hooks --- live-build/auto/config | 40 +--------------------------------------- live-build/functions | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index 65f5df56..2ec19bfe 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -37,45 +37,7 @@ cp -af /usr/share/livecd-rootfs/live-build/snap-seed-parse.py config/snap-seed-p mkdir -p config/package-lists -add_task () -{ - local pass="$1" - shift - local task - - # 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. - - 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" - done -} - -add_package () -{ - local pass="$1" - shift - local pkg - - for pkg; do - echo "$pkg" >> "config/package-lists/livecd-rootfs.list.chroot_$pass" - done -} +. config/functions OPTS= COMPONENTS= diff --git a/live-build/functions b/live-build/functions index 2cbe3e02..fe6da6d9 100644 --- a/live-build/functions +++ b/live-build/functions @@ -501,3 +501,44 @@ snap_preseed() { fi _snap_preseed $CHROOT_ROOT $SNAP $CHANNEL } + + +add_task () +{ + local pass="$1" + shift + local task + + # 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. + + 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" + done +} + +add_package () +{ + local pass="$1" + shift + local pkg + + for pkg; do + echo "$pkg" >> "config/package-lists/livecd-rootfs.list.chroot_$pass" + done +}