urlS.setPathName(DATADIR.asString());
urlS.setScheme("dir");
Service service("test",urlS);
+ service.setEnabled(true);
manager.addService(service);
manager.refreshServices();
urlS.setPathName((DATADIR+"second").asString());
urlS.setScheme("dir");
service.setUrl(urlS);
+ service.setEnabled(true);
manager.modifyService(service.name(),service);
manager.refreshServices();
repo.setBaseUrl(string("http://test.org"));
BOOST_CHECK_MESSAGE( repo.keepPackages(), "cache is depend on second url.");
}
+
+//! \todo test this
+//BOOST_AUTO_TEST_CASE(repo_dont_overwrite_external_settings_test)
+//{
+//}
for (std::set<Service>::iterator it = _pimpl->services.begin();
it != _pimpl->services.end(); ++it)
{
+ if ( !it->enabled() )
+ continue;
+
MIL << "refresh: " << it->name() << " with url: "<< it->url().asString() << endl;
refreshService(*it);
}
#include <ostream>
+#include "zypp/base/DefaultIntegral.h"
#include "zypp/Url.h"
#include "zypp/RepoInfo.h"
#include "zypp/media/MediaManager.h"
repos.push_back(info);
return true;
}
-
};
class Service::Impl{
public:
string name;
Url url;
+ DefaultIntegral<bool,false> enabled;
Pathname loc;
+
Impl() : name("") {};
Impl(const string& name_) : name(name_) {};
Impl(const string& name_, const Url& url_) : name(name_), url(url_) {};
const Service Service::noService;
string Service::name() const { return _pimpl->name; }
-
void Service::setName( const std::string& name ) { _pimpl->name = name; }
Url Service::url() const { return _pimpl->url; }
-
void Service::setUrl( const Url& url ) { _pimpl->url = url; }
+ bool Service::enabled() const { return _pimpl->enabled; }
+ void Service::setEnabled( const bool enabled ) { _pimpl->enabled = enabled; }
+
void Service::dumpServiceOn( std::ostream& str ) const
{
str << endl;
str << "[" << name() << "]" << endl;
str << "url = " << url() << endl;
+ str << "enabled = " << ( enabled() ? "1" : "0") << endl;
str << endl;
}
Url url() const;
/**
+ * Returns 'enabled' flag of the services.
+ *
+ * Disabled services imply disabled repositories of these services
+ * and they won't be refreshed by \ref RepoManager::refreshServices().
+ *
+ * Enabled services will be refreshed by \ref RepoManager::refreshServices().
+ */
+ bool enabled() const;
+
+ /**
* Gets from which file is this service loaded or saved.
*
* \note this is empty for newly created file until it is saved
*/
void setName( const std::string& name );
+ /**
+ * Sets enabled status of the services.
+ * \param enabled The desired status.
+ */
+ void setEnabled( const bool enabled );
+
public:
/**
* Writes Service to stream in ".service" format
++it )
{
//MIL << (*it).first << endl;
- if (it->first == "url" )
+ if ( it->first == "url" )
service.setUrl( Url (it->second) );
+ else if ( it->first == "enabled" )
+ service.setEnabled( str::strToTrue( it->second ) );
else
ERR << "Unknown attribute " << it->second << " ignored" << endl;
}