diff options
| -rwxr-xr-x | admin/getmaintdependees | 2 | ||||
| -rwxr-xr-x | admin/sbols | 101 |
2 files changed, 102 insertions, 1 deletions
diff --git a/admin/getmaintdependees b/admin/getmaintdependees index 4e9305b..0abf48d 100755 --- a/admin/getmaintdependees +++ b/admin/getmaintdependees @@ -42,7 +42,7 @@ for i in $builds; do source ./$j.info &>/dev/null || continue if [ "$MAINTAINER" != "$maint" -a "$EMAIL" != "NOEMAIL" ]; then can_orphan=no - echo -n "('$MAINTAINER' $EMAIL) " + echo -n "($MAINTAINER <$EMAIL>) " fi done echo diff --git a/admin/sbols b/admin/sbols new file mode 100755 index 0000000..dd64e1b --- /dev/null +++ b/admin/sbols @@ -0,0 +1,101 @@ +#!/bin/sh + +VERSION="0.0.1" +SELF="$( basename $0 )" + +die() { + echo "$SELF: fatal: $@" 1>&2 + exit 1 +} + +warn() { + echo "$SELF: warning: $@" 1>&2 +} + +usage() { + cat <<EOF +$SELF - query SBo git tree for info on builds + +Usage: $SELF [-mdrag] [ -M <maintainer> | <build> [<build> ...] ] + +Build arguments are build names as used with cdsb: category/build, or +just build, and partial matches are supported. For each one, show the +category/build (and optionally the maintainer, dependencies, and/or +description). Output is one line per argument. + +Options: + -M <maintainer> Show all builds for given maintainer. If this + option is used, it must be the last option (this is done to + avoid the need to quote maintainer names with spaces in them). + -m Show maintainer name and email. + -d Show description (from top of slack-desc). + -r Show REQUIRES. + -g Show last git commit date/author/desciption (slow!). + -x Show dependees (requires hoorex). + -a Same as -mdr (show all info, except git and dependees). + -A Same as -mdrgh (show all info). + +Environment: + SBO_GITROOT - set this to the path of the local SBo git clone. + If not set, the current directory is assumed. +EOF +} + +source ~/sbostuff/sbostuff.sh + +if [ "$1" = "--help" -o "$1" = "" ]; then + usage ; exit 0 +fi + +while getopts ":MmdragxA" OPT; do + case "$OPT" in + M) opt_M=1 ;; + m) opt_m=1 ;; + d) opt_d=1 ;; + r) opt_r=1 ;; + a) opt_m=1 ; opt_d=1 ; opt_r=1 ;; + g) opt_g=1 ;; + x) opt_x=1 ;; + A) opt_m=1 ; opt_d=1 ; opt_r=1 ; opt_g=1 ; opt_x=1 ;; + *) die "invalid option -$OPTARG, try --help" ;; + esac +done +shift $(($OPTIND - 1)) + +[ "$SBO_GITROOT" != "" ] && cd "$SBO_GITROOT" +[ -d .git -a -d system -a -d academic ] || die "not a valid SBo git checkout" + +if [ "$opt_M" = "1" ]; then + cdsb + builds="$( git grep -l "$*" '*/*/*.info' | cut -d/ -f1,2 )" + [ "$builds" = "" ] && die "maintainer '$*' not found" + set $builds +fi + +for i; do + if cdsb $i; then + i="$( basename $( pwd ) )" + prgcat="$( pwd | rev | cut -d/ -f1,2 | rev )" + echo -n $prgcat + if [ "$opt_m" = "1" ]; then + source ./$i.info + echo -n ": $MAINTAINER <$EMAIL>" + fi + if [ "$opt_d" = "1" ]; then + echo -n " $( grep $i: slack-desc | head -1 | cut -d' ' -f3- )" + fi + if [ "$opt_r" = "1" ]; then + echo -n " $( grep ^REQUIRES $i.info | grep -v '""' )" + fi + if [ "$opt_g" = "1" ]; then + echo -n " $( git -P log -n1 --format="%as;%an;%s" . | sed "s,;$prgcat: ,;,")" + fi + if [ "$opt_x" = "1" ]; then + x="$( hoorex -a $i | cut -d' ' -f2- )" + [ "$x" != "" ] && echo -n " | $x" + fi + echo + else + warn "$i not found in repo" + fi +done |
