aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-23 11:55:46 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-23 11:55:46 +0000
commit604033b71af17585586fc9bb09a6f8f63bb08169 (patch)
treedd92c7078a7e4d983e581bc1ce513f66e4a48c8b
parentbe73d69521951b5efe2852d1313d05f3054facab (diff)
downloadpaludis-604033b71af17585586fc9bb09a6f8f63bb08169.tar.gz
paludis-604033b71af17585586fc9bb09a6f8f63bb08169.tar.xz
Support optional PDE parameter for query_use
-rw-r--r--ruby/default_environment.cc9
-rwxr-xr-xruby/default_environment_TEST_setup.sh1
2 files changed, 8 insertions, 2 deletions
diff --git a/ruby/default_environment.cc b/ruby/default_environment.cc
index 463c39c..61816f1 100644
--- a/ruby/default_environment.cc
+++ b/ruby/default_environment.cc
@@ -36,11 +36,16 @@ namespace
{
try
{
- if (1 == argc)
+ if (1 == argc || 2 == argc)
{
UseFlagName * use_flag_ptr;
Data_Get_Struct(argv[0], UseFlagName, use_flag_ptr);
- return DefaultEnvironment::get_instance()->query_use(*use_flag_ptr, 0) ? Qtrue : Qfalse;
+
+ PackageDatabaseEntry * pde_ptr(0);
+ if (2 == argc)
+ Data_Get_Struct(argv[1], PackageDatabaseEntry, pde_ptr);
+
+ return DefaultEnvironment::get_instance()->query_use(*use_flag_ptr, pde_ptr) ? Qtrue : Qfalse;
}
else
rb_raise(rb_eArgError, "DefaultEnvironment.query_use expects one or two arguments, but got %d", argc);
diff --git a/ruby/default_environment_TEST_setup.sh b/ruby/default_environment_TEST_setup.sh
index 40201bf..8b2b450 100755
--- a/ruby/default_environment_TEST_setup.sh
+++ b/ruby/default_environment_TEST_setup.sh
@@ -18,6 +18,7 @@ END
cat <<END > home/.paludis/use.conf
* enabled
+~foo/bar-1 sometimes_enabled
END
cat <<END > home/.paludis/licenses.conf