-// GroupedFromCommandLine - Return all versions specified on commandline/*{{{*/
-std::map<unsigned short, PackageSet> PackageSet::GroupedFromCommandLine(
- pkgCacheFile &Cache, const char **cmdline,
- std::list<PackageSet::Modifier> const &mods,
- unsigned short const &fallback, CacheSetHelper &helper) {
- std::map<unsigned short, PackageSet> pkgsets;
- for (const char **I = cmdline; *I != 0; ++I) {
- unsigned short modID = fallback;
- std::string str = *I;
- bool modifierPresent = false;
- for (std::list<PackageSet::Modifier>::const_iterator mod = mods.begin();
- mod != mods.end(); ++mod) {
- size_t const alength = strlen(mod->Alias);
- switch(mod->Pos) {
- case PackageSet::Modifier::POSTFIX:
- if (str.compare(str.length() - alength, alength,
- mod->Alias, 0, alength) != 0)
- continue;
- str.erase(str.length() - alength);
- modID = mod->ID;
- break;
- case PackageSet::Modifier::PREFIX:
- continue;
- case PackageSet::Modifier::NONE:
- continue;
- }
- modifierPresent = true;
- break;
- }
- if (modifierPresent == true) {
- bool const errors = helper.showErrors(false);
- pkgCache::PkgIterator Pkg = FromName(Cache, *I, helper);
- helper.showErrors(errors);
- if (Pkg.end() == false) {
- pkgsets[fallback].insert(Pkg);
- continue;
- }
- }
- pkgsets[modID].insert(PackageSet::FromString(Cache, str, helper));
- }
- return pkgsets;
-}
- /*}}}*/
-// FromCommandLine - Return all packages specified on commandline /*{{{*/
-PackageSet PackageSet::FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
- PackageSet pkgset;
- for (const char **I = cmdline; *I != 0; ++I) {
- PackageSet pset = FromString(Cache, *I, helper);
- pkgset.insert(pset.begin(), pset.end());
- }
- return pkgset;
-}
- /*}}}*/