aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-25 16:05:24 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-25 16:05:24 +0000
commit8e997c10a4a46163712f866d7fae3827c35d0443 (patch)
tree02be14faf1290c4e92b5efe63926427095820355
parent42314ff28e0a56b0d86aa354bcf563576d7add4b (diff)
downloadpaludis-8e997c10a4a46163712f866d7fae3827c35d0443.tar.gz
paludis-8e997c10a4a46163712f866d7fae3827c35d0443.tar.xz
Use real profiles from profiles.desc for QA environment.
-rw-r--r--paludis/qa/files.m42
-rw-r--r--paludis/qa/qa_environment.cc47
-rw-r--r--paludis/qa/qa_environment.hh7
-rw-r--r--paludis/qa/qa_environment.sr14
-rwxr-xr-xpaludis/qa/qa_environment_TEST_setup.sh3
5 files changed, 67 insertions, 6 deletions
diff --git a/paludis/qa/files.m4 b/paludis/qa/files.m4
index 8288fe1..cca3dfc 100644
--- a/paludis/qa/files.m4
+++ b/paludis/qa/files.m4
@@ -40,7 +40,7 @@ add(`metadata_check', `hh', `cc')
add(`package_dir_check', `hh', `cc')
add(`package_name_check', `hh', `cc', `test', `testscript')
add(`parse_deps_check', `hh', `cc')
-add(`qa_environment', `hh', `cc', `test', `testscript')
+add(`qa_environment', `hh', `cc', `test', `testscript', `sr')
add(`restrict_check', `hh', `cc')
add(`src_uri_check', `hh', `cc')
add(`pdepend_overlap_check', `hh', `cc')
diff --git a/paludis/qa/qa_environment.cc b/paludis/qa/qa_environment.cc
index a1e7b16..c43ee0a 100644
--- a/paludis/qa/qa_environment.cc
+++ b/paludis/qa/qa_environment.cc
@@ -21,6 +21,9 @@
#include <paludis/package_database_entry.hh>
#include <paludis/qa/qa_environment.hh>
#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/util/log.hh>
+#include <paludis/config_file.hh>
#include <map>
using namespace paludis;
@@ -28,16 +31,45 @@ using namespace paludis::qa;
namespace paludis
{
+ namespace qa
+ {
+#include <paludis/qa/qa_environment-sr.hh>
+#include <paludis/qa/qa_environment-sr.cc>
+ }
+
template<>
struct Implementation<QAEnvironmentBase> :
InternalCounted<QAEnvironmentBase>
{
- std::map<std::string, PackageDatabase::Pointer> package_databases;
+ std::vector<PackageDatabasesEntry> package_databases;
- Implementation(const FSEntry &, const Environment * const env)
+ Implementation(const FSEntry & base, const Environment * const env)
{
- package_databases.insert(std::make_pair("base",
- PackageDatabase::Pointer(new PackageDatabase(env))));
+ Context context("When creating package databases from profiles.desc under '"
+ + stringify(base / "profiles") + "':");
+
+ LineConfigFile profiles_desc(base / "profiles" / "profiles.desc");
+ for (LineConfigFile::Iterator line(profiles_desc.begin()), line_end(profiles_desc.end()) ;
+ line != line_end ; ++line)
+ {
+ std::vector<std::string> tokens;
+ WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
+
+ if (tokens.size() != 3)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Skipping invalid line '"
+ + *line + "'");
+ continue;
+ }
+ package_databases.push_back(PackageDatabasesEntry(PackageDatabasesEntry::create()
+ .arch(UseFlagName(tokens.at(0)))
+ .location(base / "profiles" / tokens.at(1))
+ .status(tokens.at(2))
+ .package_database(PackageDatabase::Pointer(new PackageDatabase(env)))));
+ }
+
+ if (package_databases.empty())
+ throw ProfilesDescError("No profiles.desc entries found");
}
};
}
@@ -53,7 +85,7 @@ QAEnvironmentBase::~QAEnvironmentBase()
QAEnvironment::QAEnvironment(const FSEntry & base) :
QAEnvironmentBase(base, this),
- Environment(_imp->package_databases.begin()->second)
+ Environment(_imp->package_databases.begin()->package_database)
{
AssociativeCollection<std::string, std::string>::Pointer keys(
new AssociativeCollection<std::string, std::string>::Concrete);
@@ -80,3 +112,8 @@ QAEnvironment::paludis_command() const
"'paludis_command called from within QAEnvironment'";
}
+ProfilesDescError::ProfilesDescError(const std::string & message) throw () :
+ ConfigurationError("Bad profiles.desc: " + message)
+{
+}
+
diff --git a/paludis/qa/qa_environment.hh b/paludis/qa/qa_environment.hh
index 0eb29dc..2dba804 100644
--- a/paludis/qa/qa_environment.hh
+++ b/paludis/qa/qa_environment.hh
@@ -63,6 +63,13 @@ namespace paludis
virtual std::string paludis_command() const;
};
+
+ class ProfilesDescError :
+ public ConfigurationError
+ {
+ public:
+ ProfilesDescError(const std::string & message) throw ();
+ };
}
}
diff --git a/paludis/qa/qa_environment.sr b/paludis/qa/qa_environment.sr
new file mode 100644
index 0000000..c7e9909
--- /dev/null
+++ b/paludis/qa/qa_environment.sr
@@ -0,0 +1,14 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_PackageDatabasesEntry()
+{
+ key arch UseFlagName
+ key location FSEntry
+ key status std::string
+ key package_database PackageDatabase::Pointer
+
+ allow_named_args
+}
+
+
diff --git a/paludis/qa/qa_environment_TEST_setup.sh b/paludis/qa/qa_environment_TEST_setup.sh
index b13b5ce..6764e76 100755
--- a/paludis/qa/qa_environment_TEST_setup.sh
+++ b/paludis/qa/qa_environment_TEST_setup.sh
@@ -15,6 +15,9 @@ END
cat <<END > profiles/profile/make.defaults
ARCH=test
END
+cat <<END > profiles/profiles.desc
+test profile/ stable
+END
mkdir -p cat-one/pkg-one
cat <<END > cat-one/pkg-one/pkg-one-1.ebuild
DESCRIPTION="foo"