libdnf/0032-context-automatically-setup-arch-variable.patch
2026-06-10 15:42:57 +02:00

40 lines
1.7 KiB
Diff

From 5f2278ee2a30b94b5d80ab480505bf6b4750dd1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Thu, 28 May 2026 14:02:05 +0200
Subject: [PATCH] [context] automatically setup $arch variable
---
libdnf/dnf-repo.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libdnf/dnf-repo.cpp b/libdnf/dnf-repo.cpp
index 7b4f83bb..0d92c676 100644
--- a/libdnf/dnf-repo.cpp
+++ b/libdnf/dnf-repo.cpp
@@ -1212,6 +1212,14 @@ dnf_repo_setup(DnfRepo *repo, GError **error) try
"basearch not set");
return FALSE;
}
+ auto * arch = dnf_context_get_arch_info(priv->context);
+ if (arch == NULL) {
+ g_set_error_literal(error,
+ DNF_ERROR,
+ DNF_ERROR_INTERNAL_ERROR,
+ "arch not set");
+ return FALSE;
+ }
release = g_key_file_get_string(priv->keyfile, "general", "version", NULL);
if (release == NULL) {
release = g_strdup(dnf_context_get_release_ver(priv->context));
@@ -1238,6 +1246,7 @@ dnf_repo_setup(DnfRepo *repo, GError **error) try
priv->urlvars = lr_urlvars_set(priv->urlvars, "releasever_major", release_major);
priv->urlvars = lr_urlvars_set(priv->urlvars, "releasever_minor", release_minor);
priv->urlvars = lr_urlvars_set(priv->urlvars, "basearch", basearch);
+ priv->urlvars = lr_urlvars_set(priv->urlvars, "arch", arch);
/* Call libdnf::dnf_context_load_vars(priv->context); only when values not in cache.
* But what about if variables on disk change during long running programs (PackageKit daemon)?
* if (!libdnf::dnf_context_get_vars_cached(priv->context))
--
2.54.0