[1/3] Added DISTRO_APT_SNAPSHOT_PREMIRROR_BASE to specify the base-url of the mirror used.

Message ID 20240927190650.128263-2-alexander.heinisch@siemens.com
State Under Review
Headers show
Series Added support for apt caching | expand

Commit Message

alexander.heinisch Sept. 27, 2024, 7:06 p.m. UTC
From: Alexander Heinisch <alexander.heinisch@siemens.com>

This enables the use of local caches like apt-cache-ng when using
isar's snapshot facility.
e.g. DISTRO_APT_SNAPSHOT_PREMIRROR_BASE=localhost:3142/snapshot.debian.org

Note: When setting the variable from the environment make sure you add it
to the kas file as follows. Make sure the default is null.
```
env:
  DISTRO_APT_SNAPSHOT_PREMIRROR_BASE: null
```

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 meta-isar/conf/distro/ubuntu-common.inc | 3 ++-
 meta/conf/distro/debian-common.conf     | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Jan Kiszka Oct. 1, 2024, 3:18 p.m. UTC | #1
On 27.09.24 21:06, alexander.heinisch via isar-users wrote:
> From: Alexander Heinisch <alexander.heinisch@siemens.com>
> 
> This enables the use of local caches like apt-cache-ng when using
> isar's snapshot facility.
> e.g. DISTRO_APT_SNAPSHOT_PREMIRROR_BASE=localhost:3142/snapshot.debian.org

Why "BASE"? Also with regular PREMIRROR, you do not need to rewrite the
whole URL, thus this is also with some "BASE" semantic. Just trying to
make the name shorter.

Jan

> 
> Note: When setting the variable from the environment make sure you add it
> to the kas file as follows. Make sure the default is null.
> ```
> env:
>   DISTRO_APT_SNAPSHOT_PREMIRROR_BASE: null
> ```
> 
> Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
> ---
>  meta-isar/conf/distro/ubuntu-common.inc | 3 ++-
>  meta/conf/distro/debian-common.conf     | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/meta-isar/conf/distro/ubuntu-common.inc b/meta-isar/conf/distro/ubuntu-common.inc
> index 232bee35..2c2f02f8 100644
> --- a/meta-isar/conf/distro/ubuntu-common.inc
> +++ b/meta-isar/conf/distro/ubuntu-common.inc
> @@ -37,4 +37,5 @@ 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/${APT_SNAPSHOT_DATE}/\n"
> +DISTRO_APT_SNAPSHOT_PREMIRROR_BASE ??= "snapshot.ubuntu.com"
> +DISTRO_APT_SNAPSHOT_PREMIRROR ??= "(http|https)://archive.ubuntu.com/(.*) https://${DISTRO_APT_SNAPSHOT_PREMIRROR_BASE}/\2/${APT_SNAPSHOT_DATE}/\n"
> diff --git a/meta/conf/distro/debian-common.conf b/meta/conf/distro/debian-common.conf
> index 8c6a3f63..de9e6933 100644
> --- a/meta/conf/distro/debian-common.conf
> +++ b/meta/conf/distro/debian-common.conf
> @@ -40,4 +40,5 @@ COMPAT_DISTRO_ARCH:amd64 = "i386"
>  COMPAT_DISTRO_ARCH:arm64 = "armhf"
>  
>  # snapshot mirror for reproducible builds
> -DISTRO_APT_SNAPSHOT_PREMIRROR ??= "deb.debian.org/(.*) snapshot.debian.org/archive/\1/${APT_SNAPSHOT_DATE}/\n"
> +DISTRO_APT_SNAPSHOT_PREMIRROR_BASE ??= "snapshot.debian.org"
> +DISTRO_APT_SNAPSHOT_PREMIRROR ??= "deb.debian.org/(.*) ${DISTRO_APT_SNAPSHOT_PREMIRROR_BASE}/archive/\1/${APT_SNAPSHOT_DATE}/\n"

Patch

diff --git a/meta-isar/conf/distro/ubuntu-common.inc b/meta-isar/conf/distro/ubuntu-common.inc
index 232bee35..2c2f02f8 100644
--- a/meta-isar/conf/distro/ubuntu-common.inc
+++ b/meta-isar/conf/distro/ubuntu-common.inc
@@ -37,4 +37,5 @@  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/${APT_SNAPSHOT_DATE}/\n"
+DISTRO_APT_SNAPSHOT_PREMIRROR_BASE ??= "snapshot.ubuntu.com"
+DISTRO_APT_SNAPSHOT_PREMIRROR ??= "(http|https)://archive.ubuntu.com/(.*) https://${DISTRO_APT_SNAPSHOT_PREMIRROR_BASE}/\2/${APT_SNAPSHOT_DATE}/\n"
diff --git a/meta/conf/distro/debian-common.conf b/meta/conf/distro/debian-common.conf
index 8c6a3f63..de9e6933 100644
--- a/meta/conf/distro/debian-common.conf
+++ b/meta/conf/distro/debian-common.conf
@@ -40,4 +40,5 @@  COMPAT_DISTRO_ARCH:amd64 = "i386"
 COMPAT_DISTRO_ARCH:arm64 = "armhf"
 
 # snapshot mirror for reproducible builds
-DISTRO_APT_SNAPSHOT_PREMIRROR ??= "deb.debian.org/(.*) snapshot.debian.org/archive/\1/${APT_SNAPSHOT_DATE}/\n"
+DISTRO_APT_SNAPSHOT_PREMIRROR_BASE ??= "snapshot.debian.org"
+DISTRO_APT_SNAPSHOT_PREMIRROR ??= "deb.debian.org/(.*) ${DISTRO_APT_SNAPSHOT_PREMIRROR_BASE}/archive/\1/${APT_SNAPSHOT_DATE}/\n"