Fix bug causing updates to fail on systems with multiple versions of a package installed
authorJ. Ali Harlow <ali@juiblex.co.uk>
Mon Sep 28 17:37:12 2009 +0100 (2009-09-28)
changeset 3863d3fab314c4e
parent 385 3cde352d3270
child 387 ef9237601f24
Fix bug causing updates to fail on systems with multiple versions of a package installed
librazor/transaction.c
test/update.sh
     1.1 --- a/librazor/transaction.c	Mon Sep 28 17:36:02 2009 +0100
     1.2 +++ b/librazor/transaction.c	Mon Sep 28 17:37:12 2009 +0100
     1.3 @@ -692,15 +692,18 @@
     1.4  		if (!prop_iter_seek_to(&ppi, RAZOR_PROPERTY_PROVIDES, name))
     1.5  			continue;
     1.6  
     1.7 +		if (any_provider_satisfies_requirement(&ppi,
     1.8 +						       RAZOR_PROPERTY_GREATER,
     1.9 +						       version)) {
    1.10 +			razor_transaction_remove_package(trans, p);
    1.11 +			continue;
    1.12 +		}
    1.13 +
    1.14  		pkg = pick_matching_provider(trans->upstream.set, &ppi,
    1.15  					     RAZOR_PROPERTY_GREATER, version);
    1.16  		if (pkg == NULL)
    1.17  			continue;
    1.18  
    1.19 -		fprintf(stderr, "updating %s-%s to %s-%s\n",
    1.20 -			name, version,
    1.21 -			&ppi.pool[pkg->name], &ppi.pool[pkg->version]);
    1.22 -
    1.23  		razor_transaction_remove_package(trans, p);
    1.24  		razor_transaction_install_package(trans, pkg);
    1.25  	}
     2.1 --- a/test/update.sh	Mon Sep 28 17:36:02 2009 +0100
     2.2 +++ b/test/update.sh	Mon Sep 28 17:37:12 2009 +0100
     2.3 @@ -86,4 +86,16 @@
     2.4  fs_check_file /opt/var/lib/zip/data.zap
     2.5  ../src/razor remove zip || exit 1
     2.6  fs_check_no_file /opt/var/lib/zip/data.zap
     2.7 +set_repository base
     2.8 +../src/razor import-yum || exit 1
     2.9 +../src/razor install --relocate /usr=/opt zip || exit 1
    2.10 +../src/razor install --relocate /usr=/opt zip || exit 1
    2.11 +set_repository updates
    2.12 +../src/razor import-yum || exit 1
    2.13 +../src/razor update --relocate /usr=/opt || exit 1
    2.14 +check_file /opt/bin/zip
    2.15 +fs_check_file_contents /opt/bin/zip zip-2-1
    2.16 +fs_check_file /opt/var/lib/zip/data.zap
    2.17 +../src/razor remove zip || exit 1
    2.18 +fs_check_no_file /opt/var/lib/zip/data.zap
    2.19  rm -rf "$RAZOR_ROOT"