]>
git.saurik.com Git - apt.git/blob - apt-pkg/edsp/edspsystem.cc
92edb8d7715dee2745295990910bc62b588ec2c9
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/configuration.h>
15 #include <apt-pkg/debversion.h>
16 #include <apt-pkg/edspindexfile.h>
17 #include <apt-pkg/edspsystem.h>
18 #include <apt-pkg/fileutl.h>
19 #include <apt-pkg/pkgcache.h>
20 #include <apt-pkg/cacheiterators.h>
31 // System::debSystem - Constructor /*{{{*/
32 edspSystem::edspSystem()
36 Label
= "Debian APT solver interface";
40 // System::~debSystem - Destructor /*{{{*/
41 edspSystem::~edspSystem()
46 // System::Lock - Get the lock /*{{{*/
47 bool edspSystem::Lock()
52 // System::UnLock - Drop a lock /*{{{*/
53 bool edspSystem::UnLock(bool /*NoErrors*/)
58 // System::CreatePM - Create the underlying package manager /*{{{*/
59 // ---------------------------------------------------------------------
60 /* we can't use edsp input as input for real installations - just a
61 simulation can work, but everything else will fail bigtime */
62 pkgPackageManager
*edspSystem::CreatePM(pkgDepCache
* /*Cache*/) const
67 // System::Initialize - Setup the configuration space.. /*{{{*/
68 bool edspSystem::Initialize(Configuration
&Cnf
)
70 Cnf
.Set("Dir::State::extended_states", "/dev/null");
71 Cnf
.Set("Dir::State::status","/dev/null");
72 Cnf
.Set("Dir::State::lists","/dev/null");
74 Cnf
.Set("Debug::NoLocking", "true");
75 Cnf
.Set("APT::Get::Simulate", "true");
84 // System::ArchiveSupported - Is a file format supported /*{{{*/
85 bool edspSystem::ArchiveSupported(const char * /*Type*/)
90 // System::Score - Determine if we should use the edsp system /*{{{*/
91 signed edspSystem::Score(Configuration
const &Cnf
)
93 if (Cnf
.Find("edsp::scenario", "") == "stdin")
95 if (RealFileExists(Cnf
.FindFile("edsp::scenario","")) == true)
100 // System::AddStatusFiles - Register the status files /*{{{*/
101 bool edspSystem::AddStatusFiles(std::vector
<pkgIndexFile
*> &List
)
105 if (_config
->Find("edsp::scenario", "") == "stdin")
106 StatusFile
= new edspIndex("stdin");
108 StatusFile
= new edspIndex(_config
->FindFile("edsp::scenario"));
110 List
.push_back(StatusFile
);
114 // System::FindIndex - Get an index file for status files /*{{{*/
115 bool edspSystem::FindIndex(pkgCache::PkgFileIterator File
,
116 pkgIndexFile
*&Found
) const
120 if (StatusFile
->FindInCache(*File
.Cache()) == File
)