aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2007-01-02 16:21:06 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2007-01-02 16:21:06 +0000
commit83ebe56b5d362dd7c51fa8eeec0b39d0deaff23a (patch)
treecbf9837b1b96080c77e376c40a20416fb7e18896
parent5a1d7c6abb6583666c4ed272df44465b7dc56c8c (diff)
downloadpaludis-83ebe56b5d362dd7c51fa8eeec0b39d0deaff23a.tar.gz
paludis-83ebe56b5d362dd7c51fa8eeec0b39d0deaff23a.tar.xz
Add ProfileCheck and ProfilesCheck to ruby binding.
Update qualudis.rb demo.
-rw-r--r--ruby/check.cc249
-rw-r--r--ruby/check_TEST.rb174
-rw-r--r--ruby/demos/qualudis.rb55
-rw-r--r--ruby/paludis_ruby.hh6
-rw-r--r--ruby/repository.cc16
5 files changed, 473 insertions, 27 deletions
diff --git a/ruby/check.cc b/ruby/check.cc
index 7922309..dbe199d 100644
--- a/ruby/check.cc
+++ b/ruby/check.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Richard Brown <mynamewasgone@gmail.com>
+ * Copyright (c) 2006, 2007 Richard Brown <mynamewasgone@gmail.com>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -37,6 +37,7 @@ namespace
{
static VALUE c_ebuild_check_data;
static VALUE c_per_profile_ebuild_check_data;
+ static VALUE c_profile_check_data;
static VALUE c_package_dir_check;
static VALUE c_package_dir_check_maker;
static VALUE c_file_check;
@@ -45,6 +46,10 @@ namespace
static VALUE c_ebuild_check_maker;
static VALUE c_per_profile_ebuild_check;
static VALUE c_per_profile_ebuild_check_maker;
+ static VALUE c_profiles_check;
+ static VALUE c_profiles_check_maker;
+ static VALUE c_profile_check;
+ static VALUE c_profile_check_maker;
VALUE
ebuild_check_data_init(int, VALUE *, VALUE self)
@@ -129,6 +134,46 @@ namespace
}
}
+ VALUE
+ profile_check_data_init(int, VALUE *, VALUE self)
+ {
+ return self;
+ }
+
+ /*
+ * call-seq:
+ * new(profiles_dir, profiles_desc_line)
+ *
+ * Creates a new ProfileCheckData for ProfileCheck.
+ */
+ VALUE
+ profile_check_data_new(int argc, VALUE *argv, VALUE self)
+ {
+ ProfileCheckData * ptr(0);
+ try
+ {
+ if (2 == argc)
+ {
+ ptr = new ProfileCheckData(
+ FSEntry(StringValuePtr(argv[0])),
+ value_to_portage_repository_profiles_desc_line(argv[1])
+ );
+ }
+ else
+ {
+ rb_raise(rb_eArgError, "ProfileCheckData expects two arguments, but got %d",argc);
+ }
+ VALUE tdata(Data_Wrap_Struct(self, 0, &Common<ProfileCheckData>::free, ptr));
+ rb_obj_call_init(tdata, argc, argv);
+ return tdata;
+ }
+ catch (const std::exception & e)
+ {
+ delete ptr;
+ exception_to_ruby_exception(e);
+ }
+ }
+
/*
* Document-method: describe
*
@@ -258,6 +303,44 @@ namespace
}
/*
+ * call-seq:
+ * check(dir) -> CheckResult
+ *
+ * Runs check on directory.
+ */
+ VALUE
+ profiles_check_check(VALUE self, VALUE f)
+ {
+ try
+ {
+ return (check_check <ProfilesCheck::Pointer, FSEntry> (self, FSEntry(StringValuePtr(f))));
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * check(profile_check_data) -> CheckResult
+ *
+ * Runs check on ProfileCheckData.
+ */
+ VALUE
+ profile_check_check(VALUE self, VALUE f)
+ {
+ try
+ {
+ return (check_check <ProfileCheck::Pointer, ProfileCheckData> (self, value_to_profile_check_data(f)));
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
* Document-method: keys
*
* call-seq:
@@ -359,6 +442,44 @@ namespace
}
}
+ /*
+ * call-seq:
+ * find_maker(name)
+ *
+ * Fetch the named check.
+ */
+ VALUE profiles_check_maker_find_maker(VALUE, VALUE maker)
+ {
+ try
+ {
+ ProfilesCheck::Pointer p = (ProfilesCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
+ return profiles_check_to_value(p);
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * find_maker(name)
+ *
+ * Fetch the named check.
+ */
+ VALUE profile_check_maker_find_maker(VALUE, VALUE maker)
+ {
+ try
+ {
+ ProfileCheck::Pointer p = (ProfileCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
+ return profile_check_to_value(p);
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
void do_register_check()
{
rb_require("singleton");
@@ -372,7 +493,6 @@ namespace
rb_define_singleton_method(c_ebuild_check_data, "new", RUBY_FUNC_CAST(&ebuild_check_data_new),-1);
rb_define_method(c_ebuild_check_data, "initialize", RUBY_FUNC_CAST(&ebuild_check_data_init),-1);
-
/*
* Document-class: Paludis::QA::PerProfileEbuildCheckData
*
@@ -383,6 +503,15 @@ namespace
rb_define_method(c_per_profile_ebuild_check_data, "initialize", RUBY_FUNC_CAST(&per_profile_ebuild_check_data_init),-1);
/*
+ * Document-class: Paludis::QA::ProfileCheckData
+ *
+ * A collection class for ProfileCheck.
+ */
+ c_profile_check_data = rb_define_class_under(paludis_qa_module(), "ProfileCheckData", rb_cObject);
+ rb_define_singleton_method(c_profile_check_data, "new", RUBY_FUNC_CAST(&profile_check_data_new),-1);
+ rb_define_method(c_profile_check_data, "initialize", RUBY_FUNC_CAST(&profile_check_data_init),-1);
+
+ /*
* Document-class: Paludis::QA::PackageDirCheck
*
* A QA check that operates upon a package directory.
@@ -427,6 +556,28 @@ namespace
rb_define_method(c_per_profile_ebuild_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<PerProfileEbuildCheck::Pointer>::is_important),0);
/*
+ * Document-class: Paludis::QA::ProfilesCheck
+ *
+ * Base class for QA checks that operate upon the top level /profiles directory.
+ */
+ c_profiles_check = rb_define_class_under(paludis_qa_module(), "ProfilesCheck", rb_cObject);
+ rb_funcall(c_profiles_check, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_profiles_check, "check", RUBY_FUNC_CAST(&profiles_check_check),1);
+ rb_define_method(c_profiles_check, "describe", RUBY_FUNC_CAST(&CheckStruct<ProfilesCheck::Pointer>::describe),0);
+ rb_define_method(c_profiles_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<ProfilesCheck::Pointer>::is_important),0);
+
+ /*
+ * Document-class: Paludis::QA::ProfileCheck
+ *
+ * Base class for QA checks that operate upon a profiles.desc entry directory.
+ */
+ c_profile_check = rb_define_class_under(paludis_qa_module(), "ProfileCheck", rb_cObject);
+ rb_funcall(c_profile_check, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_profile_check, "check", RUBY_FUNC_CAST(&profile_check_check),1);
+ rb_define_method(c_profile_check, "describe", RUBY_FUNC_CAST(&CheckStruct<ProfileCheck::Pointer>::describe),0);
+ rb_define_method(c_profile_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<ProfileCheck::Pointer>::is_important),0);
+
+ /*
* Document-class: Paludis::QA::PackageDirCheckMaker
*
* Class to access PackageDirChecks
@@ -481,6 +632,34 @@ namespace
rb_define_method(c_per_profile_ebuild_check_maker, "find_maker", RUBY_FUNC_CAST(&per_profile_ebuild_check_maker_find_maker),1);
rb_define_alias(c_per_profile_ebuild_check_maker, "check_names", "keys");
rb_define_alias(c_per_profile_ebuild_check_maker, "find_check", "find_maker");
+
+ /*
+ * Document-class: Paludis::QA::ProfilesCheckMaker
+ *
+ * Class to access ProfilesChecks
+ *
+ */
+ c_profiles_check_maker = rb_define_class_under(paludis_qa_module(), "ProfilesCheckMaker", rb_cObject);
+ rb_funcall(c_profiles_check_maker, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_funcall(rb_const_get(rb_cObject, rb_intern("Singleton")), rb_intern("included"), 1, c_profiles_check_maker);
+ rb_define_method(c_profiles_check_maker, "keys", RUBY_FUNC_CAST(&CheckMakerStruct<ProfilesCheckMaker>::keys),0);
+ rb_define_method(c_profiles_check_maker, "find_maker", RUBY_FUNC_CAST(&profiles_check_maker_find_maker),1);
+ rb_define_alias(c_profiles_check_maker, "check_names", "keys");
+ rb_define_alias(c_profiles_check_maker, "find_check", "find_maker");
+
+ /*
+ * Document-class: Paludis::QA::ProfileCheckMaker
+ *
+ * Class to access ProfileChecks
+ *
+ */
+ c_profile_check_maker = rb_define_class_under(paludis_qa_module(), "ProfileCheckMaker", rb_cObject);
+ rb_funcall(c_profile_check_maker, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_funcall(rb_const_get(rb_cObject, rb_intern("Singleton")), rb_intern("included"), 1, c_profile_check_maker);
+ rb_define_method(c_profile_check_maker, "keys", RUBY_FUNC_CAST(&CheckMakerStruct<ProfileCheckMaker>::keys),0);
+ rb_define_method(c_profile_check_maker, "find_maker", RUBY_FUNC_CAST(&profile_check_maker_find_maker),1);
+ rb_define_alias(c_profile_check_maker, "check_names", "keys");
+ rb_define_alias(c_profile_check_maker, "find_check", "find_maker");
}
}
@@ -533,6 +712,38 @@ paludis::ruby::ebuild_check_to_value(EbuildCheck::Pointer m)
}
VALUE
+paludis::ruby::profiles_check_to_value(ProfilesCheck::Pointer m)
+{
+ ProfilesCheck::Pointer * m_ptr(0);
+ try
+ {
+ m_ptr = new ProfilesCheck::Pointer(m);
+ return Data_Wrap_Struct(c_profiles_check, 0, &Common<ProfilesCheck::Pointer>::free, m_ptr);
+ }
+ catch (const std::exception & e)
+ {
+ delete m_ptr;
+ exception_to_ruby_exception(e);
+ }
+}
+
+VALUE
+paludis::ruby::profile_check_to_value(ProfileCheck::Pointer m)
+{
+ ProfileCheck::Pointer * m_ptr(0);
+ try
+ {
+ m_ptr = new ProfileCheck::Pointer(m);
+ return Data_Wrap_Struct(c_profile_check, 0, &Common<ProfileCheck::Pointer>::free, m_ptr);
+ }
+ catch (const std::exception & e)
+ {
+ delete m_ptr;
+ exception_to_ruby_exception(e);
+ }
+}
+
+VALUE
paludis::ruby::per_profile_ebuild_check_to_value(PerProfileEbuildCheck::Pointer m)
{
PerProfileEbuildCheck::Pointer * m_ptr(0);
@@ -548,6 +759,21 @@ paludis::ruby::per_profile_ebuild_check_to_value(PerProfileEbuildCheck::Pointer
}
}
+EbuildCheckData
+paludis::ruby::value_to_ebuild_check_data(VALUE v)
+{
+ if (rb_obj_is_kind_of(v, c_ebuild_check_data))
+ {
+ EbuildCheckData * v_ptr;
+ Data_Get_Struct(v, EbuildCheckData, v_ptr);
+ return *v_ptr;
+ }
+ else
+ {
+ rb_raise(rb_eTypeError, "Can't convert %s into EbuildCheckData", rb_obj_classname(v));
+ }
+}
+
VALUE
paludis::ruby::ebuild_check_data_to_value(const EbuildCheckData & v)
{
@@ -577,20 +803,27 @@ paludis::ruby::per_profile_ebuild_check_data_to_value(const PerProfileEbuildChec
return Data_Wrap_Struct(c_per_profile_ebuild_check_data, 0, &Common<PerProfileEbuildCheckData>::free, vv);
}
-EbuildCheckData
-paludis::ruby::value_to_ebuild_check_data(VALUE v)
+ProfileCheckData
+paludis::ruby::value_to_profile_check_data(VALUE v)
{
- if (rb_obj_is_kind_of(v, c_ebuild_check_data))
+ if (rb_obj_is_kind_of(v, c_profile_check_data))
{
- EbuildCheckData * v_ptr;
- Data_Get_Struct(v, EbuildCheckData, v_ptr);
+ ProfileCheckData * v_ptr;
+ Data_Get_Struct(v, ProfileCheckData, v_ptr);
return *v_ptr;
}
else
{
- rb_raise(rb_eTypeError, "Can't convert %s into EbuildCheckData", rb_obj_classname(v));
+ rb_raise(rb_eTypeError, "Can't convert %s into ProfileCheckData", rb_obj_classname(v));
}
}
+VALUE
+paludis::ruby::profile_check_data_to_value(const ProfileCheckData & v)
+{
+ ProfileCheckData * vv(new ProfileCheckData(v));
+ return Data_Wrap_Struct(c_profile_check_data, 0, &Common<ProfileCheckData>::free, vv);
+}
+
RegisterRubyClass::Register paludis_ruby_register_check PALUDIS_ATTRIBUTE((used))
(&do_register_check);
diff --git a/ruby/check_TEST.rb b/ruby/check_TEST.rb
index 0686c1a..85ca993 100644
--- a/ruby/check_TEST.rb
+++ b/ruby/check_TEST.rb
@@ -197,6 +197,92 @@ module Paludis
end
end
+ class TestCase_ProfilesCheckMaker < Test::Unit::TestCase
+ def instance
+ ProfilesCheckMaker.instance
+ end
+
+ def test_instance
+ assert_equal ProfilesCheckMaker.instance.__id__, ProfilesCheckMaker.instance.__id__
+ assert_kind_of ProfilesCheckMaker, ProfilesCheckMaker.instance
+ end
+
+ def test_no_create
+ assert_raise NoMethodError do
+ x = ProfilesCheckMaker.new()
+ end
+ end
+
+ def test_respond_to
+ assert_respond_to instance, :keys
+ assert_respond_to instance, :find_maker
+ assert_respond_to instance, :check_names
+ assert_respond_to instance, :find_check
+ end
+
+ def test_keys
+ assert_kind_of Array, instance.keys
+ assert_not_equal 0, instance.keys
+ end
+
+ def test_find_maker
+ name = instance.keys.first
+ assert_kind_of ProfilesCheck, instance.find_maker(name)
+ end
+ def test_check_names
+ assert_kind_of Array, instance.check_names
+ assert_equal instance.keys, instance.check_names
+ end
+
+ def test_find_check
+ name = instance.keys.first
+ assert_equal instance.find_maker(name).describe, instance.find_check(name).describe
+ end
+ end
+
+ class TestCase_ProfileCheckMaker < Test::Unit::TestCase
+ def instance
+ ProfileCheckMaker.instance
+ end
+
+ def test_instance
+ assert_equal ProfileCheckMaker.instance.__id__, ProfileCheckMaker.instance.__id__
+ assert_kind_of ProfileCheckMaker, ProfileCheckMaker.instance
+ end
+
+ def test_no_create
+ assert_raise NoMethodError do
+ x = ProfileCheckMaker.new()
+ end
+ end
+
+ def test_respond_to
+ assert_respond_to instance, :keys
+ assert_respond_to instance, :find_maker
+ assert_respond_to instance, :check_names
+ assert_respond_to instance, :find_check
+ end
+
+ def test_keys
+ assert_kind_of Array, instance.keys
+ assert_not_equal 0, instance.keys
+ end
+
+ def test_find_maker
+ name = instance.keys.first
+ assert_kind_of ProfileCheck, instance.find_maker(name)
+ end
+ def test_check_names
+ assert_kind_of Array, instance.check_names
+ assert_equal instance.keys, instance.check_names
+ end
+
+ def test_find_check
+ name = instance.keys.first
+ assert_equal instance.find_maker(name).describe, instance.find_check(name).describe
+ end
+ end
+
class TestCase_EbuildCheckData < Test::Unit::TestCase
def test_create
env = QAEnvironment.new('check_TEST_dir/repo1')
@@ -204,7 +290,7 @@ module Paludis
end
end
- class TestCase_EbuildCheckData < Test::Unit::TestCase
+ class TestCase_PerProfileEbuildCheckData < Test::Unit::TestCase
def test_create
env = QAEnvironment.new('check_TEST_dir/repo1')
ecd = PerProfileEbuildCheckData.new('cat-one/pkg-one',
@@ -214,6 +300,13 @@ module Paludis
end
end
+ class TestCase_ProfileCheckData < Test::Unit::TestCase
+ def test_create
+ env = QAEnvironment.new('check_TEST_dir/repo1')
+ ecd = EbuildCheckData.new('cat-one/pkg-one', "1", env)
+ end
+ end
+
class TestCase_PackageDirCheck < Test::Unit::TestCase
def get_check
PackageDirCheckMaker.instance.find_maker('package_name')
@@ -330,7 +423,7 @@ module Paludis
class TestCase_PerProfileEbuildCheck < Test::Unit::TestCase
def get_ecd
env = QAEnvironment.new('check_TEST_dir/repo1')
- ecd = PerProfileEbuildCheckData.new('cat-one/pkg-one', "1", env, 'check_TEST_dir/repo1/profiles/profile')
+ PerProfileEbuildCheckData.new('cat-one/pkg-one', "1", env, 'check_TEST_dir/repo1/profiles/profile')
end
def get_check
@@ -367,6 +460,83 @@ module Paludis
end
end
end
+
+ class TestCase_ProfilesCheck < Test::Unit::TestCase
+ def get_check
+ ProfilesCheckMaker.instance.find_maker('repo_name')
+ end
+
+ def test_no_create
+ assert_raise NoMethodError do
+ x = ProfilesCheck.new()
+ end
+ end
+
+ def test_respond_to
+ check = get_check
+ assert_respond_to check, :describe
+ assert_respond_to check, :is_important?
+ assert_respond_to check, :check
+ end
+
+ def test_describe
+ check = get_check
+ assert_equal "Checks that repo_name is sane", check.describe
+ end
+
+ def test_is_important
+ check = get_check
+ assert_equal false, check.is_important?
+ end
+
+ def test_check
+ check = get_check
+ assert_nothing_raised do
+ cr = check.check('check_TEST_dir/repo1/profiles')
+ end
+ end
+ end
+
+ class TestCase_ProfileCheck < Test::Unit::TestCase
+ def get_pcd
+ env = QAEnvironment.new('check_TEST_dir/repo1')
+ ProfileCheckData.new('check_TEST_dir/repo1/profiles', env.portage_repository.profiles.first)
+ end
+
+ def get_check
+ ProfileCheckMaker.instance.find_maker('profile_paths_exist')
+ end
+
+ def test_no_create
+ assert_raise NoMethodError do
+ x = ProfileCheck.new()
+ end
+ end
+
+ def test_respond_to
+ check = get_check
+ assert_respond_to check, :describe
+ assert_respond_to check, :is_important?
+ assert_respond_to check, :check
+ end
+
+ def test_describe
+ check = get_check
+ assert_equal "Checks that profile paths exist", check.describe
+ end
+
+ def test_is_important
+ check = get_check
+ assert_equal true, check.is_important?
+ end
+
+ def test_check
+ check = get_check
+ assert_nothing_raised do
+ cr = check.check(get_pcd)
+ end
+ end
+ end
end
end
diff --git a/ruby/demos/qualudis.rb b/ruby/demos/qualudis.rb
index 3e733f4..ba05f29 100644
--- a/ruby/demos/qualudis.rb
+++ b/ruby/demos/qualudis.rb
@@ -47,7 +47,7 @@ def display_errors(result)
when QALevel::Skip
next unless @verbose
done_out = display_header_once(done_out, result)
- print " skip: "
+ print " exlude: "
when QALevel::Minor
done_out = display_header_once(done_out, result)
print " minor: "
@@ -76,8 +76,8 @@ def do_check_kind(maker, ok, fatal, value)
next unless @checks.include? check_name
end
- unless @skip_checks.empty?
- next if @skip_checks.include? check_name
+ unless @exlude_checks.empty?
+ next if @exlude_checks.include? check_name
end
r = maker.find_check(check_name).check(value)
@@ -212,6 +212,20 @@ def do_check_eclass_dir(dir, env)
return ok
end
+def do_check_profiles_dir(dir, env)
+ set_entry_heading "QA checks for profiles directory #{dir}:"
+
+ ok, fatal = do_check_kind(ProfilesCheckMaker.instance, ok, fatal, dir)
+
+ env.portage_repository.profiles.each do |p|
+ break if fatal;
+ set_entry_heading "QA checks for profile.desc entry #{p.path} #{p.arch} #{p.status}:"
+
+ ok, fatal = do_check_kind(ProfileCheckMaker.instance, ok, fatal, ProfileCheckData.new(dir, p));
+
+ end
+end
+
def do_check_top_level(dir)
set_entry_heading "QA checks for top level directory #{dir}"
@@ -224,6 +238,8 @@ def do_check_top_level(dir)
next unless File.directory? full_dir
if d == 'eclass'
ok &= do_check_eclass_dir("#{full_dir}/eclass", env)
+ elsif d == 'profiles'
+ ok &= do_check_profiles_dir("#{full_dir}/profiles", env)
elsif env.package_database.fetch_repository(env.package_database.favourite_repository).has_category_named?(d)
ok &= do_check_category_dir("#{full_dir}", env)
end
@@ -235,6 +251,9 @@ def do_check(dir)
if File.basename(dir) == 'eclass'
env = QAEnvironment.new(File.dirname(dir), @write_cache_dir)
return do_check_eclass_dir(dir, env)
+ elsif File.basename(dir) == 'profiles'
+ env = QAEnvironment.new(File.dirname(dir), @write_cache_dir)
+ return do_check_profiles_dir(dir, env)
elsif Dir["#{dir}/*\-*.ebuild"].length>0
env = QAEnvironment.new(File.dirname(File.dirname(dir)))
return do_check_package_dir(dir,env)
@@ -250,12 +269,12 @@ def do_check(dir)
end
def describe_check(title, maker)
- puts title
+ puts "#{title}:"
maker.check_names.each do |check_name|
$stderr.puts " #{check_name}:"
$stderr.puts " #{maker.find_check(check_name).describe}"
- $stderr.puts
end
+ $stderr.puts
end
@verbose = false
@@ -263,7 +282,7 @@ end
@min_level = QALevel::Info
@write_cache_dir = '/var/empty'
@checks = []
-@skip_checks = []
+@exlude_checks = []
describe = false
Log.instance.log_level = LogLevel::Qa
@@ -274,7 +293,7 @@ opts = GetoptLong.new(
[ '--version', '-V', GetoptLong::NO_ARGUMENT ],
[ '--describe', '-d', GetoptLong::NO_ARGUMENT ],
[ '--qa-check', '-c', GetoptLong::REQUIRED_ARGUMENT ],
- [ '--skip-qa-check', '-s', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--exlude-qa-check','-s', GetoptLong::REQUIRED_ARGUMENT ],
[ '--log-level', '-L', GetoptLong::REQUIRED_ARGUMENT ],
[ '--message-level', '-M', GetoptLong::REQUIRED_ARGUMENT ],
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
@@ -294,15 +313,15 @@ opts.each do | opt, arg |
puts
puts "Options for general checks:"
puts " --qa-check, -c Only perform given check"
- puts " --skip-qa-check, -s Skip given check"
+ puts " --exlude-qa-check, -s Exlude given check"
puts " --verbose, -v Be verbose"
puts " --quiet, -q Be quiet"
puts " --log-level, -L Set log level"
puts " debug Show debug output (noisy)"
- puts " qa Show QA messages and warnings only"
- puts " warning Show warnings only (default)"
- puts " silent Suppress all log messages"
- puts " --message-level, -M Set log level (debug, qa, warning, silent)"
+ puts " qa Show QA messages and warnings only (default)"
+ puts " warning Show warnings only"
+ puts " silent Suppress all log messages (UNSAFE)"
+ puts " --message-level, -M Specify the message level"
puts " info Show info and upwards (default)"
puts " minor Show minor and upwards"
puts " major Show major and upwards"
@@ -321,21 +340,23 @@ opts.each do | opt, arg |
describe_check("File Checks", FileCheckMaker.instance)
describe_check("Ebuild Checks", EbuildCheckMaker.instance)
describe_check("Per Profile Ebuild Checks", PerProfileEbuildCheckMaker.instance)
+ describe_check("Top level profiles/ checks", ProfilesCheckMaker.instance)
+ describe_check("Per profiles.desc entry checks", ProfileCheckMaker.instance)
exit 0
when '--qa-check'
- unless @skip_checks.empty?
- $stderr.puts "Don't specify --skip-qa-checks and --qa-checks in the same command"
+ unless @exlude_checks.empty?
+ $stderr.puts "Don't specify --exlude-qa-checks and --qa-checks in the same command"
exit 1
end
@checks << arg
- when '--skip-qa-check'
+ when '--exlude-qa-check'
unless @checks.empty?
- $stderr.puts "Don't specify --skip-qa-checks and --qa-checks in the same command"
+ $stderr.puts "Don't specify --exlude-qa-checks and --qa-checks in the same command"
exit 1
end
- @skip_checks << arg
+ @exlude_checks << arg
when '--verbose'
@verbose = true
diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh
index d768c0d..d6f9124 100644
--- a/ruby/paludis_ruby.hh
+++ b/ruby/paludis_ruby.hh
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Richard Brown <mynamewasgone@gmail.com>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -97,20 +98,25 @@ namespace paludis
PackageDatabaseEntry value_to_package_database_entry(VALUE v);
EnvironmentData* value_to_environment_data(VALUE v);
NoConfigEnvironment* value_to_no_config_environment(VALUE v);
+ PortageRepositoryProfilesDescLine value_to_portage_repository_profiles_desc_line(VALUE v);
#ifdef ENABLE_RUBY_QA
VALUE paludis_qa_module();
qa::Message value_to_message(VALUE v);
qa::EbuildCheckData value_to_ebuild_check_data(VALUE v);
qa::PerProfileEbuildCheckData value_to_per_profile_ebuild_check_data(VALUE v);
+ qa::ProfileCheckData value_to_profile_check_data(VALUE v);
qa::QAEnvironment* value_to_qa_environment(VALUE v);
VALUE ebuild_check_data_to_value(const qa::EbuildCheckData &);
VALUE per_profile_ebuild_check_data_to_value(const qa::PerProfileEbuildCheckData &);
+ VALUE profile_check_data_to_value(const qa::ProfileCheckData &);
VALUE check_result_to_value(const qa::CheckResult &);
VALUE package_dir_check_to_value(qa::PackageDirCheck::Pointer);
VALUE file_check_to_value(qa::FileCheck::Pointer);
VALUE ebuild_check_to_value(qa::EbuildCheck::Pointer);
VALUE per_profile_ebuild_check_to_value(qa::PerProfileEbuildCheck::Pointer);
+ VALUE profiles_check_to_value(qa::ProfilesCheck::Pointer);
+ VALUE profile_check_to_value(qa::ProfileCheck::Pointer);
VALUE message_to_value(const qa::Message &);
VALUE metadata_file_to_value(const qa::MetadataFile &);
#endif
diff --git a/ruby/repository.cc b/ruby/repository.cc
index 3e51235..6dce2ca 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Richard Brown <mynamewasgone@gmail.com>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -911,6 +912,21 @@ paludis::ruby::portage_repository_profiles_desc_line_to_value(const PortageRepos
return Data_Wrap_Struct(c_portage_repository_profiles_desc_line, 0, &Common<PortageRepositoryProfilesDescLine>::free, vv);
}
+PortageRepositoryProfilesDescLine
+paludis::ruby::value_to_portage_repository_profiles_desc_line(VALUE v)
+{
+ if (rb_obj_is_kind_of(v, c_portage_repository_profiles_desc_line))
+ {
+ PortageRepositoryProfilesDescLine * v_ptr;
+ Data_Get_Struct(v, PortageRepositoryProfilesDescLine, v_ptr);
+ return *v_ptr;
+ }
+ else
+ {
+ rb_raise(rb_eTypeError, "Can't convert %s into PortageRepositoryProfilesDescLine", rb_obj_classname(v));
+ }
+}
+
RegisterRubyClass::Register paludis_ruby_register_repository PALUDIS_ATTRIBUTE((used))
(&do_register_repository);