def write_layout(_path):
    """
    Write a valid gentoo layout file to :path:.

    Args:
        path - The output path of the layout.conf
    """

    path.mkdir_uchroot("/etc/portage/metadata")
    path.mkfile_uchroot("/etc/portage/metadata/layout.conf")
    with open(_path, 'w') as layoutconf:
        lines = '''masters = gentoo'''
        layoutconf.write(lines)