diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-shell.cc apt-0.5.15cnc6/cmdline/apt-shell.cc --- apt-0.5.15cnc6-orig/cmdline/apt-shell.cc 2005-05-15 20:35:30 +0400 +++ apt-0.5.15cnc6/cmdline/apt-shell.cc 2005-05-15 20:37:58 +0400 @@ -3500,11 +3500,14 @@ bool ShowVersion = _config->FindB("APT::Cache::ShowVersion", false); bool ShowSummary = _config->FindB("APT::Cache::ShowSummary", false); + const char *MatchSection = _config->Find("APT::Cache::MatchGroup","").c_str(); + bool ShowGroup = _config->FindB("APT::Cache::ShowGroup", false); const char *PkgName; + const char *PkgSection; int Matches[Cache->Head().PackageCount]; int NumMatches = 0; - int Len, NameMaxLen = 0, VerMaxLen = 0; + int Len = 0, NameMaxLen = 0, VerMaxLen = 0; bool Matched; for (unsigned int J = 0; J < Cache->Head().PackageCount; J++) { @@ -3517,7 +3520,12 @@ if (ShowUpgradable && (Pkg->CurrentVer == 0 || Cache[Pkg].Upgradable() == false)) continue; + PkgSection = Pkg.Section(); + if (strlen(MatchSection) > 0 && strcmp(MatchSection,PkgSection) != 0) + continue; + PkgName = Pkg.Name(); + if (MatchAll == true) Matched = true; else for (int i=0; i != NumPatterns; i++) { @@ -3622,6 +3630,7 @@ Blank[ColumnLen] = 0; const char *Str; + const char *PkgSection; int StrLen; unsigned int K; for (unsigned int Line = 0; Line != NumLines; Line++) { @@ -3631,13 +3640,33 @@ break; pkgCache::PkgIterator Pkg(Cache,Cache.List[Matches[K]]); Str = Pkg.Name(); + PkgSection = Pkg.Section(); StrLen = strlen(Str); - if (Len < ColumnLen-1) - c2out << Str << Blank+StrLen; - else - c2out << Str << " "; + string status = "available"; + if (Pkg->CurrentVer != 0) status = "installed"; + if (Pkg->CurrentVer != 0) + for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false; D++) + { + pkgCache::PkgIterator P = D.ParentPkg(); + if ((P->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential && + (P->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important) + continue; + status = "locked"; + } + if (Pkg->CurrentVer != 0 && Cache[Pkg].Upgradable() == true) status = "upgradable"; + if (Cache[Pkg].NewInstall()) status = "be-installed"; + if (Cache[Pkg].Delete()) status = "be-removed"; + if (Cache[Pkg].Upgrade() == true && Cache[Pkg].NewInstall() != true) status = "be-upgraded"; + if (ShowGroup) + c2out << PkgSection << "\t" << Str << endl; + else + { + c2out << Str; + if (strlen(MatchSection) > 0) + cout << "\t" << status; + cout << endl; + } } - c2out << endl; } } @@ -4313,6 +4342,8 @@ {'i',"installed","APT::Cache::ShowInstalled",0}, {'v',"version","APT::Cache::ShowVersion",0}, {'s',"summary","APT::Cache::ShowSummary",0}, + {'g',"showgroup","APT::Cache::ShowGroup",0}, + {'G',"groupmember","APT::Cache::MatchGroup",CommandLine::HasArg}, {'n',"installed","APT::Cache::Installed",0}, {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, diff -uNr apt-0.5.15cnc6-orig/cmdline/apt-shell.cc.orig apt-0.5.15cnc6/cmdline/apt-shell.cc.orig