]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
simplaret: rewritten simplaret_get using simplaret_search
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 9 Dec 2006 03:12:40 +0000 (03:12 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 9 Dec 2006 03:12:40 +0000 (03:12 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@45 04377dda-e619-0410-9926-eae83683ac58

src/simplaret

index f9b3c2f7118f629cec1d993b6d37bbc998171919..a0e2a8342e8091d21960b7c8c8778510a99e8b57 100755 (executable)
@@ -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
 
 }