aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-01-12 19:14:50 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-01-12 19:14:50 +0000
commit7d1656abad164e3af66b87b64bd09ee70e133131 (patch)
tree6946d937efa67a58526dfb4ce7430783b03e28e5 /src
parent5f057cf540b6946a53ee76b9bf8e0c2cf82bdc41 (diff)
downloadsimplepkg-7d1656abad164e3af66b87b64bd09ee70e133131.tar.gz
simplepkg-7d1656abad164e3af66b87b64bd09ee70e133131.tar.bz2
simplaret: new function simplaret_search_and_delete fix simplaret_get behaviour for patches stored in ROOT repositories
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@100 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src')
-rwxr-xr-xsrc/simplaret52
1 files changed, 32 insertions, 20 deletions
diff --git a/src/simplaret b/src/simplaret
index 83d2ea9..03af06c 100755
--- a/src/simplaret
+++ b/src/simplaret
@@ -381,6 +381,31 @@ function simplaret_purge {
}
+function simplaret_search_and_delete {
+
+ for file in `find $2/ -name $1*tgz 2> /dev/null`; do
+ candidate="`basename $file`"
+ if [ "`package_name $candidate`" == "$1" ]; then
+ # check if has the same version and build number, otherwise erase the old one
+ for result in `simplaret_search $(package_name $candidate) --basename-only`; do
+ if [ "`package_name $candidate`" == "`package_name $result`" ] && \
+ [ "`package_version $candidate`" == "`package_version $result`" ] && \
+ [ "`package_build $candidate`" == "`package_build $result`" ]; then
+ if [ "$2" != "--silent" ]; then
+ echo package $candidate already downloaded and stored at `dirname $file`
+ else echo $file
+ fi
+ return 0
+ else
+ rm $file
+ break
+ fi
+ done
+ fi
+ done
+
+}
+
function simplaret_get {
# get a package
@@ -395,27 +420,14 @@ function simplaret_get {
for repos_type in patches root repos noarch; do
simplaret_set_storage_folder
+ simplaret_search_and_delete $1 $storage
- for file in `find $storage/ -name $1*tgz 2> /dev/null`; do
- candidate="`basename $file`"
- if [ "`package_name $candidate`" == "$1" ]; then
- # check if has the same version and build number, otherwise erase the old one
- for result in `simplaret_search $(package_name $candidate) --basename-only`; do
- if [ "`package_name $candidate`" == "`package_name $result`" ] && \
- [ "`package_version $candidate`" == "`package_version $result`" ] && \
- [ "`package_build $candidate`" == "`package_build $result`" ]; then
- if [ "$2" != "--silent" ]; then
- echo package $candidate already downloaded and stored at `dirname $file`
- else echo $file
- fi
- return 0
- else
- rm $file
- break
- fi
- done
- fi
- done
+ # if repos_type == root, check also if
+ # there is a package on $PATCHES_DIR/root-$repository_name
+ if [ "$repos_type" == "root" ]; then
+ simplaret_repository_name
+ simplaret_search_and_delete $1 $PATCHES_DIR/$ARCH/$VERSION/root-$repository_name
+ fi
done