From 0be83f8dc737f469403280a2d6bd09ece2d5ab2e Mon Sep 17 00:00:00 2001 From: Benjamin Zeller Date: Tue, 8 Oct 2024 12:51:20 +0200 Subject: [PATCH] First config fixes --- zypp/ng/repo/workflows/rpmmd.cc | 2 +- zypp/repo/RepoMirrorList.cc | 4 ++-- zypp/repo/RepoMirrorList.h | 7 ++++--- zypp/repo/yum/RepomdFileCollector.cc | 7 ++++--- zypp/repo/yum/RepomdFileCollector.h | 3 ++- zypp/target/rpm/RpmDb.cc | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/zypp/ng/repo/workflows/rpmmd.cc b/zypp/ng/repo/workflows/rpmmd.cc index 248cbd06fc..5316a288bc 100644 --- a/zypp/ng/repo/workflows/rpmmd.cc +++ b/zypp/ng/repo/workflows/rpmmd.cc @@ -100,7 +100,7 @@ namespace zyppng::RpmmdWorkflows { using ProvideRes = typename ProvideType::Res; DlLogic( DlContextRefType ctx, MediaHandle &&mediaHandle, ProgressObserverRef &&progressObserver ) - : zypp::repo::yum::RepomdFileCollector( ctx->destDir() ) + : zypp::repo::yum::RepomdFileCollector( ctx->zyppContext(), ctx->destDir() ) , _ctx( std::move(ctx)) , _mediaHandle(std::move(mediaHandle)) , _progressObserver(std::move(progressObserver)) diff --git a/zypp/repo/RepoMirrorList.cc b/zypp/repo/RepoMirrorList.cc index 0d6649fc9a..b588d5069a 100644 --- a/zypp/repo/RepoMirrorList.cc +++ b/zypp/repo/RepoMirrorList.cc @@ -124,7 +124,7 @@ namespace zypp } // namespace /////////////////////////////////////////////////////////////////// - RepoMirrorList::RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r, bool mirrorListForceMetalink_r ) + RepoMirrorList::RepoMirrorList( zyppng::ContextBaseRef ctx, const Url & url_r, const Pathname & metadatapath_r, bool mirrorListForceMetalink_r ) { if ( url_r.getScheme() == "file" ) { @@ -147,7 +147,7 @@ namespace zypp cachefile /= "mirrorlist.txt"; zypp::filesystem::PathInfo cacheinfo( cachefile ); - if ( !cacheinfo.isFile() || cacheinfo.mtime() < time(NULL) - (long) ZConfig::instance().repo_refresh_delay() * 60 ) + if ( !cacheinfo.isFile() || cacheinfo.mtime() < time(NULL) - (long) ctx->config().repo_refresh_delay() * 60 ) { DBG << "Getting MirrorList from URL: " << url_r << endl; RepoMirrorListTempProvider provider( url_r ); // RAII: lifetime of downloaded file diff --git a/zypp/repo/RepoMirrorList.h b/zypp/repo/RepoMirrorList.h index 89a556f73a..b5a04a48ed 100644 --- a/zypp/repo/RepoMirrorList.h +++ b/zypp/repo/RepoMirrorList.h @@ -13,6 +13,7 @@ #include #include #include +#include namespace zypp { @@ -21,10 +22,10 @@ namespace zypp class RepoMirrorList { public: - RepoMirrorList( const Url & url_r, const Pathname & metadatapath_r, bool mirrorListForceMetalink_r ); + RepoMirrorList( zyppng::ContextBaseRef ctx, const Url & url_r, const Pathname & metadatapath_r, bool mirrorListForceMetalink_r ); - RepoMirrorList( const Url & url_r ) - : RepoMirrorList( url_r, Pathname(), false ) + RepoMirrorList( zyppng::ContextBaseRef ctx, const Url & url_r ) + : RepoMirrorList( ctx, url_r, Pathname(), false ) {} const std::vector & getUrls() const diff --git a/zypp/repo/yum/RepomdFileCollector.cc b/zypp/repo/yum/RepomdFileCollector.cc index 8274317e1c..1d77625e99 100644 --- a/zypp/repo/yum/RepomdFileCollector.cc +++ b/zypp/repo/yum/RepomdFileCollector.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include namespace zypp::env @@ -89,11 +90,11 @@ namespace zypp::repo::yum * Localized type: * susedata.LOCALE */ - RepomdFileCollector::RepomdFileCollector( const Pathname &destDir_r ) + RepomdFileCollector::RepomdFileCollector( zyppng::ContextBaseRef ctx, const Pathname &destDir_r ) : _destDir { destDir_r } { - addWantedLocale( ZConfig::instance().textLocale() ); - for ( const Locale & it : ZConfig::instance().repoRefreshLocales() ) + addWantedLocale( ctx->config().textLocale() ); + for ( const Locale & it : ctx->config().repoRefreshLocales() ) addWantedLocale( it ); } diff --git a/zypp/repo/yum/RepomdFileCollector.h b/zypp/repo/yum/RepomdFileCollector.h index 6d9c7a8961..101db720ca 100644 --- a/zypp/repo/yum/RepomdFileCollector.h +++ b/zypp/repo/yum/RepomdFileCollector.h @@ -10,6 +10,7 @@ #ifndef ZYPP_SOURCE_YUM_REPOMDFILECOLLECTOR #define ZYPP_SOURCE_YUM_REPOMDFILECOLLECTOR +#include #include #include #include @@ -32,7 +33,7 @@ namespace zypp::repo::yum using FinalizeCb = std::function; - RepomdFileCollector( const Pathname & destDir_r ); + RepomdFileCollector( zyppng::ContextBaseRef ctx, const Pathname & destDir_r ); virtual ~RepomdFileCollector(); bool collect( const OnMediaLocation & loc_r, const std::string & typestr_r ); diff --git a/zypp/target/rpm/RpmDb.cc b/zypp/target/rpm/RpmDb.cc index 385f2b1dc4..f548cf8688 100644 --- a/zypp/target/rpm/RpmDb.cc +++ b/zypp/target/rpm/RpmDb.cc @@ -1707,7 +1707,7 @@ void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, Rpm opts.push_back("--noglob"); // ZConfig defines cross-arch installation - if ( ! ZConfig::instance().systemArchitecture().compatibleWith( ZConfig::instance().defaultSystemArchitecture() ) ) + if ( ! ZConfig::instance().systemArchitecture().compatibleWith( ZConfig::defaults().defaultSystemArchitecture() ) ) opts.push_back("--ignorearch"); if (flags & RPMINST_NODIGEST)