(self, catalog_name)
Generates a new catalog with the latest packages.
Generates a new catalog with the latest packages.
Generates a new catalog with the latest packages .
def NewCatalog(self, catalog_name):
    """Generates a new catalog with the latest packages."""
    self.CreateCatalogNames(catalog_name)
    print ('Generating new %s catalog - this may take a while. (up to 10 mins)'
           % catalog_name)
    self.newcatalog = []
    if catalog_name == 'base':
      pkgsrc = os.path.join(self.pkgsource, self.os_version, 'base')
    elif catalog_name == 'thirdparty':
      if self.thirdparty_location == '':  # pylint: disable-msg=C6403
        pkgsrc = os.path.join(self.pkgsource, self.os_version)
        self.thirdparty_location = pkgsrc
      else:
        pkgsrc = self.thirdparty_location
    else:
      print 'Unknown catalog name: %s' % catalog_name
      raise SystemExit

    linegen = LineGenerator(pkgsrc)
    print 'Generating catalog for %s' % pkgsrc
    print 'Generating catalog checksums and lines...'
    linegen.GenAllLines()

    for line in linegen.catalog_lines:
      last_pkg = line.split()[1]

    old_pkg = ''
    old_line = ''
    pkgname = ''

    for line in linegen.catalog_lines:
      pkg = line.split()[1]
      try:
        date = re.findall('-([0-9]+).dmg', pkg)
        if date:
          if len(date[0]) == 8 or len(date[0]) == 12:
            pkgname = os.path.basename(line.split(date[0])[0])
        if old_pkg != pkgname:
          self.newcatalog.append(old_line)
        if pkg == last_pkg:
          # Add last line
          self.newcatalog.append(line)
        old_pkg = pkgname
      except AttributeError:
        pass
      if catalog_name == 'base' and pkg != last_pkg:
        self.newcatalog.append(line)
      old_line = line

    self.RenameCatalog(catalog_name)
    self.WriteCatalog()
def NewCatalog ( self , catalog_name ) : self . CreateCatalogNames ( catalog_name ) print ( 'Generating new %s catalog - this may take a while. (up to 10 mins)' % catalog_name ) self . newcatalog = [ ] if catalog_name == 'base' : pkgsrc = os . path . join ( self . pkgsource , self . os_version , 'base' ) elif catalog_name == 'thirdparty' : if self . thirdparty_location == '' : # pylint: disable-msg=C6403 pkgsrc = os . path . join ( self . pkgsource , self . os_version ) self . thirdparty_location = pkgsrc else : pkgsrc = self . thirdparty_location else : print 'Unknown catalog name: %s' % catalog_name raise SystemExit linegen = LineGenerator ( pkgsrc ) print 'Generating catalog for %s' % pkgsrc print 'Generating catalog checksums and lines...' linegen . GenAllLines ( ) for line in linegen . catalog_lines : last_pkg = line . split ( ) [ 1 ] old_pkg = '' old_line = '' pkgname = '' for line in linegen . catalog_lines : pkg = line . split ( ) [ 1 ] try : date = re . findall ( '-([0-9]+).dmg' , pkg ) if date : if len ( date [ 0 ] ) == 8 or len ( date [ 0 ] ) == 12 : pkgname = os . path . basename ( line . split ( date [ 0 ] ) [ 0 ] ) if old_pkg != pkgname : self . newcatalog . append ( old_line ) if pkg == last_pkg : # Add last line self . newcatalog . append ( line ) old_pkg = pkgname except AttributeError : pass if catalog_name == 'base' and pkg != last_pkg : self . newcatalog . append ( line ) old_line = line self . RenameCatalog ( catalog_name ) self . WriteCatalog ( )