X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/dfa11ecc05d342af77f86120c123a3ea618544b6..36afd8495a5646ccdec0153c93945a5a27606fce:/apt-pkg/deb/dpkgpm.cc?ds=sidebyside diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 79a8c312b..93dff390d 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -375,8 +375,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) }, // Purge operation { - {"config-files", _("Preparing for remove with config %s")}, - {"not-installed", _("Removed with config %s")}, + {"config-files", _("Preparing to completely remove %s")}, + {"not-installed", _("Completely removed %s")}, {NULL, NULL} }, }; @@ -474,6 +474,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) case Item::Install: Args[n++] = "--unpack"; Size += strlen(Args[n-1]); + Args[n++] = "--auto-deconfigure"; + Size += strlen(Args[n-1]); break; } @@ -612,20 +614,55 @@ bool pkgDPkgPM::Go(int OutStatusFd) if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true) std::clog << "got from dpkg '" << line << "'" << std::endl; - // pass "error" and "conffile-prompt" messages from dpkg verbatim - if((strncmp(line,"error",strlen("error")) == 0) || - (strncmp(line,"conffile-prompt",strlen("conffile-prompt")) == 0)) - { - write(OutStatusFd, line, strlen(line)); - line[0]=0; - continue; - } - // line contains the dpkg status info now. it has the form: - // 'status: : ' (see dpkg(1) for details) + // the status we output + ostringstream status; + + /* dpkg sends strings like this: + 'status: : ' + errors look like this: + 'status: /var/cache/apt/archives/krecipes_0.8.1-0ubuntu1_i386.deb : error : trying to overwrite `/usr/share/doc/kde/HTML/en/krecipes/krectip.png', which is also in package krecipes-data + and conffile-prompt like this + 'status: conffile-prompt: conffile : 'current-conffile' 'new-conffile' useredited distedited + + */ char* list[5]; - TokSplitString(':', line, list, 5); + if(!TokSplitString(':', line, list, sizeof(list)/sizeof(list[0]))) + // FIXME: dpkg sends multiline error messages sometimes (see + // #374195 for a example. we should support this by + // either patching dpkg to not send multiline over the + // statusfd or by rewriting the code here to deal with + // it. for now we just ignore it and not crash + continue; char *pkg = list[1]; - char *action = list[2]; + char *action = _strstrip(list[2]); + + if(strncmp(action,"error",strlen("error")) == 0) + { + status << "pmerror:" << list[1] + << ":" << (Done/float(Total)*100.0) + << ":" << list[3] + << endl; + if(OutStatusFd > 0) + write(OutStatusFd, status.str().c_str(), status.str().size()); + line[0]=0; + if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true) + std::clog << "send: '" << status.str() << "'" << endl; + continue; + } + if(strncmp(action,"conffile",strlen("conffile")) == 0) + { + status << "pmconffile:" << list[1] + << ":" << (Done/float(Total)*100.0) + << ":" << list[3] + << endl; + if(OutStatusFd > 0) + write(OutStatusFd, status.str().c_str(), status.str().size()); + line[0]=0; + if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true) + std::clog << "send: '" << status.str() << "'" << endl; + continue; + } + vector &states = PackageOps[pkg]; const char *next_action = NULL; if(PackageOpsDone[pkg] < states.size()) @@ -642,7 +679,6 @@ bool pkgDPkgPM::Go(int OutStatusFd) // we moved from one dpkg state to a new one, report that PackageOpsDone[pkg]++; Done++; - ostringstream status; // build the status str status << "pmstatus:" << pkg << ":" << (Done/float(Total)*100.0) @@ -651,11 +687,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) if(OutStatusFd > 0) write(OutStatusFd, status.str().c_str(), status.str().size()); if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true) - { - std::clog << "send to fd: '" << status.str() - << "'" << std::endl; - - } + std::clog << "send: '" << status.str() << "'" << endl; } if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)