aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-12 00:44:41 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-12 00:44:41 +0000
commit7ef5db4623505c30471e27cfa3aa90c5ec0bdd62 (patch)
tree7ea20c26b7a9088afdffe089f5f16a5529a1b21a
parent99f7b75f68bcbd0447118b4f155b715cac4a585c (diff)
downloadpaludis-7ef5db4623505c30471e27cfa3aa90c5ec0bdd62.tar.gz
paludis-7ef5db4623505c30471e27cfa3aa90c5ec0bdd62.tar.xz
Allow selective profile querying
-rw-r--r--src/adjutrix/command_line.cc15
-rw-r--r--src/adjutrix/command_line.hh21
-rw-r--r--src/adjutrix/display_profiles_use.cc42
3 files changed, 60 insertions, 18 deletions
diff --git a/src/adjutrix/command_line.cc b/src/adjutrix/command_line.cc
index 3d5cd74..963a7ba 100644
--- a/src/adjutrix/command_line.cc
+++ b/src/adjutrix/command_line.cc
@@ -62,10 +62,18 @@ CommandLine::CommandLine() :
a_repository_directory(&general_args, "repository-dir", 'D',
"Where to find the repository (default: detected from ./ or ../ or ../..)"),
+
+ tree_args(this, "Tree action options",
+ "Options which are relevant for tree actions."),
a_category(&general_args, "category", 'C',
- "Matches with this category name only"),
+ "Matches with this category name only (may be specified multiple times)"),
a_package(&general_args, "package", 'P',
- "Matches with this package name only")
+ "Matches with this package name only (may be specified multiple times)"),
+
+ profile_args(this, "Profile action options",
+ "Options which are relevant for profile actions."),
+ a_profile(&profile_args, "profile", 'p',
+ "Display results for this profile path, rather than all profiles (may be specified multiple times)")
{
add_usage_line("--find-stable-candidates arch [ --repository-dir /path ] "
"[ --category app-misc --category sys-apps ... ] "
@@ -76,7 +84,8 @@ CommandLine::CommandLine() :
add_usage_line("--keywords-graph [ --repository-dir /path ] "
"[ --category app-misc --category sys-apps ... ] "
"[ --package foo --package fnord ... ]");
- add_usage_line("--display-profiles-use [ --repository-dir /path ]");
+ add_usage_line("--display-profiles-use [ --profile default-linux/x86/2006.0 "
+ "--profile default-linux/x86/2006.1 ... ] [ --repository-dir /path ]");
add_usage_line("--version");
add_usage_line("--help");
diff --git a/src/adjutrix/command_line.hh b/src/adjutrix/command_line.hh
index 4b21240..279ae33 100644
--- a/src/adjutrix/command_line.hh
+++ b/src/adjutrix/command_line.hh
@@ -81,10 +81,29 @@ class CommandLine :
paludis::args::AliasArg a_no_color;
paludis::args::StringArg a_repository_directory;
+
+ ///}
+
+
+ ///\name Tree arguments
+ ///\{
+
+ paludis::args::ArgsGroup tree_args;
+
paludis::args::StringSetArg a_category;
paludis::args::StringSetArg a_package;
- ///}
+ ///\}
+
+ ///\name Profile arguments
+ ///\{
+
+ paludis::args::ArgsGroup profile_args;
+
+ paludis::args::StringSetArg a_profile;
+
+ ///\}
+
};
/**
diff --git a/src/adjutrix/display_profiles_use.cc b/src/adjutrix/display_profiles_use.cc
index 0a1c0e9..284d67a 100644
--- a/src/adjutrix/display_profiles_use.cc
+++ b/src/adjutrix/display_profiles_use.cc
@@ -150,24 +150,38 @@ void do_display_profiles_use(AdjutrixEnvironment & env)
}
}
- LineConfigFile profiles_desc(env.main_repository_dir() / "profiles" / "profiles.desc");
+ if (CommandLine::get_instance()->a_profile.args_begin() ==
+ CommandLine::get_instance()->a_profile.args_end())
{
- for (LineConfigFile::Iterator line(profiles_desc.begin()), line_end(profiles_desc.end()) ;
- line != line_end ; ++line)
+ LineConfigFile profiles_desc(env.main_repository_dir() / "profiles" / "profiles.desc");
{
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
-
- if (tokens.size() != 3)
+ for (LineConfigFile::Iterator line(profiles_desc.begin()), line_end(profiles_desc.end()) ;
+ line != line_end ; ++line)
{
- Log::get_instance()->message(ll_warning, lc_context, "Skipping invalid line '"
- + *line + "'");
- continue;
- }
+ std::vector<std::string> tokens;
+ WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
- env.set_profile(env.main_repository_dir() / "profiles" / tokens.at(1));
- display_profiles_use(env, tokens.at(0) + "." + tokens.at(2), env.main_repository_dir() /
- "profiles" / tokens.at(1), all_use_flags, all_use_expand_flags);
+ if (tokens.size() != 3)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Skipping invalid line '"
+ + *line + "'");
+ continue;
+ }
+
+ env.set_profile(env.main_repository_dir() / "profiles" / tokens.at(1));
+ display_profiles_use(env, tokens.at(0) + "." + tokens.at(2), env.main_repository_dir() /
+ "profiles" / tokens.at(1), all_use_flags, all_use_expand_flags);
+ }
+ }
+ }
+ else
+ {
+ for (args::StringSetArg::Iterator i(CommandLine::get_instance()->a_profile.args_begin()),
+ i_end(CommandLine::get_instance()->a_profile.args_end()) ; i != i_end ; ++i)
+ {
+ env.set_profile(env.main_repository_dir() / "profiles" / (*i));
+ display_profiles_use(env, *i, env.main_repository_dir() /
+ "profiles" / *i, all_use_flags, all_use_expand_flags);
}
}
}