def alpine_to_hostspec(arch):
    """
    See: abuild source code/functions.sh.in: arch_to_hostspec()
    """
    mapping = {'aarch64': 'aarch64-alpine-linux-musl', 'armel':
        'armv5-alpine-linux-musleabi', 'armhf':
        'armv6-alpine-linux-musleabihf', 'armv7':
        'armv7-alpine-linux-musleabihf', 'mips': 'mips-alpine-linux-musl',
        'mips64': 'mips64-alpine-linux-musl', 'mipsel':
        'mipsel-alpine-linux-musl', 'mips64el':
        'mips64el-alpine-linux-musl', 'ppc': 'powerpc-alpine-linux-musl',
        'ppc64': 'powerpc64-alpine-linux-musl', 'ppc64le':
        'powerpc64le-alpine-linux-musl', 's390x': 's390x-alpine-linux-musl',
        'x86': 'i586-alpine-linux-musl', 'x86_64': 'x86_64-alpine-linux-musl'}
    if arch in mapping:
        return mapping[arch]
    raise ValueError("Can not map Alpine architecture '" + arch +
        "' to the right hostspec value")
