aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-22 12:45:40 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-22 12:45:40 +0000
commite68d9de42edddf8eafe9463dbc2f0772bff949ec (patch)
tree1f18e11b88f9a077a0571656e55ef265f3a531a6
parent721c4c194a49c4f131af590d56edd056bfcb5465 (diff)
downloadpaludis-e68d9de42edddf8eafe9463dbc2f0772bff949ec.tar.gz
paludis-e68d9de42edddf8eafe9463dbc2f0772bff949ec.tar.xz
Allow the user to specify importance= for repositories. Value is an integer, larger is more important.
-rw-r--r--paludis/default_config.cc15
-rw-r--r--paludis/default_config.hh11
2 files changed, 21 insertions, 5 deletions
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index 17233a8..842ddf7 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -32,6 +32,7 @@
#include "tokeniser.hh"
#include <fstream>
#include <algorithm>
+#include <sstream>
using namespace paludis;
@@ -86,12 +87,24 @@ DefaultConfig::DefaultConfig()
throw DefaultConfigError("Key 'profile' empty or not specified in " +
stringify(*repo_file));
+ int importance(0);
+ if (! k.get("importance").empty())
+ {
+ std::stringstream s(k.get("importance"));
+ s >> importance;
+ if (! s.eof())
+ throw DefaultConfigError("Key 'importance' should be a number in "
+ + stringify(*repo_file));
+ }
+
_repos.push_back(RepositoryConfigEntry(k.get("location"),
- k.get("profile"), k.get("format")));
+ k.get("profile"), k.get("format"), importance));
}
if (_repos.empty())
throw DefaultConfigError("No repositories specified");
+
+ _repos.sort();
}
/* keywords */
diff --git a/paludis/default_config.hh b/paludis/default_config.hh
index 8b2a22e..895a1ee 100644
--- a/paludis/default_config.hh
+++ b/paludis/default_config.hh
@@ -52,15 +52,18 @@ namespace paludis
{
rce_location,
rce_profile,
- rce_format
+ rce_format,
+ rce_importance
};
struct RepositoryConfigEntryTag :
- SmartRecordTag<comparison_mode::FullComparisonTag, comparison_method::SmartRecordCompareByAllTag>,
- SmartRecordKeys<RepositoryConfigEntryKeys, 3>,
+ SmartRecordTag<comparison_mode::FullComparisonTag,
+ comparison_method::SmartRecordCompareByKeyTag<rce_importance> >,
+ SmartRecordKeys<RepositoryConfigEntryKeys, 4>,
SmartRecordKey<rce_location, FSEntry>,
SmartRecordKey<rce_profile, FSEntry>,
- SmartRecordKey<rce_format, std::string>
+ SmartRecordKey<rce_format, std::string>,
+ SmartRecordKey<rce_importance, unsigned>
{
};