]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/indexcopy.cc
fix 'Source' to 'Package' rename in apt-ftparchive
[apt.git] / apt-pkg / indexcopy.cc
index 854ba1bd7d871f272f581358281398d504faa544..144c508bef3b7fe8d4bacc255cf417876ccd2d4b 100644 (file)
@@ -216,6 +216,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
         FinalF += URItoFileName(S);
         if (rename(TargetF.c_str(),FinalF.c_str()) != 0)
            return _error->Errno("rename","Failed to rename");
+        ChangeOwnerAndPermissionOfFile("CopyPackages", FinalF.c_str(), "root", "root", 0644);
       }
         
       /* Mangle the source to be in the proper notation with
@@ -516,7 +517,7 @@ bool SigVerify::Verify(string prefix, string file, indexRecords *MetaIndex)
       return false;
    }
 
-   if (!Record->Hash.VerifyFile(prefix+file))
+   if (!Record->Hashes.VerifyFile(prefix+file))
    {
       _error->Warning(_("Hash mismatch for: %s"),file.c_str());
       return false;
@@ -524,8 +525,10 @@ bool SigVerify::Verify(string prefix, string file, indexRecords *MetaIndex)
 
    if(Debug == true)
    {
-      cout << "File: " << prefix+file << endl;
-      cout << "Expected Hash " << Record->Hash.toStr() << endl;
+      cout << "File: " << prefix+file << endl
+        << "Expected Hash " << endl;
+      for (HashStringList::const_iterator hs = Record->Hashes.begin(); hs != Record->Hashes.end(); ++hs)
+        std::cout <<  "\t- " << hs->toStr() << std::endl;
    }
 
    return true;
@@ -544,8 +547,9 @@ bool SigVerify::CopyMetaIndex(string CDROM, string CDName,          /*{{{*/
       FileFd Rel;
       Target.Open(TargetF,FileFd::WriteAtomic);
       Rel.Open(prefix + file,FileFd::ReadOnly);
-      if (CopyFile(Rel,Target) == false)
+      if (CopyFile(Rel,Target) == false || Target.Close() == false)
         return _error->Error("Copying of '%s' for '%s' from '%s' failed", file.c_str(), CDName.c_str(), prefix.c_str());
+      ChangeOwnerAndPermissionOfFile("CopyPackages", TargetF.c_str(), "root", "root", 0644);
 
       return true;
 }
@@ -758,6 +762,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,   /*{{{*/
         FinalF += URItoFileName(S);
         if (rename(TargetF.c_str(),FinalF.c_str()) != 0)
            return _error->Errno("rename","Failed to rename");
+        ChangeOwnerAndPermissionOfFile("CopyTranslations", FinalF.c_str(), "root", "root", 0644);
       }
       
       
@@ -791,3 +796,5 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,   /*{{{*/
    return true;
 }
                                                                        /*}}}*/
+
+APT_CONST IndexCopy::~IndexCopy() {}