Mailinglist Archive: zypp-commit (223 mails)

< Previous Next >
[zypp-commit] r10657 - in /trunk/libzypp: tests/zypp/RepoManager_test.cc zypp/RepoManager.cc zypp/Service.cc zypp/Service.h zypp/parser/ServiceFileReader.cc
  • From: jkupec@xxxxxxxxxxxxxxxx
  • Date: Wed, 23 Jul 2008 14:15:32 -0000
  • Message-id: <20080723141532.B045B56EBD@xxxxxxxxxxxxxxxx>
Author: jkupec
Date: Wed Jul 23 16:15:32 2008
New Revision: 10657

URL: http://svn.opensuse.org/viewcvs/zypp?rev=10657&view=rev
Log:
- Service::enabled() added

Modified:
trunk/libzypp/tests/zypp/RepoManager_test.cc
trunk/libzypp/zypp/RepoManager.cc
trunk/libzypp/zypp/Service.cc
trunk/libzypp/zypp/Service.h
trunk/libzypp/zypp/parser/ServiceFileReader.cc

Modified: trunk/libzypp/tests/zypp/RepoManager_test.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/RepoManager_test.cc?rev=10657&r1=10656&r2=10657&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/RepoManager_test.cc (original)
+++ trunk/libzypp/tests/zypp/RepoManager_test.cc Wed Jul 23 16:15:32 2008
@@ -84,6 +84,7 @@
urlS.setPathName(DATADIR.asString());
urlS.setScheme("dir");
Service service("test",urlS);
+ service.setEnabled(true);

manager.addService(service);
manager.refreshServices();
@@ -93,6 +94,7 @@
urlS.setPathName((DATADIR+"second").asString());
urlS.setScheme("dir");
service.setUrl(urlS);
+ service.setEnabled(true);

manager.modifyService(service.name(),service);
manager.refreshServices();
@@ -177,3 +179,8 @@
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)
+//{
+//}

Modified: trunk/libzypp/zypp/RepoManager.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=10657&r1=10656&r2=10657&view=diff
==============================================================================
--- trunk/libzypp/zypp/RepoManager.cc (original)
+++ trunk/libzypp/zypp/RepoManager.cc Wed Jul 23 16:15:32 2008
@@ -1422,6 +1422,9 @@
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);
}

Modified: trunk/libzypp/zypp/Service.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Service.cc?rev=10657&r1=10656&r2=10657&view=diff
==============================================================================
--- trunk/libzypp/zypp/Service.cc (original)
+++ trunk/libzypp/zypp/Service.cc Wed Jul 23 16:15:32 2008
@@ -2,6 +2,7 @@

#include <ostream>

+#include "zypp/base/DefaultIntegral.h"
#include "zypp/Url.h"
#include "zypp/RepoInfo.h"
#include "zypp/media/MediaManager.h"
@@ -19,14 +20,15 @@
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_) {};
@@ -46,18 +48,20 @@
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;
}


Modified: trunk/libzypp/zypp/Service.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Service.h?rev=10657&r1=10656&r2=10657&view=diff
==============================================================================
--- trunk/libzypp/zypp/Service.h (original)
+++ trunk/libzypp/zypp/Service.h Wed Jul 23 16:15:32 2008
@@ -67,6 +67,16 @@
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
@@ -99,6 +109,12 @@
*/
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

Modified: trunk/libzypp/zypp/parser/ServiceFileReader.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/ServiceFileReader.cc?rev=10657&r1=10656&r2=10657&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/ServiceFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/ServiceFileReader.cc Wed Jul 23 16:15:32 2008
@@ -59,8 +59,10 @@
++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;
}

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages