{
enum Action {
ABORT, // abort and return error
- RETRY // retry
+ RETRY, // retry
+ IGNORE, // ignore this resolvable but continue
};
enum Error {
*/
SourceImpl::SourceImpl( const null & )
: base::ProvideNumericId<SourceImpl,Source_Ref::NumericId>( NULL )
- , _tmp_metadata_dir("/var/tmp/zypp.0")
, _res_store_initialized(true)
{}
, _priority_unsubscribed (0)
, _subscribed(false)
, _base_source(false)
- , _tmp_metadata_dir(getZYpp()->tmpPath())
, _res_store_initialized(false)
{
}
return const_cast<SourceImpl*>(this)->provideResolvables(self, kind);
}
+ Pathname SourceImpl::tmpMetadataDir() const
+ {
+ if ( !_tmp_metadata_dir_ptr )
+ _tmp_metadata_dir_ptr.reset(new filesystem::TmpDir(getZYpp()->tmpPath()));
+ return _tmp_metadata_dir_ptr->path();
+ }
+
Date SourceImpl::timestamp() const
{
return Date::now();
callback::TempConnect<media::DownloadProgressReport> tmp_download( download_report );
- file = provideJustFile( package->location(), package->sourceMediaNr());
-
+ try
+ {
+ file = provideJustFile( package->location(), package->sourceMediaNr());
+ }
+ catch (const Exception &e)
+ {
+ ERR << "Failed to provide " << package << " from " << url() << " in source " << alias() << std::endl;
+ ZYPP_RETHROW (e);
+ }
+
report->finish( package, source::DownloadResolvableReport::NO_ERROR, "" );
CheckSum checksum = package->checksum();
* reset the media verifier to no verifier
*/
void resetMediaVerifier();
+
+ /**
+ * function that creates the tmp metadata dir if it was not created.
+ * this directory is used when cache_dir is not set (design flaw FIXME)
+ */
+ Pathname tmpMetadataDir() const;
protected:
/** All resolvables provided by this source. */
/** source contains base product? */
bool _base_source;
- filesystem::TmpDir _tmp_metadata_dir;
+ private:
+ mutable shared_ptr<filesystem::TmpDir> _tmp_metadata_dir_ptr;
///////////////////////////////////////////////////////////////////
// no playground below this line ;)
///////////////////////////////////////////////////////////////////
const Pathname SuseTagsImpl::metadataRoot() const
{
- return _cache_dir.empty() ? _tmp_metadata_dir : _cache_dir;
+ return _cache_dir.empty() ? tmpMetadataDir() : _cache_dir;
}
const Pathname SuseTagsImpl::contentFile() const
else
{
// no previous cache, use the data read temporarely
- copyLocalMetadata(_tmp_metadata_dir.path(), cache_dir_r);
+ copyLocalMetadata(tmpMetadataDir(), cache_dir_r);
}
MIL << "Metadata saved in " << cache_dir_r << ". Setting as cache." << std::endl;
{
if ( _cache_dir.empty() || !PathInfo(_cache_dir).isExist() )
{
- MIL << "Cache dir not set. Downloading to temp dir: " << _tmp_metadata_dir << std::endl;
+ MIL << "Cache dir not set. Downloading to temp dir: " << tmpMetadataDir() << std::endl;
// as we have no local dir set we use a tmp one, but we use a member variable because
// it cant go out of scope while the source exists.
- saveMetadataTo(_tmp_metadata_dir);
+ saveMetadataTo(tmpMetadataDir());
}
else
{
const Pathname YUMSourceImpl::metadataRoot() const
{
- return _cache_dir.empty() ? _tmp_metadata_dir : _cache_dir;
+ return _cache_dir.empty() ? tmpMetadataDir() : _cache_dir;
}
const Pathname YUMSourceImpl::repomdFile() const
{
if ( _cache_dir.empty() || !PathInfo(_cache_dir).isExist() )
{
- DBG << "Cache dir not set. Downloading to temp dir: " << _tmp_metadata_dir << std::endl;
+ DBG << "Cache dir not set. Downloading to temp dir: " << tmpMetadataDir() << std::endl;
// as we have no local dir set we use a tmp one, but we use a member variable because
// it cant go out of scope while the source exists.
- saveMetadataTo(_tmp_metadata_dir);
+ saveMetadataTo(tmpMetadataDir());
}
else
{
else
{
// no previous cache, use the data read temporarely
- copyLocalMetadata(_tmp_metadata_dir.path(), cache_dir_r);
+ copyLocalMetadata(tmpMetadataDir(), cache_dir_r);
}
MIL << "Metadata saved in " << cache_dir_r << ". Setting as cache." << std::endl;