flatcar-scripts/pkg_auto/occurences.sh
Krzesimir Nowak 020f9fe19c pkg-auto: Add some tools
These tools I found useful when I had to investigate why report
generation failed. Since report generation failed, I had no reports
about ebuild diffs or package occurences. The new scripts,
`diff_pkg.sh` and `occurences.sh`, allowed me to get these reports for
the troublesome package.
2025-01-22 13:32:39 +01:00

44 lines
839 B
Bash
Executable File

#!/bin/bash
##
## Print all the places in the scripts repository where the given
## package is mentioned. It's sort of like grep, but a bit smarter and
## with a slightly better output.
##
## Parameters:
## -h: this help
##
## Positional:
## 1: scripts repo
## 2: package name
##
set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/impl/pkg_auto_lib.sh"
while [[ ${#} -gt 0 ]]; do
case ${1} in
-h)
print_help
exit 0
;;
--)
shift
break
;;
-*)
fail "unknown flag '${1}'"
;;
*)
break
;;
esac
done
if [[ ${#} -ne 2 ]]; then
fail 'Expected two positional parameters: a path to scripts repository and a package name'
fi
generate_mention_report_for_package "${1}" "${2}"