13#include <zypp/base/LogTools.h>
14#include <zypp/base/Regex.h>
15#include <zypp-core/base/UserRequestException>
16#include <zypp-media/MediaException>
19#include <zypp/PathInfo.h>
20#include <zypp/TmpPath.h>
23#undef ZYPP_BASE_LOGGER_LOGGROUP
24#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::fetcher"
37 const Pathname & prefered_attach_point)
39 , _prefAttachPoint(prefered_attach_point)
44 const Pathname & prefered_attach_point)
46 , _prefAttachPoint(prefered_attach_point)
55 for (
const auto & mm :
_medias )
56 manager.
close( mm.second );
92 DBG <<
"Going to release file " << file
93 <<
" from media number " << media_nr << endl;
102 bool dots,
unsigned media_nr )
112 media_mgr.
dirInfo(media, retlist, dirname, dots);
131 const auto &fName = file.
filename();
143 const auto &fName = file.
filename();
159 const auto &fName = file.
filename();
168 provide( std::ref(op), resource, options );
242 for (
const auto &resource : files ) {
244 unsigned media_nr(resource.medianr());
247 if ( !media_mgr.
isOpen( media ) ) {
248 MIL <<
"Skipping precache of file " << resource.filename() <<
" media is not open";
261 ProvideFileOptions options )
263 const auto &file(resource.
filename());
264 unsigned media_nr(resource.
medianr());
278 DBG <<
"Going to try to provide " << (resource.
optional() ?
"optional" :
"") <<
" file " << file
279 <<
" from media number " << media_nr << endl;
290 unsigned int devindex = 0;
291 std::vector<std::string> devices;
320 MIL <<
"Can't provide file. Non-Interactive mode." << endl;
328 user = report->requestMedia (
339 MIL <<
"ProvideFile exception caught, callback answer: " << user << endl;
343 DBG <<
"Aborting" << endl;
344 AbortRequestException aexcp(
"Aborting requested by user");
345 aexcp.remember(excp);
350 DBG <<
"Skipping" << endl;
351 SkipRequestException nexcp(
"User-requested skipping of a file");
352 nexcp.remember(excp);
357 DBG <<
"Eject: try to release" << endl;
361 media_mgr.
release (media, devindex < devices.size() ? devices[devindex] :
"");
372 DBG <<
"Going to try again" << endl;
374 media_mgr.
close(media);
383 DBG <<
"Don't know, let's ABORT" << endl;
396 ProvideFileOptions options )
402 provide( std::ref(op), resource, options );
406 provide( std::ref(op), resource, options );
438 WAR <<
"Verifier not found" << endl;
448 if (scheme ==
"cd" || scheme ==
"dvd")
451 DBG <<
"Rewriting url " << url_r << endl;
467 DBG <<
"Url rewrite result: " << url << endl;
481 DBG <<
"Url rewrite result: " << url << endl;
490 DBG <<
"Releasing all media IDs held by this MediaSetAccess" << endl;
492 for (MediaMap::const_iterator m =
_medias.begin(); m !=
_medias.end(); ++m)
493 manager.
release(m->second,
"");
Base class for Exception.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
std::string getScheme() const
Returns the scheme name of the URL.
std::string getPathName(EEncoding eflag=zypp::url::E_DECODED) const
Returns the path name from the URL.
std::string getQueryParam(const std::string ¶m, EEncoding eflag=zypp::url::E_DECODED) const
Return the value for the specified query parameter.
void setPathName(const std::string &path, EEncoding eflag=zypp::url::E_DECODED)
Set the path name.
void setQueryParam(const std::string ¶m, const std::string &value)
Set or add value for the specified query parameter.
const std::string & asString() const
String representation.
static ManagedFile asManagedFile()
Create a temporary file and convert it to a automatically cleaned up ManagedFile.
@ icase
Do not differentiate case.
Regular expression match result.
String related utilities and Regular expression matching.
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
std::list< DirEntry > DirContent
Returned by readdir.
std::string numstring(char n, int w=0)
bool regex_match(const std::string &s, smatch &matches, const regex ®ex)
\relates regex \ingroup ZYPP_STR_REGEX \relates regex \ingroup ZYPP_STR_REGEX
Easy-to use interface to the ZYPP dependency resolver.
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
void operator()(media::MediaAccessId media, const OnMediaLocation &file)
void operator()(media::MediaAccessId media, const OnMediaLocation &file)
void operator()(media::MediaAccessId media, const OnMediaLocation &file)
ProvideFileExistenceOperation()
void operator()(media::MediaAccessId media, const OnMediaLocation &file)
Wrapper for const correct access via Smart pointer types.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
#define IMPL_PTR_TYPE(NAME)