name: "Drop ebuilds matching the condition" description: "Checks if any ebuild for the package matches the condition and if so - removes them" inputs: atom: description: "category/name package atom" required: true condition: description: "version condition used to match ebuilds to drop" required: true outputs: message: description: "space-separated list of removed ebuild versions" runs: using: docker image: Dockerfile args: - -c - | set -euo pipefail condition_atom=$(echo "${{inputs.condition}}" | sed -r 's:^(<|>)=?:\0${{inputs.atom}}-:') existing_ebuilds=( "./${{inputs.atom}}"/*.ebuild ) category=$(dirname "${{inputs.atom}}") message="" for ebuild in ${existing_ebuilds[@]}; do p="=${category}/$(basename "${ebuild%.*}")" echo "Checking ${p} vs ${condition_atom}" if qatom -qc "${p}" "${condition_atom}" | grep -cq '=='; then echo "Removing ${ebuild}" rm -f "${ebuild}" if [[ -z "${message}" ]]; then message="drop" fi message="${message} `qatom -F '%{PV}' "${p}"`" fi; done; echo "message=${message}" >> "${GITHUB_OUTPUT}"