aboutsummaryrefslogtreecommitdiff
path: root/paludis/environments/paludis/extra_distribution_data.cc
blob: cffe8ea040ddb446b169bc8e67a2ef00704f85ea (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
/* vim: set sw=4 sts=4 et foldmethod=syntax : */

/*
 * Copyright (c) 2008, 2009, 2010 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/environments/paludis/extra_distribution_data.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/distribution-impl.hh>

using namespace paludis;
using namespace paludis::paludis_environment;

namespace paludis
{
    template <>
    struct ExtraDistributionDataData<PaludisDistribution>
    {
        static std::string config_file_name()
        {
            return "paludis.conf";
        }

        static std::tr1::shared_ptr<PaludisDistribution> make_data(const std::tr1::shared_ptr<const KeyValueConfigFile> & k)
        {
            return make_shared_ptr(new PaludisDistribution(make_named_values<PaludisDistribution>(
                            n::bashrc_filename() = k->get("bashrc_filename"),
                            n::info_messages_are_spam() = destringify<bool>(k->get("info_messages_are_spam")),
                            n::keywords_filename_part() = k->get("keywords_filename_part"),
                            n::licenses_filename_part() = k->get("licenses_filename_part"),
                            n::mandatory_userpriv() = destringify<bool>(k->get("mandatory_userpriv")),
                            n::mirrors_filename_part() = k->get("mirrors_filename_part"),
                            n::output_filename_part() = k->get("output_filename_part"),
                            n::output_managers_directory() = k->get("output_managers_directory"),
                            n::package_mask_filename_part() = k->get("package_mask_filename_part"),
                            n::package_unmask_filename_part() = k->get("package_unmask_filename_part"),
                            n::repositories_directory() = k->get("repositories_directory"),
                            n::repository_defaults_filename_part() = k->get("repository_defaults_filename_part"),
                            n::use_filename_part() = k->get("use_filename_part")
                            )));
        }
    };
}

template class ExtraDistributionData<PaludisDistribution>;
template class InstantiationPolicy<ExtraDistributionData<PaludisDistribution>, instantiation_method::SingletonTag>;