]>
Commit | Line | Data |
---|---|---|
6c139d6e AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
b9c0654c | 3 | // $Id: packagemanager.cc,v 1.30 2003/04/27 03:04:15 doogie Exp $ |
6c139d6e AL |
4 | /* ###################################################################### |
5 | ||
6 | Package Manager - Abstacts the package manager | |
7 | ||
8 | More work is needed in the area of transitioning provides, ie exim | |
9 | replacing smail. This can cause interesing side effects. | |
10 | ||
11 | Other cases involving conflicts+replaces should be tested. | |
12 | ||
13 | ##################################################################### */ | |
14 | /*}}}*/ | |
15 | // Include Files /*{{{*/ | |
094a497d AL |
16 | #include <apt-pkg/packagemanager.h> |
17 | #include <apt-pkg/orderlist.h> | |
18 | #include <apt-pkg/depcache.h> | |
19 | #include <apt-pkg/error.h> | |
20 | #include <apt-pkg/version.h> | |
03e39e59 | 21 | #include <apt-pkg/acquire-item.h> |
30e1eab5 AL |
22 | #include <apt-pkg/algorithms.h> |
23 | #include <apt-pkg/configuration.h> | |
b2e465d6 AL |
24 | #include <apt-pkg/sptr.h> |
25 | ||
26 | #include <apti18n.h> | |
5819a761 | 27 | #include <iostream> |
1d6386f3 | 28 | #include <fcntl.h> |
92fcbfc1 | 29 | /*}}}*/ |
5819a761 AL |
30 | using namespace std; |
31 | ||
590f1923 CB |
32 | bool pkgPackageManager::SigINTStop = false; |
33 | ||
6c139d6e AL |
34 | // PM::PackageManager - Constructor /*{{{*/ |
35 | // --------------------------------------------------------------------- | |
36 | /* */ | |
b2e465d6 | 37 | pkgPackageManager::pkgPackageManager(pkgDepCache *pCache) : Cache(*pCache) |
6c139d6e AL |
38 | { |
39 | FileNames = new string[Cache.Head().PackageCount]; | |
40 | List = 0; | |
30e1eab5 | 41 | Debug = _config->FindB("Debug::pkgPackageManager",false); |
6c139d6e AL |
42 | } |
43 | /*}}}*/ | |
44 | // PM::PackageManager - Destructor /*{{{*/ | |
45 | // --------------------------------------------------------------------- | |
46 | /* */ | |
47 | pkgPackageManager::~pkgPackageManager() | |
48 | { | |
49 | delete List; | |
50 | delete [] FileNames; | |
51 | } | |
52 | /*}}}*/ | |
03e39e59 AL |
53 | // PM::GetArchives - Queue the archives for download /*{{{*/ |
54 | // --------------------------------------------------------------------- | |
55 | /* */ | |
56 | bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, | |
57 | pkgRecords *Recs) | |
58 | { | |
7a1b1f8b AL |
59 | if (CreateOrderList() == false) |
60 | return false; | |
61 | ||
5e312de7 DK |
62 | bool const ordering = |
63 | _config->FindB("PackageManager::UnpackAll",true) ? | |
64 | List->OrderUnpack() : List->OrderCritical(); | |
65 | if (ordering == false) | |
7a1b1f8b AL |
66 | return _error->Error("Internal ordering error"); |
67 | ||
68 | for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) | |
69 | { | |
70 | PkgIterator Pkg(Cache,*I); | |
281daf46 AL |
71 | FileNames[Pkg->ID] = string(); |
72 | ||
7a1b1f8b AL |
73 | // Skip packages to erase |
74 | if (Cache[Pkg].Delete() == true) | |
03e39e59 | 75 | continue; |
d38b7b3d AL |
76 | |
77 | // Skip Packages that need configure only. | |
9dbb421f AL |
78 | if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure && |
79 | Cache[Pkg].Keep() == true) | |
d38b7b3d | 80 | continue; |
281daf46 AL |
81 | |
82 | // Skip already processed packages | |
83 | if (List->IsNow(Pkg) == false) | |
84 | continue; | |
803ea2a8 | 85 | |
7a1b1f8b AL |
86 | new pkgAcqArchive(Owner,Sources,Recs,Cache[Pkg].InstVerIter(Cache), |
87 | FileNames[Pkg->ID]); | |
03e39e59 | 88 | } |
7a1b1f8b | 89 | |
03e39e59 AL |
90 | return true; |
91 | } | |
92 | /*}}}*/ | |
6c139d6e AL |
93 | // PM::FixMissing - Keep all missing packages /*{{{*/ |
94 | // --------------------------------------------------------------------- | |
95 | /* This is called to correct the installation when packages could not | |
96 | be downloaded. */ | |
97 | bool pkgPackageManager::FixMissing() | |
bdae53f1 | 98 | { |
e6756cde | 99 | pkgDepCache::ActionGroup group(Cache); |
b2e465d6 | 100 | pkgProblemResolver Resolve(&Cache); |
2fd65468 | 101 | List->SetFileList(FileNames); |
e6756cde | 102 | |
9dbb421f | 103 | bool Bad = false; |
6c139d6e AL |
104 | for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) |
105 | { | |
2fd65468 | 106 | if (List->IsMissing(I) == false) |
9dbb421f | 107 | continue; |
2fd65468 | 108 | |
9dbb421f AL |
109 | // Okay, this file is missing and we need it. Mark it for keep |
110 | Bad = true; | |
74a05226 | 111 | Cache.MarkKeep(I, false, false); |
6c139d6e | 112 | } |
bdae53f1 AL |
113 | |
114 | // We have to empty the list otherwise it will not have the new changes | |
115 | delete List; | |
116 | List = 0; | |
6c139d6e | 117 | |
9dbb421f AL |
118 | if (Bad == false) |
119 | return true; | |
120 | ||
6c139d6e | 121 | // Now downgrade everything that is broken |
30e1eab5 | 122 | return Resolve.ResolveByKeep() == true && Cache.BrokenCount() == 0; |
6c139d6e AL |
123 | } |
124 | /*}}}*/ | |
3a6d37fd MV |
125 | // PM::ImmediateAdd - Add the immediate flag recursivly /*{{{*/ |
126 | // --------------------------------------------------------------------- | |
127 | /* This adds the immediate flag to the pkg and recursively to the | |
128 | dependendies | |
129 | */ | |
d183f850 | 130 | void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer, unsigned const int &Depth) |
3a6d37fd MV |
131 | { |
132 | DepIterator D; | |
133 | ||
134 | if(UseInstallVer) | |
135 | { | |
136 | if(Cache[I].InstallVer == 0) | |
137 | return; | |
138 | D = Cache[I].InstVerIter(Cache).DependsList(); | |
139 | } else { | |
140 | if (I->CurrentVer == 0) | |
141 | return; | |
142 | D = I.CurrentVer().DependsList(); | |
143 | } | |
144 | ||
145 | for ( /* nothing */ ; D.end() == false; D++) | |
146 | if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) | |
147 | { | |
148 | if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate)) | |
149 | { | |
150 | if(Debug) | |
d183f850 | 151 | clog << OutputInDepth(Depth) << "ImmediateAdd(): Adding Immediate flag to " << D.TargetPkg() << " cause of " << D.DepType() << " " << I.Name() << endl; |
3a6d37fd | 152 | List->Flag(D.TargetPkg(),pkgOrderList::Immediate); |
d183f850 | 153 | ImmediateAdd(D.TargetPkg(), UseInstallVer, Depth + 1); |
3a6d37fd MV |
154 | } |
155 | } | |
156 | return; | |
157 | } | |
158 | /*}}}*/ | |
7a1b1f8b AL |
159 | // PM::CreateOrderList - Create the ordering class /*{{{*/ |
160 | // --------------------------------------------------------------------- | |
161 | /* This populates the ordering list with all the packages that are | |
162 | going to change. */ | |
163 | bool pkgPackageManager::CreateOrderList() | |
164 | { | |
281daf46 AL |
165 | if (List != 0) |
166 | return true; | |
167 | ||
7a1b1f8b | 168 | delete List; |
b2e465d6 | 169 | List = new pkgOrderList(&Cache); |
7a1b1f8b | 170 | |
b684d8c7 | 171 | NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true); |
e2a5ff0c | 172 | ImmConfigureAll = _config->FindB("APT::Immediate-Configure-All",false); |
a6c8798a CB |
173 | |
174 | if (Debug && ImmConfigureAll) | |
175 | clog << "CreateOrderList(): Adding Immediate flag for all packages because of APT::Immediate-Configure-All" << endl; | |
079cc404 | 176 | |
7a1b1f8b AL |
177 | // Generate the list of affected packages and sort it |
178 | for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) | |
179 | { | |
e7b470ee AL |
180 | // Ignore no-version packages |
181 | if (I->VersionList == 0) | |
182 | continue; | |
183 | ||
138d4b3d | 184 | // Mark the package and its dependends for immediate configuration |
a6c8798a | 185 | if ((((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential || |
138d4b3d | 186 | (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important) && |
a6c8798a | 187 | NoImmConfigure == false) || ImmConfigureAll) |
7a1b1f8b | 188 | { |
a6c8798a | 189 | if(Debug && !ImmConfigureAll) |
3a6d37fd | 190 | clog << "CreateOrderList(): Adding Immediate flag for " << I.Name() << endl; |
7a1b1f8b | 191 | List->Flag(I,pkgOrderList::Immediate); |
a6c8798a CB |
192 | |
193 | if (!ImmConfigureAll) { | |
a6c8798a CB |
194 | // Look for other install packages to make immediate configurea |
195 | ImmediateAdd(I, true); | |
e2a5ff0c | 196 | |
a6c8798a CB |
197 | // And again with the current version. |
198 | ImmediateAdd(I, false); | |
199 | } | |
7a1b1f8b AL |
200 | } |
201 | ||
202 | // Not interesting | |
203 | if ((Cache[I].Keep() == true || | |
204 | Cache[I].InstVerIter(Cache) == I.CurrentVer()) && | |
d556d1a1 | 205 | I.State() == pkgCache::PkgIterator::NeedsNothing && |
d0c59649 | 206 | (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall && |
d556d1a1 AL |
207 | (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete || |
208 | (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge)) | |
7a1b1f8b AL |
209 | continue; |
210 | ||
211 | // Append it to the list | |
138d4b3d | 212 | List->push_back(I); |
7a1b1f8b AL |
213 | } |
214 | ||
215 | return true; | |
216 | } | |
217 | /*}}}*/ | |
6c139d6e AL |
218 | // PM::DepAlwaysTrue - Returns true if this dep is irrelevent /*{{{*/ |
219 | // --------------------------------------------------------------------- | |
220 | /* The restriction on provides is to eliminate the case when provides | |
221 | are transitioning between valid states [ie exim to smail] */ | |
222 | bool pkgPackageManager::DepAlwaysTrue(DepIterator D) | |
223 | { | |
224 | if (D.TargetPkg()->ProvidesList != 0) | |
225 | return false; | |
226 | ||
227 | if ((Cache[D] & pkgDepCache::DepInstall) != 0 && | |
228 | (Cache[D] & pkgDepCache::DepNow) != 0) | |
229 | return true; | |
230 | return false; | |
231 | } | |
232 | /*}}}*/ | |
233 | // PM::CheckRConflicts - Look for reverse conflicts /*{{{*/ | |
234 | // --------------------------------------------------------------------- | |
235 | /* This looks over the reverses for a conflicts line that needs early | |
236 | removal. */ | |
237 | bool pkgPackageManager::CheckRConflicts(PkgIterator Pkg,DepIterator D, | |
238 | const char *Ver) | |
239 | { | |
240 | for (;D.end() == false; D++) | |
241 | { | |
b2e465d6 AL |
242 | if (D->Type != pkgCache::Dep::Conflicts && |
243 | D->Type != pkgCache::Dep::Obsoletes) | |
6c139d6e | 244 | continue; |
5af32db6 AL |
245 | |
246 | // The package hasnt been changed | |
247 | if (List->IsNow(Pkg) == false) | |
248 | continue; | |
6c139d6e | 249 | |
5af32db6 AL |
250 | // Ignore self conflicts, ignore conflicts from irrelevent versions |
251 | if (D.ParentPkg() == Pkg || D.ParentVer() != D.ParentPkg().CurrentVer()) | |
6c139d6e AL |
252 | continue; |
253 | ||
b2e465d6 | 254 | if (Cache.VS().CheckDep(Ver,D->CompareOp,D.TargetVer()) == false) |
6c139d6e | 255 | continue; |
b2e465d6 | 256 | |
6c139d6e | 257 | if (EarlyRemove(D.ParentPkg()) == false) |
5af32db6 AL |
258 | return _error->Error("Reverse conflicts early remove for package '%s' failed", |
259 | Pkg.Name()); | |
260 | } | |
6c139d6e AL |
261 | return true; |
262 | } | |
263 | /*}}}*/ | |
264 | // PM::ConfigureAll - Run the all out configuration /*{{{*/ | |
265 | // --------------------------------------------------------------------- | |
266 | /* This configures every package. It is assumed they are all unpacked and | |
590f1923 CB |
267 | that the final configuration is valid. This is also used to catch packages |
268 | that have not been configured when using ImmConfigureAll */ | |
6c139d6e AL |
269 | bool pkgPackageManager::ConfigureAll() |
270 | { | |
b2e465d6 | 271 | pkgOrderList OList(&Cache); |
6c139d6e AL |
272 | |
273 | // Populate the order list | |
274 | for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) | |
275 | if (List->IsFlag(pkgCache::PkgIterator(Cache,*I), | |
276 | pkgOrderList::UnPacked) == true) | |
277 | OList.push_back(*I); | |
278 | ||
279 | if (OList.OrderConfigure() == false) | |
280 | return false; | |
5e312de7 DK |
281 | |
282 | std::string const conf = _config->Find("PackageManager::Configure","all"); | |
283 | bool const ConfigurePkgs = (conf == "all"); | |
284 | ||
6c139d6e AL |
285 | // Perform the configuring |
286 | for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++) | |
287 | { | |
288 | PkgIterator Pkg(Cache,*I); | |
17182c0c CB |
289 | |
290 | /* Check if the package has been configured, this can happen if SmartConfigure | |
291 | calls its self */ | |
292 | if (List->IsFlag(Pkg,pkgOrderList::Configured)) continue; | |
803ea2a8 | 293 | |
590f1923 | 294 | if (ConfigurePkgs == true && SmartConfigure(Pkg) == false) { |
634985f8 | 295 | _error->Error("Internal error, packages left unconfigured. %s",Pkg.Name()); |
6c139d6e | 296 | return false; |
634985f8 | 297 | } |
6c139d6e AL |
298 | |
299 | List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); | |
300 | } | |
301 | ||
302 | return true; | |
303 | } | |
304 | /*}}}*/ | |
305 | // PM::SmartConfigure - Perform immediate configuration of the pkg /*{{{*/ | |
306 | // --------------------------------------------------------------------- | |
590f1923 CB |
307 | /* This routine trys to put the system in a state where Pkg can be configured, |
308 | this involves checking each of Pkg's dependanies and unpacking and | |
309 | configuring packages where needed. */ | |
6c139d6e AL |
310 | bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) |
311 | { | |
0eacf067 MV |
312 | if (Debug == true) |
313 | clog << "SmartConfigure " << Pkg.Name() << endl; | |
6c139d6e | 314 | |
590f1923 | 315 | VerIterator const instVer = Cache[Pkg].InstVerIter(Cache); |
b2e465d6 | 316 | |
590f1923 CB |
317 | /* Because of the ordered list, most dependancies should be unpacked, |
318 | however if there is a loop this is not the case, so check for dependancies before configuring. | |
319 | This is done after the package installation as it makes it easier to deal with conflicts problems */ | |
6c139d6e | 320 | bool Bad = false; |
590f1923 CB |
321 | for (DepIterator D = instVer.DependsList(); |
322 | D.end() == false; ) | |
6c139d6e | 323 | { |
590f1923 CB |
324 | // Compute a single dependency element (glob or) |
325 | pkgCache::DepIterator Start; | |
326 | pkgCache::DepIterator End; | |
327 | D.GlobOr(Start,End); | |
6c139d6e | 328 | |
590f1923 CB |
329 | if (End->Type == pkgCache::Dep::Depends) |
330 | Bad = true; | |
6c139d6e | 331 | |
590f1923 CB |
332 | // Check for dependanices that have not been unpacked, probably due to loops. |
333 | while (End->Type == pkgCache::Dep::Depends) { | |
334 | PkgIterator DepPkg; | |
335 | VerIterator InstallVer; | |
336 | SPtrArray<Version *> VList = Start.AllTargets(); | |
337 | ||
338 | for (Version **I = VList; *I != 0; I++) { | |
6c139d6e | 339 | VerIterator Ver(Cache,*I); |
590f1923 CB |
340 | DepPkg = Ver.ParentPkg(); |
341 | ||
342 | if (!Bad) continue; | |
343 | ||
344 | InstallVer = VerIterator(Cache,Cache[DepPkg].InstallVer); | |
345 | //VerIterator CandVer(Cache,Cache[DepPkg].CandidateVer); | |
a6c8798a | 346 | |
b9f66879 | 347 | if (Debug) { |
a6c8798a | 348 | if (Ver==0) { |
590f1923 | 349 | cout << " Checking if " << Ver << " of " << DepPkg.Name() << " satisfies this dependancy" << endl; |
a6c8798a | 350 | } else { |
590f1923 | 351 | cout << " Checking if " << Ver.VerStr() << " of " << DepPkg.Name() << " satisfies this dependancy" << endl; |
a6c8798a | 352 | } |
590f1923 CB |
353 | |
354 | if (DepPkg.CurrentVer()==0) { | |
355 | cout << " CurrentVer " << DepPkg.CurrentVer() << " IsNow " << List->IsNow(DepPkg) << " NeedsNothing " << (DepPkg.State() == PkgIterator::NeedsNothing) << endl; | |
a6c8798a | 356 | } else { |
590f1923 | 357 | cout << " CurrentVer " << DepPkg.CurrentVer().VerStr() << " IsNow " << List->IsNow(DepPkg) << " NeedsNothing " << (DepPkg.State() == PkgIterator::NeedsNothing) << endl; |
a6c8798a | 358 | } |
590f1923 | 359 | |
a6c8798a | 360 | if (InstallVer==0) { |
590f1923 | 361 | cout << " InstallVer " << InstallVer << endl; |
a6c8798a | 362 | } else { |
590f1923 | 363 | cout << " InstallVer " << InstallVer.VerStr() << endl; |
a6c8798a | 364 | } |
590f1923 CB |
365 | //if (CandVer != 0) |
366 | // cout << " CandVer " << CandVer.VerStr() << endl; | |
9fc57a59 | 367 | |
b9f66879 | 368 | cout << " Keep " << Cache[DepPkg].Keep() << " Unpacked " << List->IsFlag(DepPkg,pkgOrderList::UnPacked) << " Configured " << List->IsFlag(DepPkg,pkgOrderList::Configured) << " Removed " << List->IsFlag(DepPkg,pkgOrderList::Removed) << endl; |
a6c8798a | 369 | |
9fc57a59 | 370 | } |
590f1923 CB |
371 | |
372 | // Check if it satisfies this dependancy | |
373 | if (DepPkg.CurrentVer() == Ver && List->IsNow(DepPkg) == true && | |
b9f66879 | 374 | !List->IsFlag(DepPkg,pkgOrderList::Removed) && DepPkg.State() == PkgIterator::NeedsNothing) |
6c139d6e AL |
375 | { |
376 | Bad = false; | |
377 | continue; | |
378 | } | |
a6c8798a | 379 | |
590f1923 CB |
380 | if (Cache[DepPkg].InstallVer == *I) { |
381 | if (List->IsFlag(DepPkg,pkgOrderList::UnPacked)) { | |
382 | if (!List->IsFlag(DepPkg,pkgOrderList::Loop)) { | |
383 | List->Flag(Pkg,pkgOrderList::Loop); | |
384 | Bad = !SmartConfigure(DepPkg); | |
385 | } else { | |
386 | Bad = false; | |
387 | } | |
388 | } else if (List->IsFlag(DepPkg,pkgOrderList::Configured)) { | |
389 | Bad = false; | |
390 | } | |
6c139d6e | 391 | continue; |
590f1923 | 392 | } |
6c139d6e | 393 | } |
590f1923 CB |
394 | |
395 | if (InstallVer != 0 && Bad) { | |
396 | Bad = false; | |
397 | List->Flag(Pkg,pkgOrderList::Loop); | |
398 | if (!List->IsFlag(DepPkg,pkgOrderList::Loop)) { | |
399 | if (Debug) | |
400 | cout << " Unpacking " << DepPkg.Name() << " to avoid loop" << endl; | |
401 | SmartUnPack(DepPkg, true); | |
402 | } | |
403 | } | |
404 | ||
405 | if (Start==End) { | |
406 | if (Bad && Debug) { | |
407 | if (!List->IsFlag(DepPkg,pkgOrderList::Loop)) { | |
408 | _error->Warning("Could not satisfy dependancies for %s",Pkg.Name()); | |
409 | } | |
410 | } | |
411 | break; | |
412 | ||
413 | } else { | |
414 | Start++; | |
415 | } | |
6c139d6e | 416 | } |
590f1923 CB |
417 | } |
418 | ||
419 | static std::string const conf = _config->Find("PackageManager::Configure","all"); | |
420 | static bool const ConfigurePkgs = (conf == "all" || conf == "smart"); | |
421 | ||
17182c0c CB |
422 | if (List->IsFlag(Pkg,pkgOrderList::Configured)) |
423 | return _error->Error("Internal configure error on '%s'. ",Pkg.Name(),1); | |
424 | ||
590f1923 CB |
425 | if (ConfigurePkgs == true && Configure(Pkg) == false) |
426 | return false; | |
6c139d6e | 427 | |
590f1923 CB |
428 | List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); |
429 | ||
430 | if (Cache[Pkg].InstVerIter(Cache)->MultiArch == pkgCache::Version::Same) | |
431 | for (PkgIterator P = Pkg.Group().PackageList(); | |
432 | P.end() == false; P = Pkg.Group().NextPkg(P)) | |
6c139d6e | 433 | { |
590f1923 CB |
434 | if (Pkg == P || List->IsFlag(P,pkgOrderList::Configured) == true || |
435 | Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer && | |
436 | (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)) | |
437 | continue; | |
438 | SmartConfigure(P); | |
6c139d6e | 439 | } |
590f1923 CB |
440 | |
441 | // Sanity Check | |
442 | if (List->IsFlag(Pkg,pkgOrderList::Configured) == false && Debug) | |
443 | _error->Warning(_("Could not perform immediate configuration on '%s'. " | |
444 | "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.Name(),1); | |
445 | ||
6c139d6e AL |
446 | return true; |
447 | } | |
448 | /*}}}*/ | |
449 | // PM::EarlyRemove - Perform removal of packages before their time /*{{{*/ | |
450 | // --------------------------------------------------------------------- | |
451 | /* This is called to deal with conflicts arising from unpacking */ | |
452 | bool pkgPackageManager::EarlyRemove(PkgIterator Pkg) | |
453 | { | |
454 | if (List->IsNow(Pkg) == false) | |
455 | return true; | |
456 | ||
457 | // Already removed it | |
458 | if (List->IsFlag(Pkg,pkgOrderList::Removed) == true) | |
459 | return true; | |
460 | ||
461 | // Woops, it will not be re-installed! | |
462 | if (List->IsFlag(Pkg,pkgOrderList::InList) == false) | |
463 | return false; | |
9d4c8f67 AL |
464 | |
465 | // Essential packages get special treatment | |
5af32db6 | 466 | bool IsEssential = false; |
9d4c8f67 | 467 | if ((Pkg->Flags & pkgCache::Flag::Essential) != 0) |
5af32db6 AL |
468 | IsEssential = true; |
469 | ||
470 | /* Check for packages that are the dependents of essential packages and | |
471 | promote them too */ | |
472 | if (Pkg->CurrentVer != 0) | |
473 | { | |
474 | for (DepIterator D = Pkg.RevDependsList(); D.end() == false && | |
475 | IsEssential == false; D++) | |
476 | if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) | |
477 | if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0) | |
478 | IsEssential = true; | |
479 | } | |
480 | ||
481 | if (IsEssential == true) | |
9d4c8f67 AL |
482 | { |
483 | if (_config->FindB("APT::Force-LoopBreak",false) == false) | |
b2e465d6 AL |
484 | return _error->Error(_("This installation run will require temporarily " |
485 | "removing the essential package %s due to a " | |
486 | "Conflicts/Pre-Depends loop. This is often bad, " | |
487 | "but if you really want to do it, activate the " | |
488 | "APT::Force-LoopBreak option."),Pkg.Name()); | |
9d4c8f67 | 489 | } |
6c139d6e AL |
490 | |
491 | bool Res = SmartRemove(Pkg); | |
492 | if (Cache[Pkg].Delete() == false) | |
493 | List->Flag(Pkg,pkgOrderList::Removed,pkgOrderList::States); | |
494 | ||
495 | return Res; | |
496 | } | |
497 | /*}}}*/ | |
498 | // PM::SmartRemove - Removal Helper /*{{{*/ | |
499 | // --------------------------------------------------------------------- | |
500 | /* */ | |
501 | bool pkgPackageManager::SmartRemove(PkgIterator Pkg) | |
502 | { | |
503 | if (List->IsNow(Pkg) == false) | |
504 | return true; | |
505 | ||
506 | List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); | |
803ea2a8 | 507 | |
28166356 | 508 | return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge); |
803ea2a8 | 509 | return true; |
6c139d6e AL |
510 | } |
511 | /*}}}*/ | |
512 | // PM::SmartUnPack - Install helper /*{{{*/ | |
513 | // --------------------------------------------------------------------- | |
590f1923 CB |
514 | /* This puts the system in a state where it can Unpack Pkg, if Pkg is allready |
515 | unpacked, or when it has been unpacked, if Immediate==true it configures it. */ | |
6c139d6e | 516 | bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) |
d77b985a DK |
517 | { |
518 | return SmartUnPack(Pkg, true); | |
519 | } | |
520 | bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate) | |
6c139d6e | 521 | { |
cfcdf7fe CB |
522 | if (Debug == true) |
523 | clog << "SmartUnPack " << Pkg.Name() << endl; | |
524 | ||
6c139d6e AL |
525 | // Check if it is already unpacked |
526 | if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure && | |
527 | Cache[Pkg].Keep() == true) | |
528 | { | |
529 | List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); | |
d77b985a DK |
530 | if (Immediate == true && |
531 | List->IsFlag(Pkg,pkgOrderList::Immediate) == true) | |
6c139d6e | 532 | if (SmartConfigure(Pkg) == false) |
634985f8 | 533 | _error->Warning(_("Could not perform immediate configuration on already unpacked '%s'. " |
f66a64c2 | 534 | "Please see man 5 apt.conf under APT::Immediate-Configure for details."),Pkg.Name()); |
6c139d6e AL |
535 | return true; |
536 | } | |
a6c8798a | 537 | |
d77b985a DK |
538 | VerIterator const instVer = Cache[Pkg].InstVerIter(Cache); |
539 | ||
590f1923 CB |
540 | /* PreUnpack Checks: This loop checks and attemps to rectify and problems that would prevent the package being unpacked. |
541 | It addresses: PreDepends, Conflicts, Obsoletes and DpkgBreaks. Any resolutions that do not require it should | |
542 | avoid configuration (calling SmartUnpack with Immediate=true), this is because any loops before Pkg is unpacked | |
543 | can cause problems. This will be either dealt with if the package is configured as a dependancy of | |
544 | Pkg (if and when Pkg is configured), or by the ConfigureAll call at the end of the for loop in OrderInstall. */ | |
d77b985a | 545 | for (DepIterator D = instVer.DependsList(); |
421c8d10 | 546 | D.end() == false; ) |
6c139d6e | 547 | { |
421c8d10 AL |
548 | // Compute a single dependency element (glob or) |
549 | pkgCache::DepIterator Start; | |
550 | pkgCache::DepIterator End; | |
551 | D.GlobOr(Start,End); | |
552 | ||
553 | while (End->Type == pkgCache::Dep::PreDepends) | |
6c139d6e | 554 | { |
9fc57a59 | 555 | if (Debug) |
f4945db3 MV |
556 | clog << "PreDepends order for " << Pkg.Name() << std::endl; |
557 | ||
6c139d6e | 558 | // Look for possible ok targets. |
b2e465d6 | 559 | SPtrArray<Version *> VList = Start.AllTargets(); |
6c139d6e AL |
560 | bool Bad = true; |
561 | for (Version **I = VList; *I != 0 && Bad == true; I++) | |
562 | { | |
563 | VerIterator Ver(Cache,*I); | |
564 | PkgIterator Pkg = Ver.ParentPkg(); | |
565 | ||
566 | // See if the current version is ok | |
567 | if (Pkg.CurrentVer() == Ver && List->IsNow(Pkg) == true && | |
568 | Pkg.State() == PkgIterator::NeedsNothing) | |
569 | { | |
570 | Bad = false; | |
9fc57a59 | 571 | if (Debug) |
f4945db3 | 572 | clog << "Found ok package " << Pkg.Name() << endl; |
6c139d6e AL |
573 | continue; |
574 | } | |
575 | } | |
576 | ||
577 | // Look for something that could be configured. | |
578 | for (Version **I = VList; *I != 0 && Bad == true; I++) | |
579 | { | |
580 | VerIterator Ver(Cache,*I); | |
581 | PkgIterator Pkg = Ver.ParentPkg(); | |
582 | ||
583 | // Not the install version | |
584 | if (Cache[Pkg].InstallVer != *I || | |
585 | (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)) | |
586 | continue; | |
17182c0c CB |
587 | |
588 | if (List->IsFlag(Pkg,pkgOrderList::Configured)) { | |
589 | Bad = false; | |
590 | continue; | |
591 | } | |
6c139d6e | 592 | |
9fc57a59 | 593 | if (Debug) |
f4945db3 | 594 | clog << "Trying to SmartConfigure " << Pkg.Name() << endl; |
6c139d6e AL |
595 | Bad = !SmartConfigure(Pkg); |
596 | } | |
1006601e | 597 | |
421c8d10 | 598 | /* If this or element did not match then continue on to the |
1006601e | 599 | next or element until a matching element is found */ |
421c8d10 | 600 | if (Bad == true) |
1006601e AL |
601 | { |
602 | // This triggers if someone make a pre-depends/depend loop. | |
421c8d10 | 603 | if (Start == End) |
1006601e AL |
604 | return _error->Error("Couldn't configure pre-depend %s for %s, " |
605 | "probably a dependency cycle.", | |
606 | End.TargetPkg().Name(),Pkg.Name()); | |
421c8d10 AL |
607 | Start++; |
608 | } | |
a6c8798a | 609 | else |
421c8d10 | 610 | break; |
6c139d6e AL |
611 | } |
612 | ||
b2e465d6 AL |
613 | if (End->Type == pkgCache::Dep::Conflicts || |
614 | End->Type == pkgCache::Dep::Obsoletes) | |
6c139d6e AL |
615 | { |
616 | /* Look for conflicts. Two packages that are both in the install | |
617 | state cannot conflict so we don't check.. */ | |
b2e465d6 | 618 | SPtrArray<Version *> VList = End.AllTargets(); |
6c139d6e AL |
619 | for (Version **I = VList; *I != 0; I++) |
620 | { | |
621 | VerIterator Ver(Cache,*I); | |
9fc57a59 CB |
622 | PkgIterator ConflictPkg = Ver.ParentPkg(); |
623 | VerIterator InstallVer(Cache,Cache[ConflictPkg].InstallVer); | |
624 | ||
e2a5ff0c | 625 | // See if the current version is conflicting |
b9f66879 | 626 | if (ConflictPkg.CurrentVer() == Ver && List->IsNow(ConflictPkg)) |
e2a5ff0c CB |
627 | { |
628 | if (Debug && false) | |
629 | cout << " " << Pkg.Name() << " conflicts with " << ConflictPkg.Name() << endl; | |
9fc57a59 CB |
630 | |
631 | if (Debug && false) { | |
632 | if (Ver==0) { | |
633 | cout << " Checking if " << Ver << " of " << ConflictPkg.Name() << " satisfies this dependancy" << endl; | |
634 | } else { | |
635 | cout << " Checking if " << Ver.VerStr() << " of " << ConflictPkg.Name() << " satisfies this dependancy" << endl; | |
636 | } | |
637 | ||
638 | if (ConflictPkg.CurrentVer()==0) { | |
639 | cout << " CurrentVer " << ConflictPkg.CurrentVer() << " IsNow " << List->IsNow(ConflictPkg) << " NeedsNothing " << (ConflictPkg.State() == PkgIterator::NeedsNothing) << endl; | |
640 | } else { | |
641 | cout << " CurrentVer " << ConflictPkg.CurrentVer().VerStr() << " IsNow " << List->IsNow(ConflictPkg) << " NeedsNothing " << (ConflictPkg.State() == PkgIterator::NeedsNothing) << endl; | |
642 | } | |
643 | ||
644 | if (InstallVer==0) { | |
645 | cout << " InstallVer " << InstallVer << endl; | |
646 | } else { | |
647 | cout << " InstallVer " << InstallVer.VerStr() << endl; | |
648 | } | |
649 | ||
e2a5ff0c | 650 | cout << " Keep " << Cache[ConflictPkg].Keep() << " Unpacked " << List->IsFlag(ConflictPkg,pkgOrderList::UnPacked) << " Configured " << List->IsFlag(ConflictPkg,pkgOrderList::Configured) << " Removed " << List->IsFlag(ConflictPkg,pkgOrderList::Removed) << " Loop " << List->IsFlag(ConflictPkg,pkgOrderList::Loop) << endl; |
9fc57a59 CB |
651 | cout << " Delete " << Cache[ConflictPkg].Delete() << endl; |
652 | } | |
6c139d6e | 653 | |
e2a5ff0c CB |
654 | if (!List->IsFlag(ConflictPkg,pkgOrderList::Loop)) { |
655 | if (Cache[ConflictPkg].Keep() == 0 && Cache[ConflictPkg].InstallVer != 0) { | |
b9f66879 CB |
656 | if (Debug) |
657 | cout << "Unpacking " << ConflictPkg.Name() << " to prevent conflict" << endl; | |
e2a5ff0c CB |
658 | List->Flag(Pkg,pkgOrderList::Loop); |
659 | SmartUnPack(ConflictPkg,false); | |
660 | } else { | |
661 | if (EarlyRemove(ConflictPkg) == false) | |
662 | return _error->Error("Internal Error, Could not early remove %s",ConflictPkg.Name()); | |
663 | } | |
664 | } else { | |
665 | if (!List->IsFlag(ConflictPkg,pkgOrderList::Removed)) { | |
b9f66879 CB |
666 | if (Debug) |
667 | cout << "Because of conficts knot, removing " << ConflictPkg.Name() << " to conflict violation" << endl; | |
e2a5ff0c CB |
668 | if (EarlyRemove(ConflictPkg) == false) |
669 | return _error->Error("Internal Error, Could not early remove %s",ConflictPkg.Name()); | |
670 | } | |
671 | } | |
6c139d6e AL |
672 | } |
673 | } | |
6c139d6e | 674 | } |
cfcdf7fe CB |
675 | |
676 | // Check for breaks | |
677 | if (End->Type == pkgCache::Dep::DpkgBreaks) { | |
678 | SPtrArray<Version *> VList = End.AllTargets(); | |
679 | for (Version **I = VList; *I != 0; I++) | |
680 | { | |
681 | VerIterator Ver(Cache,*I); | |
8b1f5756 | 682 | PkgIterator BrokenPkg = Ver.ParentPkg(); |
e2a5ff0c CB |
683 | VerIterator InstallVer(Cache,Cache[BrokenPkg].InstallVer); |
684 | ||
e2a5ff0c CB |
685 | if (Debug && false) { |
686 | if (Ver==0) { | |
687 | cout << " Checking if " << Ver << " of " << BrokenPkg.Name() << " satisfies this dependancy" << endl; | |
688 | } else { | |
689 | cout << " Checking if " << Ver.VerStr() << " of " << BrokenPkg.Name() << " satisfies this dependancy" << endl; | |
690 | } | |
691 | ||
692 | if (BrokenPkg.CurrentVer()==0) { | |
693 | cout << " CurrentVer " << BrokenPkg.CurrentVer() << " IsNow " << List->IsNow(BrokenPkg) << " NeedsNothing " << (BrokenPkg.State() == PkgIterator::NeedsNothing) << endl; | |
694 | } else { | |
695 | cout << " CurrentVer " << BrokenPkg.CurrentVer().VerStr() << " IsNow " << List->IsNow(BrokenPkg) << " NeedsNothing " << (BrokenPkg.State() == PkgIterator::NeedsNothing) << endl; | |
696 | } | |
697 | ||
698 | if (InstallVer==0) { | |
699 | cout << " InstallVer " << InstallVer << endl; | |
700 | } else { | |
701 | cout << " InstallVer " << InstallVer.VerStr() << endl; | |
702 | } | |
703 | ||
704 | cout << " Keep " << Cache[BrokenPkg].Keep() << " Unpacked " << List->IsFlag(BrokenPkg,pkgOrderList::UnPacked) << " Configured " << List->IsFlag(BrokenPkg,pkgOrderList::Configured) << " Removed " << List->IsFlag(BrokenPkg,pkgOrderList::Removed) << " Loop " << List->IsFlag(BrokenPkg,pkgOrderList::Loop) << " InList " << List->IsFlag(BrokenPkg,pkgOrderList::InList) << endl; | |
705 | cout << " Delete " << Cache[BrokenPkg].Delete() << endl; | |
706 | } | |
55c04aa4 | 707 | // Check if it needs to be unpacked |
8b1f5756 | 708 | if (List->IsFlag(BrokenPkg,pkgOrderList::InList) && Cache[BrokenPkg].Delete() == false && |
e2a5ff0c CB |
709 | !List->IsFlag(BrokenPkg,pkgOrderList::Loop) && List->IsNow(BrokenPkg)) { |
710 | List->Flag(Pkg,pkgOrderList::Loop); | |
55c04aa4 | 711 | // Found a break, so unpack the package |
a6c8798a CB |
712 | if (Debug) |
713 | cout << " Unpacking " << BrokenPkg.Name() << " to avoid break" << endl; | |
590f1923 | 714 | /* */ |
8b1f5756 | 715 | SmartUnPack(BrokenPkg, false); |
cfcdf7fe | 716 | } |
9fc57a59 | 717 | // Check if a package needs to be removed |
e2a5ff0c | 718 | if (Cache[BrokenPkg].Delete() == true && !List->IsFlag(BrokenPkg,pkgOrderList::Configured)) { |
9fc57a59 CB |
719 | if (Debug) |
720 | cout << " Removing " << BrokenPkg.Name() << " to avoid break" << endl; | |
721 | SmartRemove(BrokenPkg); | |
722 | } | |
cfcdf7fe CB |
723 | } |
724 | } | |
9fc57a59 CB |
725 | } |
726 | ||
727 | // FIXME: Crude but effective fix, allows the SmartUnPack method to be used for packages that new to the system | |
728 | if (instVer != 0) { | |
729 | //cout << "Check for reverse conflicts on " << Pkg.Name() << " " << instVer.VerStr() << endl; | |
730 | ||
731 | // Check for reverse conflicts. | |
732 | if (CheckRConflicts(Pkg,Pkg.RevDependsList(), | |
733 | instVer.VerStr()) == false) | |
734 | return false; | |
735 | ||
736 | for (PrvIterator P = instVer.ProvidesList(); | |
737 | P.end() == false; P++) | |
738 | CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion()); | |
739 | ||
740 | List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); | |
741 | ||
742 | if (instVer->MultiArch == pkgCache::Version::Same) | |
743 | for (PkgIterator P = Pkg.Group().PackageList(); | |
744 | P.end() == false; P = Pkg.Group().NextPkg(P)) | |
745 | { | |
746 | if (Pkg == P || List->IsFlag(P,pkgOrderList::UnPacked) == true || | |
747 | Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer && | |
748 | (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)) | |
749 | continue; | |
750 | SmartUnPack(P, false); | |
751 | } | |
a6c8798a | 752 | |
9fc57a59 CB |
753 | } else { |
754 | VerIterator InstallVer(Cache,Cache[Pkg].InstallVer); | |
755 | //cout << "Check for reverse conflicts on " << Pkg.Name() << " " << InstallVer.VerStr() << endl; | |
756 | ||
757 | // Check for reverse conflicts. | |
758 | if (CheckRConflicts(Pkg,Pkg.RevDependsList(), | |
759 | InstallVer.VerStr()) == false) | |
760 | return false; | |
761 | ||
762 | List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); | |
763 | } | |
764 | ||
765 | if(Install(Pkg,FileNames[Pkg->ID]) == false) | |
766 | return false; | |
767 | ||
590f1923 | 768 | if (Immediate == true && List->IsFlag(Pkg,pkgOrderList::Immediate) == true) { |
634985f8 | 769 | |
590f1923 CB |
770 | // Perform immedate configuration of the package. |
771 | if (SmartConfigure(Pkg) == false) | |
772 | _error->Warning(_("Could not perform immediate configuration on '%s'. " | |
773 | "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.Name(),2); | |
774 | } | |
6c139d6e AL |
775 | |
776 | return true; | |
777 | } | |
778 | /*}}}*/ | |
779 | // PM::OrderInstall - Installation ordering routine /*{{{*/ | |
780 | // --------------------------------------------------------------------- | |
781 | /* */ | |
281daf46 | 782 | pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() |
6c139d6e | 783 | { |
7a1b1f8b | 784 | if (CreateOrderList() == false) |
281daf46 AL |
785 | return Failed; |
786 | ||
787 | Reset(); | |
6c139d6e | 788 | |
30e1eab5 | 789 | if (Debug == true) |
5e312de7 | 790 | clog << "Beginning to order" << endl; |
6c139d6e | 791 | |
5e312de7 DK |
792 | bool const ordering = |
793 | _config->FindB("PackageManager::UnpackAll",true) ? | |
794 | List->OrderUnpack(FileNames) : List->OrderCritical(); | |
795 | if (ordering == false) | |
281daf46 AL |
796 | { |
797 | _error->Error("Internal ordering error"); | |
798 | return Failed; | |
799 | } | |
800 | ||
30e1eab5 AL |
801 | if (Debug == true) |
802 | clog << "Done ordering" << endl; | |
803 | ||
281daf46 | 804 | bool DoneSomething = false; |
6c139d6e AL |
805 | for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) |
806 | { | |
807 | PkgIterator Pkg(Cache,*I); | |
e2a5ff0c | 808 | |
281daf46 AL |
809 | if (List->IsNow(Pkg) == false) |
810 | { | |
b684d8c7 | 811 | if (!List->IsFlag(Pkg,pkgOrderList::Configured) && !NoImmConfigure) { |
634985f8 CB |
812 | if (SmartConfigure(Pkg) == false && Debug) |
813 | _error->Warning("Internal Error, Could not configure %s",Pkg.Name()); | |
814 | // FIXME: The above warning message might need changing | |
b684d8c7 | 815 | } else { |
634985f8 CB |
816 | if (Debug == true) |
817 | clog << "Skipping already done " << Pkg.Name() << endl; | |
818 | } | |
281daf46 | 819 | continue; |
634985f8 | 820 | |
281daf46 AL |
821 | } |
822 | ||
2fd65468 | 823 | if (List->IsMissing(Pkg) == true) |
281daf46 AL |
824 | { |
825 | if (Debug == true) | |
a3eaf954 | 826 | clog << "Sequence completed at " << Pkg.Name() << endl; |
281daf46 AL |
827 | if (DoneSomething == false) |
828 | { | |
829 | _error->Error("Internal Error, ordering was unable to handle the media swap"); | |
830 | return Failed; | |
831 | } | |
832 | return Incomplete; | |
833 | } | |
6c139d6e AL |
834 | |
835 | // Sanity check | |
d0c59649 AL |
836 | if (Cache[Pkg].Keep() == true && |
837 | Pkg.State() == pkgCache::PkgIterator::NeedsNothing && | |
838 | (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall) | |
281daf46 | 839 | { |
71a174ee | 840 | _error->Error("Internal Error, trying to manipulate a kept package (%s)",Pkg.Name()); |
281daf46 AL |
841 | return Failed; |
842 | } | |
6c139d6e AL |
843 | |
844 | // Perform a delete or an install | |
845 | if (Cache[Pkg].Delete() == true) | |
846 | { | |
847 | if (SmartRemove(Pkg) == false) | |
281daf46 | 848 | return Failed; |
6c139d6e AL |
849 | } |
850 | else | |
851 | if (SmartUnPack(Pkg) == false) | |
281daf46 AL |
852 | return Failed; |
853 | DoneSomething = true; | |
590f1923 CB |
854 | |
855 | if (ImmConfigureAll) { | |
856 | /* ConfigureAll here to pick up and packages left unconfigured becuase they were unpacked in the | |
857 | "PreUnpack Checks" section */ | |
858 | ConfigureAll(); | |
859 | } | |
6c139d6e | 860 | } |
5e312de7 | 861 | |
6c139d6e AL |
862 | // Final run through the configure phase |
863 | if (ConfigureAll() == false) | |
281daf46 | 864 | return Failed; |
6c139d6e AL |
865 | |
866 | // Sanity check | |
867 | for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) | |
281daf46 | 868 | { |
6c139d6e | 869 | if (List->IsFlag(*I,pkgOrderList::Configured) == false) |
281daf46 AL |
870 | { |
871 | _error->Error("Internal error, packages left unconfigured. %s", | |
872 | PkgIterator(Cache,*I).Name()); | |
873 | return Failed; | |
874 | } | |
9fc57a59 | 875 | } |
281daf46 AL |
876 | |
877 | return Completed; | |
6c139d6e AL |
878 | } |
879 | /*}}}*/ | |
1d6386f3 MV |
880 | // PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/ |
881 | // --------------------------------------------------------------------- | |
882 | pkgPackageManager::OrderResult | |
883 | pkgPackageManager::DoInstallPostFork(int statusFd) | |
884 | { | |
885 | if(statusFd > 0) | |
886 | // FIXME: use SetCloseExec here once it taught about throwing | |
887 | // exceptions instead of doing _exit(100) on failure | |
888 | fcntl(statusFd,F_SETFD,FD_CLOEXEC); | |
889 | bool goResult = Go(statusFd); | |
890 | if(goResult == false) | |
891 | return Failed; | |
892 | ||
1d6386f3 MV |
893 | return Res; |
894 | }; | |
895 | ||
2a7e07c7 MV |
896 | // PM::DoInstall - Does the installation /*{{{*/ |
897 | // --------------------------------------------------------------------- | |
898 | /* This uses the filenames in FileNames and the information in the | |
899 | DepCache to perform the installation of packages.*/ | |
900 | pkgPackageManager::OrderResult pkgPackageManager::DoInstall(int statusFd) | |
901 | { | |
902 | if(DoInstallPreFork() == Failed) | |
903 | return Failed; | |
904 | ||
7230ad48 | 905 | return DoInstallPostFork(statusFd); |
2a7e07c7 | 906 | } |
eef71338 | 907 | /*}}}*/ |