11 #include <solv/solvversion.h> 12 #include <zypp/base/String.h> 13 #include <zypp/base/LogTools.h> 14 #include <zypp/base/Function.h> 37 if ( ! prefix_r.
empty() && prefix_r !=
"/" )
51 std::string base { file.
basename() };
52 size_t hypoff = base.find(
"-" );
53 if ( hypoff != std::string::npos )
54 base.replace( 0, hypoff + 1,
"" );
56 std::list<std::string> retlist;
59 for (
const auto & fn : retlist )
89 : _downloader { downloader_r }
91 , _destDir { destDir_r }
95 addWantedLocale( it );
108 #if defined(LIBSOLVEXT_FEATURE_ZCHUNK_COMPRESSION) 109 const std::string & basetype { zchk ? typestr_r.substr( 0, typestr_r.size()-4 ) : typestr_r };
113 const std::string & basetype { typestr_r };
117 if ( basetype ==
"other" || basetype ==
"filelists" )
124 if ( ! wantLocale(
Locale(basetype.c_str()+9) ) )
129 if ( zchk || !_wantedFiles.count( basetype ) )
130 _wantedFiles[basetype] = loc_r;
138 for (
const auto & el : _wantedFiles )
141 const OnMediaLocation & loc_with_path { loc_with_path_prefix( loc, _downloader.repoInfo().path() ) };
148 {
return _downloader._deltaDir; }
151 {
return _wantedLocales.count( locale_r ); }
157 _wantedLocales.insert( locale_r );
179 , _deltaDir { deltaDir_r }
193 Impl pimpl( *
this, media_r, destDir_r );
Pathname path() const
Repository path.
void addWantedLocale(Locale locale_r)
void defaultDownloadMasterIndex(MediaSetAccess &media_r, const Pathname &destdir_r, const Pathname &masterIndex_r)
Common workflow downloading a (signed) master index file.
static ZConfig & instance()
Singleton ctor.
Helper filtering the files offered by a RepomdFileReader.
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
void downloadMediaInfo(const Pathname &dest_dir, MediaSetAccess &media, const ProgressData::ReceiverFnc &progressrcv)
Downloads the media info (/media.1) to a local directory.
const Pathname & _destDir
What is known about a repository.
std::string basename() const
Return the last component of this path.
bool operator()(const OnMediaLocation &loc_r, const std::string &typestr_r)
The callback invoked by the RepomdFileReader.
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
LocaleSet _wantedLocales
Locales do download.
void setMediaSetAccess(MediaSetAccess &media)
Sets the media set access that will be used to precache and to download the files when start is calle...
void start(const Pathname &dest_dir, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
start the transfer to a destination directory dest_dir The media has to be provides with setMediaSetA...
std::map< std::string, OnMediaLocation > _wantedFiles
bool empty() const
Test for an empty path.
const Pathname & deltaDir() const
void download(MediaSetAccess &media_r, const Pathname &destDir_r, const ProgressData::ReceiverFnc &progress_r=ProgressData::ReceiverFnc()) override
Download metadata to a local directory.
Impl(Downloader &downloader_r, MediaSetAccess &media_r, const Pathname &destDir_r)
RepoStatus status(MediaSetAccess &media_r) override
Status of the remote repository.
bool startsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasPrefix
const RepoInfo & repoInfo() const
bool endsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasSuffix
bool wantLocale(const Locale &locale_r) const
'Language[_Country]' codes.
int readdir(std::list< std::string > &retlist_r, const Pathname &path_r, bool dots_r)
Return content of directory via retlist.
#define NON_MOVABLE(CLASS)
Delete move ctor and move assign.
Reads through a repomd.xml file and collects type, location, checksum and other data about metadata f...
#define NON_COPYABLE(CLASS)
Delete copy ctor and copy assign.
Wrapper class for ::stat/::lstat.
Interface of repomd.xml file reader.
Track changing files or directories.
function< void(const Pathname &file)> FileChecker
Functor signature used to check files.
Downloader for YUM (rpm-nmd) repositories Encapsulates all the knowledge of which files have to be do...
Easy-to use interface to the ZYPP dependency resolver.
std::unordered_set< Locale > LocaleSet