Join with aliencode
[ntk/apt.git] / apt-pkg / packagemanager.h
CommitLineData
6c139d6e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
b2e465d6 3// $Id: packagemanager.h,v 1.11 2001/02/20 07:03:17 jgg Exp $
6c139d6e
AL
4/* ######################################################################
5
6 Package Manager - Abstacts the package manager
7
8 Three steps are
9 - Aquiration of archives (stores the list of final file names)
10 - Sorting of operations
6fc33863 11 - Invokation of package manager
6c139d6e
AL
12
13 This is the final stage when the package cache entities get converted
14 into file names and the state stored in a DepCache is transformed
15 into a series of operations.
16
17 In the final scheme of things this may serve as a director class to
18 access the actual install methods based on the file type being
19 installed.
20
21 ##################################################################### */
22 /*}}}*/
6c139d6e
AL
23#ifndef PKGLIB_PACKAGEMANAGER_H
24#define PKGLIB_PACKAGEMANAGER_H
25
26#ifdef __GNUG__
094a497d 27#pragma interface "apt-pkg/packagemanager.h"
6c139d6e
AL
28#endif
29
30#include <string>
094a497d 31#include <apt-pkg/pkgcache.h>
6c139d6e 32
03e39e59 33class pkgAcquire;
6c139d6e
AL
34class pkgDepCache;
35class pkgSourceList;
36class pkgOrderList;
03e39e59 37class pkgRecords;
b2e465d6 38class pkgPackageManager : protected pkgCache::Namespace
6c139d6e 39{
281daf46
AL
40 public:
41
42 enum OrderResult {Completed,Failed,Incomplete};
43
6c139d6e
AL
44 protected:
45 string *FileNames;
46 pkgDepCache &Cache;
47 pkgOrderList *List;
30e1eab5 48 bool Debug;
b2e465d6 49
6c139d6e 50 bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
281daf46 51 OrderResult OrderInstall();
6c139d6e 52 bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
7a1b1f8b 53 bool CreateOrderList();
6c139d6e
AL
54
55 // Analysis helpers
56 bool DepAlwaysTrue(DepIterator D);
57
58 // Install helpers
59 bool ConfigureAll();
60 bool SmartConfigure(PkgIterator Pkg);
61 bool SmartUnPack(PkgIterator Pkg);
62 bool SmartRemove(PkgIterator Pkg);
63 bool EarlyRemove(PkgIterator Pkg);
64
b2e465d6
AL
65 // The Actual installation implementation
66 virtual bool Install(PkgIterator Pkg,string File) {return false;};
67 virtual bool Configure(PkgIterator Pkg) {return false;};
68 virtual bool Remove(PkgIterator Pkg,bool Purge=false) {return false;};
03e39e59 69 virtual bool Go() {return true;};
281daf46 70 virtual void Reset() {};
6c139d6e
AL
71
72 public:
281daf46 73
b50b2c97 74 // Main action members
03e39e59
AL
75 bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
76 pkgRecords *Recs);
281daf46 77 OrderResult DoInstall();
6c139d6e
AL
78 bool FixMissing();
79
b2e465d6 80 pkgPackageManager(pkgDepCache *Cache);
6c139d6e
AL
81 virtual ~pkgPackageManager();
82};
83
84#endif