Pkg::SourceProvideFile — Make a file available at the local filesystem
string
SourceProvideFile
( | integer | SrcId, |
| integer | medianr, | |
| string | file); |
SrcId
Specifies the InstSrc .
medianr
Number of the media the file is located on ('1' for the 1st media).
file
Filename relative to the media root.
YCPValue PkgModuleFunctions::SourceProvideFileCommon(const YCPInteger &id, const YCPInteger &mid, const YCPString& f, const YCPBoolean & optional) { CallInitDownload(std::string(_("Downloading ") + f->value()));
bool found = true; YRepo_Ptr repo = logFindRepository(id->value()); if (!repo) found = false;
extern ZyppRecipients::MediaChangeSensitivity _silent_probing; // remember the current value ZyppRecipients::MediaChangeSensitivity _silent_probing_old = _silent_probing;
// disable media change callback for optional file if (optional->value()) _silent_probing = ZyppRecipients::MEDIA_CHANGE_OPTIONALFILE;
zypp::filesystem::Pathname path; // FIXME use ManagedMedia if (found) { try { path = repo->mediaAccess()->provideFile(f->value(), mid->value()); y2milestone("local path: '%s'", path.asString().c_str()); } catch (const zypp::Exception& excpt) { found = false;
if (!optional->value()) { _last_error.setLastError(ExceptionAsString(excpt)); y2milestone("File not found: %s", f->value_cstr()); } } }
// set the original probing value _silent_probing = _silent_probing_old;
CallDestDownload();
if (found) { return YCPString(path.asString()); } else { return YCPVoid(); } }
Let an InstSrc provide some file (make it available at the local filesystem).