]>
git.saurik.com Git - apt.git/blob - apt-pkg/deb/dpkgpm.h
07c99aeadd45f1193ae97f80cf80c3db4a70f27a
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: dpkgpm.h,v 1.8 2001/05/07 05:05:13 jgg Exp $
4 /* ######################################################################
6 DPKG Package Manager - Provide an interface to dpkg
8 ##################################################################### */
10 #ifndef PKGLIB_DPKGPM_H
11 #define PKGLIB_DPKGPM_H
13 #include <apt-pkg/packagemanager.h>
14 #include <apt-pkg/pkgcache.h>
15 #include <apt-pkg/macros.h>
22 #ifndef APT_10_CLEANER_HEADERS
23 #include <apt-pkg/init.h>
27 namespace APT
{ namespace Progress
{ class PackageManager
; } }
29 #ifndef APT_8_CLEANER_HEADERS
34 class pkgDPkgPMPrivate
;
37 class pkgDPkgPM
: public pkgPackageManager
40 pkgDPkgPMPrivate
* const d
;
42 /** \brief record the disappear action and handle accordingly
44 dpkg let packages disappear then they have no files any longer and
45 nothing depends on them. We need to collect this as dpkg as well as
46 APT doesn't know beforehand that the package will disappear, so the
47 only possible option is to tell the user afterwards about it.
48 To enhance the experience we also try to forward the auto-install
49 flag so the disappear-causer(s) are not autoremoved next time -
50 for the transfer to happen the disappeared version needs to depend
51 on the package the flag should be forwarded to and this package
52 needs to declare a Replaces on the disappeared package.
53 \param pkgname Name of the package that disappeared
55 APT_HIDDEN
void handleDisappearAction(std::string
const &pkgname
);
63 const char *state
; // the dpkg state (e.g. "unpack")
64 const char *str
; // the human readable translation of the state
67 // the dpkg states that the pkg will run through, the string is
68 // the package, the vector contains the dpkg states that the package
70 std::map
<std::string
,std::vector
<struct DpkgState
> > PackageOps
;
71 // the dpkg states that are already done; the string is the package
72 // the int is the state that is already done (e.g. a package that is
73 // going to be install is already in state "half-installed")
74 std::map
<std::string
,unsigned int> PackageOpsDone
;
77 unsigned int PackagesDone
;
78 unsigned int PackagesTotal
;
82 enum Ops
{Install
, Configure
, Remove
, Purge
, ConfigurePending
, TriggersPending
,
83 RemovePending
, PurgePending
} Op
;
86 Item(Ops Op
,PkgIterator Pkg
,std::string File
= "") : Op(Op
),
87 File(File
), Pkg(Pkg
) {};
91 std::vector
<Item
> List
;
94 bool RunScriptsWithPkgs(const char *Cnf
);
95 APT_DEPRECATED_MSG("Use SendPkgInfo with the version as parameter instead") bool SendV2Pkgs(FILE *F
);
96 bool SendPkgsInfo(FILE * const F
, unsigned int const &Version
);
97 void WriteHistoryTag(std::string
const &tag
, std::string value
);
98 std::string
ExpandShortPackageName(pkgDepCache
&Cache
,
99 const std::string
&short_pkgname
);
102 void SendTerminalProgress(float percentage
);
104 // apport integration
105 void WriteApportReport(const char *pkgpath
, const char *errormsg
);
112 void BuildPackagesProgressMap();
113 void StartPtyMagic();
114 void SetupSlavePtyMagic();
118 void DoStdin(int master
);
119 void DoTerminalPty(int master
);
120 void DoDpkgStatusFd(int statusfd
);
121 void ProcessDpkgStatusLine(char *line
);
123 // The Actual installation implementation
124 virtual bool Install(PkgIterator Pkg
,std::string File
) APT_OVERRIDE
;
125 virtual bool Configure(PkgIterator Pkg
) APT_OVERRIDE
;
126 virtual bool Remove(PkgIterator Pkg
,bool Purge
= false) APT_OVERRIDE
;
128 virtual bool Go(APT::Progress::PackageManager
*progress
) APT_OVERRIDE
;
129 virtual bool Go(int StatusFd
=-1) APT_OVERRIDE
;
131 virtual void Reset() APT_OVERRIDE
;
135 pkgDPkgPM(pkgDepCache
*Cache
);
136 virtual ~pkgDPkgPM();
139 void SigINT(int sig
);