parameters: (pkg, symbol_pkg)
docstring: Return a generator over BinarySymbolInfo tuples for all ELF files in 'pkg'.
  
    This function extracts both RPM/DEB files, then walks the binary pkg directory to
    enumerate all ELF files, matches them to the location of their respective .debug files
    and yields all tuples thereof. We use a generator here to keep the temporary directory
    and its contents around until the consumer of the generator has finished its processing.
docstring_summary: Return a generator over BinarySymbolInfo tuples for all ELF files in 'pkg'.
docstring_tokens: Return a generator over BinarySymbolInfo tuples for all ELF files in pkg .
function: def enumerate_pkg_files(pkg, symbol_pkg):
    """Return a generator over BinarySymbolInfo tuples for all ELF files in 'pkg'.
  
    This function extracts both RPM/DEB files, then walks the binary pkg directory to
    enumerate all ELF files, matches them to the location of their respective .debug files
    and yields all tuples thereof. We use a generator here to keep the temporary directory
    and its contents around until the consumer of the generator has finished its processing.
    """
    KUDU_BINARY_BASE = os.path.join('usr', 'lib', 'kudu')
    KUDU_SYMBOL_BASE = os.path.join('usr', 'lib', 'debug', KUDU_BINARY_BASE)
    assert_file_exists(pkg)
    assert_file_exists(symbol_pkg)
    tmp_dir = tempfile.mkdtemp()
    try:
      # Extract pkg
      logging.info('Extracting to %s: %s' % (tmp_dir, pkg))
      extract_pkg(os.path.abspath(pkg), tmp_dir)
      # Extract symbol_pkg
      logging.info('Extracting to %s: %s' % (tmp_dir, symbol_pkg))
      extract_pkg(os.path.abspath(symbol_pkg), tmp_dir)
      # Walk pkg path and find elf files
      binary_base = os.path.join(tmp_dir, KUDU_BINARY_BASE)
      symbol_base = os.path.join(tmp_dir, KUDU_SYMBOL_BASE)
      # Find folder with .debug file in symbol_pkg path
      for binary_path in find_elf_files(binary_base):
        # Add tuple to output
        rel_dir = os.path.relpath(os.path.dirname(binary_path), binary_base)
        debug_dir = os.path.join(symbol_base, rel_dir)
        yield BinarySymbolInfo(binary_path, debug_dir)
    finally:
      shutil.rmtree(tmp_dir)
function_tokens: def enumerate_pkg_files ( pkg , symbol_pkg ) : KUDU_BINARY_BASE = os . path . join ( 'usr' , 'lib' , 'kudu' ) KUDU_SYMBOL_BASE = os . path . join ( 'usr' , 'lib' , 'debug' , KUDU_BINARY_BASE ) assert_file_exists ( pkg ) assert_file_exists ( symbol_pkg ) tmp_dir = tempfile . mkdtemp ( ) try : # Extract pkg logging . info ( 'Extracting to %s: %s' % ( tmp_dir , pkg ) ) extract_pkg ( os . path . abspath ( pkg ) , tmp_dir ) # Extract symbol_pkg logging . info ( 'Extracting to %s: %s' % ( tmp_dir , symbol_pkg ) ) extract_pkg ( os . path . abspath ( symbol_pkg ) , tmp_dir ) # Walk pkg path and find elf files binary_base = os . path . join ( tmp_dir , KUDU_BINARY_BASE ) symbol_base = os . path . join ( tmp_dir , KUDU_SYMBOL_BASE ) # Find folder with .debug file in symbol_pkg path for binary_path in find_elf_files ( binary_base ) : # Add tuple to output rel_dir = os . path . relpath ( os . path . dirname ( binary_path ) , binary_base ) debug_dir = os . path . join ( symbol_base , rel_dir ) yield BinarySymbolInfo ( binary_path , debug_dir ) finally : shutil . rmtree ( tmp_dir )