This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

rpg-status is now known as rpg-list

  • Loading branch information...
rtomayko committed Mar 17, 2010
1 parent 7dfdad8 commit b94a9ef212a79c17bf2814d8d5a63416235895a9
Showing with 61 additions and 53 deletions.
  1. +16 −18 Makefile
  2. +39 −26 rpg-status.sh → rpg-list.sh
  3. +5 −8 rpg-outdated.sh
  4. +1 −1 rpg-sync.sh
View
@@ -27,31 +27,29 @@ SHELL = /bin/sh
all:: build
SOURCES = \
- rpg-sh-setup.sh rpg.sh rpg-config.sh rpg-fetch.sh \
- rpg-install.sh rpg-version-test.sh rpg-uninstall.sh \
- rpg-build.sh rpg-env.sh rpg-sync.sh rpg-resolve.sh rpg-upgrade.sh \
- rpg-steal.sh rpg-fsck.sh rpg-status.sh rpg-outdated.sh \
+ rpg-sh-setup.sh rpg.sh rpg-config.sh rpg-fetch.sh rpg-install.sh \
+ rpg-version-test.sh rpg-uninstall.sh rpg-build.sh rpg-env.sh rpg-sync.sh \
+ rpg-resolve.sh rpg-upgrade.sh rpg-steal.sh rpg-fsck.sh rpg-outdated.sh \
rpg-package-register.sh rpg-package-install.sh rpg-solve.sh rpg-unpack.sh \
rpg-package-spec.rb rpg-parse-index.rb rpg-shit-list.sh rpg-prepare.sh \
- rpg-help.sh rpg-package-list.sh
+ rpg-help.sh rpg-package-list.sh rpg-list.sh
-USERPROGRAMS = rpg rpg-sh-setup
+DOCHTML = \
+ rpg-sh-setup.html rpg.html rpg-fetch.html rpg-version-test.html \
+ rpg-sync.html rpg-upgrade.html rpg-outdated.html \
+ rpg-package-install.html rpg-package-spec.html rpg-parse-index.html \
+ rpg-list.html
PROGRAMPROGRAMS = \
- rpg-config rpg-fetch \
- rpg-install rpg-version-test rpg-uninstall \
- rpg-build rpg-env rpg-sync rpg-resolve rpg-upgrade \
- rpg-steal rpg-fsck rpg-status rpg-outdated rpg-parse-package-list \
- rpg-package-register rpg-package-install rpg-solve rpg-unpack \
- rpg-package-spec rpg-parse-index rpg-shit-list rpg-prepare \
- rpg-complete rpg-help rpg-package-list
+ rpg-config rpg-fetch rpg-install rpg-version-test rpg-uninstall rpg-build \
+ rpg-env rpg-sync rpg-resolve rpg-upgrade rpg-steal rpg-fsck rpg-status \
+ rpg-outdated rpg-parse-package-list rpg-package-register rpg-package-install \
+ rpg-solve rpg-unpack rpg-package-spec rpg-parse-index rpg-shit-list \
+ rpg-prepare rpg-complete rpg-help rpg-package-list rpg-list
-PROGRAMS = $(USERPROGRAMS) $(PROGRAMPROGRAMS)
+USERPROGRAMS = rpg rpg-sh-setup
-DOCHTML = \
- rpg-sh-setup.html rpg.html rpg-fetch.html rpg-version-test.html \
- rpg-sync.html rpg-upgrade.html rpg-status.html rpg-outdated.html \
- rpg-package-install.html rpg-package-spec.html rpg-parse-index.html
+PROGRAMS = $(USERPROGRAMS) $(PROGRAMPROGRAMS)
.SUFFIXES: .sh .rb .html
@@ -1,5 +1,5 @@
#!/bin/sh
-# The `rpg-status` program compares installed packages to packages available
+# The `rpg-list` program compares installed packages to packages available
# in the remote repository. It's useful for determining the versions of
# packages and how they relate to same named packages available in the
# repository.
@@ -12,25 +12,29 @@ set -e
. rpg-sh-setup
ARGV="$@"
-USAGE '${PROGNAME} [-u] [-p] [<glob>...]
-Show status of installed packages vs available packages.
+USAGE '${PROGNAME} [-u] [-a] [-p|-s] [<glob>...]
+List installed and/or available packages.
-Options
- -a Include all packages, not just installed, packages
- -u Sync the available package index before running
- -p Generate more parseable output
+Passing one or more <glob>s filters the list to matching packages.
-Passing one or more <glob>s filters the list to matching packages.'
+Options
+ -a Include packages available but not installed
+ -u Sync the package index with remote repository first
+ -p Generate easily parseable output
+ -s Write package names only (no versions or status)'
sync=false
parsey=false
+simple=false
joiner=
-while getopts apu opt
+while getopts apus opt
do
case $opt in
a) joiner="-a2";;
u) sync=true;;
p) parsey=true;;
+ s) simple=true
+ parsey=true;;
?) helpthem;
exit 2;;
esac
@@ -90,8 +94,6 @@ else remotefilter="grep"
done
fi
-notice "remote filter: $remotefilter"
-
# Main Pipeline
# -------------
@@ -163,23 +165,34 @@ grep -v '. - - .' |
# All that's left is to read the output from `join` and apply some light
# formatting.
-while read package curvers recvers pdup
-do
- test "$package" = '-' &&
- package="$pdup"
+if $simple
+then
+ awk '{
+ if ( $1 != "-" ) {
+ print $1;
+ } else if ($4 != "-") {
+ print $4;
+ }
+ }'
+else
+ while read package curvers recvers pdup
+ do
+ test "$package" = '-' &&
+ package="$pdup"
- if test "$recvers" = '-'
- then sig="$st_missing"
+ if test "$recvers" = '-'
+ then sig="$st_missing"
- elif test "$curvers" = "-"
- then sig="$st_missing"
- curvers="-"
+ elif test "$curvers" = "-"
+ then sig="$st_missing"
+ curvers="-"
- elif test "$curvers" = "$recvers"
- then sig="$st_up2date"
+ elif test "$curvers" = "$recvers"
+ then sig="$st_up2date"
- else sig="$st_outdate"
- fi
+ else sig="$st_outdate"
+ fi
- printf "$st_format" "$sig" "$package" "$curvers" "$recvers"
-done
+ printf "$st_format" "$sig" "$package" "$curvers" "$recvers"
+ done
+fi
View
@@ -4,15 +4,12 @@ set -e
ARGV="$@"
USAGE '${PROGNAME} [-u] [<glob>...]
-List packages that can be upgraded.
+List locally packages that can be updated.
Options
-u Sync the available package index before running.'
-# rpg-status implements -u so just pass everything right on over.
-rpg-status -p "$@" |
-grep '^o' |
-while read _ package curvers newvers
-do
- echo "$package $curvers -> $newvers"
-done
+# `rpg-list` implements `-u` so just pass everything right on over.
+rpg-list "$@" |
+grep '^\*' |
+sed 's/..//'
View
@@ -11,7 +11,7 @@
# with the remote repository. If the command completes successfully,
# the index is guaranteed to be up to date with the repository.
#
-# 2. Some other rpg program (like `rpg-upgrade` or `rpg-status`) executes
+# 2. Some other rpg program (like `rpg-upgrade` or `rpg-list`) executes
# `rpg-sync -s` before performing an operation on the index. In this
# mode, `rpg-sync` attempts to determine if the index is overly stale
# (based on the `RPGSTALETIME` option) and may or may not perform an

0 comments on commit b94a9ef

Please sign in to comment.