From 632ec0d8518f1ee1b2af1eeae6a9d967dd26b16f Mon Sep 17 00:00:00 2001 From: rhatto Date: Sun, 30 Aug 2009 20:53:15 +0000 Subject: Attempt to fix #94 and #95 git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@811 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/simplaret | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'trunk/src/simplaret') diff --git a/trunk/src/simplaret b/trunk/src/simplaret index 04281f2..b981867 100755 --- a/trunk/src/simplaret +++ b/trunk/src/simplaret @@ -240,7 +240,11 @@ function simplaret_repository_url { if [ "$repos_type" == "root" ]; then simplaret_set_arch - repository_url="$repository_url/`basename $repository_url`-$VERSION/" + distro="`basename $repository_url`" + if [ "$ARCH" == "x86_64" && "$distro" == "slackware" ]; then + distro="slackware64" + fi + repository_url="$repository_url/$distro-$VERSION/" fi } @@ -294,9 +298,9 @@ function simplaret_find_package { # usage: simplaret_find_package if [ "$1" == "-all" ]; then - grep -e ".tgz$" $2/`simplaret_filelist` | awk '{ print $8 }' + grep -E -e "$(pkg_ext_grep .)$" $2/`simplaret_filelist` | awk '{ print $8 }' else - grep $1 $2/`simplaret_filelist` | awk '{ print $8 }' | grep -e ".tgz$" + grep $1 $2/`simplaret_filelist` | awk '{ print $8 }' | grep -E -e "$(pkg_ext_grep .)$" fi } @@ -465,7 +469,7 @@ function simplaret_purge { simplaret_set_storage_folder for file in `find $storage/ $mtime 2> /dev/null`; do - for extension in tgz asc meta txt slack-required; do + for extension in `pkg_ext` asc meta txt slack-required; do if echo $file | grep -qe ".$extension$"; then rm $file fi @@ -495,6 +499,7 @@ function simplaret_search_and_delete { # searching by full package filename name_version="`package_version $1`" name_build="`package_build $1`" + name_ext="`package_ext $1`" # search wheter the package filename is in the repositories if [ "`simplaret_search $1 | grep $1 | wc -l`" == "0" ]; then @@ -502,14 +507,16 @@ function simplaret_search_and_delete { return 1 fi - for file in `find $2/ -name $name*tgz 2> /dev/null`; do + for file in `find $2/ $(pkg_ext_find $name*) 2> /dev/null`; do candidate="`basename $file`" version="`package_version $candidate`" build="`package_build $candidate`" + ext="`package_ext $candidate`" if [ "`package_name $candidate`" == "$name" ]; then if [ "$name_version" == "$version" ] && \ - [ "$name_build" == "$build" ]; then + [ "$name_build" == "$build" ] && \ + [ "$name_ext" == "$ext" ]; then LAST_DOWNLOADED_PACKAGE="$file" if [ "$3" != "--silent" ]; then echo Package $candidate already downloaded @@ -521,7 +528,7 @@ function simplaret_search_and_delete { return 1 else place="`dirname $file`" - basename="`basename $file tgz`" + basename="`strip_pkg_ext $file`" rm -f $file rm -f $place/$candidate.slack-required rm -f $file.asc $place/$basename.meta $place/$basename.txt @@ -533,17 +540,19 @@ function simplaret_search_and_delete { else - for file in `find $2/ -name $name*tgz 2> /dev/null`; do + for file in `find $2/ $(pkg_ext_find $name*) 2> /dev/null`; do candidate="`basename $file`" version="`package_version $candidate`" build="`package_build $candidate`" + ext="`package_ext $candidate`" if [ "`package_name $candidate`" == "$name" ]; 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`" ]; then if [ "$version" == "`package_version $result`" ] && \ - [ "$build" == "`package_build $result`" ]; then + [ "$build" == "`package_build $result`" ] && \ + [ "$ext" == "`package_ext $result`" ]; then LAST_DOWNLOADED_PACKAGE="$file" if [ "$3" != "--silent" ]; then echo Package $candidate already downloaded @@ -555,7 +564,7 @@ function simplaret_search_and_delete { return 1 else place="`dirname $file`" - basename="`basename $file tgz`" + basename="`strip_pkg_ext $file`" rm -f $file rm -f $place/$candidate.slack-required rm -f $file.asc $place/$basename.meta $place/$basename.txt -- cgit v1.2.3