11 #include <zypp-core/ng/ui/ProgressObserver> 12 #include <zypp-media/ng/ProvideSpec> 13 #include <zypp/ng/Context> 21 #undef ZYPP_BASE_LOGGER_LOGGROUP 22 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::repomanager" 36 StatusLogic( repo::DownloadContextRef ctx, MediaHandle &&media )
37 :
_ctx(std::move(ctx))
41 MaybeAwaitable<expected<zypp::RepoStatus>> execute() {
50 if ( !status.empty() &&
_ctx->repoInfo ().requireStatusWithMediaFile()) {
63 repo::DownloadContextRef
_ctx;
70 StatusLogic impl( std::move(dl), std::move(mediaHandle) );
71 zypp_co_return zypp_co_await( impl.execute() );
85 DlLogic( repo::DownloadContextRef ctx, MediaHandle &&mediaHandle, ProgressObserverRef &&progressObserver )
86 :
zypp::repo::yum::RepomdFileCollector( ctx->destDir() )
95 | [
this]( expected<zypp::ManagedFile> &&mediaInfo ) {
98 if ( mediaInfo )
_ctx->files().push_back ( std::move(mediaInfo.get()) );
104 |
and_then( [
this] ( repo::DownloadContextRef && ) {
107 std::vector<zypp::OnMediaLocation> requiredFiles;
115 requiredFiles.push_back( file );
129 }) |
and_then ( [
this]( std::vector<zypp::ManagedFile> &&dlFiles ) {
130 auto &downloadedFiles =
_ctx->files();
131 downloadedFiles.insert( downloadedFiles.end(), std::make_move_iterator(dlFiles.begin()), std::make_move_iterator(dlFiles.end()) );
142 return _ctx->repoInfo();
146 return _ctx->deltaDir();
149 repo::DownloadContextRef
_ctx;
155 MaybeAwaitable<expected< repo::DownloadContextRef> >
download( repo::DownloadContextRef dl,
ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver)
157 DlLogic impl( std::move(dl), std::move(mediaHandle), std::move(progressObserver) );
158 zypp_co_return zypp_co_await( impl.execute() );
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
MaybeAwaitable< expected< repo::DownloadContextRef > > downloadMasterIndex(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle, zypp::filesystem::Pathname masterIndex_r)
std::enable_if_t<!std::is_same_v< void, T >, expected< Container< T >, E > > collect(Container< expected< T, E >, CArgs... > &&in)
expected< T, E > inspect(expected< T, E > exp, Function &&f)
auto finishProgress(ProgressObserverRef progressObserver, ProgressObserver::FinishResult result=ProgressObserver::Success)
Helper filtering the files offered by a RepomdFileReader.
What is known about a repository.
static expected< std::decay_t< Type >, Err > make_expected_success(Type &&t)
MaybeAwaitable< expected< repo::DownloadContextRef > > download(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver)
MaybeAwaitable< expected< zypp::ManagedFile > > provideToCacheDir(CacheProviderContextRef cacheContext, ProvideMediaHandle medium, zypp::Pathname file, ProvideFileSpec filespec)
repo::DownloadContextRef _ctx
ProvideFileSpec & setMirrorsAllowed(bool set=true)
Enables or disables the use of mirrors when fetching this file.
ProvideMediaHandle MediaHandle
std::enable_if_t< is_instance_of_v< expected, Ret >, expected< Container< typename Ret::value_type > > > transform_collect(Container< Msg, CArgs... > &&in, Transformation &&f)
Downloader workspace for YUM (rpm-nmd) repositories Encapsulates all the knowledge of which files hav...
static expected success(ConsParams &&...params)
MaybeAwaitable< expected< zypp::RepoStatus > > repoStatus(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle)
Reads through a repomd.xml file and collects type, location, checksum and other data about metadata f...
Exception for repository handling.
ProgressObserverRef _progressObserver
Interface of repomd.xml file reader.
ResultType and_then(const expected< T, E > &exp, Function &&f)
Track changing files or directories.
#define ZYPP_FWD_CURRENT_EXCPT()
Drops a logline and returns the current Exception as a std::exception_ptr.
Easy-to use interface to the ZYPP dependency resolver.
auto downloadMediaInfo(MediaHandle &&mediaHandle, const zypp::filesystem::Pathname &destdir)
auto incProgress(ProgressObserverRef progressObserver, double progrIncrease=1.0, std::optional< std::string > newStr={})