[6/6] meta: Do not update isar-apt during sbuild chroot prepare

Message ID 20250221154843.515037-7-amikan@ilbers.de
State New
Headers show
Series Fix essentials rebuild and cover with CI | expand

Commit Message

Anton Mikanovich Feb. 21, 2025, 3:48 p.m. UTC
After moving to manual isar-apt update during package build in 0e846829
there is no need in obtaining isar-apt package list during sbuild
rootfs prepare. Moreover, it can results in out of sync between the
data in /var/lib/apt/lists and local isar-apt copy of the recipe.
In case of rebuilding the package already included into sbuild chroot
this sync lost can raise 'File not found' issues with updated debs.
Remove isar-apt update during sbuild chroot prepare and do it later
for every package separately based on local isar-apt copy.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Jan Kiszka Feb. 21, 2025, 4:34 p.m. UTC | #1
On 21.02.25 16:48, Anton Mikanovich wrote:
> After moving to manual isar-apt update during package build in 0e846829
> there is no need in obtaining isar-apt package list during sbuild
> rootfs prepare. Moreover, it can results in out of sync between the
> data in /var/lib/apt/lists and local isar-apt copy of the recipe.
> In case of rebuilding the package already included into sbuild chroot
> this sync lost can raise 'File not found' issues with updated debs.

Why is the sync we do inside sbuild not curing this de-synchronization?

> Remove isar-apt update during sbuild chroot prepare and do it later
> for every package separately based on local isar-apt copy.

What about building a custom schroot that should have a self-built,
isar-apt-originated package included? Won't that fail now?

Practically, users could just pull such packages whenever they build
something in that custom schroot, but having to handle self-built
packages differently than those coming from external repos is at least
not intuitive.

Jan
Anton Mikanovich March 3, 2025, 10:13 a.m. UTC | #2
21/02/2025 18:34, Jan Kiszka wrote:
> On 21.02.25 16:48, Anton Mikanovich wrote:
>> After moving to manual isar-apt update during package build in 0e846829
>> there is no need in obtaining isar-apt package list during sbuild
>> rootfs prepare. Moreover, it can results in out of sync between the
>> data in /var/lib/apt/lists and local isar-apt copy of the recipe.
>> In case of rebuilding the package already included into sbuild chroot
>> this sync lost can raise 'File not found' issues with updated debs.
> Why is the sync we do inside sbuild not curing this de-synchronization?
That's a good question I was unable to answer: if /var/lib/apt/lists has an
information about the package which not exists in the repo, apt still 
tries to
install that package.
>> Remove isar-apt update during sbuild chroot prepare and do it later
>> for every package separately based on local isar-apt copy.
> What about building a custom schroot that should have a self-built,
> isar-apt-originated package included? Won't that fail now?

If it is the case covered with hello-isar application - it is still working.
Isar-apt is populated with libhello-dev because of fixed deps, then manual
apt-get update will be performed on isar-apt only inside sbuild hook, so
libhello-dev will be installed into schroot for hello-isar building.

> Practically, users could just pull such packages whenever they build
> something in that custom schroot, but having to handle self-built
> packages differently than those coming from external repos is at least
> not intuitive.
>
> Jan
>
Jan Kiszka March 3, 2025, 2:32 p.m. UTC | #3
On 03.03.25 11:13, Anton Mikanovich wrote:
> 21/02/2025 18:34, Jan Kiszka wrote:
>> On 21.02.25 16:48, Anton Mikanovich wrote:
>>> After moving to manual isar-apt update during package build in 0e846829
>>> there is no need in obtaining isar-apt package list during sbuild
>>> rootfs prepare. Moreover, it can results in out of sync between the
>>> data in /var/lib/apt/lists and local isar-apt copy of the recipe.
>>> In case of rebuilding the package already included into sbuild chroot
>>> this sync lost can raise 'File not found' issues with updated debs.
>> Why is the sync we do inside sbuild not curing this de-synchronization?
> That's a good question I was unable to answer: if /var/lib/apt/lists has an
> information about the package which not exists in the repo, apt still
> tries to
> install that package.
>>> Remove isar-apt update during sbuild chroot prepare and do it later
>>> for every package separately based on local isar-apt copy.
>> What about building a custom schroot that should have a self-built,
>> isar-apt-originated package included? Won't that fail now?
> 
> If it is the case covered with hello-isar application - it is still
> working.
> Isar-apt is populated with libhello-dev because of fixed deps, then manual
> apt-get update will be performed on isar-apt only inside sbuild hook, so
> libhello-dev will be installed into schroot for hello-isar building.
> 

But will the custom schroot already contain libhello-dev, or will
schroot simply install while setting up the build env for hello-isar?
I'm referring to SBUILD_CHROOT_PREINSTALL_EXTRA for self-built packages.

Jan
Anton Mikanovich March 3, 2025, 3:16 p.m. UTC | #4
03/03/2025 16:32, Jan Kiszka wrote:
> But will the custom schroot already contain libhello-dev, or will
> schroot simply install while setting up the build env for hello-isar?
> I'm referring to SBUILD_CHROOT_PREINSTALL_EXTRA for self-built packages.
>
> Jan
>
No, using custom packages in SBUILD_CHROOT_PREINSTALL_EXTRA is not covered
in CI (but should be) and probably will not work as expected.
I'm going back to the fix.

Patch

diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
index 6478d3a6..f5d1f1dd 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
@@ -1,7 +1,10 @@ 
 # Common part for build chroot filesystem.
 #
 # This software is a part of ISAR.
-# Copyright (C) 2015-2021 ilbers GmbH
+# Copyright (C) 2015-2025 ilbers GmbH
+# Copyright (C) 2023-2025 Siemens AG
+#
+# SPDX-License-Identifier: MIT
 
 LICENSE = "gpl-2.0"
 LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
@@ -56,6 +59,9 @@  SBUILD_CHROOT_DIR = "${WORKDIR}/rootfs"
 ROOTFSDIR = "${SBUILD_CHROOT_DIR}"
 ROOTFS_PACKAGES = "${SBUILD_CHROOT_PREINSTALL}"
 
+# We need isar-apt configured but not updated yet
+rootfs_install_pkgs_download[isar-apt-lock] = ""
+ROOTFS_INSTALL_COMMAND:remove = "rootfs_install_pkgs_update"
 ROOTFS_POSTPROCESS_COMMAND:remove = "rootfs_cleanup_isar_apt"
 
 # Do not cleanup base-apt