diff options
author | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2012-08-15 15:25:59 -0300 |
---|---|---|
committer | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2012-08-15 15:25:59 -0300 |
commit | fe138085ad889447942f03b969f1a3abb862cb8a (patch) | |
tree | 782e71f1b32b822135031317fa69ffd021935e7b | |
parent | 0a7e0e2866dd5a3b8c794b1aefcec58c15cbe9df (diff) |
Toru-where is an utility to find PKGBUILD dirs on toru's path cache
Use with toru-path
-rwxr-xr-x | toru-path | 5 | ||||
-rwxr-xr-x | toru-utils | 5 | ||||
-rwxr-xr-x | toru-where | 11 | ||||
-rwxr-xr-x | treepkg | 13 |
4 files changed, 18 insertions, 16 deletions
@@ -2,6 +2,11 @@ source $(dirname $(command -v $0))/toru-utils +if [ ! -w "$TORUPATH" ]; then + error "Toru's path isn't writable. Please check $TORUPATH" + exit 1 +fi + LASTSYNCFILE=${TORUPATH}/lastsync.paths # TODO pass other paths via flags @@ -5,11 +5,6 @@ source /etc/abs.conf source /etc/libretools.conf -if [ ! -w "$TORUPATH" ]; then - error "Toru's path isn't writable. Please check $TORUPATH" - exit 1 -fi - LASTSYNCFILE=${TORUPATH}/lastsync FORCE=false QUIET=false diff --git a/toru-where b/toru-where new file mode 100755 index 0000000..02a7a88 --- /dev/null +++ b/toru-where @@ -0,0 +1,11 @@ +#!/bin/bash +# Locates a PKGBUILD dir on toru's path cache + +source $(dirname $(command -v $0))/toru-utils + +# Look in all cached but pick the last one +grep "^${1}:" "${TORUPATH}/paths" 2>/dev/null| \ + tail -n1 2>/dev/null|\ + cut -d: -f2 2>/dev/null + +exit $? @@ -81,17 +81,8 @@ bury() { } || return 1 } -# Finds a PKGBUILD on toru's path cache -# Look in all caches but pick the first one -# TODO move to a toru flag (-p?) -where_is() { - grep "^${1}:" "${TORUPATH}/paths" 2>/dev/null| \ - tail -n1 2>/dev/null|\ - cut -d: -f2 2>/dev/null -} - # Guess the repo from the pkgbase path -# $1 path, pwd or where_is +# $1 path, pwd or toru-where guess_repo() { basename "$(dirname "${1}")" } @@ -176,7 +167,7 @@ if ! ${BUILDNOW}; then egrep -q ";${_dep};" "${BUILDORDER}" && bury "${_dep}" ${NEXTDEPTH} # Ask toru where's a PKGBUILD - depdir="$(where_is ${_dep})" + depdir="$(toru-where ${_dep})" if [ -z "${depdir}" -o ! -d "${depdir}" ]; then # We specify the pkgname because we can't source the dep PKGBUILD |