]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
simplaret: cleaned the code a bit
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 8 Dec 2006 17:56:46 +0000 (17:56 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 8 Dec 2006 17:56:46 +0000 (17:56 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@43 04377dda-e619-0410-9926-eae83683ac58

src/simplaret

index 88f59787938835e7e8967045867d5cc7e1631820..50eb5a72a3fa315fad1cb2c767b56bd7d46b639a 100755 (executable)
@@ -177,6 +177,17 @@ function simplaret_repository_url {
 
 }
 
+function simplaret_set_storage_folder {
+
+  storage="$STORAGE/$ARCH/$VERSION/$repos_type"
+  if [ "$repos_type" == "noarch" ]; then
+    storage="$STORAGE/noarch"
+  elif [ "$repos_type" == "patches" ]; then
+    storage="$PATCHES_DIR/$ARCH/$VERSION"
+  fi
+
+}
+
 function simplaret_update {
 
   local storage
@@ -188,13 +199,9 @@ function simplaret_update {
 
       simplaret_repository_name
       simplaret_repository_url
+      simplaret_set_storage_folder
 
-      storage="$STORAGE/$ARCH/$VERSION/$repos_type"
-      if [ "$repos_type" == "noarch" ]; then
-        storage="$STORAGE/noarch"
-      elif [ "$repos_type" == "patches" ]; then
-        storage="$PATCHES_DIR/$ARCH/$VERSION"
-      elif [ "$repost_type" == "root" ]; then
+      if [ "$repost_type" == "root" ]; then
         repository_url="$repository_url/$DISTRO_FOLDER/$EXTRA_FOLDER" 
       fi
 
@@ -253,13 +260,7 @@ function simplaret_search {
   for repos_type in patches root repos noarch; do
 
     name="`echo $repos_type | tr '[:lower:]' '[:upper:]'`"
-
-    storage="$STORAGE/$ARCH/$VERSION/$repos_type"
-    if [ "$repos_type" == "noarch" ]; then
-      storage="$STORAGE/noarch"
-    elif [ "$repos_type" == "patches" ]; then
-      storage="$PATCHES_DIR/$ARCH/$VERSION"
-    fi
+    simplaret_set_storage_folder
 
     for repository in `simplaret_repository $repos_type`; do
       
@@ -312,12 +313,7 @@ function simplaret_purge {
 
   for repos_type in patches root repos noarch; do
 
-    storage="$STORAGE/$ARCH/$VERSION/$repos_type"
-    if [ "$repos_type" == "noarch" ]; then
-      storage="$STORAGE/noarch"
-    elif [ "$repos_type" == "patches" ]; then
-      storage="$PATCHES_DIR/$ARCH/$VERSION"
-    fi
+    simplaret_set_storage_folder
 
     for file in `find $storage/ $mtime 2> /dev/null`; do
       for extension in tgz asc meta; do
@@ -338,7 +334,8 @@ function simplaret_purge {
 
 function simplaret_get {
 
-  # TODO: with no parameters, update the existing packages at the local repo?
+  # TODO: new repository format
+  #       with no parameters, update the existing packages at the local repo?
   #       support to --get package-version-arch-build.tgz or just half the name
   #       precedence: patches slackware repos noarch
   #       ROOT_PRIORITY
@@ -354,7 +351,7 @@ function simplaret_get {
            [ "`package_version $candidate`" == "`package_version $result`" ] && \
            [ "`package_build $candidate`" == "`package_build $result`" ]; then
           echo package $candidate already downloaded and stored at `dirname $file`
-          exit 0
+          return 0
         else
           rm $file
         fi