diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-06-01 17:43:37 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-06-01 17:43:37 +0200 |
commit | 636120d5b3dd25e83826f4c79d559c02f96c82af (patch) | |
tree | f69a8b2b175f541dbf5a26e9a4feb86e82888ae8 /bin | |
parent | f8d5270f835f2dff6cdc6fc574280a57ca9eed60 (diff) |
bin/pkg: pkg_info: Prefetch infos
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pkg | 54 |
1 files changed, 32 insertions, 22 deletions
@@ -206,41 +206,51 @@ real_priority () { pkg_info () { cd $PDIR/$1 || return [ -z "$1" ] && die "Not enough arguments\n" - info "Package: " - echo "$1" + # Fetch the infos + NAME="$1" if ([ -r priority ]) { - prio=$(cat priority) - info "Priority: " - echo "$prio ($(real_priority $prio))" + PRIORITY=$(cat priority) + PRIORITY_NAME=$(real_priority "$PRIORITY") } LOG=$(hg log) - info "Version: " - echo $LOG | grep -m1 'changeset:' | grep -E -o '[0-9]{1,}:[0-9a-f]*' - info "Date: " - echo $LOG | grep -m1 'date:' | grep -Eo '[A-Z][a-z]{2}.*' + VERSION=$(echo $LOG | grep -m1 'changeset:' | grep -Eo '[0-9]{1,}:[0-9a-f]*') + DATE=$(echo $LOG | grep -m1 'date:' | grep -Eo '[A-Z][a-z]{2}.*') if ([ -r dependencies ]) { - info "Depends: " - cat dependencies | tr "\n" " " | sed 's/ /, /g' | sed 's/, $//' - echo + DEPENDENCIES=$(cat dependencies | tr "\n" " " | sed 's/ /, /g' | sed 's/, $//') } if ([ -r tags ]) { - info "Tags: " - cat tags | tr "\n" " " | sed 's/ /, /g' | sed 's/, $//' - echo + TAGS=$(cat tags | tr "\n" " " | sed 's/ /, /g' | sed 's/, $//') } if ([ -d hooks ]) { - info "Hooks: " - ls hooks + HOOKS=$(ls hooks) } if ([ -r Makefile ]) { - info "Makefile\n" + MAKEFILE=1 } - info "Repository size: " - du -sh .hg | grep -o '.*[KMG]' + SIZE=$(du -sh .hg | grep -o '.*[KMG]') if ([ -r description ]) { - info "Description:\n" - cat description + DESCRIPTION=$(cat description) } + + # Show 'em + info "Package: " + echo "$NAME" + info "Priority: " + echo "$PRIORITY ($PRIORITY_NAME)" + info "Version: " + echo "$VERSION" + info "Date: " + echo "$DATE" + info "Dependencies: " + echo "$DEPENDENCIES" + info "Tags: " + echo "$TAGS" + info "Hooks: " + echo "$HOOKS" + info "Repository Size: " + echo "$SIZE" + info "Description:\n" + echo "$DESCRIPTION" } pkg_log () { |