aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/qa/qa_checks.cc
blob: 9359915d1638580807fa43d7f2bcf3f6d07990dc (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
/* vim: set sw=4 sts=4 et foldmethod=syntax : */

/*
 * Copyright (c) 2007 Ciaran McCreesh
 *
 * 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/repositories/e/qa/qa_checks.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/instantiation_policy-impl.hh>

#include <paludis/repositories/e/qa/stray_files.hh>
#include <paludis/repositories/e/qa/gpg.hh>
#include <paludis/repositories/e/qa/ebuild_count.hh>
#include <paludis/repositories/e/qa/changelog.hh>
#include <paludis/repositories/e/qa/misc_files.hh>
#include <paludis/repositories/e/qa/files_dir_size.hh>
#include <paludis/repositories/e/qa/eapi_supported.hh>
#include <paludis/repositories/e/qa/metadata_keys.hh>
#include <paludis/repositories/e/qa/short_description_key.hh>
#include <paludis/repositories/e/qa/homepage_key.hh>
#include <paludis/repositories/e/qa/iuse_key.hh>
#include <paludis/repositories/e/qa/spec_keys.hh>
#include <paludis/repositories/e/qa/extractors.hh>
#include <paludis/repositories/e/qa/fetches_key.hh>
#include <paludis/repositories/e/qa/restrict_key.hh>
#include <paludis/repositories/e/qa/visibility.hh>
#include <paludis/repositories/e/qa/default_functions.hh>
#include <paludis/repositories/e/qa/variable_assigns.hh>
#include <paludis/repositories/e/qa/kv_variables.hh>
#include <paludis/repositories/e/qa/root_variable.hh>
#include <paludis/repositories/e/qa/subshell_die.hh>
#include <paludis/repositories/e/qa/whitespace.hh>
#include <paludis/repositories/e/qa/header.hh>
#include <paludis/repositories/e/qa/repo_name.hh>
#include <paludis/repositories/e/qa/categories.hh>

using namespace paludis;
using namespace paludis::erepository;

template class InstantiationPolicy<QAChecks, instantiation_method::SingletonTag>;

namespace paludis
{
    template <>
    struct Implementation<QAChecks>
    {
        const tr1::shared_ptr<QAChecksGroup<TreeCheckFunction> > tree_checks_group;
        const tr1::shared_ptr<QAChecksGroup<EclassFileContentsCheckFunction> > eclass_file_contents_checks_group;
        const tr1::shared_ptr<QAChecksGroup<CategoryDirCheckFunction> > category_dir_checks_group;
        const tr1::shared_ptr<QAChecksGroup<PackageDirCheckFunction> > package_dir_checks_group;
        const tr1::shared_ptr<QAChecksGroup<PackageIDCheckFunction> > package_id_checks_group;
        const tr1::shared_ptr<QAChecksGroup<PackageIDFileContentsCheckFunction> > package_id_file_contents_checks_group;

        Implementation() :
            tree_checks_group(new QAChecksGroup<TreeCheckFunction>),
            eclass_file_contents_checks_group(new QAChecksGroup<EclassFileContentsCheckFunction>),
            category_dir_checks_group(new QAChecksGroup<CategoryDirCheckFunction>),
            package_dir_checks_group(new QAChecksGroup<PackageDirCheckFunction>),
            package_id_checks_group(new QAChecksGroup<PackageIDCheckFunction>),
            package_id_file_contents_checks_group(new QAChecksGroup<PackageIDFileContentsCheckFunction>)
        {
        }
    };
}

QAChecks::QAChecks() :
    PrivateImplementationPattern<QAChecks>(new Implementation<QAChecks>())
{
    using namespace tr1::placeholders;

    _imp->tree_checks_group->add_check("stray_tree_files",
            tr1::bind(stray_files_check, _2, _4, _1, is_stray_at_tree_dir, "stray_tree_files"));

    _imp->tree_checks_group->add_check("repo_name",
            tr1::bind(repo_name_check, _2, _1, "repo_name"));

    _imp->tree_checks_group->add_check("categories",
            tr1::bind(categories_check, _2, _4, "categories"));

    _imp->eclass_file_contents_checks_group->add_check("variable_assigns",
            tr1::bind(variable_assigns_check, _1, _2, tr1::shared_ptr<const ERepositoryID>(), _5, "variable_assigns"));

    _imp->eclass_file_contents_checks_group->add_check("subshell_die",
            tr1::bind(subshell_die_check, _1, _2, tr1::shared_ptr<const ERepositoryID>(), _5, "subshell_die"));

    _imp->eclass_file_contents_checks_group->add_check("header",
            tr1::bind(header_check, _1, _2, tr1::shared_ptr<const ERepositoryID>(), _5, "header"));

    _imp->eclass_file_contents_checks_group->add_check("whitespace",
            tr1::bind(whitespace_check, _1, _2, tr1::shared_ptr<const ERepositoryID>(), _5, "whitespace"));

    _imp->category_dir_checks_group->add_check("stray_category_dir_files",
            tr1::bind(stray_files_check, _2, _4, _1, is_stray_at_category_dir, "stray_category_dir_files"));

    _imp->package_dir_checks_group->add_check("gpg",
            tr1::bind(gpg_check, _2, _1, "gpg"));

    _imp->package_dir_checks_group->add_check("ebuild_count",
            tr1::bind(ebuild_count_check, _2, _1, _4, _5, "ebuild_count"));

    _imp->package_dir_checks_group->add_check("changelog",
            tr1::bind(changelog_check, _2, _1, _5, "changelog"));

    _imp->package_dir_checks_group->add_check("misc_files",
            tr1::bind(misc_files_check, _2, _1, "misc_files"));

    _imp->package_dir_checks_group->add_check("files_dir_size",
            tr1::bind(files_dir_size_check, _2, _1, "files_dir_size"));

    _imp->package_id_checks_group->add_check("eapi_supported",
            tr1::bind(eapi_supported_check, _1, _2, _5, "eapi_supported"));

    _imp->package_id_checks_group->add_check("metadata_keys",
            tr1::bind(metadata_keys_check, _1, _2, _5, "metadata_keys"));
    _imp->package_id_checks_group->add_prerequirement("metadata_keys", "eapi_supported");

    _imp->package_id_checks_group->add_check("short_description_key",
            tr1::bind(short_description_key_check, _1, _2, _5, "short_description_key"));
    _imp->package_id_checks_group->add_prerequirement("short_description_key", "metadata_keys");

    _imp->package_id_checks_group->add_check("homepage_key",
            tr1::bind(homepage_key_check, _1, _2, _5, "homepage_key"));
    _imp->package_id_checks_group->add_prerequirement("homepage_key", "metadata_keys");

    _imp->package_id_checks_group->add_check("iuse_key",
            tr1::bind(iuse_key_check, _1, _2, _4, _5, "iuse_key"));
    _imp->package_id_checks_group->add_prerequirement("iuse_key", "metadata_keys");

    _imp->package_id_checks_group->add_check("spec_keys",
            tr1::bind(spec_keys_check, _1, _2, _5, "spec_keys"));
    _imp->package_id_checks_group->add_prerequirement("spec_keys", "metadata_keys");

    _imp->package_id_checks_group->add_check("extractors",
            tr1::bind(extractors_check, _1, _2, _5, "extractors"));
    _imp->package_id_checks_group->add_prerequirement("extractors", "metadata_keys");

    _imp->package_id_checks_group->add_check("fetches_key",
            tr1::bind(fetches_key_check, _1, _2, _5, "fetches_key"));
    _imp->package_id_checks_group->add_prerequirement("fetches_key", "metadata_keys");

    _imp->package_id_checks_group->add_check("restrict_key",
            tr1::bind(restrict_key_check, _1, _2, _5, "restrict_key"));
    _imp->package_id_checks_group->add_prerequirement("restrict_key", "metadata_keys");

    _imp->package_id_checks_group->add_check("visibility",
            tr1::bind(visibility_check, _1, _2, _3, _4, _5, "visibility"));
    _imp->package_id_checks_group->add_prerequirement("visibility", "metadata_keys");

    _imp->package_id_file_contents_checks_group->add_check("default_functions",
            tr1::bind(default_functions_check, _1, _2, _5, _6, "default_functions"));

    _imp->package_id_file_contents_checks_group->add_check("variable_assigns",
            tr1::bind(variable_assigns_check, _1, _2, _5, _6, "variable_assigns"));

    _imp->package_id_file_contents_checks_group->add_check("kv_variables",
            tr1::bind(kv_variables_check, _1, _2, _5, _6, "kv_variables"));

    _imp->package_id_file_contents_checks_group->add_check("root_variable",
            tr1::bind(root_variable_check, _1, _2, _5, _6, "root_variable"));

    _imp->package_id_file_contents_checks_group->add_check("subshell_die",
            tr1::bind(subshell_die_check, _1, _2, _5, _6, "subshell_die"));

    _imp->package_id_file_contents_checks_group->add_check("whitespace",
            tr1::bind(whitespace_check, _1, _2, _5, _6, "whitespace"));

    _imp->package_id_file_contents_checks_group->add_check("header",
            tr1::bind(header_check, _1, _2, _5, _6, "header"));
}

QAChecks::~QAChecks()
{
}

const tr1::shared_ptr<QAChecksGroup<TreeCheckFunction> >
QAChecks::tree_checks_group()
{
    return _imp->tree_checks_group;
}

const tr1::shared_ptr<QAChecksGroup<EclassFileContentsCheckFunction> >
QAChecks::eclass_file_contents_checks_group()
{
    return _imp->eclass_file_contents_checks_group;
}

const tr1::shared_ptr<QAChecksGroup<CategoryDirCheckFunction> >
QAChecks::category_dir_checks_group()
{
    return _imp->category_dir_checks_group;
}

const tr1::shared_ptr<QAChecksGroup<PackageDirCheckFunction> >
QAChecks::package_dir_checks_group()
{
    return _imp->package_dir_checks_group;
}

const tr1::shared_ptr<QAChecksGroup<PackageIDCheckFunction> >
QAChecks::package_id_checks_group()
{
    return _imp->package_id_checks_group;
}

const tr1::shared_ptr<QAChecksGroup<PackageIDFileContentsCheckFunction> >
QAChecks::package_id_file_contents_checks_group()
{
    return _imp->package_id_file_contents_checks_group;
}