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/pkgcache.h>
19 #include <apt-pkg/cacheiterators.h>
27 // System::edspSystem - Constructor /*{{{*/
28 edspSystem::edspSystem() : pkgSystem("Debian APT solver interface", &debVS
), d(NULL
), StatusFile(NULL
)
32 // System::~debSystem - Destructor /*{{{*/
33 edspSystem::~edspSystem()
38 // System::Lock - Get the lock /*{{{*/
39 bool edspSystem::Lock()
44 // System::UnLock - Drop a lock /*{{{*/
45 bool edspSystem::UnLock(bool /*NoErrors*/)
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 */
54 pkgPackageManager
*edspSystem::CreatePM(pkgDepCache
* /*Cache*/) const
59 // System::Initialize - Setup the configuration space.. /*{{{*/
60 bool edspSystem::Initialize(Configuration
&Cnf
)
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");
66 Cnf
.Set("Debug::NoLocking", "true");
67 Cnf
.Set("APT::Get::Simulate", "true");
76 // System::ArchiveSupported - Is a file format supported /*{{{*/
77 bool edspSystem::ArchiveSupported(const char * /*Type*/)
82 // System::Score - Never use the EDSP system automatically /*{{{*/
83 signed edspSystem::Score(Configuration
const &)
88 bool edspSystem::AddStatusFiles(std::vector
<pkgIndexFile
*> &List
) /*{{{*/
92 if (_config
->Find("edsp::scenario", "") == "stdin")
93 StatusFile
= new edspIndex("stdin");
95 StatusFile
= new edspIndex(_config
->FindFile("edsp::scenario"));
97 List
.push_back(StatusFile
);
101 // System::FindIndex - Get an index file for status files /*{{{*/
102 bool edspSystem::FindIndex(pkgCache::PkgFileIterator File
,
103 pkgIndexFile
*&Found
) const
107 if (StatusFile
->FindInCache(*File
.Cache()) == File
)
117 APT_HIDDEN edspSystem edspSys
;