code: def updateRpmDicts(rpmrc, pyfile):
      
      try:
          # Read old rpmutils.py file
          oldpy = open(pyfile,"r").readlines()
          # Read current rpmrc.in file
          rpm = open(rpmrc,"r").readlines()
          # Parse for data
          data = {}
          # Allowed section names that get parsed
          sections = ['optflags',
                      'arch_canon',
                      'os_canon',
                      'buildarchtranslate',
                      'arch_compat',
                      'os_compat',
                      'buildarch_compat']
          for l in rpm:
              l = l.rstrip('\n').replace(':',' ')
              # Skip comments
              if l.lstrip().startswith('#'):
                  continue
              tokens = l.strip().split()
              if len(tokens):
                  key = tokens[0]
                  if key in sections:
                      # Have we met this section before?
                      if tokens[0] not in data:
                          # No, so insert it
                          data[key] = {}
                      # Insert data
                      data[key][tokens[1]] = tokens[2:]
          # Write new rpmutils.py file
          out = open(pyfile,"w")
          pm = 0
          for l in oldpy:
              if pm:
                  if l.startswith('# End of rpmrc dictionaries'):
                      pm = 0
                      out.write(l)
              else:
                  out.write(l)
                  if l.startswith('# Start of rpmrc dictionaries'):
                      pm = 1
                      # Write data sections to single dictionaries
                      for key, entries in data.items():
                          out.write("%s = {\n" % key)
                          for arch in sorted(entries.keys()):
                              out.write("  '%s' : ['%s'],\n" % (arch, "','".join(entries[arch])))
                          out.write("}\n\n")
          out.close()
      except:
          pass
docs: Read the given rpmrc file with RPM definitions and update the
          info dictionaries in the file pyfile with it.
          The arguments will usually be 'rpmrc.in' from a recent RPM source
          tree, and 'rpmutils.py' referring to this script itself.
          See also usage() below.