diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-01-11 22:00:22 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-01-11 22:00:22 +0000 |
commit | b58e612715555d83f6a67343a852810c0450bc0d (patch) | |
tree | 36818f189536fd68273e772924f13f3da8a3bd54 /src | |
parent | 8936656efea31724ec5ba681f3cb7f6115d102c0 (diff) | |
download | simplepkg-b58e612715555d83f6a67343a852810c0450bc0d.tar.gz simplepkg-b58e612715555d83f6a67343a852810c0450bc0d.tar.bz2 |
simplaret: changing --upgrade behaviour
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@92 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src')
-rwxr-xr-x | src/simplaret | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/src/simplaret b/src/simplaret index d307726..62e9c82 100755 --- a/src/simplaret +++ b/src/simplaret @@ -425,7 +425,12 @@ function simplaret_get { candidate="`basename $file`" if [ "`package_name $candidate`" == "$1" ]; then simplaret_repository_url + + # TODO: if repos_type == root and the package is a patch, + # save it on $PATCHES_DIR/root-$root_name/ + simplaret_download $repository_url $file $storage/$repository_name + if [ ! -f "$storage/$repository_name/$candidate" ]; then if [ "$2" != "--silent" ]; then echo error downloading $candidate from $repos_type repository $repository_url, please check your settings @@ -439,6 +444,7 @@ function simplaret_get { simplaret_checksum $storage/$repository_name/CHECKSUMS.md5 $storage/$repository_name/$candidate --silent return $? fi + fi done @@ -447,7 +453,11 @@ function simplaret_get { function simplaret_search_and_download_patch { - local package_version package_build + local package_version package_build installed_version + local installed_build repos_type get + + # get the repository type + repos_type="`echo $sugested | cut -d , -f 2`" # get just the file name sugested="`echo $sugested | cut -d , -f 1`" @@ -469,12 +479,29 @@ function simplaret_search_and_download_patch { for installed in $installed_packs; do if [[ "$sugested" == "`package_name $installed.tgz`" ]]; then package_installed="1" + installed_version="`package_version $installed.tgz`" + installed_build="`package_build $installed.tgz`" break fi done # if the package is installed, download the patch - if [[ "$package_installed" == "1" ]]; then + if [ "$package_installed" == "1" ]; then + if [ "$repos_type" == "patches" ] || [ "$repos_type" == "root" ]; then + # TODO: DOWNLOAD_EVEN_APPLIED_PATCHES + get="yes" + else + # here, we're dealing with repositories other than ROOT and REPOS, + # so we need to check if either version or build number are different, + # otherwise all installed packages would be downloaded + if [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then + get="yes" + fi + fi + fi + + # finally, get the package + if [ "$get" == "yes" ]; then simplaret_get $sugested if [ "$?" == "0" ]; then DOWNLOADED_PATCHES="$DOWNLOADED_PATCHES $sugested " # the ending space is important @@ -483,7 +510,7 @@ function simplaret_search_and_download_patch { fi - unset package_installed + unset package_installed get } @@ -507,7 +534,7 @@ function simplaret_get_jail_patches { VERSION="`default_version`" ARCH="`default_arch`" - # TODO: remove it, forcing user to always do a simplaret --update? + # we need to do that for each arch/version pairs simplaret_update # in case there's something wrong with the jail, abort @@ -520,17 +547,14 @@ function simplaret_get_jail_patches { echo fetching patches for arch $ARCH and version $VERSION for jail $root - # list all available patches in PATCHES repositories + # list all available patches for sugested in `simplaret_search --formatted | grep patches`; do simplaret_search_and_download_patch done # grab patches from every other places if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "1" ]; then - # TODO: for sugested in `simplaret_search --formatted`; do - # and also think yet some more about this scheme... does ROOT/patches - # should be dealed as a PATCHES repository? - for sugested in `simplaret_search patches --formatted | grep -v patches`; do + for sugested in `simplaret_search --formatted | grep -v patches`; do simplaret_search_and_download_patch done fi |