]> git.wh0rd.org Git - home.git/commitdiff
more gentoo helpers
authorMike Frysinger <vapier@gentoo.org>
Mon, 19 Sep 2011 22:35:05 +0000 (18:35 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:39 +0000 (15:36 -0400)
.bin/bugz [deleted file]
.bin/bugz.git [new file with mode: 0755]
.bin/cvs-cleanup
.bin/ec-close [new symlink]
.bin/er-close [new file with mode: 0755]
.bin/gbugz
.bin/gbugz.git [new symlink]
.profile.d/gentoo.sh

diff --git a/.bin/bugz b/.bin/bugz
deleted file mode 100755 (executable)
index b1ca07a..0000000
--- a/.bin/bugz
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh -e
-cd /usr/local/src/pybugz
-export PYTHONPATH=$PWD
-cd bugz
-exec ../bin/bugz "$@"
diff --git a/.bin/bugz.git b/.bin/bugz.git
new file mode 100755 (executable)
index 0000000..b1ca07a
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+cd /usr/local/src/pybugz
+export PYTHONPATH=$PWD
+cd bugz
+exec ../bin/bugz "$@"
index 38c9d01f0884164d9d6f07c91ac1f85fd197f285..56bca49b1a9da910a2ca905adfaba70f4ca57e17 100755 (executable)
@@ -1,8 +1,7 @@
 #!/bin/bash
 find -name .cvsignore -exec rm {} \;
-cvs up -C | \
-       grep -v .cvsignore | \
-       egrep -v '^(U|P|\?|\()' | \
+cvs up -C -I'!' | \
+       grep -v -e .cvsignore -e '^[UP(]' | \
        awk '{print $NF}' | \
        grep -v cleanup >& cvsup
 cat cvsup | xargs rm -vrf
diff --git a/.bin/ec-close b/.bin/ec-close
new file mode 120000 (symlink)
index 0000000..fc468e2
--- /dev/null
@@ -0,0 +1 @@
+er-close
\ No newline at end of file
diff --git a/.bin/er-close b/.bin/er-close
new file mode 100755 (executable)
index 0000000..7c7c4e6
--- /dev/null
@@ -0,0 +1,113 @@
+#!/bin/bash
+
+. ~/.profile.d/gentoo.sh
+
+op=${0##*/}
+op=${op%-close}
+tdir="${HOME}/.cache/bugz"
+mkdir -p "${tdir}"
+find "${tdir}" -mmin +30 -type f -delete
+
+usage() {
+       cat <<-EOF
+       Usage: ${0##*/} <bugid> <reason> [<bugid> <reason> ...]
+       EOF
+       if [[ $# -gt 0 ]] ; then
+               printf '\nerror: %s\n' "$*"
+       fi
+       exit
+}
+
+bugs=()
+comments=()
+cl_msg=
+while [[ $# -ne 0 ]] ; do
+       bug=$1
+       reason=$2
+       shift 2
+
+       if [[ -z ${bug} || -n ${bug//[0-9#]} ]] ; then
+               usage "invalid bug"
+       fi
+
+       case ${bug} in
+               *#*) c=${bug##*#} ;;
+               *)   c=0 ;;
+       esac
+       : $(( ++c ))
+       b=${bug%%#*}
+       bugs=( "${bugs[@]}" ${b} )
+       comments=( "${comments[@]}" "${reason}" )
+
+       xml="${tdir}/${b}.xml"
+       # server doesn't support timestamps, so cannot use -N
+       if [[ ! -e $xml ]] ; then
+               wget -q -O $xml https://bugs.gentoo.org/${b}?ctype=xml
+       fi
+       name=$(xml sel -E utf8 -t -m bugzilla/bug/long_desc -c who -n $xml | \
+               head -${c} | tail -1 | grep -o 'name=".*">' | cut -d\" -f2)
+       if [[ -z ${name} ]] ; then
+               name=$(xml sel -E utf8 -t -m bugzilla/bug/long_desc -v who -n $xml | \
+                       head -${c} | tail -1 | cut -d@ -f1)
+       fi
+
+       if [[ -n ${cl_msg} ]] ; then
+               cl_msg+="  "
+       fi
+       cl_msg+="${reason} #${bug} by ${name}."
+done
+
+run() {
+       local opt=$1; shift
+       printf "'%s' " "$@"
+       echo
+       case $opt in
+       -g) "$@" ;;
+       esac
+}
+
+doit() {
+       run "$@" $op "${cl_msg}" || exit 1
+       echo
+       for (( n=0; n < ${#bugs[@]}; ++n )) ; do
+               b=${bugs[$n]}
+               c=${comments[$n]}
+               run "$@" gbugz -q modify ${b} --fixed -c "\
+should be all set now in the tree; thanks for the report!
+
+Commit message: $c$(printf '\n%s' ${urls})"
+       done
+       echo
+}
+
+cvs=$(cvs up)
+files=$(echo "$cvs" | awk '$1 ~ /^[MA]/ { print $NF }' | grep -v '^Manifest$')
+unk_files=$(echo "$cvs" | awk '$1 !~ /^[MA]/')
+if [[ -n ${unk_files} ]] ; then
+       echo "unknown files:"
+       echo "${unk_files}"
+       exit 1
+fi
+urls=$(cvs_gentoo_url ${files} | LC_ALL=C sort -V)
+
+cmds=$(doit -p)
+echo
+echo "${cmds}"
+printf "\nOk to go? [Y/n/e] "
+read g
+case ${g} in
+       e)
+               t=$(mktemp)
+               echo "${cmds}" > "${t}"
+               ${EDITOR:-nano} "${t}" || rm "${t}"
+               . "${t}"
+               rm "${t}"
+               ;;
+       ""|y)
+               echo
+               doit -g
+               ;;
+       *)
+               exit 1
+               ;;
+esac
index 6232c467012f5d3d4dcd7a362e4951ee993d9411..9dbec05ac6b77c7a9063b840b717e409034ce0f3 100755 (executable)
@@ -1,2 +1,2 @@
 #!/bin/sh
-exec bugz -u vapier@gentoo.org "$@"
+exec ${0#g} -u vapier@gentoo.org "$@"
diff --git a/.bin/gbugz.git b/.bin/gbugz.git
new file mode 120000 (symlink)
index 0000000..c754979
--- /dev/null
@@ -0,0 +1 @@
+gbugz
\ No newline at end of file
index 04a6c32038322fa24f413dc1893787dbf8291abd..31e64c5f4307d632072b1e05b7ab76972ded0d98 100644 (file)
@@ -122,22 +122,21 @@ att() {
        return 1
 }
 arch_emails() {
-       local a ret=""
+       local ret
        if [[ $@ == *.ebuild* ]] ; then
                local e keys
                for e in "$@" ; do
                        keys=$(sed -n '/^[[:space:]]*KEYWORD/{s:.*=::;s:"::g;p}' ${e})
                        for a in ${keys} ; do
                                [[ ${a} != ~* ]] && continue
-                               ret="${ret} ${a/\~}@gentoo.org"
+                               ret="${ret} ${a}"
                        done
                done
        else
-               for a in "$@" ; do
-                       ret="${ret} ${a/\~}@gentoo.org"
-               done
+               ret="$*"
        fi
-       echo ${ret}
+       printf '%s@gentoo.org ' ${ret//\~}
+       echo
 }
 submit_bug_stable() {
        local msg="doit"
@@ -167,17 +166,17 @@ submit_bug_stable() {
                echo "Unable to read ebuild '${ebuild}'"
                return 1
        fi
-       bugz post \
+       gbugz \
+               post \
                --batch \
-               -u vapier@gentoo.org \
-               -t "Stabilize ${cat}/${pkg}" \
+               -t "${cat}/${pkg}: stabilize" \
                -d "${msg}" \
                -a "${maintainer}" \
-               --cc="${cc}" \
+               --cc="${cc// /,}" \
                -k STABLEREQ \
                --product='Gentoo Linux' \
                --component=Ebuilds \
-               --priority=P2 \
+               --priority=Normal \
                --severity=enhancement
 }