aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-14 00:43:33 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-14 00:43:33 +0000
commitf3fc93c6bd2e82591eca0ac6bb2d02af279a07c7 (patch)
treede0ae939e60893716d3d4dbbf34b3efe89c0ec4c
parentaf7844efbf185d17f743e048044d8037e83e3da9 (diff)
downloadpaludis-f3fc93c6bd2e82591eca0ac6bb2d02af279a07c7.tar.gz
paludis-f3fc93c6bd2e82591eca0ac6bb2d02af279a07c7.tar.xz
Replace the select one behaviour present on certain sets with a universal merge all
-rw-r--r--paludis/default_environment.cc2
-rw-r--r--paludis/default_environment.hh2
-rw-r--r--paludis/environment.cc58
-rw-r--r--paludis/environment.hh4
4 files changed, 27 insertions, 39 deletions
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index e893cc0..a141c6f 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -475,7 +475,7 @@ DefaultEnvironment::hook_dirs() const
return join(hook_dirs.begin(), hook_dirs.end(), " ");
}
-DepAtom::Pointer
+CompositeDepAtom::Pointer
DefaultEnvironment::local_package_set(const std::string & s,
const PackageSetOptions &) const
{
diff --git a/paludis/default_environment.hh b/paludis/default_environment.hh
index 4d03ea4..37f0e0a 100644
--- a/paludis/default_environment.hh
+++ b/paludis/default_environment.hh
@@ -49,7 +49,7 @@ namespace paludis
~DefaultEnvironment();
protected:
- DepAtom::Pointer local_package_set(const std::string &,
+ CompositeDepAtom::Pointer local_package_set(const std::string &,
const PackageSetOptions & = PackageSetOptions(false)) const;
public:
diff --git a/paludis/environment.cc b/paludis/environment.cc
index 4e7ee7f..43fd1c3 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -193,51 +193,39 @@ Environment::mask_reasons(const PackageDatabaseEntry & e) const
DepAtom::Pointer
Environment::package_set(const std::string & s, const PackageSetOptions & o) const
{
+ /* favour local sets first */
+ CompositeDepAtom::Pointer result(local_package_set(s));
+ if (0 != result)
+ return result;
+
+ /* these sets always exist, even if empty */
if (s == "everything" || s == "system" || s == "world" || s == "security")
- {
AllDepAtom::Pointer result(new AllDepAtom);
- for (PackageDatabase::RepositoryIterator r(package_database()->begin_repositories()),
- r_end(package_database()->end_repositories()) ;
- r != r_end ; ++r)
+ for (PackageDatabase::RepositoryIterator r(package_database()->begin_repositories()),
+ r_end(package_database()->end_repositories()) ;
+ r != r_end ; ++r)
+ {
+ if (! (*r)->sets_interface)
+ continue;
+
+ DepAtom::Pointer add((*r)->sets_interface->package_set(s, o));
+ if (0 != add)
{
- if (! (*r)->sets_interface)
- continue;
+ if (! result)
+ result.assign(new AllDepAtom);
+ result->add_child(add);
+ }
- DepAtom::Pointer add((*r)->sets_interface->package_set(s, o));
+ if ("everything" == s || "world" == s)
+ {
+ add = (*r)->sets_interface->package_set("system");
if (0 != add)
result->add_child(add);
-
- if ("system" != s)
- {
- add = (*r)->sets_interface->package_set("system");
- if (0 != add)
- result->add_child(add);
- }
}
-
- return result;
}
- else
- {
- DepAtom::Pointer rr(local_package_set(s));
- if (0 != rr)
- return rr;
- for (PackageDatabase::RepositoryIterator r(package_database()->begin_repositories()),
- r_end(package_database()->end_repositories()) ;
- r != r_end ; ++r)
- {
- if (! (*r)->sets_interface)
- continue;
-
- DepAtom::Pointer result((*r)->sets_interface->package_set(s));
- if (0 != result)
- return result;
- }
-
- return DepAtom::Pointer(0);
- }
+ return result;
}
namespace
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 03a1116..8fd0549 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -106,10 +106,10 @@ namespace paludis
/**
* Local package set, or zero.
*/
- virtual DepAtom::Pointer local_package_set(const std::string &,
+ virtual CompositeDepAtom::Pointer local_package_set(const std::string &,
const PackageSetOptions & = PackageSetOptions(false)) const
{
- return DepAtom::Pointer(0);
+ return AllDepAtom::Pointer(0);
}
/**