meta: Allow to specify the snapshot date in the upstream format.

Message ID 20241007112745.92905-1-alexander.heinisch@siemens.com
State Superseded, archived
Headers show
Series meta: Allow to specify the snapshot date in the upstream format. | expand

Commit Message

alexander.heinisch Oct. 7, 2024, 11:27 a.m. UTC
From: Alexander Heinisch <alexander.heinisch@siemens.com>

Currently, it is only possible to specify a unix timestamp to resolve
the snapshot version used. Since this is not very user friendly, most
downstream projects put comments like `# 20240702T082400Z` next to the
snapshot assignment `ISAR_APT_SNAPSHOT_TIMESTAMP = ...`.

This patch makes it easier for users to specify the snapshot version
in a more natural way by `APT_SNAPSHOT_DATE = 20240702T082400Z`

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 doc/user_manual.md                                  | 3 ++-
 kas/opt/Kconfig                                     | 2 +-
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

Comments

Anton Mikanovich Oct. 7, 2024, 11:34 a.m. UTC | #1
07/10/2024 14:27, alexander.heinisch via isar-users wrote:
> From: Alexander Heinisch <alexander.heinisch@siemens.com>
>
> Currently, it is only possible to specify a unix timestamp to resolve
> the snapshot version used. Since this is not very user friendly, most
> downstream projects put comments like `# 20240702T082400Z` next to the
> snapshot assignment `ISAR_APT_SNAPSHOT_TIMESTAMP = ...`.
>
> This patch makes it easier for users to specify the snapshot version
> in a more natural way by `APT_SNAPSHOT_DATE = 20240702T082400Z`
>
> Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>

Please mark later patchset versions with v3, v4, etc, to make it easier
to track changes between patchset versions.

Patch

diff --git a/doc/user_manual.md b/doc/user_manual.md
index 706c74bf..bcfea5a0 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -435,7 +435,8 @@  Some other variables include:
  - `ISAR_USE_APT_SNAPSHOT` - Use a frozen apt snapshot instead of the live mirror. Optional.
    `ISAR_APT_DL_LIMIT` - Rate limit the apt fetching to n kB / s. Optional.
  - `DISTRO_APT_SNAPSHOT_PREMIRROR` - Similar to `DISTRO_APT_PREMIRRORS` but for a snapshot, pre-defined for supported distros.
- - `ISAR_APT_SNAPSHOT_TIMESTAMP` - Timestamp of the apt snapshot. Automatically derived from `SOURCE_DATE_EPOCH` if not overwritten.
+ - `ISAR_APT_SNAPSHOT_TIMESTAMP` - Unix timestamp of the apt snapshot. Automatically derived from `SOURCE_DATE_EPOCH` if not overwritten. (Consider `APT_SNAPSHOT_DATE` for a more user friendly format)
+ - `APT_SNAPSHOT_DATE` - Timestamp in upstream format (e.g. `20240702T082400Z`) of the apt snapshot. Automatically derived from `ISAR_APT_SNAPSHOT_TIMESTAMP`
  - `THIRD_PARTY_APT_KEYS` - List of gpg key URIs used to verify apt repos for apt installation after bootstrapping.
  - `FILESEXTRAPATHS` - The default directories BitBake uses when it processes recipes are initially defined by the FILESPATH variable. You can extend FILESPATH variable by using FILESEXTRAPATHS.
  - `FILESOVERRIDES` - A subset of OVERRIDES used by the build system for creating FILESPATH. The FILESOVERRIDES variable uses overrides to automatically extend the FILESPATH variable.
diff --git a/kas/opt/Kconfig b/kas/opt/Kconfig
index 65482e3a..802bb1a0 100644
--- a/kas/opt/Kconfig
+++ b/kas/opt/Kconfig
@@ -44,7 +44,7 @@  config USE_APT_SNAPSHOT
 	bool "Use the distros snapshot mirror"
 	depends on !MIRROR_DEBIAN && (DEBIAN_BUSTER || DEBIAN_BULLSEYE || DEBIAN_BOOKWORM || DEBIAN_TRIXIE || DEBIAN_SID || UBUNTU_FOCAL || UBUNTU_JAMMY)
 	help
-		Use a snapshot mirror for the selected distribution. The date is defined by ISAR_APT_SNAPSHOT_TIMESTAMP.
+		Use a snapshot mirror for the selected distribution. The date is defined by APT_SNAPSHOT_DATE.
 
 config KAS_INCLUDE_APT_SNAPSHOT
 	string
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 12f32ff0..125554e1 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -34,7 +34,7 @@  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')}"
 FILESEXTRAPATHS:append = ":${BBPATH}"
-APT_SNAPSHOT_DATE = "${@ get_apt_snapshot_date(d)}"
+APT_SNAPSHOT_DATE ?= "${@ get_apt_snapshot_date(d)}"
 
 inherit deb-dl-dir