24 using namespace zypp::xml;
25 using namespace zypp::parser::yum;
34 Downloader::Downloader(
const RepoInfo &repoinfo ,
const Pathname &delta_dir)
35 : repo::
Downloader(repoinfo), _delta_dir(delta_dir), _media_ptr(0L)
46 if (prefix.empty() || prefix ==
"/")
58 if (!PathInfo(dir).isDir())
60 string base = file.basename();
61 size_t hypoff = base.find(
"-");
62 if (hypoff != string::npos)
63 base.replace(0, hypoff + 1,
"");
64 size_t basesize = base.size();
65 std::list<Pathname> retlist;
68 for_( it, retlist.begin(), retlist.end() )
70 string fn = it->asString();
71 if (fn.size() >= basesize && fn.substr(fn.size() - basesize, basesize) == base)
81 MIL << id_r <<
" : " << loc_with_path << endl;
103 struct RepomdFileReaderCallback2
110 addWantedLocale( it );
114 bool repomd_Callback2(
const OnMediaLocation & loc_r,
const ResourceType & dtype_r,
const std::string & typestr_r )
133 bool wantLocale(
const Locale & locale_r )
const
136 void addWantedLocale( Locale locale_r )
141 locale_r = locale_r.fallback();
176 Pathname masterIndex(
repoInfo().path() /
"/repodata/repomd.xml" );
191 start( dest_dir, media );
void defaultDownloadMasterIndex(MediaSetAccess &media_r, const Pathname &destdir_r, const Pathname &masterIndex_r)
Common workflow downloading a (signed) master index file.
static const ResourceType PATCHES
RepoStatus status(MediaSetAccess &media)
Status of the remote repository.
static const ResourceType OTHER
static ZConfig & instance()
Singleton ctor.
function< bool(const OnMediaLocation &, const repo::yum::ResourceType &, const std::string &)> ProcessResource2
Alternate callback also receiving the ResourceType as string.
bool patches_Callback(const OnMediaLocation &loc, const std::string &id)
Iterates through a patches.xml file giving on each iteration a OnMediaLocation object with the resour...
What is known about a repository.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
MediaSetAccess * _media_ptr
const RepoInfo & repoInfo() const
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
static const ResourceType NONE
void enqueueDigested(const OnMediaLocation &resource, const FileChecker &checker=FileChecker(), const Pathname &deltafile=Pathname())
Enqueue a object for transferal, they will not be transferred until start() is called.
LocaleSet _wantedLocales
Locales do download.
bool repomd_Callback(const OnMediaLocation &loc, const ResourceType &dtype)
Interface of patches.xml file reader.
void start(const Pathname &dest_dir, MediaSetAccess &media, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
start the transfer to a destination directory dest_dir You have to provde a media set access media to...
static Pathname search_deltafile(const Pathname &dir, const Pathname &file)
'Language[_Country]' codes.
int readdir(std::list< std::string > &retlist_r, const Pathname &path_r, bool dots_r)
Return content of directory via retlist.
Reads through a repomd.xml file and collects type, location, checksum and other data about metadata f...
RepomdFileReader::ProcessResource _origCallback
Original Downloader callback.
static OnMediaLocation loc_with_path_prefix(const OnMediaLocation &loc, const Pathname &prefix)
void download(MediaSetAccess &media, const Pathname &dest_dir, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Download metadata to a local directory.
Interface of repomd.xml file reader.
Track changing files or directories.
static const ResourceType FILELISTS
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...
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
std::unordered_set< Locale > LocaleSet
function< bool(const OnMediaLocation &, const repo::yum::ResourceType &)> ProcessResource
Callbacl taking OnMediaLocation and repo::yum::ResourceType.