[4/4] bootstrap: do not leave 50isar.conf in final rootfss

Message ID 20220205151528.9199-5-henning.schild@siemens.com
State Accepted, archived
Headers show
Series apt configuration fixes | expand

Commit Message

Henning Schild Feb. 5, 2022, 5:15 a.m. UTC
This commits makes sure we do not leave a file around which is really
only meant for building. In case people will want to "apt-get" later
they might have their own ideas on how to deal with Recommends and
Suggests. And if so they should write a package to configure apt for
their images.

So it cleans up a file not owned by any package, and unifies the way apt
configuration for the build is done.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/image.bbclass                           | 2 +-
 meta/classes/rootfs.bbclass                          | 7 +++++--
 meta/recipes-core/isar-bootstrap/files/isar-apt.conf | 2 --
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc  | 5 +----
 4 files changed, 7 insertions(+), 9 deletions(-)
 delete mode 100644 meta/recipes-core/isar-bootstrap/files/isar-apt.conf

Patch

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 9d783d80a228..d44298bcdd7c 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -221,7 +221,7 @@  do_rootfs_finalize() {
         rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/isar-apt.list"
         rm -f "${ROOTFSDIR}/etc/apt/preferences.d/isar-apt"
         rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
-        rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/80isar"
+        rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar"
 
         mv "${ROOTFSDIR}/etc/apt/sources-list" \
             "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 766a2170f43b..e8649975a333 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -105,8 +105,11 @@  rootfs_configure_apt() {
     set -e
 
     mkdir -p '${ROOTFSDIR}/etc/apt/apt.conf.d'
-    echo 'APT::Acquire::Retries "3";' > \
-        '${ROOTFSDIR}/etc/apt/apt.conf.d/80isar'
+    {
+        echo 'APT::Acquire::Retries "3";'
+        echo 'APT::Install-Recommends "0";'
+        echo 'APT::Install-Suggests "0";'
+    } > '${ROOTFSDIR}/etc/apt/apt.conf.d/50isar'
 EOSUDO
 }
 
diff --git a/meta/recipes-core/isar-bootstrap/files/isar-apt.conf b/meta/recipes-core/isar-bootstrap/files/isar-apt.conf
deleted file mode 100644
index a62feb1722d6..000000000000
--- a/meta/recipes-core/isar-bootstrap/files/isar-apt.conf
+++ /dev/null
@@ -1,2 +0,0 @@ 
-APT::Install-Recommends "0";
-APT::Install-Suggests "0";
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 26205192ed9e..2f483f5a1b6a 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -9,7 +9,6 @@  LICENSE = "gpl-2.0"
 LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
 FILESPATH_prepend := "${THISDIR}/files:"
 SRC_URI = " \
-    file://isar-apt.conf \
     file://isar-apt-fallback.conf \
     file://locale \
     file://chroot-setup.sh"
@@ -327,9 +326,6 @@  do_bootstrap() {
         install -v -m644 "${APTSRCS_INIT}" "${ROOTFSDIR}/etc/apt/sources-list"
         rm -f "${ROOTFSDIR}/etc/apt/sources.list"
         rm -rf "${ROOTFSDIR}/var/lib/apt/lists/"*
-        mkdir -p "${ROOTFSDIR}/etc/apt/apt.conf.d"
-        install -v -m644 "${WORKDIR}/isar-apt.conf" \
-                         "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf"
         find ${APT_KEYS_DIR}/ -type f | while read keyfile
         do
             MY_GPGHOME="$(chroot "${ROOTFSDIR}" mktemp -d /tmp/gpghomeXXXXXXXXXX)"
@@ -348,6 +344,7 @@  do_bootstrap() {
         done
 
         if [ "${@get_distro_suite(d)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then
+            mkdir -p "${ROOTFSDIR}/etc/apt/apt.conf.d"
             install -v -m644 "${WORKDIR}/isar-apt-fallback.conf" \
                              "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf"
         fi