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

Message ID 20241007104713.70373-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, 10:47 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>
---
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Felix Moessbauer Oct. 7, 2024, 11:12 a.m. UTC | #1
On Mon, 2024-10-07 at 12:47 +0200, alexander.heinisch@siemens.com
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`

Thanks!

Acked-by: Felix Moessbauer <felix.moessbauer@siemens.com>

> 
> Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
> ---
>  meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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
>
Jan Kiszka Oct. 7, 2024, 11:13 a.m. UTC | #2
On 07.10.24 12:47, alexander.heinisch@siemens.com 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>
> ---
>  meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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)}"
>  

Nicely minimal invasive - but now you should also document this, just
like ISAR_APT_SNAPSHOT_TIMESTAMP. And naming should be aligned.

Jan

>  inherit deb-dl-dir
>
alexander.heinisch Oct. 7, 2024, 11:21 a.m. UTC | #3
> Nicely minimal invasive - but now you should also document this, just like > ISAR_APT_SNAPSHOT_TIMESTAMP. And naming should be aligned.

Sure. Just wanted to get feedback early, before spending much time on docs 😊.
Jan Kiszka Oct. 7, 2024, 11:27 a.m. UTC | #4
On 07.10.24 13:21, Heinisch, Alexander (T CED SES-AT) wrote:
>> Nicely minimal invasive - but now you should also document this, just like > ISAR_APT_SNAPSHOT_TIMESTAMP. And naming should be aligned.
> 
> Sure. Just wanted to get feedback early, before spending much time on docs 😊.

It will definitely help with the kconfig approach, avoid non-working
conversion attempts there.

Let's just rename the var to ISAR_APT_SNAPSHOT_DATE and also clarify in
the doc that to masks ISAR_APT_SNAPSHOT_TIMESTAMP when both are provided.

Jan
alexander.heinisch Oct. 7, 2024, 11:30 a.m. UTC | #5
> It will definitely help with the kconfig approach, avoid non-working conversion attempts there.
>
> Let's just rename the var to ISAR_APT_SNAPSHOT_DATE and also clarify in the doc that to masks ISAR_APT_SNAPSHOT_TIMESTAMP when both are provided.

Renaming APT_SNAPSHOT_DATE makes sense!, also won't break downstream! Will add this.

BR Alexander

Patch

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