diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2006-12-09 03:12:40 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2006-12-09 03:12:40 +0000 |
commit | c3553938395c02bca31251a0ca2b37eb8456e4f1 (patch) | |
tree | c42b8a84d816b03247a2b069ce65eb6204feae89 /src/simplaret | |
parent | 63cba8f988ab920b59d73d30787b831eaf555af1 (diff) | |
download | simplepkg-c3553938395c02bca31251a0ca2b37eb8456e4f1.tar.gz simplepkg-c3553938395c02bca31251a0ca2b37eb8456e4f1.tar.bz2 |
simplaret: rewritten simplaret_get using simplaret_search
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@45 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src/simplaret')
-rwxr-xr-x | src/simplaret | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/src/simplaret b/src/simplaret index f9b3c2f..a0e2a83 100755 --- a/src/simplaret +++ b/src/simplaret @@ -241,6 +241,8 @@ function simplaret_show_package { echo `basename $1` elif [ "$2" == "-filename-only" ]; then echo $1 + elif [ "$2" == "-formatted" ]; then + echo $1 $repos_type $repository else if echo $1 | grep -q "/patches/"; then patch="(patch)" @@ -270,6 +272,7 @@ function simplaret_search { if [ ! -f "$storage/$repository_name/FILELIST.TXT" ]; then if [ "$WARNING" != "0" ] || [ ! -z "$SILENT" ]; then + # TODO: message should also work for noarch repositories echo warning: no file list for $repository_name repository $repository_name on arch $ARCH version $VERSION echo please do a simplaret --update fi @@ -338,8 +341,6 @@ function simplaret_get { # TODO: with no parameters, update the existing packages at the local repo? # support to --get package-version-arch-build.tgz or just half the name - # ROOT_PRIORITY - # etc # first search for an already downloaded package for repos_type in patches root repos noarch; do @@ -366,38 +367,29 @@ function simplaret_get { done # then search for the package in the repositories - for repos_type in patches root repos noarch; do + for result in `simplaret_search $1 -formatted`; do - simplaret_set_storage_folder + file="`echo $result | awk '{ print $1 }'`" + repos_type="`echo $result | awk '{ print $2 }'`" + repository="`echo $result | awk '{ print $3 }'`" - for repository in `simplaret_repository $repos_type`; do + simplaret_set_storage_folder + simplaret_repository_name - simplaret_repository_name + candidate="`basename $file`" + if [ "`package_name $candidate`" == "$1" ]; then simplaret_repository_url - - if [ ! -f "$storage/FILELIST.TXT" ]; then - if [ "$WARNING" != "0" ] || [ ! -z "$SILENT" ]; then - # TODO: message should also work for noarch repositories - echo warning: no file list for $repos_type repository on arch $ARCH version $VERSION, please do a simplaret --update - fi + simplaret_download $repository_url $file $storage/$repository_name + if [ ! -f "$storage/$repository_name/$candidate" ]; then + echo error downloading $candidate from $repos_type repository $repository_url, please check your settings + exit 1 else - for file in `simplaret_find_package $1 $storage`; do - candidate="`basename $file`" - if [ "`package_name $candidate`" == "$1" ]; then - simplaret_download $repository_url $file $storage - if [ ! -f "$storage/$candidate" ]; then - echo error downloading $candidate from $repos_type repository $root_url, please check your settings - exit 1 - else - echo package $candidate stored at $STORAGE/$ARCH/$VERSION - simplaret_checksum $storage/CHECKSUMS.md5 $storage/$candidate - exit 0 - fi - fi - done + echo package $candidate stored at $storage/$repository_name + simplaret_checksum $storage/$repository_name/CHECKSUMS.md5 $storage/$repository_name/$candidate + exit 0 fi + fi - done done } |