summaryrefslogtreecommitdiff
path: root/toru
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2012-01-21 11:12:01 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2012-01-21 11:12:01 -0300
commit918e09f1a47dc3d23440f08a91d91d31d62dcb5a (patch)
treeeffadb1e2c76d3e06975c92516647148ed9f420a /toru
parent0e9e94d70a0442e2c0aebdfb282269e90d688712 (diff)
parent971e5b7d0cd614e1be3a82380ef16911f2d9cefe (diff)
Merge branch 'master' into fauno
Conflicts: fullpkg toru
Diffstat (limited to 'toru')
-rwxr-xr-xtoru56
1 files changed, 46 insertions, 10 deletions
diff --git a/toru b/toru
index 55e4119..9616119 100755
--- a/toru
+++ b/toru
@@ -79,7 +79,7 @@ split_pkgname_from_pkgver() {
sed "s/^\(.\+\)-\([^-]\+-[^-]\+\)$/\1 \2/" $1
}
-# Get the fullpkgver
+# Get the fullpkgver
# pkgname from pkgver separator can be either '-' or ' '
extract_fullpkgver() {
echo "$@" | tr " " "\n" | sed "s/^.\+[ -]\([^-]\+-[^-]\+\)$/\1/"
@@ -248,23 +248,61 @@ missing() {
true
}
+## Finds a PKGBUILD on toru's path cache
+## usage: where_is <pkgname>
+# Look in all caches but pick the first one
+where_is() {
+ local _repo
+ local _path
+ for _repo in ${REPOS[@]}; do
+ _path=$(grep "^${1}:" "${TORUPATH}/${_repo}.paths.cache" 2>/dev/null |
+ cut -d: -f2)
+ [ -n "${_path}" ] && break
+ done
+
+ [ -z "$_path" ] && return 1
+
+ echo ${_path}
+}
+
+# TODO: clean usage instructions
+function usage {
+ echo ""
+ echo "$0 [options] repo1 ... repon"
+ echo ""
+ echo "Make a db containing PKGBUILD metadata."
+ echo ""
+ echo "-h : this message"
+# echo "-a : update all repos at once"
+ echo "-u : update repo information"
+ echo "-q : quiet"
+ echo "-f : rebuild the db even if it is updated"
+ echo "-p <pkgname>: return the path for pkgname"
+ echo ""
+ exit 1
+}
## MAIN
commands=()
repos=()
quiet=false
force=false
-while getopts 'hqfum' arg; do
+while getopts 'haqfpum' arg; do
case $arg in
- h) usage; exit 0 ;;
- q) quiet=true ;;
- f) force=true ;;
- u) commands+=(update);;
- m) commands+=(missing);;
+ h) usage; exit 0 ;;
+# TODO: Update all repos on $REPOS array
+# a) update_all_repos ;;
+ q) quiet=true ;;
+ f) force=true ;;
+ u) commands+=(update);;
+ p) shift $(( OPTIND - 1 ))
+ where_is "$1"
+ exit $?;;
+ m) commands+=(missing);;
esac
- shift $((OPTIND-1))
+ shift $(( OPTIND - 1 ))
done
@@ -274,6 +312,4 @@ TMPDIR=$(mktemp -d)
${commands[0]} ${@}
-#rm -rf ${TMPDIR}
-
exit $?