From 7975548c6d9a29995b75fc186ccd62e08e6b03a3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 29 Jun 2008 16:03:24 +0200 Subject: bin/pkg: added lst_update and related functions --- bin/pkg | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/bin/pkg b/bin/pkg index 6380c84..702b532 100755 --- a/bin/pkg +++ b/bin/pkg @@ -120,6 +120,16 @@ confirm_no () { ## VCS Wrappers +vcs_to_lst () { + if ([ -d $1/.hg ]) { + echo -n "$1 hg " + hg -R $1 log | fgrep changeset | head -n 1 | cut -d ' ' -f 4 + } elif ([ -d $1/.git ]) { + echo -n "$1 git " + git --git-dir=$1/.git log | fgrep commit | head -n 1 | cut -d ' ' -f 2 + } +} + vcs_add () { cd "$PDIR" case $(lst_type "$1") in @@ -142,6 +152,30 @@ lst_type () { grep ^"$1" $PDIR/.list-remote | cut -d ' ' -f 2 } +lst_update_remote () { + if ([ "$PKG_PROTO" = 'ssh' ]) { + scp -q $PKG_HOST:$(echo $PKG_ROOT | cut -d / -f 4- | sed 's!~/!!')/.list .list-remote + } elif ([ "$PKG_PROTO" = 'file' ]) { + cp $PKG_ROOT/.list .list-remote + } +} + +lst_update_full () { + cd $PDIR + rm -f .list + for i in *(@,/); { + vcs_to_lst $i >> .list + } +} + +lst_update () { + cd $PDIR + info "Updating package list..." + lst_update_remote + lst_update_full + clear_line +} + vcs_upgrade () { [ -d .hg ] && {hg pull --update ; return} [ -d .git ] && {git pull ; return} @@ -333,18 +367,6 @@ pkg_remove () { info "Package removed.\n" } -lst_update () { - cd $PDIR - info "Updating package list..." - if ([ "$PKG_PROTO" = 'ssh' ]) { - scp -q $PKG_HOST:$(echo $PKG_ROOT | cut -d / -f 4- | sed 's!~/!!')/.list .list-remote - } elif ([ "$PKG_PROTO" = 'file' ]) { - cp $PKG_ROOT/.list .list-remote - } - core/include/pkglist $PDIR - clear_line -} - pkg_upgrade () { check_installed "$1" cd $PDIR/$1 -- cgit v1.2.3