16#include <zypp-core/base/UserRequestException> 
   17#include <zypp-media/MediaException> 
   24#undef ZYPP_BASE_LOGGER_LOGGROUP 
   25#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::fetcher" 
   62  using MediaMap = std::map<media::MediaNr, media::MediaAccessId>;
 
   63  using VerifierMap = std::map<media::MediaNr, media::MediaVerifierRef>;
 
 
   86    : 
_pimpl( 
std::make_unique<
Impl>( 
std::move(label_r), 
std::move(origin), 
std::move(prefered_attach_point) ) )
 
 
   94      for ( 
const auto & mm : 
_pimpl->_medias )
 
   95        manager.
close( mm.second );
 
 
  103    if (
_pimpl->_medias.find(media_nr) != 
_pimpl->_medias.end())
 
  110      _pimpl->_verifiers.erase(media_nr);
 
  116      _pimpl->_verifiers[media_nr] = verifier;
 
 
  121  { 
return _pimpl->_label; }
 
 
  124  { 
_pimpl->_label = label_r; }
 
 
  135    DBG << 
"Going to release file " << file
 
  136        << 
" from media number " << media_nr << endl;
 
 
  145                                bool dots, 
unsigned media_nr )
 
 
  173      const auto &fName = file.
filename();
 
 
 
  185      const auto &fName = file.
filename();
 
 
 
  201      const auto &fName = file.
filename();
 
 
 
  210    provide( std::ref(op), resource, options );
 
 
  244    url.setPathName (
"/");
 
 
  284    for ( 
const auto &resource : files ) {
 
  285           unsigned media_nr(resource.medianr());
 
  289        MIL << 
"Skipping precache of file " << resource.filename() << 
" media is not open";
 
 
  302                                ProvideFileOptions options )
 
  304    const auto &file(resource.
filename());
 
  305    unsigned media_nr(resource.
medianr());
 
  319        DBG << 
"Going to try to provide " << (resource.
optional() ? 
"optional" : 
"") << 
" file " << file
 
  320            << 
" from media number " << media_nr << endl;
 
  331        unsigned int devindex = 0;
 
  332        std::vector<std::string> devices;
 
  361              MIL << 
"Can't provide file. Non-Interactive mode." << endl;
 
  370            user = report->requestMedia (
 
  382            if ( u != 
_pimpl->_origin.authority().url() ) {
 
  383              MIL << 
"User changed the URL, dropping all mirrors" << std::endl;
 
  384              _pimpl->_origin.clearMirrors();
 
  385              _pimpl->_origin.setAuthority(u);
 
  389          MIL << 
"ProvideFile exception caught, callback answer: " << user << endl;
 
  393            DBG << 
"Aborting" << endl;
 
  394            AbortRequestException aexcp(
"Aborting requested by user");
 
  395            aexcp.remember(excp);
 
  400            DBG << 
"Skipping" << endl;
 
  401            SkipRequestException nexcp(
"User-requested skipping of a file");
 
  402            nexcp.remember(excp);
 
  407            DBG << 
"Eject: try to release" << endl;
 
  411              media_mgr.
release (
media, devindex < devices.size() ? devices[devindex] : 
"");
 
  422            DBG << 
"Going to try again" << endl;
 
  425            _pimpl->_medias.erase(media_nr);
 
  433            DBG << 
"Don't know, let's ABORT" << endl;
 
 
  446                                      ProvideFileOptions options )
 
  452        provide( std::ref(op), resource, options );
 
  456    provide( std::ref(op), resource, options );
 
 
  462    if ( 
_pimpl->_medias.find( medianr ) != 
_pimpl->_medias.end() )
 
  464      return _pimpl->_medias[medianr];
 
  469      for ( 
auto &
url : rewrittenOrigin ) {
 
  475    _pimpl->_medias[medianr] = id;
 
  479      if ( 
_pimpl->_verifiers.find(medianr) != 
_pimpl->_verifiers.end() )
 
  487        _pimpl->_verifiers.erase( medianr );
 
  493      WAR << 
"Verifier not found" << endl;
 
 
  503    if (scheme == 
"cd" || scheme == 
"dvd")
 
  506    DBG << 
"Rewriting url " << url_r << endl;
 
  521        url.setQueryParam(
"iso", isofile);
 
  522        DBG << 
"Url rewrite result: " << 
url << endl;
 
  535        url.setPathName(pathname);
 
  536        DBG << 
"Url rewrite result: " << 
url << endl;
 
 
  545    DBG << 
"Releasing all media IDs held by this MediaSetAccess" << endl;
 
  547    for ( 
auto m = 
_pimpl->_medias.begin(); m != 
_pimpl->_medias.end(); ++m )
 
  548      manager.
release(m->second, 
"");
 
 
  553    str << 
"MediaSetAccess (URL='" << 
_pimpl->_origin.authority().url() << 
"', attach_point_hint='" << 
_pimpl->_prefAttachPoint << 
"')";
 
 
Base class for Exception.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
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.
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.
std::list< DirEntry > DirContent
Returned by readdir.
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
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)
#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)