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
|
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
* Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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 "fake_repository.hh"
#include <paludis/util/collection_concrete.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/distribution.hh>
using namespace paludis;
FakeRepository::FakeRepository(const Environment * const e, const RepositoryName & our_name) :
FakeRepositoryBase(e, our_name, RepositoryCapabilities::create()
.installable_interface(this)
.installed_interface(0)
.contents_interface(0)
.mask_interface(this)
.sets_interface(this)
.syncable_interface(0)
.uninstallable_interface(0)
.use_interface(this)
.world_interface(0)
.mirrors_interface(0)
.environment_variable_interface(0)
.provides_interface(0)
.virtuals_interface(DistributionData::get_instance()->default_distribution()->support_old_style_virtuals ? this : 0)
.config_interface(0)
.destination_interface(0)
.licenses_interface(0)
.portage_interface(0)
.pretend_interface(0)
.hook_interface(0),
"fake"),
_virtual_packages(new VirtualsCollection::Concrete)
{
}
void
FakeRepository::do_install(const QualifiedPackageName &, const VersionSpec &,
const InstallOptions &) const
{
}
tr1::shared_ptr<const FakeRepository::VirtualsCollection>
FakeRepository::virtual_packages() const
{
return _virtual_packages;
}
tr1::shared_ptr<const VersionMetadata>
FakeRepository::virtual_package_version_metadata(
const RepositoryVirtualsEntry & p, const VersionSpec & v) const
{
Context context("When fetching virtual package version metadata for '" + stringify(*p.provided_by_spec)
+ "' version '" + stringify(v) + "':");
if (! p.provided_by_spec->package_ptr())
throw ConfigurationError("Virtual provider atom does not specify an unambiguous package");
tr1::shared_ptr<const VersionMetadata> m(version_metadata(*p.provided_by_spec->package_ptr(), v));
tr1::shared_ptr<FakeVirtualVersionMetadata> result(new FakeVirtualVersionMetadata(
m->slot, PackageDatabaseEntry(*p.provided_by_spec->package_ptr(), v, name())));
result->eapi = m->eapi;
result->deps_interface->set_build_depend("=" + stringify(*p.provided_by_spec->package_ptr())
+ "-" + stringify(v));
result->deps_interface->set_run_depend("=" + stringify(*p.provided_by_spec->package_ptr())
+ "-" + stringify(v));
return result;
}
void
FakeRepository::add_virtual_package(const QualifiedPackageName & q, tr1::shared_ptr<const PackageDepSpec> p)
{
_virtual_packages->insert(RepositoryVirtualsEntry(q, p));
}
#ifndef MONOLITHIC
namespace paludis
{
class RepositoryMaker;
}
extern "C"
{
void PALUDIS_VISIBLE register_repositories(RepositoryMaker * maker);
}
void register_repositories(RepositoryMaker *)
{
}
#endif
|