]>
git.saurik.com Git - apt.git/blob - apt-pkg/edsp/edspsystem.cc
1 // -*- mode: cpp; mode: fold -*-
3 /* ######################################################################
5 This system provides the abstraction to use the scenario file as the
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).
9 ##################################################################### */
11 // Include Files /*{{{*/
12 #include <apt-pkg/edspsystem.h>
13 #include <apt-pkg/debversion.h>
14 #include <apt-pkg/edspindexfile.h>
15 #include <apt-pkg/configuration.h>
16 #include <apt-pkg/error.h>
17 #include <apt-pkg/fileutl.h>
19 #include <sys/types.h>
27 // System::debSystem - Constructor /*{{{*/
28 edspSystem::edspSystem()
32 Label
= "Debian APT solver interface";
36 // System::~debSystem - Destructor /*{{{*/
37 edspSystem::~edspSystem()
42 // System::Lock - Get the lock /*{{{*/
43 bool edspSystem::Lock()
48 // System::UnLock - Drop a lock /*{{{*/
49 bool edspSystem::UnLock(bool NoErrors
)
54 // System::CreatePM - Create the underlying package manager /*{{{*/
55 // ---------------------------------------------------------------------
56 /* we can't use edsp input as input for real installations - just a
57 simulation can work, but everything else will fail bigtime */
58 pkgPackageManager
*edspSystem::CreatePM(pkgDepCache
*Cache
) const
63 // System::Initialize - Setup the configuration space.. /*{{{*/
64 bool edspSystem::Initialize(Configuration
&Cnf
)
66 Cnf
.Set("Dir::State::extended_states", "/dev/null");
67 Cnf
.Set("Dir::State::status","/dev/null");
68 Cnf
.Set("Dir::State::lists","/dev/null");
70 Cnf
.Set("Debug::NoLocking", "true");
71 Cnf
.Set("APT::Get::Simulate", "true");
80 // System::ArchiveSupported - Is a file format supported /*{{{*/
81 bool edspSystem::ArchiveSupported(const char *Type
)
86 // System::Score - Determine if we should use the edsp system /*{{{*/
87 signed edspSystem::Score(Configuration
const &Cnf
)
89 if (Cnf
.Find("edsp::scenario", "") == "stdin")
91 if (FileExists(Cnf
.FindFile("edsp::scenario","")) == true)
96 // System::AddStatusFiles - Register the status files /*{{{*/
97 bool edspSystem::AddStatusFiles(vector
<pkgIndexFile
*> &List
)
101 if (_config
->Find("edsp::scenario", "") == "stdin")
102 StatusFile
= new edspIndex("stdin");
104 StatusFile
= new edspIndex(_config
->FindFile("edsp::scenario"));
106 List
.push_back(StatusFile
);
110 // System::FindIndex - Get an index file for status files /*{{{*/
111 bool edspSystem::FindIndex(pkgCache::PkgFileIterator File
,
112 pkgIndexFile
*&Found
) const
116 if (StatusFile
->FindInCache(*File
.Cache()) == File
)