+
+std::string pkgDPkgPM::ExpandShortPackageName(pkgDepCache &Cache,
+ const std::string &short_pkgname)
+{
+ if (short_pkgname.find(":") != string::npos)
+ return short_pkgname;
+
+ std::string pkgname = short_pkgname;
+ // 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].Install() || Cache[P].ReInstall() ||
+ Cache[P].Upgrade() || Cache[P].Downgrade() ||
+ Cache[P].Delete() || Cache[P].Purge())
+ {
+ pkgname = P.FullName();
+ return pkgname;
+ }
+ }
+ }
+ return pkgname;
+}
+