summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/dpkgpm.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-10-15 15:39:59 +0200
committerMichael Vogt <mvo@debian.org>2013-10-15 15:39:59 +0200
commitfd6417a6026401f95af82608e12b4a9d105b090f (patch)
treefdef6618349f693cfb503257c05f40d480618e87 /apt-pkg/deb/dpkgpm.cc
parent3921580c0b7ab67abb6eb5374af94d8951c525fe (diff)
fix logic for finding what package dpkg means in the --status-fd and only send out short packagenames
Diffstat (limited to 'apt-pkg/deb/dpkgpm.cc')
-rw-r--r--apt-pkg/deb/dpkgpm.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index b4d812d26..61d8eec02 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -557,11 +557,26 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
std::string pkgname = list[1];
if (pkgname.find(":") == std::string::npos)
{
- string const nativeArch = _config->Find("APT::Architecture");
- pkgname = pkgname + ":" + nativeArch;
+ // find the package in the group that is in a touched by dpkg
+ // if there are multiple dpkg will send us a full pkgname:arch
+ pkgCache::GrpIterator Grp = Cache.FindGrp(pkgname);
+ if (Grp.end() == false)
+ {
+ pkgCache::PkgIterator P = Grp.PackageList();
+ for (; P.end() != true; P = Grp.NextPkg(P))
+ {
+ if(Cache[P].Mode != pkgDepCache::ModeKeep)
+ {
+ pkgname = P.FullName();
+ break;
+ }
+ }
+ }
}
const char* const pkg = pkgname.c_str();
const char* action = list[2].c_str();
+
+ std::string short_pkgname = StringSplit(pkgname, ":")[0];
// 'processing' from dpkg looks like
// 'processing: action: pkg'
@@ -640,7 +655,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
PackageOpsDone[pkg]++;
PackagesDone++;
// build the status str
- status << "pmstatus:" << pkg
+ status << "pmstatus:" << short_pkgname
<< ":" << (PackagesDone/float(PackagesTotal)*100.0)
<< ":" << s
<< endl;
@@ -653,7 +668,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
std::clog << "send: '" << status.str() << "'" << endl;
}
if (Debug == true)
- std::clog << "(parsed from dpkg) pkg: " << pkg
+ std::clog << "(parsed from dpkg) pkg: " << short_pkgname
<< " action: " << action << endl;
}
/*}}}*/