[2/3] Added Kconfig for cached snapshot mirror

Message ID 20240927190650.128263-3-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>

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 kas/opt/Kconfig              | 25 ++++++++++++++++++++++++-
 kas/opt/mirror-snapshot.yaml |  3 +++
 2 files changed, 27 insertions(+), 1 deletion(-)

Patch

diff --git a/kas/opt/Kconfig b/kas/opt/Kconfig
index 65482e3a..ef08564c 100644
--- a/kas/opt/Kconfig
+++ b/kas/opt/Kconfig
@@ -7,6 +7,15 @@ 
 menu "Mirror selection"
 	depends on DEBIAN_BUSTER || DEBIAN_BULLSEYE || DEBIAN_BOOKWORM || DEBIAN_TRIXIE || DEBIAN_SID || UBUNTU_FOCAL || UBUNTU_JAMMY
 
+choice
+	prompt "Mirror type selection"
+	default MIRROR_NONE
+
+config MIRROR_NONE
+	bool "Don't use a mirror"
+	help
+	  Use apt urls as specified in apt.list
+
 config MIRROR_DEBIAN
 	bool "Use specific Debian mirror"
 	depends on DEBIAN_BUSTER || DEBIAN_BULLSEYE || DEBIAN_BOOKWORM || DEBIAN_TRIXIE || DEBIAN_SID
@@ -42,7 +51,6 @@  config KAS_INCLUDE_MIRROR_UBUNTU
 
 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.
 
@@ -51,6 +59,21 @@  config KAS_INCLUDE_APT_SNAPSHOT
 	default "kas/opt/mirror-snapshot.yaml"
 	depends on USE_APT_SNAPSHOT
 
+config USE_APT_SNAPSHOT_CACHED
+	bool "Use a cache for snapshot mirror"
+	depends on USE_APT_SNAPSHOT
+
+config DISTRO_APT_SNAPSHOT_PREMIRROR_BASE
+	string "Base URL of the snapshot mirror"
+	default "localhost:3142/snapshot.debian.org"
+	depends on USE_APT_SNAPSHOT_CACHED
+	help
+	  Set the premirror base url used for snapshots.
+	  This can either be a local cache (e.g.: localhost:3142/snapshot.debian.org) or
+	  any mirror like snapshot.debian.org used to retrieve snapshots from.
+
+endchoice
+
 endmenu
 
 
diff --git a/kas/opt/mirror-snapshot.yaml b/kas/opt/mirror-snapshot.yaml
index 59fae192..493e1552 100644
--- a/kas/opt/mirror-snapshot.yaml
+++ b/kas/opt/mirror-snapshot.yaml
@@ -7,3 +7,6 @@  header:
 local_conf_header:
   mirror-debian: |
     ISAR_USE_APT_SNAPSHOT = "1"
+
+env:
+  DISTRO_APT_SNAPSHOT_PREMIRROR_BASE: null