]> git.saurik.com Git - apt.git/blob - apt-pkg/edsp/edspsystem.cc
fix arguments for MarkInstall so packages are really marked as automatic
[apt.git] / apt-pkg / edsp / edspsystem.cc
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /* ######################################################################
4
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).
8
9 ##################################################################### */
10 /*}}}*/
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>
18 #include <apti18n.h>
19 #include <sys/types.h>
20 #include <unistd.h>
21 #include <dirent.h>
22 #include <errno.h>
23 /*}}}*/
24
25 edspSystem edspSys;
26
27 // System::debSystem - Constructor /*{{{*/
28 edspSystem::edspSystem()
29 {
30 StatusFile = 0;
31
32 Label = "Debian APT solver interface";
33 VS = &debVS;
34 }
35 /*}}}*/
36 // System::~debSystem - Destructor /*{{{*/
37 edspSystem::~edspSystem()
38 {
39 delete StatusFile;
40 }
41 /*}}}*/
42 // System::Lock - Get the lock /*{{{*/
43 bool edspSystem::Lock()
44 {
45 return true;
46 }
47 /*}}}*/
48 // System::UnLock - Drop a lock /*{{{*/
49 bool edspSystem::UnLock(bool NoErrors)
50 {
51 return true;
52 }
53 /*}}}*/
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
59 {
60 return NULL;
61 }
62 /*}}}*/
63 // System::Initialize - Setup the configuration space.. /*{{{*/
64 bool edspSystem::Initialize(Configuration &Cnf)
65 {
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");
69
70 Cnf.Set("Debug::NoLocking", "true");
71 Cnf.Set("APT::Get::Simulate", "true");
72
73 if (StatusFile) {
74 delete StatusFile;
75 StatusFile = 0;
76 }
77 return true;
78 }
79 /*}}}*/
80 // System::ArchiveSupported - Is a file format supported /*{{{*/
81 bool edspSystem::ArchiveSupported(const char *Type)
82 {
83 return false;
84 }
85 /*}}}*/
86 // System::Score - Determine if we should use the edsp system /*{{{*/
87 signed edspSystem::Score(Configuration const &Cnf)
88 {
89 if (Cnf.Find("edsp::scenario", "") == "stdin")
90 return 1000;
91 if (FileExists(Cnf.FindFile("edsp::scenario","")) == true)
92 return 1000;
93 return -1000;
94 }
95 /*}}}*/
96 // System::AddStatusFiles - Register the status files /*{{{*/
97 bool edspSystem::AddStatusFiles(vector<pkgIndexFile *> &List)
98 {
99 if (StatusFile == 0)
100 {
101 if (_config->Find("edsp::scenario", "") == "stdin")
102 StatusFile = new edspIndex("stdin");
103 else
104 StatusFile = new edspIndex(_config->FindFile("edsp::scenario"));
105 }
106 List.push_back(StatusFile);
107 return true;
108 }
109 /*}}}*/
110 // System::FindIndex - Get an index file for status files /*{{{*/
111 bool edspSystem::FindIndex(pkgCache::PkgFileIterator File,
112 pkgIndexFile *&Found) const
113 {
114 if (StatusFile == 0)
115 return false;
116 if (StatusFile->FindInCache(*File.Cache()) == File)
117 {
118 Found = StatusFile;
119 return true;
120 }
121
122 return false;
123 }
124 /*}}}*/