29 using namespace zyppng::operators;
36 template<
class Executor,
class OpType>
37 struct StatusLogic :
public LogicBase<Executor, OpType>{
43 using ZyppContextType =
typename DlContextRefType::element_type::ContextType;
44 using ProvideType =
typename ZyppContextType::ProvideType;
45 using MediaHandle =
typename ProvideType::MediaHandle;
48 StatusLogic( DlContextRefType ctx, MediaHandle &&media )
49 :
_ctx(std::move(ctx))
53 MaybeAsyncRef<expected<zypp::RepoStatus>> execute() {
55 | [
this]( expected<ProvideRes> contentFile ) {
63 if ( !status.
empty() ) {
65 | [status = std::move(status)]( expected<ProvideRes> mediaFile )
mutable {
67 return make_expected_success(status &&
zypp::RepoStatus( mediaFile->file()) );
69 return make_expected_success( std::move(status) );
72 return makeReadyResult( make_expected_success(std::move(status)) );
95 using namespace zyppng::operators;
107 template<
class Executor,
class OpType>
108 struct DlLogic :
public LogicBase<Executor, OpType> {
114 using ZyppContextType =
typename DlContextRefType::element_type::ContextType;
115 using ProvideType =
typename ZyppContextType::ProvideType;
116 using MediaHandle =
typename ProvideType::MediaHandle;
117 using ProvideRes =
typename ProvideType::Res;
119 DlLogic( DlContextRefType ctx, MediaHandle &&mediaHandle, ProgressObserverRef &&progressObserver )
128 | [
this]( expected<zypp::ManagedFile> &&mediaInfo ) {
131 if ( mediaInfo )
_ctx->files().push_back ( std::move(mediaInfo.get()) );
136 | inspect( incProgress( _progressObserver ) )
137 | and_then( [
this] ( DlContextRefType && ) {
140 std::vector<zypp::OnMediaLocation> requiredFiles;
147 MIL <<
"Consuming repo index" << std::endl;
150 content.
parse( inputfile );
152 if ( ! _repoindex ) {
157 if (
_repoindex->metaFileChecksums.empty() ) {
162 WAR <<
"No signing keys defined." << std::endl;
169 std::map<std::string,zypp::parser::susetags::RepoIndex::FileChecksumMap::const_iterator> availablePackageTranslations;
176 static const zypp::str::regex rx_packages(
"^packages((.gz)?|(.([^.]*))(.gz)?)$" );
184 else if ( what[4] ==
"FL" )
189 availablePackageTranslations[what[4]] = it;
196 }
else if ( it->first ==
"patterns.pat"
197 || it->first ==
"patterns.pat.gz" ) {
209 std::vector<std::string> patparts;
210 unsigned archpos = 2;
212 unsigned count =
zypp::str::split( it->first, std::back_inserter(patparts),
"." );
213 if ( patparts[count-1] ==
"gz" )
216 if ( count > archpos ) {
218 zypp::Arch patarch( patparts[count-archpos] );
219 if ( !patarch.compatibleWith( zConfig().systemArchitecture() ) ) {
221 MIL <<
"Discarding pattern " << it->first << std::endl;
226 WAR <<
"Pattern file name does not contain recognizable architecture: " << it->first << std::endl;
232 MIL <<
"adding job " << it->first << std::endl;
235 .
setDeltafile( search_deltafile(
_ctx->deltaDir() + descr_dir, it->first) );
237 requiredFiles.push_back( std::move(location) );
243 auto fnc_checkTransaltions( [&](
const zypp::Locale & locale_r ) {
245 auto it( availablePackageTranslations.find( toGet.code() ) );
246 if ( it != availablePackageTranslations.end() ) {
247 auto mit( it->second );
248 MIL <<
"adding job " << mit->first << std::endl;
251 .
setDeltafile( search_deltafile( deltaDir() + descr_dir, mit->first) ));
257 for (
const zypp::Locale & it : zConfig().repoRefreshLocales() ) {
258 fnc_checkTransaltions( it );
260 fnc_checkTransaltions( zConfig().textLocale() );
263 for(
const auto &it :
_repoindex->mediaFileChecksums ) {
265 if ( it.first !=
"license.tar.gz" )
268 MIL <<
"adding job " << it.first << std::endl;
271 .
setDeltafile( search_deltafile( deltaDir(), it.first ) ));
274 for(
const auto &it :
_repoindex->signingKeys ) {
275 MIL <<
"adding job " << it.first << std::endl;
277 location.setChecksum( it.second );
278 requiredFiles.push_back( std::move(location) );
283 return makeReadyResult(expected<DlContextRefType>::error( std::make_exception_ptr(e) ) );
285 return makeReadyResult(expected<DlContextRefType>::error( std::current_exception() ) );
294 | inspect ( incProgress( _progressObserver ) );
296 }) | and_then ( [
this]( std::vector<zypp::ManagedFile> &&dlFiles ) {
297 auto &downloadedFiles =
_ctx->files();
298 downloadedFiles.insert( downloadedFiles.end(), std::make_move_iterator(dlFiles.begin()), std::make_move_iterator(dlFiles.end()) );
299 return expected<DlContextRefType>::success( std::move(_ctx) );
303 } | finishProgress( _progressObserver );
309 return _ctx->repoInfo();
313 return _ctx->deltaDir();
317 return _ctx->zyppContext()->config();
320 DlContextRefType
_ctx;
327 AsyncOpRef<expected<repo::AsyncDownloadContextRef> >
download(repo::AsyncDownloadContextRef dl,
ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver)
332 expected<repo::SyncDownloadContextRef>
download(repo::SyncDownloadContextRef dl,
SyncMediaHandle mediaHandle, ProgressObserverRef progressObserver)
Track changing files or directories.
bool empty() const
Whether the status is empty (empty checksum)