From 6191b008773fc4f0476d4c8f485d146dab13cccd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 19 Jul 2007 00:22:42 +0100 Subject: apt-pkg/deb/dpkgpm.{cc,h}: - move make dpkgstatus processing into DoDpkgStatusFd() and ProcessDpkgStatusLine() [the later is a stub for now] --- apt-pkg/deb/dpkgpm.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb/dpkgpm.h') diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index a1466878d..f47cd0bd8 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -18,6 +18,10 @@ using std::vector; class pkgDPkgPM : public pkgPackageManager { + private: + int dpkgbuf_pos; + char dpkgbuf[1024]; + protected: // used for progress reporting @@ -47,7 +51,9 @@ class pkgDPkgPM : public pkgPackageManager // input processing void DoStdin(int master); void DoTerminalPty(int master, FILE *out); - // void DoDpkgStatusFd(); + void DoDpkgStatusFd(int statusfd); + void ProcessDpkgStatusLine(char *line); + // The Actuall installation implementation virtual bool Install(PkgIterator Pkg,string File); -- cgit v1.2.3 From 09fa2df2f4717ac956210d43e3f3465d6ef5b82b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 19 Jul 2007 00:56:22 +0100 Subject: apt-pkg/deb/dpkgpm.{cc,h}: - move output processing ProcessDpkgStatusLine() and out of the Go() method (yeah!) - things start to look more tidy now --- apt-pkg/deb/dpkgpm.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'apt-pkg/deb/dpkgpm.h') diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index f47cd0bd8..c7792aba4 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -12,25 +12,42 @@ #include #include +#include #include using std::vector; +using std::map; + class pkgDPkgPM : public pkgPackageManager { private: - int dpkgbuf_pos; - char dpkgbuf[1024]; - protected: + // the buffer we use for the dpkg status-fd reading + char dpkgbuf[1024]; + int dpkgbuf_pos; - // used for progress reporting + // progress reporting struct DpkgState { const char *state; // the dpkg state (e.g. "unpack") const char *str; // the human readable translation of the state }; - + + // the dpkg states that the pkg will run through, the string is + // the package, the vector contains the dpkg states that the package + // will go through + map > PackageOps; + // the dpkg states that are already done; the string is the package + // the int is the state that is already done (e.g. a package that is + // going to be install is already in state "half-installed") + map PackageOpsDone; + // progress reporting + int Done; + int Total; + + protected: + struct Item { enum Ops {Install, Configure, Remove, Purge} Op; @@ -51,8 +68,8 @@ class pkgDPkgPM : public pkgPackageManager // input processing void DoStdin(int master); void DoTerminalPty(int master, FILE *out); - void DoDpkgStatusFd(int statusfd); - void ProcessDpkgStatusLine(char *line); + void DoDpkgStatusFd(int statusfd, int OutStatusFd); + void ProcessDpkgStatusLine(int OutStatusFd, char *line); // The Actuall installation implementation -- cgit v1.2.3 From ff56e98015b17c73a3f1aacf3deef5ec4ef4e21b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 19 Jul 2007 10:37:05 +0100 Subject: apt-pkg/deb/dpkgpm.{cc,h} - a bit cleanup - move the log date to the right place - write log to dir::log::name apt-pkg/init.cc: - init dir::log::name "/var/log/apt/term.log" debian/apt.dirs: - create /var/log/apt/ doc/examples/configure-index: - add new dir::log::name to the index --- apt-pkg/deb/dpkgpm.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'apt-pkg/deb/dpkgpm.h') diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index c7792aba4..c552b20c9 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -27,6 +27,8 @@ class pkgDPkgPM : public pkgPackageManager char dpkgbuf[1024]; int dpkgbuf_pos; + protected: + // progress reporting struct DpkgState { @@ -43,10 +45,8 @@ class pkgDPkgPM : public pkgPackageManager // going to be install is already in state "half-installed") map PackageOpsDone; // progress reporting - int Done; - int Total; - - protected: + int PackagesDone; + int PackagesTotal; struct Item { @@ -71,7 +71,6 @@ class pkgDPkgPM : public pkgPackageManager void DoDpkgStatusFd(int statusfd, int OutStatusFd); void ProcessDpkgStatusLine(int OutStatusFd, char *line); - // The Actuall installation implementation virtual bool Install(PkgIterator Pkg,string File); virtual bool Configure(PkgIterator Pkg); -- cgit v1.2.3