-
Notifications
You must be signed in to change notification settings - Fork 8
/
lr-remove
executable file
·41 lines (36 loc) · 971 Bytes
/
lr-remove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# remove the specified package, opening all relevant bugs in the browser
# and grepping profiles for stale references
# note: package.mask entry must be removed first!
# (c) 2019-2024 Michał Górny <[email protected]>
# SPDX-License-Identifier: GPL-2.0-or-later
scriptdir=${BASH_SOURCE%/*}
pkg=${1}; shift
if ! [[ ${pkg} ]]; then
echo "Usage: ${0} cat/pkg [bugno]"
exit 1
fi
set -e -x
cd "$(git rev-parse --show-toplevel)"
git rm -r "${pkg}"
urls=(
"${@/#/https:\/\/bugs.gentoo.org\/show_bug.cgi?id=}"
"https://bugs.gentoo.org/buglist.cgi?no_redirect=1&quicksearch=$("${scriptdir}"/urlencode <<<"${pkg}")"
)
if type -P exo-open &>/dev/null; then
exo-open "${urls[@]}"
else
for url in "${urls[@]}"; do
xdg-open "${url}"
done
fi
git --no-pager grep "${pkg}" profiles/ || :
msg="${pkg}: Remove last-rited pkg
"
if [[ -n ${@} ]]; then
for bug; do
msg+="
Bug: https://bugs.gentoo.org/${bug}"
done
fi
exec git commit -a -s -S -m "${msg}"