summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/toru/toru-path39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/toru/toru-path b/src/toru/toru-path
index 07efb11..4dcb811 100755
--- a/src/toru/toru-path
+++ b/src/toru/toru-path
@@ -23,6 +23,34 @@
. "$(librelib messages)"
. "$(librelib conf)"
+usage() {
+ print 'Usage: [T=$TORUPATH] [V=true] [F=true] %q [-h]' "${0##*/}"
+ print 'Create/update the `$TORUPATH/paths.tch` database.'
+ echo
+ prose 'The file `%s` is a Tokyo Cabinet database a mapping between paths
+ to PKGBUILD files and `pkgname`s and `pkgbase`s. PKGBUILD files
+ are scanned for in `$ABSROOT` in each of `$REPOS`.' \
+ '$TORUPATH/paths.tch'
+ echo
+ prose 'Additionally, it creates a timestamp file at `%s`, so that skip
+ PKGBUILD files that have not changed since the previous
+ invocation.' \
+ '$TORUPATH/lastsync.paths'
+ echo
+ print 'Configuration:'
+ flag \
+ 'libretools.conf : TORUPATH' 'Where to store `paths.tch`' \
+ 'libretools.conf : REPOS' 'Which repositories to consider from `$ABSROOT`' \
+ 'abs.conf : ABSROOT' 'Where to find PKGBUILD files'
+ echo
+ print 'Options:'
+ flag \
+ 'T=$TORUPATH' 'Override libretools.conf:TORUPATH' \
+ 'V=true' 'Be verbose' \
+ 'F=true' 'Ignore timestamps; force re-scan all PKGBUILDs' \
+ '-h' 'Show this message'
+}
+
main() {
setup_traps
@@ -35,6 +63,15 @@ main() {
check_vars libretools TORUPATH REPOS || exit 1
load_files abs
check_vars abs ABSROOT || exit 1
+ # TODO: add an option to override/augment libretools.conf:REPOS
+ if [[ $# != 0 ]]; then
+ if [[ $# == 1 && "$1" == '-h' ]]; then
+ usage
+ return 0
+ fi
+ usage >&2
+ return 2
+ fi
if [ ! -w "$TORUPATH" ]; then
error "Toru's path isn't writable. Please check your TORUPATH: %q" "$TORUPATH"
@@ -48,8 +85,6 @@ main() {
tcamgr create "${pathfile}"
fi
- # TODO: ability to use flags to pass in other directories to fullrepos
-
local fullrepos=()
# This loops over ${REPOS[@]} backward. This is because early entries
# in REPOS have higher precidence, but the way this is implemented,