public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: alexander.heinisch@siemens.com,
	Felix Moessbauer <felix.moessbauer@siemens.com>,
	Clara Kowalsky <clara.kowalsky@siemens.com>
Subject: [PATCH 2/2] fix: derive distribution snapshot date from provided value
Date: Mon,  6 Oct 2025 16:12:27 +0200	[thread overview]
Message-ID: <20251006141227.1017941-2-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20251006141227.1017941-1-felix.moessbauer@siemens.com>

The final snapshot timestamp can be specified either by setting
ISAR_APT_SNAPSHOT_TIMESTAMP or by setting the otherwise derived variable
ISAR_APT_SNAPSHOT_DATE. However, the corresponding distribution specific
flag (e.g. [security]) always reads the value from the TIMESTAMP
component, hence if only ISAR_APT_SNAPSHOT_DATE is set, the date for the
security distribution is still computed from the
ISAR_APT_SNAPSHOT_TIMESTAMP which itself is derived from the source date
epoch.

By that, the timestamp of the security component was wrong if only
ISAR_APT_SNAPSHOT_DATE is set but not ISAR_APT_SNAPSHOT_DATE[security].

We fix it by tracking where the value comes from and set the flagged
version according to the parent value if not set.

Fixes: 394e9540 ("snapshots: add option to use separate timestamp ...")
Reported-by: Clara Kowalsky <clara.kowalsky@siemens.com>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta-isar/conf/distro/ubuntu-common.inc |  2 +-
 meta/classes/bootstrap.bbclass          | 11 +++++++++--
 meta/conf/distro/debian-common.conf     |  4 ++--
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/meta-isar/conf/distro/ubuntu-common.inc b/meta-isar/conf/distro/ubuntu-common.inc
index 88a3b4f0..f1e8a1d6 100644
--- a/meta-isar/conf/distro/ubuntu-common.inc
+++ b/meta-isar/conf/distro/ubuntu-common.inc
@@ -44,4 +44,4 @@ SYSTEMD_BOOTLOADER_INSTALL:focal = "systemd:${DISTRO_ARCH}"
 SYSTEMD_BOOTLOADER_INSTALL:jammy = "systemd:${DISTRO_ARCH}"
 
 # snapshot mirror for reproducible builds
-DISTRO_APT_SNAPSHOT_PREMIRROR ??= "(http|https)://archive.ubuntu.com/(.*) https://snapshot.ubuntu.com/\2/${ISAR_APT_SNAPSHOT_DATE}\n"
+DISTRO_APT_SNAPSHOT_PREMIRROR ??= "(http|https)://archive.ubuntu.com/(.*) https://snapshot.ubuntu.com/\2/${ISAR_APT_SNAPSHOT_DATE_INTERNAL}\n"
diff --git a/meta/classes/bootstrap.bbclass b/meta/classes/bootstrap.bbclass
index 64702d5d..03014cb8 100644
--- a/meta/classes/bootstrap.bbclass
+++ b/meta/classes/bootstrap.bbclass
@@ -27,8 +27,9 @@ DISTRO_VARS_PREFIX ?= "${@'HOST_' if bb.utils.to_boolean(d.getVar('BOOTSTRAP_FOR
 BOOTSTRAP_DISTRO = "${@d.getVar('HOST_DISTRO' if bb.utils.to_boolean(d.getVar('BOOTSTRAP_FOR_HOST')) else 'DISTRO')}"
 BOOTSTRAP_BASE_DISTRO = "${@d.getVar('HOST_BASE_DISTRO' if bb.utils.to_boolean(d.getVar('BOOTSTRAP_FOR_HOST')) else 'BASE_DISTRO')}"
 BOOTSTRAP_DISTRO_ARCH = "${@d.getVar('HOST_ARCH' if bb.utils.to_boolean(d.getVar('BOOTSTRAP_FOR_HOST')) else 'DISTRO_ARCH')}"
-ISAR_APT_SNAPSHOT_DATE ?= "${@ get_isar_apt_snapshot_date(d)}"
-ISAR_APT_SNAPSHOT_DATE[security] ?= "${@ get_isar_apt_snapshot_date(d, 'security')}"
+# use internal variables to track where the value comes from
+ISAR_APT_SNAPSHOT_DATE_INTERNAL ?= "${@ get_isar_apt_snapshot_date(d)}"
+ISAR_APT_SNAPSHOT_DATE_INTERNAL[security] ?= "${@ get_isar_apt_snapshot_date(d, 'security')}"
 
 python () {
     distro_bootstrap_keys = (d.getVar("DISTRO_BOOTSTRAP_KEYS") or "").split()
@@ -104,6 +105,12 @@ def parse_aptsources_list_line(source_list_line):
 
 def get_isar_apt_snapshot_date(d, dist=None):
     import time
+    snapshot_date = d.getVar('ISAR_APT_SNAPSHOT_DATE')
+    if dist:
+        snapshot_date = d.getVarFlag('ISAR_APT_SNAPSHOT_DATE', dist) or snapshot_date
+    if snapshot_date:
+        return snapshot_date
+    # no ISAR_APT_SNAPSHOT_DATE set, compute from timestamp
     source_date_epoch = d.getVar('ISAR_APT_SNAPSHOT_TIMESTAMP')
     if dist:
         source_date_epoch = d.getVarFlag('ISAR_APT_SNAPSHOT_TIMESTAMP', dist) or source_date_epoch
diff --git a/meta/conf/distro/debian-common.conf b/meta/conf/distro/debian-common.conf
index 92daddc3..cd72837a 100644
--- a/meta/conf/distro/debian-common.conf
+++ b/meta/conf/distro/debian-common.conf
@@ -45,6 +45,6 @@ DISTRO_BOOTSTRAP_BASE_PACKAGES:append:bullseye = " usrmerge"
 
 # snapshot mirror for reproducible builds
 DISTRO_APT_SNAPSHOT_PREMIRROR ??= " \
-    deb.debian.org/(debian-security)/? snapshot.debian.org/archive/\1/${@d.getVarFlag('ISAR_APT_SNAPSHOT_DATE', 'security', expand=False)}\n \
-    deb.debian.org/(.*)/? snapshot.debian.org/archive/\1/${ISAR_APT_SNAPSHOT_DATE}\n \
+    deb.debian.org/(debian-security)/? snapshot.debian.org/archive/\1/${@d.getVarFlag('ISAR_APT_SNAPSHOT_DATE_INTERNAL', 'security', expand=False)}\n \
+    deb.debian.org/(.*)/? snapshot.debian.org/archive/\1/${ISAR_APT_SNAPSHOT_DATE_INTERNAL}\n \
 "
-- 
2.51.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20251006141227.1017941-2-felix.moessbauer%40siemens.com.

  reply	other threads:[~2025-10-06 14:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-06 14:12 [PATCH 1/2] fix: lazy expand ISAR_APT_SNAPSHOT_DATE[flag] 'Felix Moessbauer' via isar-users
2025-10-06 14:12 ` 'Felix Moessbauer' via isar-users [this message]
2025-10-07 10:39 ` 'Florian Bezdeka' via isar-users
2025-10-07 14:39   ` 'MOESSBAUER, Felix' via isar-users
2025-10-07 14:57     ` 'Florian Bezdeka' via isar-users
2025-10-07 15:20       ` 'MOESSBAUER, Felix' via isar-users
2025-10-10 16:00 ` Zhihang Wei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251006141227.1017941-2-felix.moessbauer@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=alexander.heinisch@siemens.com \
    --cc=clara.kowalsky@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox