21 using namespace zypp::parser;
22 using namespace zypp::parser::susetags;
31 Downloader::Downloader(
const RepoInfo &repoinfo,
const Pathname &delta_dir )
32 : repo::
Downloader(repoinfo), _delta_dir(delta_dir)
41 Pathname mediafile = media.
provideFile(
"/media.1/media" );
49 Pathname deltafile(dir + file.basename());
50 if (PathInfo(deltafile).isExist())
56 const Pathname &dest_dir,
66 start( dest_dir, media );
68 if ( PathInfo(dest_dir / sig ).isExist() )
75 start( dest_dir, media );
80 if ( PathInfo(dest_dir / key).isExist() )
91 WAR <<
"Signature checking disabled in config of repository " <<
repoInfo().
alias() << endl;
95 start( dest_dir, media );
102 Pathname inputfile( dest_dir +
repoInfo().path() +
"/content" );
105 content.
parse( inputfile );
118 WAR <<
"No signing keys defined." << endl;
125 std::map<std::string,RepoIndex::FileChecksumMap::const_iterator> availablePackageTranslations;
132 static const str::regex rx_packages(
"^packages((.gz)?|(.([^.]*))(.gz)?)$" );
140 else if ( what[4] ==
"FL" )
145 availablePackageTranslations[what[4]] = it;
152 else if ( it->first ==
"patterns.pat"
153 || it->first ==
"patterns.pat.gz" )
167 std::vector<std::string> patparts;
168 unsigned archpos = 2;
170 unsigned count =
str::split( it->first, std::back_inserter(patparts),
"." );
171 if ( patparts[count-1] ==
"gz" )
174 if ( count > archpos )
178 Arch patarch( patparts[count-archpos] );
182 MIL <<
"Discarding pattern " << it->first << endl;
188 WAR <<
"Pattern file name does not contain recognizable architecture: " << it->first << endl;
193 MIL <<
"adding job " << it->first << endl;
201 auto fnc_checkTransaltions( [&](
const Locale & locale_r ) {
204 auto it( availablePackageTranslations.find( toGet.code() ) );
205 if ( it != availablePackageTranslations.end() )
207 auto mit( it->second );
208 MIL <<
"adding job " << mit->first << endl;
218 fnc_checkTransaltions( it );
226 if ( it->first !=
"license.tar.gz" )
229 MIL <<
"adding job " << it->first << endl;
237 MIL <<
"adding job " << it->first << endl;
243 start( dest_dir, media );
248 MIL <<
"Consuming repo index" << endl;
static const Locale noCode
No or empty code.
Checks for nothing Used as the default checker.
std::string alias() const
unique identifier for this source.
bool compatibleWith(const Arch &targetArch_r) const
Compatibility relation.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static ZConfig & instance()
Singleton ctor.
unsigned split(const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t")
Split line_r into words.
Checks for the validity of a signature.
void downloadMediaInfo(const Pathname &dest_dir, MediaSetAccess &media, const ProgressData::ReceiverFnc &progressrcv)
Downloads the media info (/media.1) to a local directory.
What is known about a repository.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
const RepoInfo & repoInfo() const
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
void addPublicKey(const PublicKey &publickey, const KeyContext &keycontext=KeyContext())
add a public key to the list of known keys
void enqueueDigested(const OnMediaLocation &resource, const FileChecker &checker=FileChecker(), const Pathname &deltafile=Pathname())
Enqueue a object for transferal, they will not be transfered until start() is called.
Locale fallback() const
Return a fallback locale for this locale, when giving up, returns empty Locale()
LocaleSet repoRefreshLocales() const
List of locales for which translated package descriptions should be downloaded.
void reset()
Reset the transfer (jobs) list.
Parse repoindex part from a content file.
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...
void setRepoIndexConsumer(const RepoIndexConsumer &fnc_r)
Consumer to call when repo index was parsed.
bool endsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasSuffix
std::string asString(const Patch::SeverityFlag &obj)
Regular expression match result.
Base class for Exception.
bool regex_match(const std::string &s, smatch &matches, const regex ®ex)
regex ZYPP_STR_REGEX regex ZYPP_STR_REGEX
Local facts about a repository This class represents the status of a repository on the system...
Arch systemArchitecture() const
The system architecture zypp uses.
function< void(const Pathname &file)> FileChecker
Functor signature used to check files.
void setRepoInfo(const RepoInfo &repoinfo)
void enqueue(const OnMediaLocation &resource, const FileChecker &checker=FileChecker())
Enqueue a object for transferal, they will not be transfered until start() is called.
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
virtual void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &fnc_r=ProgressData::ReceiverFnc())
Parse the stream.
Pathname path() const
Repository path.
void setKeyContext(const KeyContext &keycontext)
Set context for this checker.