summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-06-29 16:03:24 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-06-29 16:03:24 +0200
commit7975548c6d9a29995b75fc186ccd62e08e6b03a3 (patch)
tree48c338548cf76b9847db2f2f7e2dc83cd97d3ec2 /bin
parentb2fbd80cb1145ac42d7943eb1b8bd3fa643952b1 (diff)
bin/pkg: added lst_update and related functions
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pkg46
1 files 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