aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-11 09:53:50 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-11 09:53:50 +0100
commitf7b0e96673665c71c518601ee257822163a47452 (patch)
treeaa08a0bfd317863465d740839ebabe8d8cc1e0e0
parentf43ee8ee592a57d79f5f9eff75ac58fe7b223199 (diff)
downloadpaludis-f7b0e96673665c71c518601ee257822163a47452.tar.gz
paludis-f7b0e96673665c71c518601ee257822163a47452.tar.xz
Return whether world was changed.
-rw-r--r--paludis/environment.hh16
-rw-r--r--paludis/environments/no_config/no_config_environment.cc12
-rw-r--r--paludis/environments/no_config/no_config_environment.hh8
-rw-r--r--paludis/environments/paludis/paludis_environment.cc16
-rw-r--r--paludis/environments/paludis/paludis_environment.hh8
-rw-r--r--paludis/environments/paludis/world.cc26
-rw-r--r--paludis/environments/paludis/world.hh10
-rw-r--r--paludis/environments/portage/portage_environment.cc24
-rw-r--r--paludis/environments/portage/portage_environment.hh10
-rw-r--r--paludis/environments/test/test_environment.cc12
-rw-r--r--paludis/environments/test/test_environment.hh8
-rw-r--r--python/environment.cc16
12 files changed, 93 insertions, 73 deletions
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 64d8922..bc1f2a5 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -414,23 +414,31 @@ namespace paludis
/**
* Add this package to world.
+ *
+ * \return whether anything was added \since 0.49
*/
- virtual void add_to_world(const QualifiedPackageName &) const = 0;
+ virtual bool add_to_world(const QualifiedPackageName &) const = 0;
/**
* Add this set to world.
+ *
+ * \return whether anything was added \since 0.49
*/
- virtual void add_to_world(const SetName &) const = 0;
+ virtual bool add_to_world(const SetName &) const = 0;
/**
* Remove this package from world, if it is present.
+ *
+ * \return whether anything was removed \since 0.49
*/
- virtual void remove_from_world(const QualifiedPackageName &) const = 0;
+ virtual bool remove_from_world(const QualifiedPackageName &) const = 0;
/**
* Remove this set from world, if it is present.
+ *
+ * \return whether anything was removed \since 0.49
*/
- virtual void remove_from_world(const SetName &) const = 0;
+ virtual bool remove_from_world(const SetName &) const = 0;
/**
* Where possible, update configuration files with the first spec to use the second package name.
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index d2bd70a..fb66ed9 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -472,24 +472,28 @@ NoConfigEnvironment::accept_keywords(const std::tr1::shared_ptr<const KeywordNam
return false;
}
-void
+bool
NoConfigEnvironment::add_to_world(const QualifiedPackageName &) const
{
+ return false;
}
-void
+bool
NoConfigEnvironment::remove_from_world(const QualifiedPackageName &) const
{
+ return false;
}
-void
+bool
NoConfigEnvironment::add_to_world(const SetName &) const
{
+ return false;
}
-void
+bool
NoConfigEnvironment::remove_from_world(const SetName &) const
{
+ return false;
}
bool
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index ef2ca72..5ee30f9 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -206,13 +206,13 @@ namespace paludis
virtual HookResult perform_hook(const Hook &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual void add_to_world(const QualifiedPackageName &) const;
+ virtual bool add_to_world(const QualifiedPackageName &) const;
- virtual void add_to_world(const SetName &) const;
+ virtual bool add_to_world(const SetName &) const;
- virtual void remove_from_world(const QualifiedPackageName &) const;
+ virtual bool remove_from_world(const QualifiedPackageName &) const;
- virtual void remove_from_world(const SetName &) const;
+ virtual bool remove_from_world(const SetName &) const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 23cbe58..3e660c6 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -273,28 +273,28 @@ PaludisEnvironment::syncers_dirs() const
return result;
}
-void
+bool
PaludisEnvironment::add_to_world(const QualifiedPackageName & q) const
{
- _imp->config->world()->add_to_world(q);
+ return _imp->config->world()->add_to_world(q);
}
-void
+bool
PaludisEnvironment::add_to_world(const SetName & s) const
{
- _imp->config->world()->add_to_world(s);
+ return _imp->config->world()->add_to_world(s);
}
-void
+bool
PaludisEnvironment::remove_from_world(const QualifiedPackageName & q) const
{
- _imp->config->world()->remove_from_world(q);
+ return _imp->config->world()->remove_from_world(q);
}
-void
+bool
PaludisEnvironment::remove_from_world(const SetName & s) const
{
- _imp->config->world()->remove_from_world(s);
+ return _imp->config->world()->remove_from_world(s);
}
std::tr1::shared_ptr<const MirrorsSequence>
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index 8e354f4..eb1d1fb 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -133,13 +133,13 @@ namespace paludis
virtual bool unmasked_by_user(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual void add_to_world(const QualifiedPackageName &) const;
+ virtual bool add_to_world(const QualifiedPackageName &) const;
- virtual void add_to_world(const SetName &) const;
+ virtual bool add_to_world(const SetName &) const;
- virtual void remove_from_world(const QualifiedPackageName &) const;
+ virtual bool remove_from_world(const QualifiedPackageName &) const;
- virtual void remove_from_world(const SetName &) const;
+ virtual bool remove_from_world(const SetName &) const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
diff --git a/paludis/environments/paludis/world.cc b/paludis/environments/paludis/world.cc
index 02e1841..db580f0 100644
--- a/paludis/environments/paludis/world.cc
+++ b/paludis/environments/paludis/world.cc
@@ -59,31 +59,31 @@ World::~World()
{
}
-void
+bool
World::add_to_world(const SetName & s) const
{
- _add_string_to_world(stringify(s));
+ return _add_string_to_world(stringify(s));
}
-void
+bool
World::add_to_world(const QualifiedPackageName & q) const
{
- _add_string_to_world(stringify(q));
+ return _add_string_to_world(stringify(q));
}
-void
+bool
World::remove_from_world(const SetName & s) const
{
- _remove_string_from_world(stringify(s));
+ return _remove_string_from_world(stringify(s));
}
-void
+bool
World::remove_from_world(const QualifiedPackageName & q) const
{
- _remove_string_from_world(stringify(q));
+ return _remove_string_from_world(stringify(q));
}
-void
+bool
World::_add_string_to_world(const std::string & n) const
{
using namespace std::tr1::placeholders;
@@ -94,7 +94,7 @@ World::_add_string_to_world(const std::string & n) const
<< "Not adding '" << n << "' to world because "
"no world file has been configured. If you have recently upgraded from <paludis-0.26.0_alpha13, consult "
"the FAQ Upgrades section.";
- return;
+ return false;
}
Lock l(_imp->mutex);
@@ -111,7 +111,7 @@ World::_add_string_to_world(const std::string & n) const
{
Log::get_instance()->message("paludis_environment.world.cannot_create", ll_warning, lc_no_context)
<< "Cannot create world file '" << *_imp->maybe_world_file << "': '" << e.message() << "' (" << e.what() << ")";
- return;
+ return false;
}
}
@@ -123,8 +123,10 @@ World::_add_string_to_world(const std::string & n) const
n::tag() = std::tr1::shared_ptr<DepTag>(),
n::type() = sft_simple
));
- world.add(n);
+ bool result(world.add(n));
world.rewrite();
+
+ return result;
}
bool
diff --git a/paludis/environments/paludis/world.hh b/paludis/environments/paludis/world.hh
index 5665e27..c3069ea 100644
--- a/paludis/environments/paludis/world.hh
+++ b/paludis/environments/paludis/world.hh
@@ -36,7 +36,7 @@ namespace paludis
private PrivateImplementationPattern<World>
{
private:
- void _add_string_to_world(const std::string &) const;
+ bool _add_string_to_world(const std::string &) const;
bool _remove_string_from_world(const std::string &) const;
public:
@@ -45,11 +45,11 @@ namespace paludis
const std::tr1::shared_ptr<const SetSpecTree> world_set() const PALUDIS_ATTRIBUTE((warn_unused_result));
- void add_to_world(const SetName &) const;
- void add_to_world(const QualifiedPackageName &) const;
+ bool add_to_world(const SetName &) const;
+ bool add_to_world(const QualifiedPackageName &) const;
- void remove_from_world(const SetName &) const;
- void remove_from_world(const QualifiedPackageName &) const;
+ bool remove_from_world(const SetName &) const;
+ bool remove_from_world(const QualifiedPackageName &) const;
std::tr1::shared_ptr<const FSEntry> location_if_set() const;
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 0f6b53b..6a79b2f 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -870,31 +870,31 @@ PortageEnvironment::reduced_uid() const
return getuid();
}
-void
+bool
PortageEnvironment::add_to_world(const QualifiedPackageName & q) const
{
- _add_string_to_world(stringify(q));
+ return _add_string_to_world(stringify(q));
}
-void
+bool
PortageEnvironment::add_to_world(const SetName & s) const
{
- _add_string_to_world(stringify(s));
+ return _add_string_to_world(stringify(s));
}
-void
+bool
PortageEnvironment::remove_from_world(const QualifiedPackageName & q) const
{
- _remove_string_from_world(stringify(q));
+ return _remove_string_from_world(stringify(q));
}
-void
+bool
PortageEnvironment::remove_from_world(const SetName & s) const
{
- _remove_string_from_world(stringify(s));
+ return _remove_string_from_world(stringify(s));
}
-void
+bool
PortageEnvironment::_add_string_to_world(const std::string & s) const
{
Lock l(_imp->world_mutex);
@@ -913,7 +913,7 @@ PortageEnvironment::_add_string_to_world(const std::string & s) const
{
Log::get_instance()->message("portage_environment.world.write_failed", ll_warning, lc_no_context)
<< "Cannot create world file '" << _imp->world_file << "': '" << e.message() << "' (" << e.what() << ")";
- return;
+ return false;
}
}
@@ -925,8 +925,10 @@ PortageEnvironment::_add_string_to_world(const std::string & s) const
n::tag() = std::tr1::shared_ptr<DepTag>(),
n::type() = sft_simple
));
- world.add(s);
+ bool result(world.add(s));
world.rewrite();
+
+ return result;
}
bool
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index 1aa2617..860e552 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -76,7 +76,7 @@ namespace paludis
template<typename I_>
void _load_atom_file(const FSEntry &, I_, const std::string &, const bool);
- void _add_string_to_world(const std::string &) const;
+ bool _add_string_to_world(const std::string &) const;
bool _remove_string_from_world(const std::string &) const;
protected:
@@ -157,13 +157,13 @@ namespace paludis
virtual gid_t reduced_gid() const;
- virtual void add_to_world(const QualifiedPackageName &) const;
+ virtual bool add_to_world(const QualifiedPackageName &) const;
- virtual void add_to_world(const SetName &) const;
+ virtual bool add_to_world(const SetName &) const;
- virtual void remove_from_world(const QualifiedPackageName &) const;
+ virtual bool remove_from_world(const QualifiedPackageName &) const;
- virtual void remove_from_world(const SetName &) const;
+ virtual bool remove_from_world(const SetName &) const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index 593729f..373a885 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -192,24 +192,28 @@ TestEnvironment::unmasked_by_user(const PackageID &) const
return false;
}
-void
+bool
TestEnvironment::add_to_world(const QualifiedPackageName &) const
{
+ return false;
}
-void
+bool
TestEnvironment::remove_from_world(const QualifiedPackageName &) const
{
+ return false;
}
-void
+bool
TestEnvironment::add_to_world(const SetName &) const
{
+ return false;
}
-void
+bool
TestEnvironment::remove_from_world(const SetName &) const
{
+ return false;
}
void
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index 32bc3d6..d658082 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -108,13 +108,13 @@ namespace paludis
virtual HookResult perform_hook(const Hook &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual void add_to_world(const QualifiedPackageName &) const;
+ virtual bool add_to_world(const QualifiedPackageName &) const;
- virtual void add_to_world(const SetName &) const;
+ virtual bool add_to_world(const SetName &) const;
- virtual void remove_from_world(const QualifiedPackageName &) const;
+ virtual bool remove_from_world(const QualifiedPackageName &) const;
- virtual void remove_from_world(const SetName &) const;
+ virtual bool remove_from_world(const SetName &) const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
diff --git a/python/environment.cc b/python/environment.cc
index 69c4ae4..665e74b 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -324,38 +324,38 @@ class EnvironmentImplementationWrapper :
return EnvironmentImplementation::distribution();
}
- virtual void add_to_world(const QualifiedPackageName & s) const
+ virtual bool add_to_world(const QualifiedPackageName & s) const
{
Lock l(get_mutex());
if (bp::override f = get_override("add_to_world"))
- f(s);
+ return f(s);
else
throw PythonMethodNotImplemented("EnvironmentImplementation", "add_to_world");
}
- virtual void add_to_world(const SetName & s) const
+ virtual bool add_to_world(const SetName & s) const
{
Lock l(get_mutex());
if (bp::override f = get_override("add_to_world"))
- f(s);
+ return f(s);
else
throw PythonMethodNotImplemented("EnvironmentImplementation", "add_to_world");
}
- virtual void remove_from_world(const QualifiedPackageName & s) const
+ virtual bool remove_from_world(const QualifiedPackageName & s) const
{
Lock l(get_mutex());
if (bp::override f = get_override("remove_from_world"))
- f(s);
+ return f(s);
else
throw PythonMethodNotImplemented("EnvironmentImplementation", "remove_from_world");
}
- virtual void remove_from_world(const SetName & s) const
+ virtual bool remove_from_world(const SetName & s) const
{
Lock l(get_mutex());
if (bp::override f = get_override("remove_from_world"))
- f(s);
+ return f(s);
else
throw PythonMethodNotImplemented("EnvironmentImplementation", "remove_from_world");
}