]>
git.saurik.com Git - apt.git/blob - apt-pkg/deb/dpkgpm.h
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>
17 #include <apt-pkg/macros.h>
18 #include <apt-pkg/init.h>
20 #ifndef APT_8_CLEANER_HEADERS
25 class pkgDPkgPMPrivate
;
28 class pkgDPkgPM
: public pkgPackageManager
33 /** \brief record the disappear action and handle accordingly
35 dpkg let packages disappear then they have no files any longer and
36 nothing depends on them. We need to collect this as dpkg as well as
37 APT doesn't know beforehand that the package will disappear, so the
38 only possible option is to tell the user afterwards about it.
39 To enhance the experience we also try to forward the auto-install
40 flag so the disappear-causer(s) are not autoremoved next time -
41 for the transfer to happen the disappeared version needs to depend
42 on the package the flag should be forwarded to and this package
43 needs to declare a Replaces on the disappeared package.
44 \param pkgname Name of the package that disappeared
46 void handleDisappearAction(std::string
const &pkgname
);
54 const char *state
; // the dpkg state (e.g. "unpack")
55 const char *str
; // the human readable translation of the state
58 // the dpkg states that the pkg will run through, the string is
59 // the package, the vector contains the dpkg states that the package
61 std::map
<std::string
,std::vector
<struct DpkgState
> > PackageOps
;
62 // the dpkg states that are already done; the string is the package
63 // the int is the state that is already done (e.g. a package that is
64 // going to be install is already in state "half-installed")
65 std::map
<std::string
,unsigned int> PackageOpsDone
;
68 unsigned int PackagesDone
;
69 unsigned int PackagesTotal
;
73 enum Ops
{Install
, Configure
, Remove
, Purge
, ConfigurePending
, TriggersPending
} Op
;
76 Item(Ops Op
,PkgIterator Pkg
,std::string File
= "") : Op(Op
),
77 File(File
), Pkg(Pkg
) {};
81 std::vector
<Item
> List
;
84 bool RunScriptsWithPkgs(const char *Cnf
);
85 __deprecated
bool SendV2Pkgs(FILE *F
);
86 bool SendPkgsInfo(FILE * const F
, unsigned int const &Version
);
87 void WriteHistoryTag(std::string
const &tag
, std::string value
);
88 std::string
ExpandShortPackageName(pkgDepCache
&Cache
,
89 const std::string
&short_pkgname
);
92 void SetupTerminalScrollArea(int nr_scrolled_rows
);
93 void SendTerminalProgress(float percentage
);
96 void WriteApportReport(const char *pkgpath
, const char *errormsg
);
103 void BuildPackagesProgressMap();
104 void StartPtyMagic();
108 void DoStdin(int master
);
109 void DoTerminalPty(int master
);
110 void DoDpkgStatusFd(int statusfd
);
111 void ProcessDpkgStatusLine(char *line
);
112 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
113 void DoDpkgStatusFd(int statusfd
, int unused
) {
114 DoDpkgStatusFd(statusfd
);
116 void ProcessDpkgStatusLine(int unused
, char *line
) {
117 ProcessDpkgStatusLine(line
);
122 // The Actuall installation implementation
123 virtual bool Install(PkgIterator Pkg
,std::string File
);
124 virtual bool Configure(PkgIterator Pkg
);
125 virtual bool Remove(PkgIterator Pkg
,bool Purge
= false);
127 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
128 virtual bool Go(APT::Progress::PackageManager
*progress
);
130 virtual bool Go(int StatusFd
=-1);
131 bool GoNoABIBreak(APT::Progress::PackageManager
*progress
);
134 virtual void Reset();
138 pkgDPkgPM(pkgDepCache
*Cache
);
139 virtual ~pkgDPkgPM();
142 void SigINT(int sig
);