Fix bug causing razor update foo to always install foo
authorJ. Ali Harlow <ali@juiblex.co.uk>
Thu Oct 01 20:02:23 2009 +0100 (2009-10-01)
changeset 3894aac72ec4537
parent 388 6a6462ce8a08
child 390 297c6c8be2d1
Fix bug causing razor update foo to always install foo
src/main.c
test/mult-install.sh
test/update.sh
     1.1 --- a/src/main.c	Thu Oct 01 20:02:12 2009 +0100
     1.2 +++ b/src/main.c	Thu Oct 01 20:02:23 2009 +0100
     1.3 @@ -951,6 +951,9 @@
     1.4  	if (i == argc && do_update)
     1.5  		razor_transaction_update_all(trans);
     1.6  	for (; i < argc; i++) {
     1.7 +		if (do_update &&
     1.8 +		    mark_packages_for_update(trans, system, argv[i]))
     1.9 +			continue;
    1.10  		if (mark_packages_for_update(trans, upstream, argv[i]) == 0) {
    1.11  			fprintf(stderr, "no package matched %s\n", argv[i]);
    1.12  			razor_transaction_destroy(trans);
     2.1 --- a/test/mult-install.sh	Thu Oct 01 20:02:12 2009 +0100
     2.2 +++ b/test/mult-install.sh	Thu Oct 01 20:02:23 2009 +0100
     2.3 @@ -63,6 +63,14 @@
     2.4      fi
     2.5      fs_check_no_file $1
     2.6  }
     2.7 +check_install_count()
     2.8 +{
     2.9 +    count=`../src/razor list "$1" | wc -l`
    2.10 +    if [ "$count" != "$2" ]; then
    2.11 +	echo $1: Install count $count, should be $2 >&2
    2.12 +	exit 1
    2.13 +    fi
    2.14 +}
    2.15  export RAZOR_ROOT=`mktemp -dt` || exit 1
    2.16  ../src/razor init || exit 1
    2.17  export YUM_URL="file://localhost/`pwd`"
    2.18 @@ -71,5 +79,7 @@
    2.19  fs_check_file_contents /opt/bin/zip zip-1-1
    2.20  fs_check_file /opt/var/lib/zip/data.zap
    2.21  ../src/razor install --relocate /usr=/opt zip || exit 1
    2.22 +check_install_count zip 2
    2.23  ../src/razor install --relocate /usr=/opt zip || exit 1
    2.24 +check_install_count zip 3
    2.25  rm -rf "$RAZOR_ROOT"
     3.1 --- a/test/update.sh	Thu Oct 01 20:02:12 2009 +0100
     3.2 +++ b/test/update.sh	Thu Oct 01 20:02:23 2009 +0100
     3.3 @@ -63,6 +63,14 @@
     3.4      fi
     3.5      fs_check_no_file $1
     3.6  }
     3.7 +check_install_count()
     3.8 +{
     3.9 +    count=`../src/razor list "$1" | wc -l`
    3.10 +    if [ "$count" != "$2" ]; then
    3.11 +	echo $1: Install count $count, should be $2 >&2
    3.12 +	exit 1
    3.13 +    fi
    3.14 +}
    3.15  set_repository()
    3.16  {
    3.17      cp $1/repodata/primary.xml.gz $1/repodata/filelists.xml.gz .
    3.18 @@ -90,12 +98,19 @@
    3.19  ../src/razor import-yum || exit 1
    3.20  ../src/razor install --relocate /usr=/opt zip || exit 1
    3.21  ../src/razor install --relocate /usr=/opt zip || exit 1
    3.22 +check_install_count zip 2
    3.23  set_repository updates
    3.24  ../src/razor import-yum || exit 1
    3.25  ../src/razor update --relocate /usr=/opt || exit 1
    3.26  check_file /opt/bin/zip
    3.27  fs_check_file_contents /opt/bin/zip zip-2-1
    3.28  fs_check_file /opt/var/lib/zip/data.zap
    3.29 +check_install_count zip 1
    3.30  ../src/razor remove zip || exit 1
    3.31  fs_check_no_file /opt/var/lib/zip/data.zap
    3.32 +set_repository base
    3.33 +../src/razor import-yum || exit 1
    3.34 +../src/razor install --relocate /usr=/opt zip || exit 1
    3.35 +../src/razor update --relocate /usr=/opt zip || exit 1
    3.36 +check_install_count zip 1
    3.37  rm -rf "$RAZOR_ROOT"