From 5e457a9336967e4851e094a84f9f94f4141ee393 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 5 Jun 2007 16:14:08 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - apport integration added, this means that a apport report is written on dpkg failures --- apt-pkg/deb/dpkgpm.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apt-pkg/deb/dpkgpm.h') diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 0b181dc43..1a1fdc191 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -23,6 +23,7 @@ using std::vector; class pkgDPkgPM : public pkgPackageManager { protected: + int pkgFailures; // used for progress reporting struct DpkgState @@ -48,6 +49,9 @@ class pkgDPkgPM : public pkgPackageManager bool RunScriptsWithPkgs(const char *Cnf); bool SendV2Pkgs(FILE *F); + // apport integration + void WriteApportReport(const char *pkgpath, const char *errormsg); + // The Actuall installation implementation virtual bool Install(PkgIterator Pkg,string File); virtual bool Configure(PkgIterator Pkg); -- cgit v1.2.3-70-g09d2 From 8ecd1fedeace0e22f96259e250094006c673d065 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 3 Aug 2007 18:43:46 +0200 Subject: - when writting apport reports, attach the dpkg terminal log too --- apt-pkg/deb/dpkgpm.cc | 29 +++++++++++++++++++++++++---- apt-pkg/deb/dpkgpm.h | 5 +++-- debian/changelog | 2 ++ 3 files changed, 30 insertions(+), 6 deletions(-) (limited to 'apt-pkg/deb/dpkgpm.h') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 08c95b7a4..6cb444ef1 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -44,7 +44,8 @@ using namespace std; // --------------------------------------------------------------------- /* */ pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) - : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesTotal(0), PackagesDone(0) + : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesTotal(0), + PackagesDone(0), term_out(NULL) { } /*}}}*/ @@ -351,7 +352,7 @@ void pkgDPkgPM::DoStdin(int master) /* * read the terminal pty and write log */ -void pkgDPkgPM::DoTerminalPty(int master, FILE *term_out) +void pkgDPkgPM::DoTerminalPty(int master) { char term_buf[1024] = {0,}; @@ -569,7 +570,6 @@ bool pkgDPkgPM::Go(int OutStatusFd) return _error->Error(_("Directory '%s' missing"), logdir.c_str()); string logfile_name = flCombine(logdir, _config->Find("Dir::Log::Terminal")); - FILE *term_out = NULL; if (!logfile_name.empty()) { term_out = fopen(logfile_name.c_str(),"a"); @@ -812,7 +812,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) continue; if(FD_ISSET(master, &rfds)) - DoTerminalPty(master, term_out); + DoTerminalPty(master); if(FD_ISSET(0, &rfds)) DoStdin(master); if(FD_ISSET(_dpkgin, &rfds)) @@ -956,6 +956,27 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) fprintf(report, "Package: %s %s\n", pkgname.c_str(), pkgver.c_str()); fprintf(report, "SourcePackage: %s\n", srcpkgname.c_str()); fprintf(report, "ErrorMessage:\n %s\n", errormsg); + + // ensure that the log is flushed + if(term_out) + fflush(term_out); + + // attach terminal log it if we have it + string logfile_name = _config->FindFile("Dir::Log::Terminal"); + if (!logfile_name.empty()) + { + FILE *log = NULL; + char buf[1024]; + + fprintf(report, "DpkgTerminalLog:\n"); + log = fopen(logfile_name.c_str(),"r"); + if(log != NULL) + { + while( fgets(buf, sizeof(buf), log) != NULL) + fprintf(report, " %s", buf); + fclose(log); + } + } fclose(report); } /*}}}*/ diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index f8e9e44a8..222add98f 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -26,7 +26,8 @@ class pkgDPkgPM : public pkgPackageManager // the buffer we use for the dpkg status-fd reading char dpkgbuf[1024]; int dpkgbuf_pos; - + FILE *term_out; + protected: int pkgFailures; @@ -71,7 +72,7 @@ class pkgDPkgPM : public pkgPackageManager // input processing void DoStdin(int master); - void DoTerminalPty(int master, FILE *out); + void DoTerminalPty(int master); void DoDpkgStatusFd(int statusfd, int OutStatusFd); void ProcessDpkgStatusLine(int OutStatusFd, char *line); diff --git a/debian/changelog b/debian/changelog index a2dafbaea..1e9511875 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,8 @@ apt (0.7.6ubuntu1) gutsy; urgency=low - merged dpkg-log branch, this lets you specify a Dir::Log::Terminal file to log dpkg output to (ABI break) + - when writting apport reports, attach the dpkg + terminal log too * merged apt--sha256 branch to fully support the new sha256 checksums in the Packages and Release files (ABI break) -- cgit v1.2.3-70-g09d2 From 5d053270a275d1c825c793151f50bf3b680f55ec Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 5 Sep 2007 15:10:55 +0200 Subject: * apt-pkg/deb/dpkgpm.{cc,h}: - fix bug in dpkg log writing when a signal is caught during select() (LP: #134858) - write end marker in the log as well --- apt-pkg/deb/dpkgpm.cc | 78 ++++++++++++++++++++++++++++++++++----------------- apt-pkg/deb/dpkgpm.h | 4 +++ debian/changelog | 9 ++++++ 3 files changed, 65 insertions(+), 26 deletions(-) (limited to 'apt-pkg/deb/dpkgpm.h') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index c386e4b24..90ae413f4 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -498,6 +498,46 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd) } /*}}}*/ +bool pkgDPkgPM::OpenLog() +{ + string logdir = _config->FindDir("Dir::Log"); + if(not FileExists(logdir)) + return _error->Error(_("Directory '%s' missing"), logdir.c_str()); + string logfile_name = flCombine(logdir, + _config->Find("Dir::Log::Terminal")); + if (!logfile_name.empty()) + { + term_out = fopen(logfile_name.c_str(),"a"); + chmod(logfile_name.c_str(), 0600); + // output current time + char outstr[200]; + time_t t = time(NULL); + struct tm *tmp = localtime(&t); + strftime(outstr, sizeof(outstr), "%F %T", tmp); + fprintf(term_out, "\nLog started: "); + fprintf(term_out, outstr); + fprintf(term_out, "\n"); + } + return true; +} + +bool pkgDPkgPM::CloseLog() +{ + if(term_out) + { + char outstr[200]; + time_t t = time(NULL); + struct tm *tmp = localtime(&t); + strftime(outstr, sizeof(outstr), "%F %T", tmp); + fprintf(term_out, "Log ended: "); + fprintf(term_out, outstr); + fprintf(term_out, "\n"); + fclose(term_out); + } + term_out = NULL; + return true; +} + // DPkgPM::Go - Run the sequence /*{{{*/ // --------------------------------------------------------------------- @@ -571,24 +611,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) } // create log - string logdir = _config->FindDir("Dir::Log"); - if(not FileExists(logdir)) - return _error->Error(_("Directory '%s' missing"), logdir.c_str()); - string logfile_name = flCombine(logdir, - _config->Find("Dir::Log::Terminal")); - if (!logfile_name.empty()) - { - term_out = fopen(logfile_name.c_str(),"a"); - chmod(logfile_name.c_str(), 0600); - // output current time - char outstr[200]; - time_t t = time(NULL); - struct tm *tmp = localtime(&t); - strftime(outstr, sizeof(outstr), "%F %T", tmp); - fprintf(term_out, "\nLog started: "); - fprintf(term_out, outstr); - fprintf(term_out, "\n"); - } + OpenLog(); // this loop is runs once per operation for (vector::iterator I = List.begin(); I != List.end();) @@ -818,10 +841,15 @@ bool pkgDPkgPM::Go(int OutStatusFd) tv.tv_sec = 1; tv.tv_usec = 0; select_ret = select(max(master, _dpkgin)+1, &rfds, NULL, NULL, &tv); - if (select_ret < 0) - std::cerr << "Error in select()" << std::endl; - else if (select_ret == 0) - continue; + if (select_ret == 0) + continue; + else if (select_ret < 0 && errno == EINTR) + continue; + else if (select_ret < 0) + { + perror("select() returned error"); + continue; + } if(master >= 0 && FD_ISSET(master, &rfds)) DoTerminalPty(master); @@ -859,14 +887,12 @@ bool pkgDPkgPM::Go(int OutStatusFd) if(stopOnError) { - if(term_out) - fclose(term_out); + CloseLog(); return false; } } } - if(term_out) - fclose(term_out); + CloseLog(); if (RunScripts("DPkg::Post-Invoke") == false) return false; diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index debde36a3..e5f197405 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -70,6 +70,10 @@ class pkgDPkgPM : public pkgPackageManager // apport integration void WriteApportReport(const char *pkgpath, const char *errormsg); + // dpkg log + bool OpenLog(); + bool CloseLog(); + // input processing void DoStdin(int master); void DoTerminalPty(int master); diff --git a/debian/changelog b/debian/changelog index 304588fab..b0f414126 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +apt (0.7.6ubuntu8) gutsy; urgency=low + + * apt-pkg/deb/dpkgpm.{cc,h}: + - fix bug in dpkg log writing when a signal is caught during + select() (LP: #134858) + - write end marker in the log as well + + -- Michael Vogt Wed, 05 Sep 2007 15:03:46 +0200 + apt (0.7.6ubuntu7) gutsy; urgency=low * reupload to fix FTBFS -- cgit v1.2.3-70-g09d2 From a29b2c0b9c4e7b1c36433c9c6dd5d24697f9c4b6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 26 Jan 2010 11:57:29 +0100 Subject: Change history branch so that it does not break the apt ABI for the pkgPackageManager interface (can be reverted on the next ABI break) --- apt-pkg/deb/dpkgpm.cc | 34 +++++++++++++++++++++++----------- apt-pkg/deb/dpkgpm.h | 4 +--- apt-pkg/packagemanager.h | 6 +++++- debian/changelog | 8 ++++++++ 4 files changed, 37 insertions(+), 15 deletions(-) (limited to 'apt-pkg/deb/dpkgpm.h') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 2f84a5a87..e928776af 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -562,7 +562,7 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd) } /*}}}*/ // DPkgPM::WriteHistoryTag /*{{{*/ -void pkgDPkgPM::WriteHistoryTag(string tag, string value) +void pkgDPkgPM::WriteHistoryTag(FILE *history_out, string tag, string value) { if (value.size() > 0) { @@ -602,7 +602,7 @@ bool pkgDPkgPM::OpenLog() _config->Find("Dir::Log::History")); if (!history_name.empty()) { - history_out = fopen(history_name.c_str(),"a"); + FILE *history_out = fopen(history_name.c_str(),"a"); chmod(history_name.c_str(), 0644); fprintf(history_out, "\nStart-Date: %s\n", timestr); string remove, purge, install, upgrade, downgrade; @@ -622,12 +622,12 @@ bool pkgDPkgPM::OpenLog() remove += I.Name() + string(" (") + Cache[I].CurVersion + string("), "); } } - WriteHistoryTag("Install", install); - WriteHistoryTag("Upgrade", upgrade); - WriteHistoryTag("Downgrade",downgrade); - WriteHistoryTag("Remove",remove); - WriteHistoryTag("Purge",purge); - fflush(history_out); + WriteHistoryTag(history_out, "Install", install); + WriteHistoryTag(history_out, "Upgrade", upgrade); + WriteHistoryTag(history_out, "Downgrade",downgrade); + WriteHistoryTag(history_out, "Remove",remove); + WriteHistoryTag(history_out, "Purge",purge); + fclose(history_out); } return true; @@ -650,10 +650,11 @@ bool pkgDPkgPM::CloseLog() } term_out = NULL; - if(history_out) + string history_name = flCombine(_config->FindDir("Dir::Log"), + _config->Find("Dir::Log::History")); + if (!history_name.empty()) { - if (dpkg_error.size() > 0) - fprintf(history_out, "Error: %s\n", dpkg_error.c_str()); + FILE *history_out = fopen(history_name.c_str(),"a"); fprintf(history_out, "End-Date: %s\n", timestr); fclose(history_out); } @@ -1125,6 +1126,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) if(stopOnError) RunScripts("DPkg::Post-Invoke"); + string dpkg_error; if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV) strprintf(dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]); else if (WIFEXITED(Status) != 0) @@ -1133,7 +1135,17 @@ bool pkgDPkgPM::Go(int OutStatusFd) strprintf(dpkg_error, "Sub-process %s exited unexpectedly",Args[0]); if(dpkg_error.size() > 0) + { _error->Error(dpkg_error.c_str()); + string history_name = flCombine(_config->FindDir("Dir::Log"), + _config->Find("Dir::Log::History")); + if (!history_name.empty()) + { + FILE *history_out = fopen(history_name.c_str(),"a"); + fprintf(history_out, "Error: %s\n", dpkg_error.c_str()); + fclose(history_out); + } + } if(stopOnError) { diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index ce3e20f2e..160486bf9 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -29,8 +29,6 @@ class pkgDPkgPM : public pkgPackageManager char dpkgbuf[1024]; int dpkgbuf_pos; FILE *term_out; - FILE *history_out; - string dpkg_error; protected: int pkgFailures; @@ -70,7 +68,7 @@ class pkgDPkgPM : public pkgPackageManager // Helpers bool RunScriptsWithPkgs(const char *Cnf); bool SendV2Pkgs(FILE *F); - void WriteHistoryTag(string tag, string value); + void WriteHistoryTag(FILE* history_out, string tag, string value); // apport integration void WriteApportReport(const char *pkgpath, const char *errormsg); diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index af1476b7a..44f5d5ef7 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -49,7 +49,11 @@ class pkgPackageManager : protected pkgCache::Namespace bool Debug; bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0); - void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0); + // binary-compat change, fix on next abi break + void ImmediateAdd(PkgIterator P, bool UseInstallVer) { + ImmediateAdd(P, UseInstallVer, 0); + } + void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth); virtual OrderResult OrderInstall(); bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver); bool CreateOrderList(); diff --git a/debian/changelog b/debian/changelog index e6afafe99..9615201b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.7.25ubuntu2) lucid; urgency=low + + * Change history branch so that it does not break the + apt ABI for the pkgPackageManager interface + (can be reverted on the next ABI break) + + -- Michael Vogt Wed, 23 Dec 2009 10:14:16 +0100 + apt (0.7.25ubuntu1) lucid; urgency=low * Merged from the mvo branch -- cgit v1.2.3-70-g09d2 From 6cb1060b58d8add6e04cc30241d3ef0f45ad226d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 May 2010 15:17:52 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - write Disappeared also to the history.log --- apt-pkg/deb/dpkgpm.cc | 33 ++++++++++++++++++++++++--------- apt-pkg/deb/dpkgpm.h | 2 +- debian/changelog | 8 ++++++++ 3 files changed, 33 insertions(+), 10 deletions(-) (limited to 'apt-pkg/deb/dpkgpm.h') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 8318fe37f..35b10975f 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -568,15 +568,15 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd) } /*}}}*/ // DPkgPM::WriteHistoryTag /*{{{*/ -void pkgDPkgPM::WriteHistoryTag(string tag, string value) +void pkgDPkgPM::WriteHistoryTag(string const &tag, string value) { - if (value.size() > 0) - { - // poor mans rstrip(", ") - if (value[value.size()-2] == ',' && value[value.size()-1] == ' ') - value.erase(value.size() - 2, 2); - fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str()); - } + size_t const length = value.length(); + if (length == 0) + return; + // poor mans rstrip(", ") + if (value[length-2] == ',' && value[length-1] == ' ') + value.erase(length - 2, 2); + fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str()); } /*}}}*/ // DPkgPM::OpenLog /*{{{*/ bool pkgDPkgPM::OpenLog() @@ -663,7 +663,22 @@ bool pkgDPkgPM::CloseLog() if(history_out) { - if (dpkg_error.size() > 0) + if (disappearedPkgs.empty() == false) + { + string disappear; + for (std::set::const_iterator d = disappearedPkgs.begin(); + d != disappearedPkgs.end(); ++d) + { + pkgCache::PkgIterator P = Cache.FindPkg(*d); + disappear.append(*d); + if (P.end() == true) + disappear.append(", "); + else + disappear.append(" (").append(Cache[P].CurVersion).append("), "); + } + WriteHistoryTag("Disappeared", disappear); + } + if (dpkg_error.empty() == false) fprintf(history_out, "Error: %s\n", dpkg_error.c_str()); fprintf(history_out, "End-Date: %s\n", timestr); fclose(history_out); diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 330c788a2..b1459b1f6 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -68,7 +68,7 @@ class pkgDPkgPM : public pkgPackageManager // Helpers bool RunScriptsWithPkgs(const char *Cnf); bool SendV2Pkgs(FILE *F); - void WriteHistoryTag(string tag, string value); + void WriteHistoryTag(string const &tag, string value); // dpkg log bool OpenLog(); diff --git a/debian/changelog b/debian/changelog index 3771ca415..ee571a537 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.7.26~exp6) UNRELEASED; urgency=low + + [ David Kalnischkies ] + * apt-pkg/deb/dpkgpm.cc: + - write Disappeared also to the history.log + + -- David Kalnischkies Thu, 27 May 2010 15:12:02 +0200 + apt (0.7.26~exp5) experimental; urgency=low [ David Kalnischkies ] -- cgit v1.2.3-70-g09d2 From eb6f9bac96a2b1938df598f4fd7c68d22c68a230 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 May 2010 18:13:52 +0200 Subject: forward manual-installed bit on package disappearance --- apt-pkg/deb/dpkgpm.cc | 47 ++++++++++++++++++++++++++++++++++++++++++++++- apt-pkg/deb/dpkgpm.h | 15 +++++++++++++++ debian/changelog | 3 ++- 3 files changed, 63 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb/dpkgpm.h') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 35b10975f..0ac6ac168 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -470,7 +470,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) std::clog << "send: '" << status.str() << "'" << endl; if (strncmp(action, "disappear", strlen("disappear")) == 0) - disappearedPkgs.insert(string(pkg_or_trigger)); + handleDisappearAction(pkg_or_trigger); return; } @@ -530,6 +530,51 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) << " action: " << action << endl; } /*}}}*/ +// DPkgPM::handleDisappearAction /*{{{*/ +void pkgDPkgPM::handleDisappearAction(string const &pkgname) +{ + // record the package name for display and stuff later + disappearedPkgs.insert(pkgname); + + pkgCache::PkgIterator Pkg = Cache.FindPkg(pkgname); + if (unlikely(Pkg.end() == true)) + return; + // the disappeared package was auto-installed - nothing to do + if ((Cache[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto) + return; + pkgCache::VerIterator PkgVer = Pkg.CurrentVer(); + if (unlikely(PkgVer.end() == true)) + return; + /* search in the list of dependencies for (Pre)Depends, + check if this dependency has a Replaces on our package + and if so transfer the manual installed flag to it */ + for (pkgCache::DepIterator Dep = PkgVer.DependsList(); Dep.end() != true; ++Dep) + { + if (Dep->Type != pkgCache::Dep::Depends && + Dep->Type != pkgCache::Dep::PreDepends) + continue; + pkgCache::PkgIterator Tar = Dep.TargetPkg(); + if (unlikely(Tar.end() == true)) + continue; + // the package is already marked as manual + if ((Cache[Tar].Flags & pkgCache::Flag::Auto) != pkgCache::Flag::Auto) + continue; + pkgCache::VerIterator TarVer = Tar.CurrentVer(); + for (pkgCache::DepIterator Rep = TarVer.DependsList(); Rep.end() != true; ++Rep) + { + if (Rep->Type != pkgCache::Dep::Replaces) + continue; + if (Pkg != Rep.TargetPkg()) + continue; + // okay, they are strongly connected - transfer manual-bit + if (Debug == true) + std::clog << "transfer manual-bit from disappeared »" << pkgname << "« to »" << Tar.FullName() << "«" << std::endl; + Cache[Tar].Flags &= ~Flag::Auto; + break; + } + } +} + /*}}}*/ // DPkgPM::DoDpkgStatusFd /*{{{*/ // --------------------------------------------------------------------- /* diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index b1459b1f6..9a4478f7c 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -32,6 +32,21 @@ class pkgDPkgPM : public pkgPackageManager FILE *history_out; string dpkg_error; + /** \brief record the disappear action and handle accordingly + + dpkg let packages disappear then they have no files any longer and + nothing depends on them. We need to collect this as dpkg as well as + APT doesn't know beforehand that the package will disappear, so the + only possible option is to tell the user afterwards about it. + To enhance the experience we also try to forward the auto-install + flag so the disappear-causer(s) are not autoremoved next time - + for the transfer to happen the disappeared version needs to depend + on the package the flag should be forwarded to and this package + needs to declare a Replaces on the disappeared package. + \param pkgname Name of the package that disappeared + */ + void handleDisappearAction(string const &pkgname); + protected: // progress reporting diff --git a/debian/changelog b/debian/changelog index ee571a537..9fa04058d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ apt (0.7.26~exp6) UNRELEASED; urgency=low [ David Kalnischkies ] * apt-pkg/deb/dpkgpm.cc: - write Disappeared also to the history.log + - forward manual-installed bit on package disappearance - -- David Kalnischkies Thu, 27 May 2010 15:12:02 +0200 + -- David Kalnischkies Thu, 27 May 2010 17:34:51 +0200 apt (0.7.26~exp5) experimental; urgency=low -- cgit v1.2.3-70-g09d2