aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-21 19:22:03 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-26 15:25:00 +0000
commit393adbc779c4bf332e9bb966a14f73fea002ae41 (patch)
tree23608fb619f830b585700444d036c3cae3ee091b
parent04f54edce9cefa3a71fc274376b6a64e6eafee1f (diff)
downloadpaludis-393adbc779c4bf332e9bb966a14f73fea002ae41.tar.gz
paludis-393adbc779c4bf332e9bb966a14f73fea002ae41.tar.xz
Pass optional reason to unmask queries
-rw-r--r--paludis/environment.hh4
-rw-r--r--paludis/environments/no_config/no_config_environment.cc2
-rw-r--r--paludis/environments/no_config/no_config_environment.hh2
-rw-r--r--paludis/environments/paludis/package_mask_conf.cc2
-rw-r--r--paludis/environments/paludis/package_mask_conf.hh3
-rw-r--r--paludis/environments/paludis/paludis_environment.cc6
-rw-r--r--paludis/environments/paludis/paludis_environment.hh2
-rw-r--r--paludis/environments/portage/portage_environment.cc2
-rw-r--r--paludis/environments/portage/portage_environment.hh2
-rw-r--r--paludis/environments/test/test_environment.cc2
-rw-r--r--paludis/environments/test/test_environment.hh2
-rw-r--r--paludis/repositories/e/ebuild_id.cc2
-rw-r--r--paludis/repositories/fake/fake_package_id.cc2
-rw-r--r--python/additional_tests.cc2
-rw-r--r--python/environment.cc6
-rwxr-xr-xpython/environment_TEST.py2
16 files changed, 23 insertions, 20 deletions
diff --git a/paludis/environment.hh b/paludis/environment.hh
index eb9bfa2..c072bb1 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -238,9 +238,11 @@ namespace paludis
* should be used rather than calling this directly.
*
* \since 0.58 takes id by shared_ptr
+ * \since 0.60 takes optional extra reason string
*/
virtual bool unmasked_by_user(
- const std::shared_ptr<const PackageID> &) const
+ const std::shared_ptr<const PackageID> &,
+ const std::string &) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index 103da45..07ecaa7 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -503,7 +503,7 @@ NoConfigEnvironment::remove_from_world(const SetName &) const
}
bool
-NoConfigEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> &) const
+NoConfigEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const
{
return false;
}
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index 5a1ea83..575927a 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -190,7 +190,7 @@ namespace paludis
virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool will_be_used_for_overridden) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &) const
+ virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::shared_ptr<const FSPathSequence> hook_dirs() const
diff --git a/paludis/environments/paludis/package_mask_conf.cc b/paludis/environments/paludis/package_mask_conf.cc
index 4814e0e..5287fc7 100644
--- a/paludis/environments/paludis/package_mask_conf.cc
+++ b/paludis/environments/paludis/package_mask_conf.cc
@@ -98,7 +98,7 @@ PackageMaskConf::add(const FSPath & filename)
}
bool
-PackageMaskConf::query(const std::shared_ptr<const PackageID> & e) const
+PackageMaskConf::query(const std::shared_ptr<const PackageID> & e, const std::string &) const
{
using namespace std::placeholders;
if (indirect_iterator(_imp->masks.end()) != std::find_if(
diff --git a/paludis/environments/paludis/package_mask_conf.hh b/paludis/environments/paludis/package_mask_conf.hh
index 8cd6568..cb927d0 100644
--- a/paludis/environments/paludis/package_mask_conf.hh
+++ b/paludis/environments/paludis/package_mask_conf.hh
@@ -63,7 +63,8 @@ namespace paludis
/**
* Query a mask.
*/
- bool query(const std::shared_ptr<const PackageID> &) const;
+ bool query(const std::shared_ptr<const PackageID> &,
+ const std::string &) const;
};
}
}
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 1eea305..8ec4bc9 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -192,9 +192,9 @@ PaludisEnvironment::accept_license(const std::string & license, const std::share
}
bool
-PaludisEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> & d) const
+PaludisEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> & d, const std::string & reason) const
{
- return _imp->config->package_unmask_conf()->query(d);
+ return _imp->config->package_unmask_conf()->query(d, reason);
}
std::shared_ptr<const FSPathSequence>
@@ -431,7 +431,7 @@ PaludisEnvironment::mask_for_breakage(const std::shared_ptr<const PackageID> & i
const std::shared_ptr<const Mask>
PaludisEnvironment::mask_for_user(const std::shared_ptr<const PackageID> & d, const bool o) const
{
- if (_imp->config->package_mask_conf()->query(d))
+ if (_imp->config->package_mask_conf()->query(d, ""))
return std::make_shared<UserConfigMask>(o);
return std::shared_ptr<const Mask>();
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index 8cbb899..14deb9b 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -126,7 +126,7 @@ namespace paludis
virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &) const
+ virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool add_to_world(const QualifiedPackageName &) const;
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index adc2ffd..eb1ace4 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -672,7 +672,7 @@ PortageEnvironment::accept_keywords(const std::shared_ptr <const KeywordNameSet>
}
bool
-PortageEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> & e) const
+PortageEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> & e, const std::string &) const
{
for (PackageUnmask::const_iterator i(_imp->package_unmask.begin()), i_end(_imp->package_unmask.end()) ;
i != i_end ; ++i)
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index 2174833..a309f74 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -152,7 +152,7 @@ namespace paludis
virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &) const
+ virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual uid_t reduced_uid() const;
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index 6394cf3..eb84fc6 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -189,7 +189,7 @@ TestEnvironment::mask_for_user(const std::shared_ptr<const PackageID> &, const b
}
bool
-TestEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> &) const
+TestEnvironment::unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const
{
return false;
}
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index c499683..7d35621 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -89,7 +89,7 @@ namespace paludis
virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &) const
+ virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::shared_ptr<const FSPathSequence> hook_dirs() const
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 79e8a6d..acfa9bf 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -566,7 +566,7 @@ EbuildID::need_masks_added() const
_imp->environment->distribution())->concept_license(), license_key()->raw_name()));
}
- if (! _imp->environment->unmasked_by_user(shared_from_this()))
+ if (! _imp->environment->unmasked_by_user(shared_from_this(), ""))
{
/* repo unless user */
if (_imp->repository_mask->value())
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index bbfe333..4a170b6 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -1068,7 +1068,7 @@ FakePackageID::need_masks_added() const
add_mask(std::make_shared<FakeUnacceptedMask>('L', "license", license_key()->raw_name()));
}
- if (! _imp->env->unmasked_by_user(shared_from_this()))
+ if (! _imp->env->unmasked_by_user(shared_from_this(), ""))
{
std::shared_ptr<const Mask> user_mask(_imp->env->mask_for_user(shared_from_this(), false));
if (user_mask)
diff --git a/python/additional_tests.cc b/python/additional_tests.cc
index cf9c739..6b8fafe 100644
--- a/python/additional_tests.cc
+++ b/python/additional_tests.cc
@@ -62,7 +62,7 @@ namespace environment
e.mask_for_user(pid, false);
- bool PALUDIS_ATTRIBUTE((unused)) b4(e.unmasked_by_user(pid));
+ bool PALUDIS_ATTRIBUTE((unused)) b4(e.unmasked_by_user(pid, ""));
e.package_database();
diff --git a/python/environment.cc b/python/environment.cc
index 752c8cb..1a0d3f8 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -108,13 +108,13 @@ class EnvironmentImplementationWrapper :
throw PythonMethodNotImplemented("EnvironmentImplementation", "mask_for_user");
}
- virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> & p) const
+ virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> & p, const std::string & s) const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
Lock l(get_mutex());
if (bp::override f = get_override("unmasked_by_user"))
- return f(p);
+ return f(p, s);
else
throw PythonMethodNotImplemented("EnvironmentImplementation", "unmasked_by_user");
}
@@ -611,7 +611,7 @@ void expose_environment()
)
.def("unmasked_by_user", bp::pure_virtual(&EnvImp::unmasked_by_user),
- "unmasked_by_user(PackageID) -> bool\n"
+ "unmasked_by_user(PackageID, String) -> bool\n"
"Do we have a user unmask for a particular package?\n\n"
"This is only applied to repository and profile style masks, not\n"
"keywords, licences etc. If true, user_mask shouldn't be used."
diff --git a/python/environment_TEST.py b/python/environment_TEST.py
index 6b02ba0..59a8bc5 100755
--- a/python/environment_TEST.py
+++ b/python/environment_TEST.py
@@ -102,7 +102,7 @@ class TestCase_04_Environment_subclassingd(unittest.TestCase):
def mask_for_user(self, pid, b):
return UserMask()
- def unmasked_by_user(self, pid):
+ def unmasked_by_user(self, pid, reason):
return False
def bashrc_files(self):