Print this page
3166 feed generation needs performance improvement
3306 feed returns invalid last-modified header

Split Close
Expand all
Collapse all
          --- old/src/modules/server/catalog.py
          +++ new/src/modules/server/catalog.py
↓ open down ↓ 22 lines elided ↑ open up ↑
  23   23  # Use is subject to license terms.
  24   24  
  25   25  import subprocess
  26   26  import threading
  27   27  import signal
  28   28  import os
  29   29  import sys
  30   30  import cherrypy
  31   31  
  32   32  import pkg.catalog as catalog
       33 +import pkg.fmri as fmri
  33   34  import pkg.indexer as indexer
  34   35  import pkg.server.query_engine as query_e
  35   36  
  36   37  from pkg.misc import SERVER_DEFAULT_MEM_USE_KB
  37   38  from pkg.misc import emsg
  38   39  
  39   40  class ServerCatalog(catalog.Catalog):
  40   41          """The catalog information which is only needed by the server."""
  41   42  
  42   43          def __init__(self, cat_root, authority = None, pkg_root = None,
↓ open down ↓ 210 lines elided ↑ open up ↑
 253  254  
 254  255          def search(self, token):
 255  256                  """Search through the search database for 'token'.  Return a
 256  257                  list of token type / fmri pairs."""
 257  258                  assert self.index_root
 258  259                  if not self.query_engine:
 259  260                          self.query_engine = \
 260  261                              query_e.ServerQueryEngine(self.index_root)
 261  262                  query = query_e.Query(token, case_sensitive=False)
 262  263                  return self.query_engine.search(query)
      264 +
      265 +        @staticmethod
      266 +        def read_catalog(catalog, dir, auth=None):
      267 +                """Read the catalog file in "dir" and combine it with the
      268 +                existing data in "catalog"."""
      269 +
      270 +                catf = file(os.path.join(dir, "catalog"))
      271 +                for line in catf:
      272 +                        if not line.startswith("V pkg") and \
      273 +                            not line.startswith("C pkg"):
      274 +                                continue
      275 +
      276 +                        f = fmri.PkgFmri(line[7:])
      277 +                        ServerCatalog.cache_fmri(catalog, f, auth)
      278 +
      279 +                catf.close()
      280 +
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX