summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtoru-path5
-rwxr-xr-xtoru-utils5
-rwxr-xr-xtoru-where11
-rwxr-xr-xtreepkg13
4 files changed, 18 insertions, 16 deletions
diff --git a/toru-path b/toru-path
index 5065a30..9bfc3ff 100755
--- a/toru-path
+++ b/toru-path
@@ -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
diff --git a/toru-utils b/toru-utils
index 0818aa6..c0918ae 100755
--- a/toru-utils
+++ b/toru-utils
@@ -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 $?
diff --git a/treepkg b/treepkg
index 8dab83a..fcb9d29 100755
--- a/treepkg
+++ b/treepkg
@@ -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