libzypp: zypp::repo::RepoMediaAccess Class Reference

libzypp 17.38.14

zypp::repo::RepoMediaAccess Class Reference

Provides files from different repos. More...

`#include <zypp/repo/RepoProvideFile.h>`

## Classes
class | Impl

## Public Member Functions
| RepoMediaAccess (ProvideFilePolicy defaultPolicy_r=ProvideFilePolicy())
| Ctor taking the default ProvideFilePolicy.
| ~RepoMediaAccess ()
ManagedFile | provideFile (const RepoInfo &repo_r, const OnMediaLocation &loc_r, const ProvideFilePolicy &policy_r)
| Provide a file from a Repository.
ManagedFile | provideFile (RepoInfo repo_r, const OnMediaLocation &loc_r)
void | setDefaultPolicy (const ProvideFilePolicy &policy_r)
| Set a new default ProvideFilePolicy.
const ProvideFilePolicy & | defaultPolicy () const
| Get the current default ProvideFilePolicy.

## Static Public Member Functions
static Pathname | mapToCachePath (const RepoInfo &repo_r, const OnMediaLocation &resource_r)
| Map a resource filename to a local path below a repositories cache.

## Private Attributes
RW_pointer< Impl > | _impl

## Detailed Description

Provides files from different repos.

Class that allows to get files from repositories It handles automatically setting media verifiers if the repo is cached, and reuses media set access opened for repositories during its scope, so you can provide files from different repositories in different order without opening and closing medias all the time

Definition at line 72 of file RepoProvideFile.h.

## Constructor & Destructor Documentation

## ◆ RepoMediaAccess()

zypp::repo::RepoMediaAccess::RepoMediaAccess | ( | ProvideFilePolicy | defaultPolicy_r = ProvideFilePolicy() | ) |

Ctor taking the default ProvideFilePolicy.

Definition at line 253 of file RepoProvideFile.cc.

## ◆ ~RepoMediaAccess()

zypp::repo::RepoMediaAccess::~RepoMediaAccess | ( |  | ) |

Definition at line 257 of file RepoProvideFile.cc.

## Member Function Documentation

## ◆ provideFile() [1/2]

ManagedFile zypp::repo::RepoMediaAccess::provideFile | ( | const RepoInfo & | repo_r,
|  | const OnMediaLocation & | loc_r,
|  | const ProvideFilePolicy & | policy_r )

Provide a file from a Repository.

Let source_r provide the file described by loc_r. In case loc_r contains a checksum, the file is verified. policy_r provides callback hooks for download progress reporting and behaviour on failed checksum verification.

Exceptions

  Exception |

Todo
  Investigate why this needs a non-const Repository as arg.

Definition at line 266 of file RepoProvideFile.cc.

## ◆ provideFile() [2/2]

ManagedFile zypp::repo::RepoMediaAccess::provideFile | ( | RepoInfo | repo_r,
|  | const OnMediaLocation & | loc_r )
| inline

Definition at line 93 of file RepoProvideFile.h.

## ◆ setDefaultPolicy()

void zypp::repo::RepoMediaAccess::setDefaultPolicy | ( | const ProvideFilePolicy & | policy_r | ) |

Set a new default ProvideFilePolicy.

Definition at line 260 of file RepoProvideFile.cc.

## ◆ defaultPolicy()

const ProvideFilePolicy & zypp::repo::RepoMediaAccess::defaultPolicy | ( |  | ) | const

Get the current default ProvideFilePolicy.

Definition at line 263 of file RepoProvideFile.cc.

## ◆ mapToCachePath()

Pathname zypp::repo::RepoMediaAccess::mapToCachePath | ( | const RepoInfo & | repo_r,
|  | const OnMediaLocation & | resource_r )
| static

Map a resource filename to a local path below a repositories cache.

bsc#1253740: Resource filenames pointing to "../" may refer to locations outside the repositories root. That's actually not desired and does not work for mounted media, as they refer to locations outside the mount point. Unfortunately it works for http/ftp and is actually used by TumbleWeed.

The remote path relative to the repositories root is usually composed as "repo.path / resource.filename". Replicating the remote file tree below the repositories cache directory fails if this remote path is relative and refers to "../". It will point to a location outside the cache. To fix this all remote paths will be mapped to filenames below the cache root.

So the location of a package on disk should be computed as:

repo.packagesPath() / RepoMediaAccess::mapToCachePath( repo, resource )
zypp::repo::RepoMediaAccess::mapToCachePath
static Pathname mapToCachePath(const RepoInfo &repo_r, const OnMediaLocation &resource_r)
Map a resource filename to a local path below a repositories cache.
Definition RepoProvideFile.cc:385
zypp::repo
Definition DeltaCandidates.cc:30

Definition at line 385 of file RepoProvideFile.cc.

## Member Data Documentation

## ◆ _impl

RW_pointer<Impl> zypp::repo::RepoMediaAccess::_impl
| private

Definition at line 127 of file RepoProvideFile.h.

The documentation for this class was generated from the following files:

- zypp/repo/RepoProvideFile.h
- zypp/repo/RepoProvideFile.cc