manager.buildCache(repo);
}
+BOOST_AUTO_TEST_CASE(repo_seting_test)
+{
+ RepoInfo repo;
+ repo.setAlias("foo");
+ repo.addBaseUrl(string("http://test.org"));
+ BOOST_CHECK_MESSAGE( repo.keepPackages(), "http scheme is not cached");
+ 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");
+ repo.setBaseUrl(string("file:///test.txt"));
+ BOOST_CHECK_MESSAGE( !repo.keepPackages(), "file scheme is cached");
+ repo.setBaseUrl(string("http://test.org"));
+ BOOST_CHECK_MESSAGE( repo.keepPackages(), "cache is depend on second url.");
+}
RepoInfo & RepoInfo::addBaseUrl( const Url &url )
{
+ if ( _pimpl->baseUrls.size()==0 ) //first url
+ {
+ string scheme = url.getScheme();
+ if ( scheme == "http" || scheme == "ftp" || scheme == "smb" )
+ setKeepPackages(true);
+ else
+ setKeepPackages(false);
+ }
+
_pimpl->baseUrls.insert(url);
return *this;
}
/**
* Add a base url. \see baseUrls
* \param url The base url for the repository.
+ * \note can change keepPackages,so change it after this call
*
* To recreate the base URLs list, use \ref setBaseUrl(const Url &) followed
* by addBaseUrl().
/**
* Clears current base URL list and adds \a url.
+ * \note can change keepPackages,so change it after this call
*/
RepoInfo & setBaseUrl( const Url &url );