def rpm_eval(macro):
    """Get value of given macro using rpm tool"""
    try:
        value = subprocess.Popen(
            ['rpm', '--eval', macro],
            stdout=subprocess.PIPE).communicate()[0].strip()
    except OSError:
        logger.error('Failed to get value of {0} rpm macro'.format(
            macro), exc_info=True)
        value = b''
    return console_to_str(value)
Get value of given macro using rpm tool