]> git.wh0rd.org - home.git/blame - .profile.d/gentoo.sh
ddnuke: add fdisk+prompt to startup, and rough ETA
[home.git] / .profile.d / gentoo.sh
CommitLineData
a810f714 1alias ebuild-sync='rsync -av ./ /usr/portage/${PWD#/usr/local/src/gentoo/repo/gentoo/} --exclude ChangeLog --exclude CVS --exclude metadata.xml --delete'
eca710ea 2alias ebuild-emerge='sudo emerge -1av $(echo ${PWD} | awk -F/ "{printf \"%s/%s\", \$(NF-1), \$(NF)}")'
6d0816bf 3alias ekeyword='ekeyword -v -q'
051c2832
MF
4alias repoman='repoman -q -q'
5alias rf='/usr/local/src/gentoo/portage/repoman/bin/repoman.git -q full'
eca710ea 6
2239c239 7_echangelog() {
1afdf944
MF
8 [[ ! -e ChangeLog ]] \
9 && echo "No ChangeLog" \
10 && return 1
11 echangelog "$@" || return 1
2239c239
MF
12}
13er() {
a810f714 14 repoman commit "${@:1:$#-1}" -m "${@:$#}" || return 1
1afdf944 15}
2239c239 16ec() {
369dd755
MF
17 (
18 _echangelog "$@" || exit 1
19 cvs commit -m "$@" || exit 1
20 )
2239c239
MF
21}
22
1afdf944 23att() {
294704a2
MF
24 while [[ $# -gt 0 ]] ; do
25 declare url=$1 tmp=$(mktemp) filename || return 1
26 [[ ${url} == */* ]] || url="http://bugs.gentoo.org/attachment.cgi?id=${url}"
27 printf '%s -> ' "${url}"
28 if eval $(wget -S -O"${tmp}" "${url}" 2>&1 |
29 grep 'Content-disposition:' | sed 's/.* //') && \
30 mv "${tmp}" "${filename}" && \
31 chmod $(printf "%03o" "$((0666 & ~$(umask)))") "${filename}" ; then
32 du -b "${filename}"
33 else
34 echo "FAIL"
35 rm -f "${tmp}"
36 fi
37 shift
38 done
1afdf944
MF
39}
40arch_emails() {
ef325790 41 local ret
1afdf944
MF
42 if [[ $@ == *.ebuild* ]] ; then
43 local e keys
44 for e in "$@" ; do
39d58573 45 keys=$(sed -n '/^[[:space:]]*KEYWORD/{s:.*=::;s:"::g;p}' ${e})
1afdf944
MF
46 for a in ${keys} ; do
47 [[ ${a} != ~* ]] && continue
39efb5ff
MF
48 case ${a} in
49 *-*) continue ;;
50 ~arm64|~m68k|~mips|~s390|~sh) continue ;;
51 ~*) ret="${ret} ${a}" ;;
52 esac
1afdf944
MF
53 done
54 done
55 else
ef325790 56 ret="$*"
1afdf944 57 fi
39efb5ff 58 printf '%s@gentoo.org,' ${ret//\~}
ef325790 59 echo
1afdf944 60}
8ef7abb4
MF
61stable_arch_emails() {
62 arch_emails "$@" | sed -r -e 's:([^ ]*-[^ ]*|mips)@[^ ]*::g'
63}
036bd914
MF
64eget_maintainer() {
65 local f=${1:-metadata.xml}
66 local maintainer=$(xml sel -t -v pkgmetadata/herd $f)
67 if [[ ${maintainer:-no-herd} == "no-herd" ]] ; then
68 maintainer=$(xml sel -t -v pkgmetadata/maintainer/email $f)
69 elif [[ -n ${maintainer} ]] ; then
70 maintainer="${maintainer}@gentoo.org"
71 fi
72 if [[ -z ${maintainer} ]] ; then
73 echo "No maintainer found in $f"
74 return 1
75 fi
94696975 76 echo ${maintainer}
036bd914
MF
77 return 0
78}
1afdf944
MF
79submit_bug_stable() {
80 local msg="doit"
81 if [[ $1 == "-m" ]] ; then
82 msg=$2
83 shift 2
84 fi
85 if [[ -z $1 ]] || [[ -n $2 ]] ; then
86 echo "Usage: submit_bug_stable <ebuilds>"
87 return 1
88 fi
036bd914
MF
89 local maintainer
90 maintainer=$(eget_maintainer) || return 1
1afdf944
MF
91 local cat=$(basename $(dirname $(pwd)))
92 local pkg=${1%.ebuild}
93 local ebuild=${pkg}.ebuild
8ef7abb4 94 local cc=$(stable_arch_emails ${ebuild})
1afdf944
MF
95 if [[ -z ${cc} ]] ; then
96 echo "Unable to read ebuild '${ebuild}'"
97 return 1
98 fi
94696975
MF
99 if [[ ${maintainer} == *" "* ]] ; then
100 cc+=",${maintainer#* }"
101 maintainer=${maintainer%% *}
102 fi
ef325790
MF
103 gbugz \
104 post \
5b85a493 105 --batch \
ef325790 106 -t "${cat}/${pkg}: stabilize" \
1afdf944
MF
107 -d "${msg}" \
108 -a "${maintainer}" \
ef325790 109 --cc="${cc// /,}" \
39d58573
MF
110 -k STABLEREQ \
111 --product='Gentoo Linux' \
112 --component=Ebuilds \
ef325790 113 --priority=Normal \
39d58573 114 --severity=enhancement
1afdf944
MF
115}
116
117eskeys() {
118 local k cat
119 if [[ ! -e ChangeLog ]] ; then
120 # running in a category rather than package
121 cat="/"
122 fi
d040ef70 123 [[ -z $* ]] && set -- arm64 m68k s390 sh
1afdf944 124 for k in "$@" ; do
d040ef70 125 ekeyword "${k}=x86" $(grep -l "KEYWORDS.*${k}" *${cat}*.ebuild)
1afdf944
MF
126 done
127}
128_erit() {
129 local msg=$1 ; shift
130 [[ $1 == [[:digit:]]* ]] && msg="$msg #$1" && shift
051c2832
MF
131 echo git commit -m "$(echo $@ | sed 's: :/:g') $msg"
132 git commit -m "$(echo $@ | sed 's: :/:g') $msg"
1afdf944
MF
133}
134erstable() { _erit stable "$@" ; }
135erlove() { _erit love "$@" ; }
8ef7abb4
MF
136
137export PORTAGE_INST_UID=${UID}
138export PORTAGE_INST_GID=`id -g`