- nuke bunch of old ununsed code
authorpmatilai <pmatilai>
Sat, 27 May 2006 11:14:32 +0000 (11:14 +0000)
committerpmatilai <pmatilai>
Sat, 27 May 2006 11:14:32 +0000 (11:14 +0000)
apt-pkg/rpm/rpmlistparser.cc
apt-pkg/rpm/rpmlistparser.h
apt-pkg/rpm/rpmsystem.cc
apt-pkg/rpm/rpmsystem.h

index 75bc353..cf65184 100644 (file)
@@ -189,10 +189,6 @@ bool rpmListParser::NewVersion(pkgCache::VerIterator Ver)
        return false;
    if (ParseDepends(Ver,pkgCache::Dep::Obsoletes) == false)
        return false;
-#ifdef OLD_FILEDEPS
-   if (ProcessFileProvides(Ver) == false)
-       return false;
-#endif
 
    if (ParseProvides(Ver) == false)
        return false;
@@ -318,27 +314,6 @@ bool rpmListParser::ParseDepends(pkgCache::VerIterator Ver,
 
 }
                                                                         /*}}}*/
-#ifdef OLD_FILEDEPS
-bool rpmListParser::ProcessFileProvides(pkgCache::VerIterator Ver)
-{
-   const char **names = NULL;    
-   int count = 0;
-
-   rpmHeaderGetEntry(header, RPMTAG_OLDFILENAMES, NULL, &names, &count);
-
-   while (count--) 
-   {
-      if (rpmSys.IsFileDep(string(names[count]))) 
-      {
-        if (!NewProvides(Ver, string(names[count]), string()))
-            return false;
-      }
-   }
-
-   return true;
-}
-#endif
-
 bool rpmListParser::CollectFileProvides(pkgCache &Cache,
                                        pkgCache::VerIterator Ver)
 {
@@ -411,21 +386,9 @@ bool rpmListParser::Step()
       if (RpmData->IgnorePackage(RealName) == true)
         continue;
  
-#if OLD_BESTARCH
-      bool archOk = false;
-      string tmp = rpmSys.BestArchForPackage(RealName);
-      if (tmp.empty() == true && // has packages for a single arch only
-         rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch.c_str()) > 0)
-        archOk = true;
-      else if (arch == tmp)
-        archOk = true;
-      if (Handler->IsDatabase() == true || archOk == true)
-        return true;
-#else
       if (Handler->IsDatabase() == true ||
          RpmData->ArchScore(Architecture().c_str()) > 0)
         return true;
-#endif
    }
    return false;
 }
index 57673fc..100700a 100644 (file)
@@ -53,10 +53,6 @@ class rpmListParser : public pkgCacheGenerator::ListParser
    bool ParseDepends(pkgCache::VerIterator Ver, unsigned int Type);
    bool ParseProvides(pkgCache::VerIterator Ver);
    
-#ifdef OLD_FILEDEPS
-   bool ProcessFileProvides(pkgCache::VerIterator Ver);
-#endif
-   
  public:
    
    // These all operate against the current header
index 2561f8a..71ad252 100644 (file)
@@ -299,168 +299,6 @@ bool rpmSystem::AddSourceFiles(vector<pkgIndexFile *> &List)
    return true;
 }
                                                                        /*}}}*/
-#ifdef OLD_FILEDEPS
-static void gatherFileDependencies(map<string,int> &filedeps, Header header)
-{
-   int type, count;
-   char **namel;
-   //char **verl;
-   //int *flagl;
-   int res;
-   
-   res = headerGetEntry(header, RPMTAG_REQUIRENAME, &type,
-                       (void **)&namel, &count);
-   /*
-   res = headerGetEntry(header, RPMTAG_REQUIREVERSION, &type, 
-                       (void **)&verl, &count);
-   res = headerGetEntry(header, RPMTAG_REQUIREFLAGS, &type,
-                       (void **)&flagl, &count);
-   */
-   
-   while (count--) 
-   {
-      if (*namel[count] == '/')
-        filedeps[string(namel[count])] = 1;
-   }
-}
-#endif
-
-
-#ifdef OLD_BESTARCH
-bool rpmSystem::processIndexFile(rpmIndexFile *Index,OpProgress &Progress)
-{
-   Header hdr;
-   map<string,string> archmap;
-   
-   RPMHandler *Handler = Index->CreateHandler();
-   if (_error->PendingError() == true)
-      return false;
-
-   Progress.SubProgress(0, Index->Describe());
-   
-   Handler->Rewind();
-
-   while (Handler->Skip() == true)
-   {
-      int type, count, res;
-      char *arch;
-
-      hdr = Handler->GetHeader();
-      if (!hdr)
-         break;
-
-#ifdef OLD_FILEDEPS
-      gatherFileDependencies(FileDeps, hdr);
-#endif
-      
-      /*
-       * Make it so that for each version, we keep track of the best
-       * architecture.
-       */
-      res = headerGetEntry(hdr, RPMTAG_ARCH, &type,
-                          (void **)&arch, &count);
-      assert(type == RPM_STRING_TYPE);
-      if (res) 
-      {
-        char *name;
-        char *version;
-        char *release;
-        int_32 *epoch;
-        int res;
-        char buf[256];
-        
-        headerGetEntry(hdr, RPMTAG_NAME, &type,
-                       (void **)&name, &count);
-        headerGetEntry(hdr, RPMTAG_VERSION, &type,
-                       (void **)&version, &count);
-        headerGetEntry(hdr, RPMTAG_RELEASE, &type,
-                       (void **)&release, &count);
-        res = headerGetEntry(hdr, RPMTAG_EPOCH, &type,
-                             (void **)&epoch, &count);
-        
-        if (res == 1)
-           snprintf(buf, sizeof(buf), "%i:%s-%s", *epoch, version, release);
-        else
-           snprintf(buf, sizeof(buf), "%s-%s", version, release);
-        string n = string(name)+"#"+string(buf);
-        
-        if (archmap.find(n) != archmap.end()) 
-        {
-           if (strcmp(archmap[n].c_str(), arch) != 0) 
-           {
-              int a = rpmMachineScore(RPM_MACHTABLE_INSTARCH, archmap[n].c_str());
-              int b = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
-              
-              if (b < a) 
-              {
-                 MultiArchPkgs[n] = string(arch);
-                 // this is a multiarch pkg
-                 archmap[n] = MultiArchPkgs[n];
-              }
-              else 
-              {
-                 MultiArchPkgs[n] = archmap[n];
-              }
-           }
-        }
-        else 
-        {
-           archmap[n] = string(arch);
-        }
-      }
-   }
-   
-   if (Handler->IsDatabase() == false)
-       delete Handler;
-
-   return true;
-}
-
-
-bool rpmSystem::PreProcess(pkgIndexFile **Start,pkgIndexFile **End,
-                          OpProgress &Progress)
-{
-   string ListDir = _config->FindDir("Dir::State::lists");
-   unsigned total, complete;
-   unsigned long TotalSize = 0, CurrentSize = 0;
-
-   // calculate size of files
-   
-   for (; Start != End; Start++)
-   {
-      if ((*Start)->HasPackages() == false)
-         continue;
-      
-      if ((*Start)->Exists() == false)
-         continue;
-      
-      unsigned long Size = (*Start)->Size();
-      Progress.OverallProgress(CurrentSize,TotalSize,Size,_("Reading Package Lists"));
-      CurrentSize += Size;
-
-      if (processIndexFile((rpmIndexFile*)*Start,Progress) == false)
-        return false;
-   }
-  
-   return true;
-}
-
-string rpmSystem::BestArchForPackage(string Pkg)
-{
-   if (MultiArchPkgs.find(Pkg) != MultiArchPkgs.end())
-      return MultiArchPkgs[Pkg];
-   else
-       return string();
-}
-#endif
-
-#ifdef OLD_FILEDEPS
-bool rpmSystem::IsFileDep(string File)
-{
-   return (FileDeps.find(File) != FileDeps.end());
-}
-#endif
-
 // System::FindIndex - Get an index file for status files              /*{{{*/
 // ---------------------------------------------------------------------
 /* */
index 28bff2d..50cb680 100644 (file)
@@ -31,25 +31,10 @@ class rpmSystem : public pkgSystem
    RPMDBHandler *RpmDB;
    rpmDatabaseIndex *StatusFile;
    
-#ifdef OLD_FILEDEPS
-   map<string,int> FileDeps; // file dependencies
-#endif
-#ifdef OLD_BESTARCH
-   map<string,string> MultiArchPkgs; // packages with multi-archs
-#endif
-
    bool processIndexFile(rpmIndexFile *Handler,OpProgress &Progress);
    
    public:
 
-#ifdef OLD_FILEDEPS
-   bool IsFileDep(string File);
-#endif
-#ifdef OLD_BESTARCH
-   string BestArchForPackage(string Pkg);
-   virtual bool PreProcess(pkgIndexFile **Start,pkgIndexFile **End,
-                          OpProgress &Progress);
-#endif
    RPMDBHandler *GetDBHandler();
    
    virtual bool LockRead();