Always open all three rzdb files when we're merging package sets.
authorKristian H?gsberg <krh@redhat.com>
Tue Jul 08 21:59:36 2008 -0400 (2008-07-08)
changeset 3151c52b84bfc33
parent 314 df5dc9230730
child 316 5ebed314390c
Always open all three rzdb files when we're merging package sets.
librazor/root.c
src/main.c
     1.1 --- a/librazor/root.c	Tue Jul 08 21:56:53 2008 -0400
     1.2 +++ b/librazor/root.c	Tue Jul 08 21:59:36 2008 -0400
     1.3 @@ -103,6 +103,7 @@
     1.4  razor_root_open(const char *root)
     1.5  {
     1.6  	struct razor_root *image;
     1.7 +	char details_path[PATH_MAX], files_path[PATH_MAX];
     1.8  
     1.9  	assert (root != NULL);
    1.10  
    1.11 @@ -130,8 +131,15 @@
    1.12  
    1.13  	snprintf(image->path, sizeof image->path,
    1.14  		 "%s%s/%s", root, razor_root_path, system_repo_filename);
    1.15 +	snprintf(details_path, sizeof details_path,
    1.16 +		 "%s%s/%s", root, razor_root_path, system_repo_details_filename);
    1.17 +	snprintf(files_path, sizeof files_path,
    1.18 +		 "%s%s/%s", root, razor_root_path, system_repo_files_filename);
    1.19 +
    1.20  	image->system = razor_set_open(image->path);
    1.21 -	if (image->system == NULL) {
    1.22 +	if (image->system == NULL ||
    1.23 +	    razor_set_open_details(image->system, details_path) ||
    1.24 +	    razor_set_open_files(image->system, files_path)) {
    1.25  		unlink(image->new_path);
    1.26  		close(image->fd);
    1.27  		free(image);
     2.1 --- a/src/main.c	Tue Jul 08 21:56:53 2008 -0400
     2.2 +++ b/src/main.c	Tue Jul 08 21:59:36 2008 -0400
     2.3 @@ -497,8 +497,15 @@
     2.4  	int i, errors;
     2.5  
     2.6  	set = razor_set_open(repo_filename);
     2.7 +	if (set == NULL ||
     2.8 +	    razor_set_open_details(set, "system-details.rzdb") ||
     2.9 +	    razor_set_open_files(set, "system-files.rzdb"))
    2.10 +		return 1;
    2.11 +
    2.12  	upstream = razor_set_open(rawhide_repo_filename);
    2.13 -	if (set == NULL || upstream == NULL)
    2.14 +	if (upstream == NULL ||
    2.15 +	    razor_set_open_details(upstream, "rawhide-details.rzdb") ||
    2.16 +	    razor_set_open_files(upstream, "rawhide-files.rzdb"))
    2.17  		return 1;
    2.18  
    2.19  	trans = razor_transaction_create(set, upstream);
    2.20 @@ -763,6 +770,14 @@
    2.21  
    2.22  	system = razor_root_get_system_set(root);
    2.23  	upstream = razor_set_open(rawhide_repo_filename);
    2.24 +	if (upstream == NULL ||
    2.25 +	    razor_set_open_details(upstream, "rawhide-details.rzdb") ||
    2.26 +	    razor_set_open_files(upstream, "rawhide-files.rzdb")) {
    2.27 +			fprintf(stderr, "couldn't open rawhide repo\n");
    2.28 +			razor_root_close(root);
    2.29 +			return 1;
    2.30 +	}		
    2.31 +
    2.32  	trans = razor_transaction_create(system, upstream);
    2.33  
    2.34  	for (; i < argc; i++) {