From a13a9b7f7cbf2dfa23483caf61cb4d236d88d1ea Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 8 Dec 2006 17:56:46 +0000 Subject: simplaret: cleaned the code a bit git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@43 04377dda-e619-0410-9926-eae83683ac58 --- src/simplaret | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/simplaret b/src/simplaret index 88f5978..50eb5a7 100755 --- a/src/simplaret +++ b/src/simplaret @@ -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 -- cgit v1.2.3