diff options
author | Dave Reisner <dreisner@archlinux.org> | 2014-08-28 23:09:43 -0400 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2014-08-29 22:30:30 -0400 |
commit | 5997ed5aae975f3b1fc74af0797db9c01345114a (patch) | |
tree | 7a9b0b09fdf0305d498d6d35e988f708365b81ba | |
parent | 61d246b0ea8dd89c9c31a1d9a19dac407442247b (diff) | |
download | asp32-5997ed5aae975f3b1fc74af0797db9c01345114a.tar.xz |
add 'show' verb, to display a PKGBUILD for a package
-rw-r--r-- | asp.in | 4 | ||||
-rw-r--r-- | man/asp.1.txt | 6 | ||||
-rw-r--r-- | package.inc.sh | 19 | ||||
-rw-r--r-- | shell/bash-completion | 2 | ||||
-rw-r--r-- | shell/zsh-completion | 1 |
5 files changed, 30 insertions, 2 deletions
@@ -35,6 +35,7 @@ Commands: list-local List tracked packages list-repos NAME... List repos for packages log NAME Show revision history + show NAME Show the PKGBUILD shortlog NAME Show revision history in short form update [NAME...] Update packages (update all tracked if none specified) untrack NAME... Remove a package from the local repository @@ -230,6 +231,9 @@ case $action in log) log "$1" ;; + show) + package_show_pkgbuild "$1" + ;; difflog) difflog "$1" ;; diff --git a/man/asp.1.txt b/man/asp.1.txt index 6bd2a76..5284d4a 100644 --- a/man/asp.1.txt +++ b/man/asp.1.txt @@ -69,6 +69,12 @@ The following commands are understood: *shortlog*:: Show a condensed revision history of the target. +*show*:: + Show the PKGBUILD of the target, which may be in the format 'package' or + 'repository/package'. If the repository is not specified, the PKGBUILD + will be shown at the most recent revision (which may be newer than what + is in the repositories). + *update*:: For each target, if the package is not known to the local repository, attempt to track it. If the package is tracked, update the package diff --git a/package.inc.sh b/package.inc.sh index 3f301c0..d382b41 100644 --- a/package.inc.sh +++ b/package.inc.sh @@ -70,6 +70,24 @@ package_log() { git log "${logargs[@]}" "$remote/packages/$pkgname" -- trunk/ } +package_show_pkgbuild() { + local pkgname=$1 remote repo subtree blob_id + + if [[ $pkgname = */* ]]; then + IFS=/ read -r repo pkgname <<<"$pkgname" + fi + + package_init "$pkgname" remote || return + + if [[ $repo ]]; then + subtree=repos/$repo-$OPT_ARCH + else + subtree=trunk + fi + + git show "remotes/$remote/packages/$pkgname":"$subtree"/PKGBUILD +} + package_export() { local pkgname=$1 remote repo arch local mode objtype objid path @@ -80,7 +98,6 @@ package_export() { package_init "$pkgname" remote || return 1 - # support $repo/$pkgname syntax if [[ $repo ]]; then subtree=repos/$repo-$OPT_ARCH else diff --git a/shell/bash-completion b/shell/bash-completion index 41708c3..cdd7f92 100644 --- a/shell/bash-completion +++ b/shell/bash-completion @@ -14,7 +14,7 @@ _asp() { # top level commands local -A verbs=( - [ALL_PACKAGES]='checkout difflog export list-arches list-repos log shortlog' + [ALL_PACKAGES]='checkout difflog export list-arches list-repos log shortlog show' [LOCAL_PACKAGES]='untrack update' [NONE]='disk-usage gc help list-all list-local' ) diff --git a/shell/zsh-completion b/shell/zsh-completion index e26718b..502044c 100644 --- a/shell/zsh-completion +++ b/shell/zsh-completion @@ -15,6 +15,7 @@ _asp_command() { 'list-repos' 'log' 'shortlog' + 'show' 'update' 'untrack' ) |