]> git.saurik.com Git - apt.git/blame - apt-pkg/edsp/edspsystem.cc
lintian: don't show the typofix as a typo
[apt.git] / apt-pkg / edsp / edspsystem.cc
CommitLineData
6d38011b
DK
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
4
e0a78caa 5 This system provides the abstraction to use the scenario file as the
6d38011b
DK
6 only source of package information to be able to feed the created file
7 back to APT for its own consumption (eat your own dogfood).
8
9 ##################################################################### */
10 /*}}}*/
11// Include Files /*{{{*/
ea542140
DK
12#include <config.h>
13
453b82a3 14#include <apt-pkg/configuration.h>
6d38011b
DK
15#include <apt-pkg/debversion.h>
16#include <apt-pkg/edspindexfile.h>
453b82a3 17#include <apt-pkg/edspsystem.h>
453b82a3
DK
18#include <apt-pkg/pkgcache.h>
19#include <apt-pkg/cacheiterators.h>
20
21#include <stddef.h>
22#include <string>
23#include <vector>
ea542140 24
6d38011b
DK
25 /*}}}*/
26
6c55f07a
DK
27// System::edspSystem - Constructor /*{{{*/
28edspSystem::edspSystem() : pkgSystem("Debian APT solver interface", &debVS), d(NULL), StatusFile(NULL)
6d38011b 29{
6d38011b
DK
30}
31 /*}}}*/
32// System::~debSystem - Destructor /*{{{*/
33edspSystem::~edspSystem()
34{
35 delete StatusFile;
36}
37 /*}}}*/
38// System::Lock - Get the lock /*{{{*/
39bool edspSystem::Lock()
40{
41 return true;
42}
43 /*}}}*/
44// System::UnLock - Drop a lock /*{{{*/
65512241 45bool edspSystem::UnLock(bool /*NoErrors*/)
6d38011b
DK
46{
47 return true;
48}
49 /*}}}*/
50// System::CreatePM - Create the underlying package manager /*{{{*/
51// ---------------------------------------------------------------------
52/* we can't use edsp input as input for real installations - just a
53 simulation can work, but everything else will fail bigtime */
65512241 54pkgPackageManager *edspSystem::CreatePM(pkgDepCache * /*Cache*/) const
6d38011b
DK
55{
56 return NULL;
57}
58 /*}}}*/
59// System::Initialize - Setup the configuration space.. /*{{{*/
60bool edspSystem::Initialize(Configuration &Cnf)
61{
62 Cnf.Set("Dir::State::extended_states", "/dev/null");
63 Cnf.Set("Dir::State::status","/dev/null");
64 Cnf.Set("Dir::State::lists","/dev/null");
65
66 Cnf.Set("Debug::NoLocking", "true");
67 Cnf.Set("APT::Get::Simulate", "true");
68
69 if (StatusFile) {
70 delete StatusFile;
71 StatusFile = 0;
72 }
73 return true;
74}
75 /*}}}*/
76// System::ArchiveSupported - Is a file format supported /*{{{*/
65512241 77bool edspSystem::ArchiveSupported(const char * /*Type*/)
6d38011b
DK
78{
79 return false;
80}
81 /*}}}*/
c9443c01
DK
82// System::Score - Never use the EDSP system automatically /*{{{*/
83signed edspSystem::Score(Configuration const &)
6d38011b 84{
6d38011b
DK
85 return -1000;
86}
87 /*}}}*/
5465192b 88bool edspSystem::AddStatusFiles(std::vector<pkgIndexFile *> &List) /*{{{*/
6d38011b
DK
89{
90 if (StatusFile == 0)
41ceaf02 91 {
85bcab87 92 if (_config->Find("edsp::scenario", "") == "stdin")
41ceaf02
DK
93 StatusFile = new edspIndex("stdin");
94 else
85bcab87 95 StatusFile = new edspIndex(_config->FindFile("edsp::scenario"));
41ceaf02 96 }
6d38011b
DK
97 List.push_back(StatusFile);
98 return true;
99}
100 /*}}}*/
101// System::FindIndex - Get an index file for status files /*{{{*/
102bool edspSystem::FindIndex(pkgCache::PkgFileIterator File,
103 pkgIndexFile *&Found) const
104{
105 if (StatusFile == 0)
106 return false;
107 if (StatusFile->FindInCache(*File.Cache()) == File)
108 {
109 Found = StatusFile;
110 return true;
111 }
112
113 return false;
114}
115 /*}}}*/
dce45dbe
DK
116
117APT_HIDDEN edspSystem edspSys;