From: Mike Frysinger Date: Mon, 3 Nov 2008 18:33:32 +0000 (-0500) Subject: tweak gentoo stuff X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=3200a6eef119b72285f5dd9bc2eb04cde4096310;p=home.git tweak gentoo stuff --- diff --git a/.bin/ebuild-bump b/.bin/ebuild-bump index 8288e0e..accd1d3 100755 --- a/.bin/ebuild-bump +++ b/.bin/ebuild-bump @@ -1,7 +1,5 @@ #!/bin/bash -source ~/.bash_common - cmd="" case $1 in -u|--unpack) cmd="unpack";; diff --git a/.profile.d/aliases.gentoo.sh b/.profile.d/aliases.gentoo.sh deleted file mode 100644 index 179976b..0000000 --- a/.profile.d/aliases.gentoo.sh +++ /dev/null @@ -1,159 +0,0 @@ -cvs_gentoo_url() { -_cvs_gentoo_url() { - if [[ -n $2 ]] ; then - echo "Usage: cvs_gentoo_url [:rev1[:rev2]]" - return 1 - fi - - # spec has the form file:rev1[:rev2] - # rev2 defaults to rev1-1 - export IFS=: - set -- $1 - unset IFS - - local file=$1 - if [[ ! -e ${file} ]] ; then - echo "file '${file}' does not exist" - return 1 - fi - local dir="." - [[ ${file} == */* ]] && dir=${file%/*} - file=${file##*/} - - local rev2=$2 - if [[ -z ${rev2} ]] ; then - rev2=$( - cd ${dir} - export IFS=/ - set -- $(grep /${file}/ CVS/Entries) - unset IFS - echo $3 - ) - if [[ ${rev2} == "0" ]] ; then - # new file - rev2="1.1" - else - # existing file, bump rev automatically - rev2="1.$((${rev2#1.}+1))" - fi - fi - local rev2r=${rev2#1.} - local rev1=${3:-1.$((rev2r - 1))} - - local cvsroot=$(<${dir}/CVS/Repository) - if [[ ${cvsroot} == gentoo-x86* ]] ; then - cvsroot=${cvsroot#gentoo-x86} - cvsroot=${cvsroot#/} - fi - - local urirev - [[ ${rev2} == "1.1" || ${rev1} == "${rev2}" ]] \ - && urirev="?rev=${rev2}" \ - || urirev="?r1=${rev1}&r2=${rev2}" - echo "http://sources.gentoo.org/${cvsroot}/${file}${urirev}" -} - local f - for f in "$@" ; do - _cvs_gentoo_url "${f}" - done - unset _cvs_gentoo_url -} - - -er() { - [[ ! -e ChangeLog ]] \ - && echo "No ChangeLog" \ - && return 1 - echangelog "$@" || return 1 - repoman commit -m "$@" || return 1 -} -att() { - declare url=$1 tmp=$(mktemp) filename || return 1 - [[ $url == */* ]] || url="http://bugs.gentoo.org/attachment.cgi?id=$url" - eval $(wget -S -O"$tmp" "$url" 2>&1 | tee /dev/tty | \ - grep 'Content-disposition:' | sed 's/.* //') && \ - mv "$tmp" "$filename" && \ - chmod $(printf "%03o" "$((0666 & ~$(umask)))") "$filename" && \ - ls -l "$filename" && \ - return 0 - rm -f "$tmp" - return 1 -} -arch_emails() { - local a ret="" - if [[ $@ == *.ebuild* ]] ; then - local e keys - for e in "$@" ; do - keys=$(sed -n '/^KEYWORD/{s:.*=::;s:"::g;p}' ${e}) - for a in ${keys} ; do - [[ ${a} != ~* ]] && continue - ret="${ret} ${a/\~}@gentoo.org" - done - done - else - for a in "$@" ; do - ret="${ret} ${a/\~}@gentoo.org" - done - fi - echo ${ret} -} -submit_bug_stable() { - local msg="doit" - if [[ $1 == "-m" ]] ; then - msg=$2 - shift 2 - fi - if [[ -z $1 ]] || [[ -n $2 ]] ; then - echo "Usage: submit_bug_stable " - return 1 - fi - local maintainer=$(xml sel -t -v pkgmetadata/herd metadata.xml) - if [[ ${maintainer} == "no-herd" ]] ; then - maintainer=$(xml sel -t -v pkgmetadata/maintainer/email metadata.xml) - elif [[ -n ${maintainer} ]] ; then - maintainer="${maintainer}@gentoo.org" - fi - if [[ -z ${maintainer} ]] ; then - echo "No maintainer found in metadata.xml" - return 1 - fi - local cat=$(basename $(dirname $(pwd))) - local pkg=${1%.ebuild} - local ebuild=${pkg}.ebuild - local cc=$(arch_emails ${ebuild} | sed -r -e 's:([^ ]*-fbsd|mips)@[^ ]*::g') - if [[ -z ${cc} ]] ; then - echo "Unable to read ebuild '${ebuild}'" - return 1 - fi - bugz post \ - -u vapier@gentoo.org \ - -t "Stabilize ${cat}/${pkg}" \ - -d "${msg}" \ - -a "${maintainer}" \ - --cc="${cc}" \ - -U "" \ - -k STABLEREQ -} - -eskeys() { - local k cat - if [[ ! -e ChangeLog ]] ; then - # running in a category rather than package - cat="/" - fi - [[ -z $* ]] && set -- arm m68k s390 sh - for k in "$@" ; do - local list="$(grep "^KEYWORDS=.*~${k}\>.*[^~]x86" *${cat}*d -l)" - [[ -z ${list} ]] && continue - sed -i "1s:.*:# Copyright 1999-$(date +%Y) Gentoo Foundation:" ${list} - ekeyword ${k} ${list} - done -} -_erit() { - local msg=$1 ; shift - [[ $1 == [[:digit:]]* ]] && msg="$msg #$1" && shift - echo repoman commit -m "$(echo $@ | sed 's: :/:g') $msg" - repoman commit -m "$(echo $@ | sed 's: :/:g') $msg" -} -erstable() { _erit stable "$@" ; } -erlove() { _erit love "$@" ; } diff --git a/.profile.d/gentoo.sh b/.profile.d/gentoo.sh new file mode 100644 index 0000000..179976b --- /dev/null +++ b/.profile.d/gentoo.sh @@ -0,0 +1,159 @@ +cvs_gentoo_url() { +_cvs_gentoo_url() { + if [[ -n $2 ]] ; then + echo "Usage: cvs_gentoo_url [:rev1[:rev2]]" + return 1 + fi + + # spec has the form file:rev1[:rev2] + # rev2 defaults to rev1-1 + export IFS=: + set -- $1 + unset IFS + + local file=$1 + if [[ ! -e ${file} ]] ; then + echo "file '${file}' does not exist" + return 1 + fi + local dir="." + [[ ${file} == */* ]] && dir=${file%/*} + file=${file##*/} + + local rev2=$2 + if [[ -z ${rev2} ]] ; then + rev2=$( + cd ${dir} + export IFS=/ + set -- $(grep /${file}/ CVS/Entries) + unset IFS + echo $3 + ) + if [[ ${rev2} == "0" ]] ; then + # new file + rev2="1.1" + else + # existing file, bump rev automatically + rev2="1.$((${rev2#1.}+1))" + fi + fi + local rev2r=${rev2#1.} + local rev1=${3:-1.$((rev2r - 1))} + + local cvsroot=$(<${dir}/CVS/Repository) + if [[ ${cvsroot} == gentoo-x86* ]] ; then + cvsroot=${cvsroot#gentoo-x86} + cvsroot=${cvsroot#/} + fi + + local urirev + [[ ${rev2} == "1.1" || ${rev1} == "${rev2}" ]] \ + && urirev="?rev=${rev2}" \ + || urirev="?r1=${rev1}&r2=${rev2}" + echo "http://sources.gentoo.org/${cvsroot}/${file}${urirev}" +} + local f + for f in "$@" ; do + _cvs_gentoo_url "${f}" + done + unset _cvs_gentoo_url +} + + +er() { + [[ ! -e ChangeLog ]] \ + && echo "No ChangeLog" \ + && return 1 + echangelog "$@" || return 1 + repoman commit -m "$@" || return 1 +} +att() { + declare url=$1 tmp=$(mktemp) filename || return 1 + [[ $url == */* ]] || url="http://bugs.gentoo.org/attachment.cgi?id=$url" + eval $(wget -S -O"$tmp" "$url" 2>&1 | tee /dev/tty | \ + grep 'Content-disposition:' | sed 's/.* //') && \ + mv "$tmp" "$filename" && \ + chmod $(printf "%03o" "$((0666 & ~$(umask)))") "$filename" && \ + ls -l "$filename" && \ + return 0 + rm -f "$tmp" + return 1 +} +arch_emails() { + local a ret="" + if [[ $@ == *.ebuild* ]] ; then + local e keys + for e in "$@" ; do + keys=$(sed -n '/^KEYWORD/{s:.*=::;s:"::g;p}' ${e}) + for a in ${keys} ; do + [[ ${a} != ~* ]] && continue + ret="${ret} ${a/\~}@gentoo.org" + done + done + else + for a in "$@" ; do + ret="${ret} ${a/\~}@gentoo.org" + done + fi + echo ${ret} +} +submit_bug_stable() { + local msg="doit" + if [[ $1 == "-m" ]] ; then + msg=$2 + shift 2 + fi + if [[ -z $1 ]] || [[ -n $2 ]] ; then + echo "Usage: submit_bug_stable " + return 1 + fi + local maintainer=$(xml sel -t -v pkgmetadata/herd metadata.xml) + if [[ ${maintainer} == "no-herd" ]] ; then + maintainer=$(xml sel -t -v pkgmetadata/maintainer/email metadata.xml) + elif [[ -n ${maintainer} ]] ; then + maintainer="${maintainer}@gentoo.org" + fi + if [[ -z ${maintainer} ]] ; then + echo "No maintainer found in metadata.xml" + return 1 + fi + local cat=$(basename $(dirname $(pwd))) + local pkg=${1%.ebuild} + local ebuild=${pkg}.ebuild + local cc=$(arch_emails ${ebuild} | sed -r -e 's:([^ ]*-fbsd|mips)@[^ ]*::g') + if [[ -z ${cc} ]] ; then + echo "Unable to read ebuild '${ebuild}'" + return 1 + fi + bugz post \ + -u vapier@gentoo.org \ + -t "Stabilize ${cat}/${pkg}" \ + -d "${msg}" \ + -a "${maintainer}" \ + --cc="${cc}" \ + -U "" \ + -k STABLEREQ +} + +eskeys() { + local k cat + if [[ ! -e ChangeLog ]] ; then + # running in a category rather than package + cat="/" + fi + [[ -z $* ]] && set -- arm m68k s390 sh + for k in "$@" ; do + local list="$(grep "^KEYWORDS=.*~${k}\>.*[^~]x86" *${cat}*d -l)" + [[ -z ${list} ]] && continue + sed -i "1s:.*:# Copyright 1999-$(date +%Y) Gentoo Foundation:" ${list} + ekeyword ${k} ${list} + done +} +_erit() { + local msg=$1 ; shift + [[ $1 == [[:digit:]]* ]] && msg="$msg #$1" && shift + echo repoman commit -m "$(echo $@ | sed 's: :/:g') $msg" + repoman commit -m "$(echo $@ | sed 's: :/:g') $msg" +} +erstable() { _erit stable "$@" ; } +erlove() { _erit love "$@" ; }