# HG changeset patch # User J. Ali Harlow # Date 1254423743 -3600 # Node ID 4aac72ec4537f61bf7622031f24756a99e5ad501 # Parent 6a6462ce8a080c8d6efc91b5245e97bf5581665b Fix bug causing razor update foo to always install foo diff -r 6a6462ce8a08 -r 4aac72ec4537 src/main.c --- a/src/main.c Thu Oct 01 20:02:12 2009 +0100 +++ b/src/main.c Thu Oct 01 20:02:23 2009 +0100 @@ -951,6 +951,9 @@ if (i == argc && do_update) razor_transaction_update_all(trans); for (; i < argc; i++) { + if (do_update && + mark_packages_for_update(trans, system, argv[i])) + continue; if (mark_packages_for_update(trans, upstream, argv[i]) == 0) { fprintf(stderr, "no package matched %s\n", argv[i]); razor_transaction_destroy(trans); diff -r 6a6462ce8a08 -r 4aac72ec4537 test/mult-install.sh --- a/test/mult-install.sh Thu Oct 01 20:02:12 2009 +0100 +++ b/test/mult-install.sh Thu Oct 01 20:02:23 2009 +0100 @@ -63,6 +63,14 @@ fi fs_check_no_file $1 } +check_install_count() +{ + count=`../src/razor list "$1" | wc -l` + if [ "$count" != "$2" ]; then + echo $1: Install count $count, should be $2 >&2 + exit 1 + fi +} export RAZOR_ROOT=`mktemp -dt` || exit 1 ../src/razor init || exit 1 export YUM_URL="file://localhost/`pwd`" @@ -71,5 +79,7 @@ fs_check_file_contents /opt/bin/zip zip-1-1 fs_check_file /opt/var/lib/zip/data.zap ../src/razor install --relocate /usr=/opt zip || exit 1 +check_install_count zip 2 ../src/razor install --relocate /usr=/opt zip || exit 1 +check_install_count zip 3 rm -rf "$RAZOR_ROOT" diff -r 6a6462ce8a08 -r 4aac72ec4537 test/update.sh --- a/test/update.sh Thu Oct 01 20:02:12 2009 +0100 +++ b/test/update.sh Thu Oct 01 20:02:23 2009 +0100 @@ -63,6 +63,14 @@ fi fs_check_no_file $1 } +check_install_count() +{ + count=`../src/razor list "$1" | wc -l` + if [ "$count" != "$2" ]; then + echo $1: Install count $count, should be $2 >&2 + exit 1 + fi +} set_repository() { cp $1/repodata/primary.xml.gz $1/repodata/filelists.xml.gz . @@ -90,12 +98,19 @@ ../src/razor import-yum || exit 1 ../src/razor install --relocate /usr=/opt zip || exit 1 ../src/razor install --relocate /usr=/opt zip || exit 1 +check_install_count zip 2 set_repository updates ../src/razor import-yum || exit 1 ../src/razor update --relocate /usr=/opt || exit 1 check_file /opt/bin/zip fs_check_file_contents /opt/bin/zip zip-2-1 fs_check_file /opt/var/lib/zip/data.zap +check_install_count zip 1 ../src/razor remove zip || exit 1 fs_check_no_file /opt/var/lib/zip/data.zap +set_repository base +../src/razor import-yum || exit 1 +../src/razor install --relocate /usr=/opt zip || exit 1 +../src/razor update --relocate /usr=/opt zip || exit 1 +check_install_count zip 1 rm -rf "$RAZOR_ROOT"