--- zypp/repo/yum/Downloader.cc | 23 ++++++++++++++++++++++- zypp/repo/yum/Downloader.h | 1 + zypp/repo/yum/ResourceType.cc | 3 +++ zypp/repo/yum/ResourceType.h | 2 ++ 4 files changed, 28 insertions(+), 1 deletions(-) diff --git a/zypp/repo/yum/Downloader.cc b/zypp/repo/yum/Downloader.cc index a73b72f..3f51728 100644 --- a/zypp/repo/yum/Downloader.cc +++ b/zypp/repo/yum/Downloader.cc @@ -13,6 +13,7 @@ #include "zypp/base/Function.h" #include "zypp/Date.h" +#include "zypp/PathInfo.h" #include "zypp/parser/yum/RepomdFileReader.h" #include "zypp/parser/yum/PatchesFileReader.h" @@ -25,6 +26,7 @@ using namespace std; using namespace zypp::xml; using namespace zypp::parser::yum; +using namespace zypp::filesystem; namespace zypp { @@ -87,8 +89,27 @@ bool Downloader::repomd_Callback( const OnMediaLocation &loc, MIL << "Skipping filelists.xml.gz" << endl; return true; } + // skip primary.xml.gz if we already have primary.xml.lzma + if ( dtype == ResourceType::PRIMARY && _primary_lzma_job) + { + MIL << "Skipping primary.xml.gz" << endl; + return true; + } + + FetcherJob_Ptr job = this->enqueueDigested(loc_with_path); + if ( dtype == ResourceType::PRIMARY ) + _primary_gz_job = job; + // FIXME: search for 'lzma' in $PATH + if ( dtype == ResourceType::PRIMARY_LZMA && PathInfo("/usr/bin/lzma").isX()) + { + _primary_lzma_job = job; + if (_primary_gz_job) + { + MIL << "Skipping primary.xml.gz" << endl; + this->cancelJob(_primary_gz_job); + } + } - this->enqueueDigested(loc_with_path); // We got a patches file we need to read, to add patches listed // there, so we transfer what we have in the queue, and diff --git a/zypp/repo/yum/Downloader.h b/zypp/repo/yum/Downloader.h index e9b717a..4615db6 100644 --- a/zypp/repo/yum/Downloader.h +++ b/zypp/repo/yum/Downloader.h @@ -74,6 +74,7 @@ namespace zypp private: Pathname _dest_dir; std::list<OnMediaLocation> _patches_files; + FetcherJob_Ptr _primary_lzma_job, _primary_gz_job; MediaSetAccess *_media_ptr; }; diff --git a/zypp/repo/yum/ResourceType.cc b/zypp/repo/yum/ResourceType.cc index 650ba9f..8a22828 100644 --- a/zypp/repo/yum/ResourceType.cc +++ b/zypp/repo/yum/ResourceType.cc @@ -25,6 +25,7 @@ namespace zypp const ResourceType ResourceType::NONE(ResourceType::NONE_e); const ResourceType ResourceType::REPOMD(ResourceType::REPOMD_e); const ResourceType ResourceType::PRIMARY(ResourceType::PRIMARY_e); + const ResourceType ResourceType::PRIMARY_LZMA(ResourceType::PRIMARY_LZMA_e); const ResourceType ResourceType::OTHER(ResourceType::OTHER_e); const ResourceType ResourceType::FILELISTS(ResourceType::FILELISTS_e); const ResourceType ResourceType::GROUP(ResourceType::GROUP_e); @@ -46,6 +47,7 @@ namespace zypp // initialize it _table["repomd"] = ResourceType::REPOMD_e; _table["primary"] = ResourceType::PRIMARY_e; + _table["primary_lzma"] = ResourceType::PRIMARY_LZMA_e; _table["other"] = ResourceType::OTHER_e; _table["filelists"] = ResourceType::FILELISTS_e; _table["group"] = ResourceType::GROUP_e; @@ -76,6 +78,7 @@ namespace zypp // initialize it _table[REPOMD_e] = "repomd"; _table[PRIMARY_e] = "primary"; + _table[PRIMARY_LZMA_e] = "primary_lzma"; _table[OTHER_e] = "other"; _table[FILELISTS_e] = "filelists"; _table[GROUP_e] = "group"; diff --git a/zypp/repo/yum/ResourceType.h b/zypp/repo/yum/ResourceType.h index 2d5cf9e..6965195 100644 --- a/zypp/repo/yum/ResourceType.h +++ b/zypp/repo/yum/ResourceType.h @@ -29,6 +29,7 @@ namespace zypp static const ResourceType NONE; // unknown static const ResourceType REPOMD; static const ResourceType PRIMARY; + static const ResourceType PRIMARY_LZMA; // suse extension static const ResourceType OTHER; static const ResourceType FILELISTS; static const ResourceType GROUP; @@ -45,6 +46,7 @@ namespace zypp NONE_e, REPOMD_e, PRIMARY_e, + PRIMARY_LZMA_e, OTHER_e, FILELISTS_e, GROUP_e, -- 1.7.0.3 -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org