aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-12-09 00:58:50 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-12-09 00:58:50 +0000
commit63cba8f988ab920b59d73d30787b831eaf555af1 (patch)
treef843fdfbe3500d378b853971fbdec0beaa3845f6 /src
parenta13a9b7f7cbf2dfa23483caf61cb4d236d88d1ea (diff)
downloadsimplepkg-63cba8f988ab920b59d73d30787b831eaf555af1.tar.gz
simplepkg-63cba8f988ab920b59d73d30787b831eaf555af1.tar.bz2
simplaret: simplaret_get converted to the new repository scheme
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@44 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src')
-rwxr-xr-xsrc/simplaret124
1 files changed, 58 insertions, 66 deletions
diff --git a/src/simplaret b/src/simplaret
index 50eb5a7..f9b3c2f 100755
--- a/src/simplaret
+++ b/src/simplaret
@@ -186,6 +186,10 @@ function simplaret_set_storage_folder {
storage="$PATCHES_DIR/$ARCH/$VERSION"
fi
+ if [ "$repost_type" == "root" ]; then
+ repository_url="$repository_url/$DISTRO_FOLDER/$EXTRA_FOLDER"
+ fi
+
}
function simplaret_update {
@@ -195,15 +199,13 @@ function simplaret_update {
echo updating package information for arch $ARCH and version $VERSION...
for repos_type in patches root repos noarch; do
+
+ simplaret_set_storage_folder
+
for repository in `simplaret_repository $repos_type`; do
simplaret_repository_name
simplaret_repository_url
- simplaret_set_storage_folder
-
- if [ "$repost_type" == "root" ]; then
- repository_url="$repository_url/$DISTRO_FOLDER/$EXTRA_FOLDER"
- fi
if [ ! -d "$storage/$repository_name" ]; then
mkdir -p $storage/$repository_name
@@ -334,78 +336,68 @@ function simplaret_purge {
function simplaret_get {
- # TODO: new repository format
- # with no parameters, update the existing packages at the local repo?
+ # 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
- # precedence: patches slackware repos noarch
# ROOT_PRIORITY
# etc
- # 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
- # check if has the same version and build number, otherwise erase the old one
- for result in `simplaret_search `basename $file tgz` -basename-only`; 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`
- return 0
- else
- rm $file
- fi
- done
- fi
- done
+ # first search for an already downloaded package
+ for repos_type in patches root repos noarch; do
- # first search for the package in the root repository
- if [ ! -f "$STORAGE/$ARCH/$VERSION/FILELIST.TXT" ]; then
- if [ "$WARNING" != "0" ] || [ ! -z "$SILENT" ]; then
- echo warning: no file list for root repository on arch $ARCH version $VERSION, please do a simplaret --update
- fi
- else
- for file in `simplaret_find_package $1 $STORAGE/$ARCH/$VERSION`; do
+ simplaret_set_storage_folder
+
+ for file in `find $storage/ -name $1*tgz 2> /dev/null`; do
candidate="`basename $file`"
if [ "`package_name $candidate`" == "$1" ]; then
- simplaret_root_url
- simplaret_download $root_url/$DISTRO_FOLDER/$EXTRA_FOLDER $file $STORAGE/$ARCH/$VERSION
- if [ ! -f "$STORAGE/$ARCH/$VERSION/$candidate" ]; then
- echo error downloading $candidate from root repository $root_url, please check your settings
- exit 1
- else
- echo package $candidate stored at $STORAGE/$ARCH/$VERSION
- simplaret_checksum $STORAGE/$ARCH/$VERSION/CHECKSUMS.md5 $STORAGE/$ARCH/$VERSION/$candidate
- exit 0
- fi
+ # check if has the same version and build number, otherwise erase the old one
+ for result in `simplaret_search `basename $file tgz` -basename-only`; 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`
+ return 0
+ else
+ rm $file
+ fi
+ done
fi
done
- fi
- # then search for the package in contrib repos
- for repos in `simplaret_repository repos`; do
- simplaret_repos_name
- simplaret_repos_url
- if [ ! -f "$STORAGE/$ARCH/$VERSION/$repos_name/FILELIST.TXT" ]; then
- if [ "$WARNING" != "0" ] || [ ! -z "$SILENT" ]; then
- echo warning: no file list for $repos_name repository on arch $ARCH version $VERSION, please do a simplaret --update
- fi
- else
- for file in `simplare_find_package $1 $STORAGE/$ARCH/$VERSION/$repos_name`; do
- candidate="`basename $file`"
- if [ "`package_name $candidate`" == "$1" ]; then
- simplaret_download $repos_url $file $STORAGE/$ARCH/$VERSION/$repos_name
- if [ ! -f "$STORAGE/$ARCH/$VERSION/$repos_name/$candidate" ]; then
- echo error downloading $candidate from repository $repos_url, please check your settings
- echo will try to fetch from the next repo, if exists...
- else
- echo package $candidate stored at $STORAGE/$ARCH/$VERSION/$repos_name
- simplaret_checksum $STORAGE/$ARCH/$VERSION/$repos_name/CHECKSUMS.md5 $STORAGE/$ARCH/$VERSION/$repos_name/$candidate
- exit 0
- fi
+ done
+
+ # then search for the package in the repositories
+ for repos_type in patches root repos noarch; do
+
+ simplaret_set_storage_folder
+
+ for repository in `simplaret_repository $repos_type`; do
+
+ simplaret_repository_name
+ 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
- done
- fi
+ 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
+ fi
+
+ done
done
}