summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc58
1 files changed, 16 insertions, 42 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index eaf04eee7..0ada46c73 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -40,7 +40,8 @@
#include <apt-pkg/sptr.h>
#include <apt-pkg/md5.h>
#include <apt-pkg/versionmatch.h>
-
+#include <apt-pkg/cacheset.h>
+
#include <config.h>
#include <apti18n.h>
@@ -90,14 +91,14 @@ class CacheFile : public pkgCacheFile
bool BuildCaches(bool WithLock = true)
{
OpTextProgress Prog(*_config);
- if (pkgCacheFile::BuildCaches(Prog,WithLock) == false)
+ if (pkgCacheFile::BuildCaches(&Prog,WithLock) == false)
return false;
return true;
}
bool Open(bool WithLock = true)
{
OpTextProgress Prog(*_config);
- if (pkgCacheFile::Open(Prog,WithLock) == false)
+ if (pkgCacheFile::Open(&Prog,WithLock) == false)
return false;
Sort();
@@ -837,9 +838,9 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
return false;
// Display statistics
- double FetchBytes = Fetcher.FetchNeeded();
- double FetchPBytes = Fetcher.PartialPresent();
- double DebBytes = Fetcher.TotalNeeded();
+ unsigned long long FetchBytes = Fetcher.FetchNeeded();
+ unsigned long long FetchPBytes = Fetcher.PartialPresent();
+ unsigned long long DebBytes = Fetcher.TotalNeeded();
if (DebBytes != Cache->DebSize())
{
c0out << DebBytes << ',' << Cache->DebSize() << endl;
@@ -1780,51 +1781,24 @@ bool DoInstall(CommandLine &CmdL)
Packages++;
if (Pkg.end() == true)
{
- // Check if the name is a regex
- const char *I;
- for (I = S; *I != 0; I++)
- if (*I == '?' || *I == '*' || *I == '|' ||
- *I == '[' || *I == '^' || *I == '$')
- break;
- if (*I == 0)
+ APT::PackageSet pkgset = APT::PackageSet::FromRegEx(Cache, S, c1out);
+ if (pkgset.empty() == true)
return _error->Error(_("Couldn't find package %s"),S);
// Regexs must always be confirmed
ExpectedInst += 1000;
-
- // Compile the regex pattern
- regex_t Pattern;
- int Res;
- if ((Res = regcomp(&Pattern,S,REG_EXTENDED | REG_ICASE |
- REG_NOSUB)) != 0)
- {
- char Error[300];
- regerror(Res,&Pattern,Error,sizeof(Error));
- return _error->Error(_("Regex compilation error - %s"),Error);
- }
-
- // Run over the matches
+
bool Hit = false;
- for (pkgCache::GrpIterator Grp = Cache->GrpBegin(); Grp.end() == false; ++Grp)
+ for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
{
- if (regexec(&Pattern,Grp.Name(),0,0,0) != 0)
- continue;
- Pkg = Grp.FindPkg("native");
- if (unlikely(Pkg.end() == true))
- continue;
-
- ioprintf(c1out,_("Note, selecting %s for regex '%s'\n"),
- Pkg.Name(),S);
-
if (VerTag != 0)
if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false)
return false;
-
+
Hit |= TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,
ExpectedInst,false);
}
- regfree(&Pattern);
-
+
if (Hit == false)
return _error->Error(_("Couldn't find package %s"),S);
}
@@ -2389,9 +2363,9 @@ bool DoSource(CommandLine &CmdL)
}
// Display statistics
- double FetchBytes = Fetcher.FetchNeeded();
- double FetchPBytes = Fetcher.PartialPresent();
- double DebBytes = Fetcher.TotalNeeded();
+ unsigned long long FetchBytes = Fetcher.FetchNeeded();
+ unsigned long long FetchPBytes = Fetcher.PartialPresent();
+ unsigned long long DebBytes = Fetcher.TotalNeeded();
// Check for enough free space
struct statvfs Buf;