]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
start to apply changes from the huge TODO list
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 10 Nov 2006 22:32:38 +0000 (22:32 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 10 Nov 2006 22:32:38 +0000 (22:32 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@25 04377dda-e619-0410-9926-eae83683ac58

doc/CHANGELOG
lib/common.sh
src/jail-upgrade
src/simplaret

index d473559619c077026f62e73421e0d1d8e220ba46..258dcc8db395fd32ea5af3950959e97cdf1d9242 100644 (file)
@@ -5,6 +5,12 @@ simplepkg changelog
              - fix in swaret upgrade method
              - act recursively on patches' folder
 
+           simplaret:
+             - for --get, check if an already existing package
+               in the local repository has the same version and
+               build number, otherwise erase the old and download
+               the new one.
+
 0.4.9pre6: createpkg:
              - fixes
              - now with slackbuild error handling
index af31da3aaae64831d46cc35036df291ff6b570cb..5c9a4fac4ab9a73de105cad5b7a6ee20ec876e91 100644 (file)
@@ -55,6 +55,39 @@ function package_name {
   fi
 }
 
+function package_version {
+
+  # get VERSION from a package name
+  local file pack version
+  file="`basename $1`"
+  pack="`package_name $1`"
+  version="`echo $file | sed -e "s/^$pack//" | cut -d "-" -f 1`"
+  echo $version
+
+}
+
+function package_arch {
+
+  # get ARCH from a package name
+  local file pack arch
+  file="`basename $1`"
+  pack="`package_name $1`"
+  arch="`echo $file | sed -e "s/^$pack//" | cut -d "-" -f 2`"
+  echo $arch
+
+}
+
+function package_build {
+
+  # get BUILD from a package name
+  local file pack build
+  file="`basename $1`"
+  pack="`package_name $1`"
+  build="`echo $file | sed -e "s/^$pack//" | cut -d "-" -f 3`"
+  echo $build
+
+}
+
 function install_packages {
 
   if [[ "$SIMPLARET_CLEAN"  == "1" ]]; then
index c33180c5497406631609785d47a102f85c4190be..df6e01329b02c31109c750594f8396daa00a3235 100755 (executable)
@@ -108,14 +108,14 @@ elif [ -d "$JAIL_ROOT/$1" ]; then
   else
     echo error: jail $JAIL_ROOT/$1 dont looks like a slackware system
   fi
-# elif [ -f "$1" ]; then
-#  basename="`basename $1 tgz`"
-#  if [ "`basename $1 | sed -e "s/^$basename//"`" == "tgz" ]; then
-#    # TODO:
-#    # - descobrir a arquitetura do pacote
-#    # - atualizar nas jaulas de mesma arquitetura
-#    true
-#  fi
+ elif [ -f "$1" ]; then
+  basename="`basename $1 tgz`"
+  if [ "`basename $1 | sed -e "s/^$basename//"`" == "tgz" ]; then
+    arch="`package_arch $1`"
+    # TODO
+    # - atualizar nas jaulas de mesma arquitetura
+    true
+  fi
 else
   echo "error: jail $0 does not exist"
   exit 1
index cdcf430b84e524bf95c76f693b80efd69cb8e919..797c2d6eaaa047a79620551db59af6af8af4ff50 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# simplaret v0.1.1: simplepkg's package grabber
+# simplaret v0.1.1: simplepkg's retrieval tool
 # feedback: rhatto at riseup.net | gpl
 #
 #  Simplaret is free software; you can redistribute it and/or modify it under the
@@ -24,9 +24,9 @@
 #
 # config file repos.conf:
 #
-#   ROOT-i386="http://slack.sarava.org/packages/slackware"
+#   ROOT-i386="http://slack.sarava.org/packages/slackware/"
 #   REPOS-i386-10.2="slack.sarava.org%http://slack.sarava.org/packages/slackware/slackware-10.2/"
-#   ROOT-x86_64="http://darkstar.ist.utl.pt/pub/slamd64/"
+#   ROOT-x86_64="http://mirror1.slackadelic.com/slamd64/"
 #   REPOS-x86_64-10.2="slack.sarava.org%http://slack.sarava.org/packages/slamd64/slamd64-10.2/"
 #
 # usage:
@@ -303,12 +303,24 @@ function simplaret_purge {
 
 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
+
   # search for an already downloaded package
   for file in `find $STORAGE/$ARCH/$VERSION/ -name $1*tgz 2> /dev/null`; do
     candidate="`basename $file`"
     if [ "`package_name $candidate`" == "$1" ]; then
-      echo package $candidate already downloaded and stored at `dirname $file`
-      exit 0
+      # check if has the same version and build number, otherwise erase the old one
+      for result in `simplaret_search `basename $file tgz` --silent`; do
+       if [ "`package_name $candidate`" == "`package_name $result`" ] && \
+           [ "`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
+        else
+          rm $file
+        fi
+      done
     fi
   done