def search_by_build_id(hex_encoded_id):
 cache = ((cache_dir + '-libc.so.') + hex_encoded_id)
 if (os.path.exists(cache) and read(cache).startswith('\x7fELF')):
  log.info_once(('Using cached data from %r' % cache))
  return cache
 log.info('Downloading data from GitHub')
 url_base = 'https://gitlab.com/libcdb/libcdb/raw/master/hashes/build_id/'
 url = urlparse.urljoin(url_base, hex_encoded_id)
 data = ''
 while (not data.startswith('\x7fELF')):
  data = wget(url)
  if (not data):
   return None
  if data.startswith('..'):
   url = (os.path.dirname(url) + '/')
   url = urlparse.urljoin(url, data)
 write(cache, data)
 return cache

def search_by_build_id ( hex_encoded_id ) : cache = ( ( cache_dir + '-libc.so.' ) + hex_encoded_id ) if ( os . path . exists ( cache ) and read ( cache ) . startswith ( '\x7fELF' ) ) : log . info_once ( ( 'Using cached data from %r' % cache ) ) return cache log . info ( 'Downloading data from GitHub' ) url_base = 'https://gitlab.com/libcdb/libcdb/raw/master/hashes/build_id/' url = urlparse . urljoin ( url_base , hex_encoded_id ) data = '' while ( not data . startswith ( '\x7fELF' ) ) : data = wget ( url ) if ( not data ) : return None if data . startswith ( '..' ) : url = ( os . path . dirname ( url ) + '/' ) url = urlparse . urljoin ( url , data ) write ( cache , data ) return cache
given a hex-encoded build id .