summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmdline/apt-cache.cc84
1 files changed, 28 insertions, 56 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index de4288c5a..7cb95b3f8 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -787,38 +787,24 @@ bool XVcg(CommandLine &CmdL)
ShapeMap[Pkg->ID] = 3;
}
}
-
+
// Load the list of packages from the command line into the show list
- for (const char **I = CmdL.FileList + 1; *I != 0; I++)
+ std::list<APT::PackageSet::Modifier> mods;
+ mods.push_back(APT::PackageSet::Modifier(0, ",", APT::PackageSet::Modifier::POSTFIX));
+ mods.push_back(APT::PackageSet::Modifier(1, "^", APT::PackageSet::Modifier::POSTFIX));
+ std::map<unsigned short, APT::PackageSet> pkgsets =
+ APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0);
+
+ for (APT::PackageSet::const_iterator Pkg = pkgsets[0].begin();
+ Pkg != pkgsets[0].end(); ++Pkg)
+ Show[Pkg->ID] = ToShow;
+ for (APT::PackageSet::const_iterator Pkg = pkgsets[1].begin();
+ Pkg != pkgsets[1].end(); ++Pkg)
{
- // Process per-package flags
- string P = *I;
- bool Force = false;
- if (P.length() > 3)
- {
- if (P.end()[-1] == '^')
- {
- Force = true;
- P.erase(P.end()-1);
- }
-
- if (P.end()[-1] == ',')
- P.erase(P.end()-1);
- }
-
- // Locate the package
- pkgCache::PkgIterator Pkg = Cache->FindPkg(P);
- if (Pkg.end() == true)
- {
- _error->Warning(_("Unable to locate package %s"),*I);
- continue;
- }
Show[Pkg->ID] = ToShow;
-
- if (Force == true)
- Flags[Pkg->ID] |= ForceNR;
+ Flags[Pkg->ID] |= ForceNR;
}
-
+
// Little header
cout << "graph: { title: \"packages\"" << endl <<
"xmax: 700 ymax: 700 x: 30 y: 30" << endl <<
@@ -1015,38 +1001,24 @@ bool Dotty(CommandLine &CmdL)
ShapeMap[Pkg->ID] = 3;
}
}
-
+
// Load the list of packages from the command line into the show list
- for (const char **I = CmdL.FileList + 1; *I != 0; I++)
+ std::list<APT::PackageSet::Modifier> mods;
+ mods.push_back(APT::PackageSet::Modifier(0, ",", APT::PackageSet::Modifier::POSTFIX));
+ mods.push_back(APT::PackageSet::Modifier(1, "^", APT::PackageSet::Modifier::POSTFIX));
+ std::map<unsigned short, APT::PackageSet> pkgsets =
+ APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0);
+
+ for (APT::PackageSet::const_iterator Pkg = pkgsets[0].begin();
+ Pkg != pkgsets[0].end(); ++Pkg)
+ Show[Pkg->ID] = ToShow;
+ for (APT::PackageSet::const_iterator Pkg = pkgsets[1].begin();
+ Pkg != pkgsets[1].end(); ++Pkg)
{
- // Process per-package flags
- string P = *I;
- bool Force = false;
- if (P.length() > 3)
- {
- if (P.end()[-1] == '^')
- {
- Force = true;
- P.erase(P.end()-1);
- }
-
- if (P.end()[-1] == ',')
- P.erase(P.end()-1);
- }
-
- // Locate the package
- pkgCache::PkgIterator Pkg = Cache->FindPkg(P);
- if (Pkg.end() == true)
- {
- _error->Warning(_("Unable to locate package %s"),*I);
- continue;
- }
Show[Pkg->ID] = ToShow;
-
- if (Force == true)
- Flags[Pkg->ID] |= ForceNR;
+ Flags[Pkg->ID] |= ForceNR;
}
-
+
// Little header
printf("digraph packages {\n");
printf("concentrate=true;\n");