]>
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 /*{{{*/
14 #include <apt-pkg/edspsystem.h>
15 #include <apt-pkg/debversion.h>
16 #include <apt-pkg/edspindexfile.h>
17 #include <apt-pkg/configuration.h>
18 #include <apt-pkg/error.h>
19 #include <apt-pkg/fileutl.h>
20 #include <sys/types.h>
30 // System::debSystem - Constructor /*{{{*/
31 edspSystem::edspSystem()
35 Label
= "Debian APT solver interface";
39 // System::~debSystem - Destructor /*{{{*/
40 edspSystem::~edspSystem()
45 // System::Lock - Get the lock /*{{{*/
46 bool edspSystem::Lock()
51 // System::UnLock - Drop a lock /*{{{*/
52 bool edspSystem::UnLock(bool NoErrors
)
57 // System::CreatePM - Create the underlying package manager /*{{{*/
58 // ---------------------------------------------------------------------
59 /* we can't use edsp input as input for real installations - just a
60 simulation can work, but everything else will fail bigtime */
61 pkgPackageManager
*edspSystem::CreatePM(pkgDepCache
*Cache
) const
66 // System::Initialize - Setup the configuration space.. /*{{{*/
67 bool edspSystem::Initialize(Configuration
&Cnf
)
69 Cnf
.Set("Dir::State::extended_states", "/dev/null");
70 Cnf
.Set("Dir::State::status","/dev/null");
71 Cnf
.Set("Dir::State::lists","/dev/null");
73 Cnf
.Set("Debug::NoLocking", "true");
74 Cnf
.Set("APT::Get::Simulate", "true");
83 // System::ArchiveSupported - Is a file format supported /*{{{*/
84 bool edspSystem::ArchiveSupported(const char *Type
)
89 // System::Score - Determine if we should use the edsp system /*{{{*/
90 signed edspSystem::Score(Configuration
const &Cnf
)
92 if (Cnf
.Find("edsp::scenario", "") == "stdin")
94 if (RealFileExists(Cnf
.FindFile("edsp::scenario","")) == true)
99 // System::AddStatusFiles - Register the status files /*{{{*/
100 bool edspSystem::AddStatusFiles(std::vector
<pkgIndexFile
*> &List
)
104 if (_config
->Find("edsp::scenario", "") == "stdin")
105 StatusFile
= new edspIndex("stdin");
107 StatusFile
= new edspIndex(_config
->FindFile("edsp::scenario"));
109 List
.push_back(StatusFile
);
113 // System::FindIndex - Get an index file for status files /*{{{*/
114 bool edspSystem::FindIndex(pkgCache::PkgFileIterator File
,
115 pkgIndexFile
*&Found
) const
119 if (StatusFile
->FindInCache(*File
.Cache()) == File
)