aboutsummaryrefslogtreecommitdiff
path: root/ruby/check.cc
blob: 5356d722a54bf10b2a67de07b1e8acf18231e66b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
/* vim: set sw=4 sts=4 et foldmethod=syntax : */

/*
 * 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
 * Public License version 2, as published by the Free Software Foundation.
 *
 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <paludis_ruby.hh>
#include <paludis/qa/check.hh>
#include <paludis/qa/package_dir_check.hh>
#include <paludis/util/stringify.hh>
#include <paludis/qa/qa.hh>
#include <ruby.h>
#include <cstdlib>
#include <iostream>

using namespace paludis;
using namespace paludis::qa;
using namespace paludis::ruby;
using std::cerr;

#define RUBY_FUNC_CAST(x) reinterpret_cast<VALUE (*)(...)>(x)

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;
    static VALUE c_file_check_maker;
    static VALUE c_ebuild_check;
    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)
    {
        return self;
    }

    /*
     * call-seq:
     *     EbuildCheckData.new(qualified_package_name, version_spec, environment_data)
     *
     * Creates a new EbuildCheckData for EbuildCheck.
     */
    VALUE
    ebuild_check_data_new(int argc, VALUE *argv, VALUE self)
    {
        EbuildCheckData * ptr(0);
        try
        {
            if (3 == argc)
            {
                ptr = new EbuildCheckData(
                    value_to_qualified_package_name(argv[0]),
                    value_to_version_spec(argv[1]),
                    value_to_environment_data(argv[2])->env_ptr
                );
            }
            else
            {
                rb_raise(rb_eArgError, "EbuildCheckData expects three arguments, but got %d",argc);
            }
            VALUE tdata(Data_Wrap_Struct(self, 0, &Common<EbuildCheckData>::free, ptr));
            rb_obj_call_init(tdata, argc, argv);
            return tdata;
        }
        catch (const std::exception & e)
        {
            delete ptr;
            exception_to_ruby_exception(e);
        }
    }

    VALUE
    per_profile_ebuild_check_data_init(int, VALUE *, VALUE self)
    {
        return self;
    }

    /*
     * call-seq:
     *     PerProfileEbuildCheckData.new(qualified_package_name, version_spec, environment_data, profile)
     *
     * Creates a new PerProfileEbuildCheckData for PerProfileEbuildCheck.2
     */
    VALUE
    per_profile_ebuild_check_data_new(int argc, VALUE *argv, VALUE self)
    {
        PerProfileEbuildCheckData * ptr(0);
        try
        {
            if (4 == argc)
            {
                ptr = new PerProfileEbuildCheckData(
                    value_to_qualified_package_name(argv[0]),
                    value_to_version_spec(argv[1]),
                    value_to_qa_environment(argv[2]),
                    FSEntry(StringValuePtr(argv[3]))
                );
            }
            else
            {
                rb_raise(rb_eArgError, "PerProfileEbuildCheckData expects three arguments, but got %d",argc);
            }
            VALUE tdata(Data_Wrap_Struct(self, 0, &Common<PerProfileEbuildCheckData>::free, ptr));
            rb_obj_call_init(tdata, argc, argv);
            return tdata;
        }
        catch (const std::exception & e)
        {
            delete ptr;
            exception_to_ruby_exception(e);
        }
    }

    VALUE
    profile_check_data_init(int, VALUE *, VALUE self)
    {
        return self;
    }

    /*
     * call-seq:
     *     ProfileCheckData.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
     *
     * call-seq:
     *     describe -> String
     *
     * Describe what check checks.
     */
    /*
     * Document-method: is_important?
     *
     * call-seq:
     *     is_important? -> true or false
     *
     * Is the check important?
     */
    template <typename T_>
    struct CheckStruct
    {
        static
        VALUE describe(VALUE self)
        {
            T_ * ptr;
            Data_Get_Struct(self, T_, ptr);
            return rb_str_new2((*ptr)->describe().c_str());
        }
        static
        VALUE
        is_important(VALUE self)
        {
            T_ * ptr;
            Data_Get_Struct(self, T_, ptr);
            return (*ptr)->is_important() ? Qtrue : Qfalse;
        }
    };

    template <typename T_, typename S_>
    VALUE
    check_check(VALUE check, S_ arg)
    {
        try
        {
            T_ * ptr;
            Data_Get_Struct(check, T_, ptr);
            return check_result_to_value((**ptr)(arg));
        }
        catch (const std::exception & e)
        {
            exception_to_ruby_exception(e);
        }
    }

    /*
     * call-seq:
     *     check(directory) -> CheckResult
     *
     * Runs check on directory.
     */
    VALUE
    package_dir_check_check(VALUE self, VALUE f)
    {
        try
        {
            return (check_check <PackageDirCheck::Pointer, FSEntry> (self, FSEntry(StringValuePtr(f))));
        }
        catch (const std::exception & e)
        {
            exception_to_ruby_exception(e);
        }
    }

    /*
     * call-seq:
     *     check(file) -> CheckResult
     *
     * Runs check on file.
     */
    VALUE
    file_check_check(VALUE self, VALUE f)
    {
        try
        {
            return (check_check <FileCheck::Pointer, FSEntry> (self, FSEntry(StringValuePtr(f))));
        }
        catch (const std::exception & e)
        {
            exception_to_ruby_exception(e);
        }
    }

    /*
     * call-seq:
     *     check(ebuild_check_data) -> CheckResult
     *
     * Runs check on EbuildCheckData.
     */
    VALUE
    ebuild_check_check(VALUE self, VALUE f)
    {
        try
        {
            return (check_check <EbuildCheck::Pointer, EbuildCheckData> (self, value_to_ebuild_check_data(f)));
        }
        catch (const std::exception & e)
        {
            exception_to_ruby_exception(e);
        }
    }

    /*
     * call-seq:
     *     check(per_profile_ebuild_check_data) -> CheckResult
     *
     * Runs check on PerProfileEbuildCheckData.
     */
    VALUE
    per_profile_ebuild_check_check(VALUE self, VALUE f)
    {
        try
        {
            return (check_check <PerProfileEbuildCheck::Pointer, PerProfileEbuildCheckData> (self, value_to_per_profile_ebuild_check_data(f)));
        }
        catch (const std::exception & e)
        {
            exception_to_ruby_exception(e);
        }
    }

    /*
     * 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:
     *     keys -> Array
     *
     * Fetch the check names for this class.
     */
    template <typename T_>
    struct CheckMakerStruct
    {
        static
        VALUE keys(VALUE)
        {
            std::list<std::string> checks;
            T_::get_instance()->copy_keys(std::back_inserter(checks));
            VALUE result(rb_ary_new());
            for (std::list<std::string>::const_iterator i(checks.begin()),
                i_end(checks.end()) ; i != i_end ; ++i)
            {
                rb_ary_push(result, rb_str_new2((*i).c_str()));
            }
            return result;
        }
    };

    /*
     * call-seq:
     *     find_maker(name)
     *
     * Fetch the named check.
     */
    VALUE package_dir_check_maker_find_maker(VALUE, VALUE maker)
    {
        try
        {
            PackageDirCheck::Pointer p = (PackageDirCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
            return package_dir_check_to_value(p);
        }
        catch (const std::exception & e)
        {
            exception_to_ruby_exception(e);
        }
    }

    /*
     * call-seq:
     *     find_maker(name)
     *
     * Fetch the named check.
     */
    VALUE file_check_maker_find_maker(VALUE, VALUE maker)
    {
        try
        {
            FileCheck::Pointer p = (FileCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
            return file_check_to_value(p);
        }
        catch (const std::exception & e)
        {
            exception_to_ruby_exception(e);
        }
    }

    /*
     * call-seq:
     *     find_maker(name)
     *
     * Fetch the named check.
     */
    VALUE ebuild_check_maker_find_maker(VALUE, VALUE maker)
    {
        try
        {
            EbuildCheck::Pointer p = (EbuildCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
            return ebuild_check_to_value(p);
        }
        catch (const std::exception & e)
        {
            exception_to_ruby_exception(e);
        }
    }

    /*
     * call-seq:
     *     find_maker(name)
     *
     * Fetch the named check.
     */
    VALUE per_profile_ebuild_check_maker_find_maker(VALUE, VALUE maker)
    {
        try
        {
            PerProfileEbuildCheck::Pointer p = (PerProfileEbuildCheckMaker::get_instance()->find_maker(StringValuePtr(maker)))();
            return per_profile_ebuild_check_to_value(p);
        }
        catch (const std::exception & e)
        {
            exception_to_ruby_exception(e);
        }
    }

    /*
     * 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");

        /*
         * Document-class: Paludis::QA::EbuildCheckData
         *
         * A collection class for EbuildCheck.
         */
        c_ebuild_check_data = rb_define_class_under(paludis_qa_module(), "EbuildCheckData", rb_cObject);
        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
         *
         * A collection class for PerProfileEbuildCheck.
         */
        c_per_profile_ebuild_check_data = rb_define_class_under(paludis_qa_module(), "PerProfileEbuildCheckData", rb_cObject);
        rb_define_singleton_method(c_per_profile_ebuild_check_data, "new", RUBY_FUNC_CAST(&per_profile_ebuild_check_data_new),-1);
        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.
         */
        c_package_dir_check = rb_define_class_under(paludis_qa_module(), "PackageDirCheck", rb_cObject);
        rb_funcall(c_package_dir_check, rb_intern("private_class_method"), 1, rb_str_new2("new"));
        rb_define_method(c_package_dir_check, "check", RUBY_FUNC_CAST(&package_dir_check_check),1);
        rb_define_method(c_package_dir_check, "describe", RUBY_FUNC_CAST(&CheckStruct<PackageDirCheck::Pointer>::describe),0);
        rb_define_method(c_package_dir_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<PackageDirCheck::Pointer>::is_important),0);

        /*
         * Document-class: Paludis::QA::FileCheck
         *
         * A QA check that operates upon a file.
         */
        c_file_check = rb_define_class_under(paludis_qa_module(), "FileCheck", rb_cObject);
        rb_funcall(c_file_check, rb_intern("private_class_method"), 1, rb_str_new2("new"));
        rb_define_method(c_file_check, "check", RUBY_FUNC_CAST(&file_check_check),1);
        rb_define_method(c_file_check, "describe", RUBY_FUNC_CAST(&CheckStruct<FileCheck::Pointer>::describe),0);
        rb_define_method(c_file_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<FileCheck::Pointer>::is_important),0);

        /*
         * Document-class: Paludis::QA::EbuildCheck
         *
         * Base class for QA checks that operate upon ebuilds.
         */
        c_ebuild_check = rb_define_class_under(paludis_qa_module(), "EbuildCheck", rb_cObject);
        rb_funcall(c_ebuild_check, rb_intern("private_class_method"), 1, rb_str_new2("new"));
        rb_define_method(c_ebuild_check, "check", RUBY_FUNC_CAST(&ebuild_check_check),1);
        rb_define_method(c_ebuild_check, "describe", RUBY_FUNC_CAST(&CheckStruct<EbuildCheck::Pointer>::describe),0);
        rb_define_method(c_ebuild_check, "is_important?", RUBY_FUNC_CAST(&CheckStruct<EbuildCheck::Pointer>::is_important),0);

        /*
         * Document-class: Paludis::QA::PerProfileEbuildCheck
         *
         * Base class for QA checks that operate upon ebuilds.
         */
        c_per_profile_ebuild_check = rb_define_class_under(paludis_qa_module(), "PerProfileEbuildCheck", rb_cObject);
        rb_funcall(c_per_profile_ebuild_check, rb_intern("private_class_method"), 1, rb_str_new2("new"));
        rb_define_method(c_per_profile_ebuild_check, "check", RUBY_FUNC_CAST(&per_profile_ebuild_check_check),1);
        rb_define_method(c_per_profile_ebuild_check, "describe", RUBY_FUNC_CAST(&CheckStruct<PerProfileEbuildCheck::Pointer>::describe),0);
        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
         *
         */
        c_package_dir_check_maker = rb_define_class_under(paludis_qa_module(), "PackageDirCheckMaker", rb_cObject);
        rb_funcall(c_package_dir_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_package_dir_check_maker);
        rb_define_method(c_package_dir_check_maker, "keys", RUBY_FUNC_CAST(CheckMakerStruct<PackageDirCheckMaker>::keys),0);
        rb_define_method(c_package_dir_check_maker, "find_maker", RUBY_FUNC_CAST(&package_dir_check_maker_find_maker),1);
        rb_define_alias(c_package_dir_check_maker, "check_names", "keys");
        rb_define_alias(c_package_dir_check_maker, "find_check", "find_maker");

        /*
         * Document-class: Paludis::QA::FileCheckMaker
         *
         * Class to access FileChecks
         *
         */
        c_file_check_maker = rb_define_class_under(paludis_qa_module(), "FileCheckMaker", rb_cObject);
        rb_funcall(c_file_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_file_check_maker);
        rb_define_method(c_file_check_maker, "keys", RUBY_FUNC_CAST(CheckMakerStruct<FileCheckMaker>::keys),0);
        rb_define_method(c_file_check_maker, "find_maker", RUBY_FUNC_CAST(&file_check_maker_find_maker),1);
        rb_define_alias(c_file_check_maker, "check_names", "keys");
        rb_define_alias(c_file_check_maker, "find_check", "find_maker");

        /*
         * Document-class: Paludis::QA::EbuildCheckMaker
         *
         * Class to access EbuildChecks
         *
         */
        c_ebuild_check_maker = rb_define_class_under(paludis_qa_module(), "EbuildCheckMaker", rb_cObject);
        rb_funcall(c_ebuild_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_ebuild_check_maker);
        rb_define_method(c_ebuild_check_maker, "keys", RUBY_FUNC_CAST(&CheckMakerStruct<EbuildCheckMaker>::keys),0);
        rb_define_method(c_ebuild_check_maker, "find_maker", RUBY_FUNC_CAST(&ebuild_check_maker_find_maker),1);
        rb_define_alias(c_ebuild_check_maker, "check_names", "keys");
        rb_define_alias(c_ebuild_check_maker, "find_check", "find_maker");

        /*
         * Document-class: Paludis::QA::PerProfileEbuildCheckMaker
         *
         * Class to access PerProfileEbuildChecks
         *
         */
        c_per_profile_ebuild_check_maker = rb_define_class_under(paludis_qa_module(), "PerProfileEbuildCheckMaker", rb_cObject);
        rb_funcall(c_per_profile_ebuild_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_per_profile_ebuild_check_maker);
        rb_define_method(c_per_profile_ebuild_check_maker, "keys", RUBY_FUNC_CAST(&CheckMakerStruct<PerProfileEbuildCheckMaker>::keys),0);
        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");
    }
}

VALUE
paludis::ruby::file_check_to_value(FileCheck::Pointer m)
{
    FileCheck::Pointer * m_ptr(0);
    try
    {
        m_ptr = new FileCheck::Pointer(m);
        return Data_Wrap_Struct(c_file_check, 0, &Common<FileCheck::Pointer>::free, m_ptr);
    }
    catch (const std::exception & e)
    {
        delete m_ptr;
        exception_to_ruby_exception(e);
    }
}

VALUE
paludis::ruby::package_dir_check_to_value(PackageDirCheck::Pointer m)
{
    PackageDirCheck::Pointer * m_ptr(0);
    try
    {
        m_ptr = new PackageDirCheck::Pointer(m);
        return Data_Wrap_Struct(c_package_dir_check, 0, &Common<PackageDirCheck::Pointer>::free, m_ptr);
    }
    catch (const std::exception & e)
    {
        delete m_ptr;
        exception_to_ruby_exception(e);
    }
}

VALUE
paludis::ruby::ebuild_check_to_value(EbuildCheck::Pointer m)
{
    EbuildCheck::Pointer * m_ptr(0);
    try
    {
        m_ptr = new EbuildCheck::Pointer(m);
        return Data_Wrap_Struct(c_ebuild_check, 0, &Common<EbuildCheck::Pointer>::free, m_ptr);
    }
    catch (const std::exception & e)
    {
        delete m_ptr;
        exception_to_ruby_exception(e);
    }
}

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);
    try
    {
        m_ptr = new PerProfileEbuildCheck::Pointer(m);
        return Data_Wrap_Struct(c_per_profile_ebuild_check, 0, &Common<PerProfileEbuildCheck::Pointer>::free, m_ptr);
    }
    catch (const std::exception & e)
    {
        delete m_ptr;
        exception_to_ruby_exception(e);
    }
}

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)
{
    EbuildCheckData * vv(new EbuildCheckData(v));
    return Data_Wrap_Struct(c_ebuild_check_data, 0, &Common<EbuildCheckData>::free, vv);
}

PerProfileEbuildCheckData
paludis::ruby::value_to_per_profile_ebuild_check_data(VALUE v)
{
    if (rb_obj_is_kind_of(v, c_per_profile_ebuild_check_data))
    {
        PerProfileEbuildCheckData * v_ptr;
        Data_Get_Struct(v, PerProfileEbuildCheckData, v_ptr);
        return *v_ptr;
    }
    else
    {
        rb_raise(rb_eTypeError, "Can't convert %s into PerProfileEbuildCheckData", rb_obj_classname(v));
    }
}

VALUE
paludis::ruby::per_profile_ebuild_check_data_to_value(const PerProfileEbuildCheckData & v)
{
    PerProfileEbuildCheckData * vv(new PerProfileEbuildCheckData(v));
    return Data_Wrap_Struct(c_per_profile_ebuild_check_data, 0, &Common<PerProfileEbuildCheckData>::free, vv);
}

ProfileCheckData
paludis::ruby::value_to_profile_check_data(VALUE v)
{
    if (rb_obj_is_kind_of(v, c_profile_check_data))
    {
        ProfileCheckData * v_ptr;
        Data_Get_Struct(v, ProfileCheckData, v_ptr);
        return *v_ptr;
    }
    else
    {
        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);