From c892ac977939879070d366dd55caec4e0c8deec9 Mon Sep 17 00:00:00 2001 From: rhatto Date: Tue, 17 Apr 2007 01:01:27 +0000 Subject: doc update / simplaret support for --get and --install with full package filename git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@346 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/simplaret | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'trunk/src') diff --git a/trunk/src/simplaret b/trunk/src/simplaret index 00b0c25..419f048 100755 --- a/trunk/src/simplaret +++ b/trunk/src/simplaret @@ -487,18 +487,31 @@ function simplaret_search_and_delete { function simplaret_get { # get a package - # usage: simplaret_get [--silent] + # usage: simplaret_get [--silent] local silent generate_patches search search_results + local name version build # prevent user to stay in $storage cd + name="`package_name $1`" + + if [ "$name" != "$1" ]; then + # simplaret_get was called with the package file + # name and not with just the package name + version="`package_version $1`" + build="`package_build $1`" + else + version="" + build="" + fi + # first search for an already downloaded package for repos_type in patches root repos noarch; do simplaret_set_storage_folder - simplaret_search_and_delete $1 $storage $2 + simplaret_search_and_delete $name $storage $2 if [ "$?" == "1" ]; then return 0 @@ -507,7 +520,7 @@ function simplaret_get { done # then search for the package in the repositories - search="`simplaret_search $1 --formatted`" + search="`simplaret_search $name --formatted`" search_results="`echo "$search" | wc -l`" for result in $search; do @@ -523,7 +536,18 @@ function simplaret_get { simplaret_repository_name candidate="`basename $file`" - if [ "`package_name $candidate`" == "$1" ]; then + if [ "`package_name $candidate`" == "$name" ]; then + + if [ ! -z "$build" ] && [ ! -z "$version" ]; then + # simplaret_get was called with the package file + # name and not with just the package name + if [ "$version" != "`package_version $candidate`" ] && \ + [ "$build" != "`package_build $candidate`" ]; then + # the package version and/or build doesnt matched + # the desired one + continue + fi + simplaret_repository_url # if repos_type == root, the package is a patch and @@ -545,8 +569,8 @@ function simplaret_get { rm $folder/$candidate.asc fi - if [ -f "$folder/$1.slack-required" ]; then - rm $folder/$1.slack-required + if [ -f "$folder/$name.slack-required" ]; then + rm $folder/$name.slack-required fi # download the signature, if exist @@ -555,8 +579,8 @@ function simplaret_get { fi # download slack-required, if exist - if simplaret_check_url $repository_url/`dirname $file`/$1.slack-required; then - simplaret_download $repository_url `dirname $file`/$1.slack-required $folder + if simplaret_check_url $repository_url/`dirname $file`/$name.slack-required; then + simplaret_download $repository_url `dirname $file`/$name.slack-required $folder fi if [ ! -f "$folder/$candidate" ]; then @@ -824,9 +848,12 @@ function simplaret_checksum { function simplaret_install { # download and install a package - # usage: simplaret_install [--skip-checks] + # usage: simplaret_install [--skip-checks] local package root jail_arch jail_version slack_required dep dependency tmp + local name version build + + name="`package_name $1`" root="/$ROOT" mkdir -p $root/var/log/setup/tmp @@ -857,7 +884,7 @@ function simplaret_install { package="$LAST_DOWNLOADED_PACKAGE" if [ "$package" != "0" ] && [ ! -z "$package" ]; then - slack_required="`dirname $package`/$1.slack-required" + slack_required="`dirname $package`/$name.slack-required" if [ -f "$package" ]; then if [ -f "$slack_required" ] && [ "$DEPENDENCY_CHECKING" == "1" ]; then @@ -866,7 +893,7 @@ function simplaret_install { ( cat $slack_required | while read dep; do if [ ! -z "$dep" ]; then dependency="`echo $dep | awk '{ print $1 }'`" - simplaret_solve_dep $1 $dependency $root + simplaret_solve_dep $name $dependency $root fi true done ) -- cgit v1.2.3