From dce177d9f929c18d5eb2b5164b18f92c701a0052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Wed, 21 Dec 2011 01:14:32 -0600 Subject: Some usage messages added --- toru | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'toru') diff --git a/toru b/toru index d622510..b71fb8c 100755 --- a/toru +++ b/toru @@ -15,9 +15,17 @@ source /etc/abs.conf source /etc/libretools.conf +# TODO: clean usage instructions +function usage { + echo "$0 [options] repo1 ... repon" + echo + echo "-h : this message" + exit 1 +} + if [ ! -w "$TORUPATH" ]; then error "Toru's path isn't writable. Please check $TORUPATH" - exit 1 + exit 1 fi # TODO move to common functions @@ -115,7 +123,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/" -- cgit v1.2.3-2-g168b From 69acc962f6277cf591125ba111716a7c5723e70e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sun, 25 Dec 2011 22:17:46 -0600 Subject: toru: -p flag for showing the path of some pkgname --- toru | 72 ++++++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 40 insertions(+), 32 deletions(-) (limited to 'toru') diff --git a/toru b/toru index b71fb8c..a054ddf 100755 --- a/toru +++ b/toru @@ -15,34 +15,11 @@ source /etc/abs.conf source /etc/libretools.conf -# TODO: clean usage instructions -function usage { - echo "$0 [options] repo1 ... repon" - echo - echo "-h : this message" - exit 1 -} - if [ ! -w "$TORUPATH" ]; then error "Toru's path isn't writable. Please check $TORUPATH" exit 1 fi -# TODO move to common functions -# usage : in_array( $needle, $haystack ) -function in_array { - [[ $2 ]] || return 1 # Not found - - local needle=$1; shift - local item - - for item in "$@"; do - [[ ${item#@} = $needle ]] && return 0 # Found - done - - return 1 # Not Found -} - # Stores the lastsync date lastsync() { local lastsyncfile @@ -290,23 +267,56 @@ missing() { true } +## Finds a PKGBUILD on toru's path cache +## usage: where_is +# 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 + echo ${_path} +} + +# TODO: clean usage instructions +function usage { + 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 : return the path for pkgname" + 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 ;; +# a) update_all_repos ;; + q) quiet=true ;; + f) force=true ;; + u) commands+=(update);; + p) shift $(( OPTIND - 1 )) + where_is "$1" + exit 0;; + m) commands+=(missing);; esac - shift $((OPTIND-1)) + shift $(( OPTIND - 1 )) done @@ -316,6 +326,4 @@ TMPDIR=$(mktemp -d) ${commands[0]} ${@} -#rm -rf ${TMPDIR} - exit $? -- cgit v1.2.3-2-g168b From fa0b7b6f8e45982f1e2317c386ef0cf49ee840c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Tue, 27 Dec 2011 20:07:08 -0600 Subject: libremakepkg: fixed conditionals toru: -p exit with 1 status if not found --- toru | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'toru') diff --git a/toru b/toru index a054ddf..5867bfe 100755 --- a/toru +++ b/toru @@ -280,11 +280,14 @@ where_is() { [ -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." @@ -295,6 +298,7 @@ function usage { echo "-q : quiet" echo "-f : rebuild the db even if it is updated" echo "-p : return the path for pkgname" + echo "" exit 1 } @@ -306,13 +310,14 @@ force=false while getopts 'haqfpum' arg; do case $arg in h) usage; exit 0 ;; -# a) update_all_repos ;; +# 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 0;; + exit $?;; m) commands+=(missing);; esac -- cgit v1.2.3-2-g168b