3 . ~/.profile.d/gentoo.sh
7 tdir="${HOME}/.cache/bugz"
9 find "${tdir}" -mmin +30 -type f -delete
13 Usage: ${0##*/} <bugid> <reason> [<bugid> <reason> ...]
15 if [[ $# -gt 0 ]] ; then
16 printf '\nerror: %s\n' "$*"
24 while [[ $# -ne 0 ]] ; do
27 shift 2 || usage "invalid args"
29 if [[ -z ${bug} || -n ${bug//[0-9#]} ]] ; then
39 bugs=( "${bugs[@]}" ${b} )
40 comments=( "${comments[@]}" "${reason}" )
42 xml="${tdir}/${b}.xml"
43 # server doesn't support timestamps, so cannot use -N
44 if [[ ! -s $xml ]] ; then
45 wget -q -O $xml https://bugs.gentoo.org/${b}?ctype=xml
47 name=$(xml sel -E utf8 -t -m bugzilla/bug/long_desc -c who -n $xml | \
48 head -${c} | tail -1 | grep -o 'name=".*">' | cut -d\" -f2)
49 if [[ -z ${name} ]] ; then
50 name=$(xml sel -E utf8 -t -m bugzilla/bug/long_desc -v who -n $xml | \
51 head -${c} | tail -1 | cut -d@ -f1)
54 if [[ -n ${cl_msg} ]] ; then
57 cl_msg+="${reason} #${bug} by ${name}."
70 run "$@" $op "${cl_msg}" || exit 1
72 for (( n=0; n < ${#bugs[@]}; ++n )) ; do
75 run "$@" gbugz -q modify ${b} --fixed -c "\
76 should be all set now in the tree; thanks for the report!
78 Commit message: $c$(printf '\n%s' ${urls})"
84 files=$(echo "$cvs" | awk '$1 ~ /^[MA]/ { print $NF }' | grep -v '^Manifest$')
85 unk_files=$(echo "$cvs" | awk '$1 !~ /^[MARU]/')
86 if [[ -n ${unk_files} ]] ; then
91 urls=$(cvs_gentoo_url ${files} | LC_ALL=C sort -V)
96 printf "\nOk to go? [Y/n/e] "
101 echo "${cmds}" > "${t}"
102 ${EDITOR:-nano} "${t}" || rm "${t}"