summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-04-20 16:53:31 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-04-20 16:53:31 +0200
commitbe19b2565868a9d5c48bfa52ee6ba99a9ae494aa (patch)
tree559986fd3978b9166ef01f53b3318810d38ec4c9
parentf2bd9398dc450499817c80af1b878d5466277e42 (diff)
pkg: Moved all direct package list access into the list_ functions
-rwxr-xr-xbin/pkg18
1 files changed, 13 insertions, 5 deletions
diff --git a/bin/pkg b/bin/pkg
index 0f00ffb..4ec0499 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -298,6 +298,14 @@ function list_exists {
grep "^$1 " $PDIR/.list-remote &> /dev/null
}
+function list_packages_local {
+ cut -d ' ' -f 1 $PDIR/.list
+}
+
+function list_packages_remote {
+ cut -d ' ' -f 1 $PDIR/.list-remote
+}
+
function list_incoming {
[[ $(list_local_version $1) != $(list_remote_version $1) ]]
}
@@ -634,7 +642,7 @@ function wrap {
info "$1: "
}
cd $PDIR
- [[ -n $progress ]] && all=$(wc -l < $PDIR/.list)
+ [[ -n $progress ]] && all=$(list_packages_local | wc -l)
[[ -n $progress ]] && current=0
for i in *(-/); {
(( current++ ))
@@ -712,15 +720,15 @@ function pkg_list {
typeset package crap
case $1 in
''|local)
- cut -d ' ' -f 1 $PDIR/.list
+ list_packages_local
;;
all|remote)
- cut -d ' ' -f 1 $PDIR/.list-remote
+ list_packages_remote
;;
not-installed)
- while read package crap; do
+ for package in $(list_packages_remote); {
list_is_installed $package || echo $package
- done < $PDIR/.list-remote
+ }
;;
esac
}