From: J. Ali Harlow Date: Thu, 1 Oct 2009 17:58:55 +0000 (+0100) Subject: Fix bug causing razor update foo to always install foo X-Git-Tag: 0.3~1 X-Git-Url: http://project.juiblex.co.uk/git/?a=commitdiff_plain;h=b98997a565439f7f8f23fe42cbd337bde24dfba0;p=razor.git Fix bug causing razor update foo to always install foo --- diff --git a/src/main.c b/src/main.c index 46d7704..8d5c097 100644 --- a/src/main.c +++ b/src/main.c @@ -951,6 +951,9 @@ command_install_or_update(int argc, const char *argv[], int do_update) 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 --git a/test/mult-install.sh b/test/mult-install.sh index a6e635c..a17ac4f 100755 --- a/test/mult-install.sh +++ b/test/mult-install.sh @@ -63,6 +63,14 @@ check_no_file() 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 @@ export YUM_URL="file://localhost/`pwd`" 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 --git a/test/update.sh b/test/update.sh index 3a2a421..0b74bed 100755 --- a/test/update.sh +++ b/test/update.sh @@ -63,6 +63,14 @@ check_no_file() 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 @@ set_repository base ../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"