aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-16 21:54:28 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-16 21:54:28 +0000
commitc1e816d8c09a1e83da4c3280647bf3dfa74494a6 (patch)
tree0390ba517a781e525effafdfd99e012d0f38277b
parente3176e4b3eb9582615cc65bcb090aa421dd0ffe7 (diff)
downloadpaludis-c1e816d8c09a1e83da4c3280647bf3dfa74494a6.tar.gz
paludis-c1e816d8c09a1e83da4c3280647bf3dfa74494a6.tar.xz
Handle USE_EXPAND in QA checks more sanely
-rw-r--r--paludis/fake_repository.cc6
-rw-r--r--paludis/fake_repository.hh2
-rw-r--r--paludis/portage_repository.cc34
-rw-r--r--paludis/portage_repository.hh2
-rw-r--r--paludis/qa/dep_flags_check.cc9
-rw-r--r--paludis/qa/environment.cc2
-rw-r--r--paludis/repository.hh13
7 files changed, 59 insertions, 9 deletions
diff --git a/paludis/fake_repository.cc b/paludis/fake_repository.cc
index 1834c3c..fe074b9 100644
--- a/paludis/fake_repository.cc
+++ b/paludis/fake_repository.cc
@@ -193,3 +193,9 @@ FakeRepository::do_is_arch_flag(const UseFlagName &) const
return false;
}
+bool
+FakeRepository::do_is_expand_flag(const UseFlagName &) const
+{
+ return false;
+}
+
diff --git a/paludis/fake_repository.hh b/paludis/fake_repository.hh
index dbf7f24..498d194 100644
--- a/paludis/fake_repository.hh
+++ b/paludis/fake_repository.hh
@@ -73,6 +73,8 @@ namespace paludis
virtual bool do_is_arch_flag(const UseFlagName &) const;
+ virtual bool do_is_expand_flag(const UseFlagName &) const;
+
public:
/**
* Constructor.
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 79f31b5..dabb4b3 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -47,6 +47,7 @@
#include <vector>
#include <deque>
#include <limits>
+#include <strings.h>
using namespace paludis;
@@ -64,7 +65,7 @@ typedef MakeHashedMap<UseFlagName, UseFlagState>::Type UseMap;
typedef MakeHashedSet<UseFlagName>::Type UseMaskSet;
-typedef MakeHashedSet<UseFlagName>::Type ArchListSet;
+typedef std::set<UseFlagName> UseFlagSet;
typedef MakeHashedMap<std::pair<QualifiedPackageName, VersionSpec>, VersionMetadata::Pointer>::Type MetadataMap;
@@ -125,7 +126,10 @@ namespace paludis
mutable bool has_profile;
/// Arch flags
- mutable ArchListSet arch_list;
+ mutable UseFlagSet arch_list;
+
+ /// Arch flags
+ mutable UseFlagSet expand_list;
/// Do we have arch_list?
mutable bool has_arch_list;
@@ -203,6 +207,9 @@ Implementation<PortageRepository>::add_profile(const FSEntry & f) const
else
use[UseFlagName(*u)] = use_enabled;
}
+
+ tokeniser.tokenise(make_defaults_f.get("USE_EXPAND"), create_inserter<UseFlagName>(
+ std::inserter(expand_list, expand_list.begin())));
}
if ((f / "use.mask").exists())
@@ -762,7 +769,6 @@ PortageRepositoryConfigurationError::PortageRepositoryConfigurationError(
{
}
-
bool
PortageRepository::do_is_arch_flag(const UseFlagName & u) const
{
@@ -780,3 +786,25 @@ PortageRepository::do_is_arch_flag(const UseFlagName & u) const
return _implementation->arch_list.end() != _implementation->arch_list.find(u);
}
+bool
+PortageRepository::do_is_expand_flag(const UseFlagName & u) const
+{
+ if (! _implementation->has_profile)
+ {
+ Context context("When checking USE_EXPAND list for '" + stringify(u) + "':");
+ _implementation->add_profile(_implementation->profile.realpath());
+ _implementation->has_profile = true;
+ }
+
+ /// \todo VV no need for this to be linear
+ for (UseFlagSet::const_iterator i(_implementation->expand_list.begin()),
+ i_end(_implementation->expand_list.end()) ; i != i_end ; ++i)
+ if (0 == strncasecmp(
+ stringify(u).c_str(),
+ (stringify(*i) + "_").c_str(),
+ stringify(*i).length() + 1))
+ return true;
+
+ return false;
+}
+
diff --git a/paludis/portage_repository.hh b/paludis/portage_repository.hh
index 0505b91..5cb2225 100644
--- a/paludis/portage_repository.hh
+++ b/paludis/portage_repository.hh
@@ -84,6 +84,8 @@ namespace paludis
virtual bool do_is_arch_flag(const UseFlagName &) const;
+ virtual bool do_is_expand_flag(const UseFlagName &) const;
+
public:
/**
* Constructor.
diff --git a/paludis/qa/dep_flags_check.cc b/paludis/qa/dep_flags_check.cc
index 36a6397..57f5e4e 100644
--- a/paludis/qa/dep_flags_check.cc
+++ b/paludis/qa/dep_flags_check.cc
@@ -71,6 +71,10 @@ namespace
result << Message(qal_maybe, "Inverse arch flag '" + stringify(u->flag()) +
"' in " + role);
}
+ if (env->package_database()->fetch_repository(env->package_database()->
+ favourite_repository())->is_expand_flag(u->flag()))
+ {
+ }
else if (iuse.end() == iuse.find(u->flag()))
result << Message(qal_major, "Conditional flag '" + stringify(u->flag()) +
"' in " + role + " not in IUSE");
@@ -102,13 +106,8 @@ DepFlagsCheck::operator() (const EbuildCheckData & e) const
e.get<ecd_environment>()->package_database()->fetch_metadata(ee));
std::set<UseFlagName> iuse(metadata->begin_iuse(), metadata->end_iuse());
- /// \todo VV need a more elegant way of doing this
iuse.insert(UseFlagName("bootstrap"));
iuse.insert(UseFlagName("build"));
- iuse.insert(UseFlagName("elibc_glibc"));
- iuse.insert(UseFlagName("userland_Darwin"));
- iuse.insert(UseFlagName("userland_bsd"));
- iuse.insert(UseFlagName("userland_GNU"));
Checker depend_checker(result, "DEPEND", e.get<ecd_environment>(), iuse);
std::string depend(metadata->get(vmk_depend));
diff --git a/paludis/qa/environment.cc b/paludis/qa/environment.cc
index 645628f..c62b283 100644
--- a/paludis/qa/environment.cc
+++ b/paludis/qa/environment.cc
@@ -33,7 +33,7 @@ QAEnvironment::QAEnvironment(const FSEntry & base) :
keys.insert(std::make_pair(std::string("importace"), "1"));
keys.insert(std::make_pair(std::string("location"), stringify(base)));
keys.insert(std::make_pair(std::string("cache"), "/var/empty"));
- keys.insert(std::make_pair(std::string("profile"), "/etc/make.profile"));
+ keys.insert(std::make_pair(std::string("profile"), stringify(base / "profiles" / "base")));
package_database()->add_repository(
RepositoryMaker::get_instance()->find_maker("portage")(
diff --git a/paludis/repository.hh b/paludis/repository.hh
index b839db3..b724d66 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -133,6 +133,11 @@ namespace paludis
*/
virtual bool do_is_arch_flag(const UseFlagName &) const = 0;
+ /**
+ * Override in descendents: is this an expand flag?
+ */
+ virtual bool do_is_expand_flag(const UseFlagName &) const = 0;
+
public:
/**
* Destructor.
@@ -323,6 +328,14 @@ namespace paludis
{
return do_is_arch_flag(u);
}
+
+ /**
+ * Query whether the specified use flag is an expand flag.
+ */
+ bool is_expand_flag(const UseFlagName & u) const
+ {
+ return do_is_expand_flag(u);
+ }
};
/**