#!/bin/bash

# ABSTRACT: Lists all known ABI's except the one specified

source "${LIBDIR}/core-functions.sh" || exit 1

ABISFILE="${LIBDIR}/perl-abis.txt"

set -euo pipefail

require_bin grep sys-apps/grep

[[ $# -gt 0 ]] || die "Expected [wanted-perl-version] in ${cmdname} [wanted-perl-version]"
[[ $# -lt 2 ]] || die "Too many arguments, expected 2 at most."

subslot="$1"
shift;

grep -xqF "${subslot}" "${ABISFILE}" || die "All known ABIs excluded, does \"${subslot}\" match a known Perl ABI-version?"

grep -vxF "${subslot}" "${ABISFILE}" | while read -r i; do
  printf "dev-lang/perl:0/%s\n" "${i}"
done

# help: Invocation
# help:   gentoo-perl list-excluded-abis [wanted-subslot]
# help:
# help: Outputs:
# help:   A list of dependency strings used by subslots other than the desired one.
