]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
Merge branch 'debian/sid' into debian/experimental
[apt.git] / cmdline / apt-get.cc
index 4b7691d934f3792dbf02db7a28f94841d2223272..06daca09bc87220aee30b951185512a98bb9ded3 100644 (file)
@@ -1874,6 +1874,9 @@ bool DoAutomaticRemove(CacheFile &Cache)
    packages */
 bool DoUpgrade(CommandLine &CmdL)
 {
+   if (CmdL.FileSize() != 1)
+      return _error->Error(_("The upgrade command takes no arguments"));
+
    CacheFile Cache;
    if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
       return false;
@@ -2206,6 +2209,9 @@ bool DoMarkAuto(CommandLine &CmdL)
 /* Intelligent upgrader that will install and remove packages at will */
 bool DoDistUpgrade(CommandLine &CmdL)
 {
+   if (CmdL.FileSize() != 1)
+      return _error->Error(_("The dist-upgrade command takes no arguments"));
+
    CacheFile Cache;
    if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
       return false;
@@ -2585,15 +2591,12 @@ bool DoSource(CommandLine &CmdL)
         if(queued.find(Last->Index().ArchiveURI(I->Path)) != queued.end())
            continue;
         queued.insert(Last->Index().ArchiveURI(I->Path));
-           
+
         // check if we have a file with that md5 sum already localy
-        if(!I->MD5Hash.empty() && FileExists(flNotDir(I->Path)))  
+        if(!I->Hash.empty() && FileExists(flNotDir(I->Path)))  
         {
-           FileFd Fd(flNotDir(I->Path), FileFd::ReadOnly);
-           MD5Summation sum;
-           sum.AddFD(Fd.Fd(), Fd.Size());
-           Fd.Close();
-           if((string)sum.Result() == I->MD5Hash) 
+            HashString hash_string = HashString(I->Hash);
+            if(hash_string.VerifyFile(flNotDir(I->Path)))
            {
               ioprintf(c1out,_("Skipping already downloaded file '%s'\n"),
                        flNotDir(I->Path).c_str());
@@ -2602,7 +2605,7 @@ bool DoSource(CommandLine &CmdL)
         }
 
         new pkgAcqFile(&Fetcher,Last->Index().ArchiveURI(I->Path),
-                       I->MD5Hash,I->Size,
+                       I->Hash,I->Size,
                        Last->Index().SourceInfo(*Last,*I),Src);
       }
    }