From 1704217d7d910b888e6fc8694db8b13240c9df88 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Tue, 6 May 2008 12:58:06 +0000 Subject: [PATCH] revert isLocal metod and use downloads instead to decide when cache packages. --- tests/zypp/RepoManager_test.cc | 2 +- zypp/RepoInfo.cc | 7 ++++--- zypp/Url.cc | 6 ------ zypp/Url.h | 11 ----------- zypp/url/UrlBase.cc | 25 ------------------------- zypp/url/UrlBase.h | 10 ---------- 6 files changed, 5 insertions(+), 56 deletions(-) diff --git a/tests/zypp/RepoManager_test.cc b/tests/zypp/RepoManager_test.cc index f4d4071..eade55e 100644 --- a/tests/zypp/RepoManager_test.cc +++ b/tests/zypp/RepoManager_test.cc @@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE(repo_seting_test) repo.setBaseUrl(string("ftp://test.org")); BOOST_CHECK_MESSAGE( repo.keepPackages(), "ftp scheme is not cached"); repo.setBaseUrl(string("smb://test.org")); - BOOST_CHECK_MESSAGE( repo.keepPackages(), "smb scheme is not cached"); + BOOST_CHECK_MESSAGE( !repo.keepPackages(), "smb scheme is cached"); repo.setBaseUrl(string("file:///test.txt")); BOOST_CHECK_MESSAGE( !repo.keepPackages(), "file scheme is cached"); repo.setBaseUrl(string("http://test.org")); diff --git a/zypp/RepoInfo.cc b/zypp/RepoInfo.cc index c3d8fc8..5f5db8f 100644 --- a/zypp/RepoInfo.cc +++ b/zypp/RepoInfo.cc @@ -13,6 +13,7 @@ #include "zypp/base/Logger.h" #include "zypp/base/DefaultIntegral.h" +#include "zypp/media/MediaAccess.h" #include "zypp/RepoInfo.h" @@ -148,10 +149,10 @@ namespace zypp { if ( _pimpl->baseUrls.size()==0 ) //first url { - if ( url.isLocal() ) - setKeepPackages(false); - else + if ( media::MediaAccess::downloads( url ) ) setKeepPackages(true); + else + setKeepPackages(false); } _pimpl->baseUrls.insert(url); diff --git a/zypp/Url.cc b/zypp/Url.cc index 8099a92..9c6b42f 100644 --- a/zypp/Url.cc +++ b/zypp/Url.cc @@ -445,12 +445,6 @@ namespace zypp return m_impl->isValid(); } - // ----------------------------------------------------------------- - bool - Url::isLocal() const - { - return m_impl->isLocal(); - } // ----------------------------------------------------------------- std::string diff --git a/zypp/Url.h b/zypp/Url.h index f5b70c5..ea85cea 100644 --- a/zypp/Url.h +++ b/zypp/Url.h @@ -259,17 +259,6 @@ namespace zypp bool isValid() const; - /** - * \brief Gets if url uses local network or pc scheme. - * - * Looks if url use local network scheme or uses internet - * scheme like http, ftp, smb. - * - * \return True if url uses local network or pc scheme - */ - bool - isLocal() const; - // ----------------- /** diff --git a/zypp/url/UrlBase.cc b/zypp/url/UrlBase.cc index b3c9333..f9fa8f2 100644 --- a/zypp/url/UrlBase.cc +++ b/zypp/url/UrlBase.cc @@ -22,7 +22,6 @@ #include #include -#include // in the Estonian locale, a-z excludes t, for example. #302525 // http://en.wikipedia.org/wiki/Estonian_alphabet @@ -429,30 +428,6 @@ namespace zypp return true; } - // --------------------------------------------------------------- - bool - UrlBase::isLocal() const - { - static std::set remote; - if (remote.empty()) //fill set - { - remote.insert("http"); - remote.insert("ftp"); - remote.insert("smb"); - remote.insert("ldap"); - remote.insert("ldaps"); - remote.insert("https"); - remote.insert("sftp"); - remote.insert("cifs"); - } - - if ( remote.find(getScheme())!=remote.end() ) - { - return false; - } - - return true; - } // --------------------------------------------------------------- std::string diff --git a/zypp/url/UrlBase.h b/zypp/url/UrlBase.h index 3d3f801..09be00b 100644 --- a/zypp/url/UrlBase.h +++ b/zypp/url/UrlBase.h @@ -400,16 +400,6 @@ namespace zypp virtual bool isValid() const; - /** - * \brief Gets if url uses local network or pc scheme. - * - * Looks if url use local network scheme or uses internet - * scheme like http, ftp, smb. - * - * \return True if url uses local network or pc scheme - */ - virtual bool - isLocal() const; // ----------------- /** -- 2.7.4