36 StatusLogic( repo::DownloadContextRef ctx, MediaHandle &&
media )
37 : _ctx(std::move(ctx))
38 , _handle(std::move(
media))
41 MaybeAwaitable<expected<zypp::RepoStatus>> execute() {
42 return _ctx->zyppContext()->provider()->provide( _handle, _ctx->repoInfo().path() /
"/repodata/repomd.xml" ,
ProvideFileSpec().setMirrorsAllowed(
false) )
50 if ( !status.
empty() && _ctx->repoInfo ().requireStatusWithMediaFile()) {
51 return _ctx->zyppContext()->provider()->provide( _handle,
"/media.1/media" ,
ProvideFileSpec().setMirrorsAllowed(
false) )
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() )
87 , _ctx(
std::move(ctx))
88 , _mediaHandle(
std::move(mediaHandle))
89 , _progressObserver(
std::move(progressObserver))
98 if ( mediaInfo ) _ctx->files().push_back ( std::move(mediaInfo.get()) );
100 if ( _progressObserver ) _progressObserver->inc();
104 |
and_then( [
this] ( repo::DownloadContextRef && ) {
107 std::vector<zypp::OnMediaLocation> requiredFiles;
110 finalize([&](
const zypp::OnMediaLocation &file ){
113 ZYPP_THROW(zypp::repo::RepoException( _ctx->repoInfo(),
"Repo can only require metadata files from primary medium."));
115 requiredFiles.push_back( file );
122 if ( _progressObserver ) _progressObserver->setBaseSteps ( _progressObserver->baseSteps () + requiredFiles.size() );
124 return transform_collect ( std::move(requiredFiles), [
this]( zypp::OnMediaLocation 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()) );
141 const zypp::RepoInfo &repoInfo()
const override {
142 return _ctx->repoInfo();
145 const zypp::filesystem::Pathname &deltaDir()
const override {
146 return _ctx->deltaDir();
149 repo::DownloadContextRef _ctx;
150 MediaHandle _mediaHandle;
151 ProgressObserverRef _progressObserver;
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() );
Track changing files or directories.
bool empty() const
Whether the status is empty (empty checksum).