Go back to having all info in one rzdb file.
We can still split the rzdb file into a main file and a file data and a details file, but that's only for optimizing the required download size. On the system we always combine the parts back into one rzdb file once downloaded.
committer: J. Ali Harlow <ali@juiblex.co.uk>
1.1 --- a/librazor/razor-internal.h Fri Jul 03 18:02:33 2009 +0100
1.2 +++ b/librazor/razor-internal.h Fri Jul 03 19:06:29 2009 +0100
1.3 @@ -37,8 +37,8 @@
1.4 #endif
1.5
1.6 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
1.7 -#define ALIGN(value, base) (((value) + (base - 1)) & ~((base) - 1))
1.8 -
1.9 +#define PADDING(value, base) (-(value) & (base - 1))
1.10 +#define ALIGN(value, base) ((value) + PADDING(value, base))
1.11 void *zalloc(size_t size);
1.12
1.13 struct razor_set_section {
1.14 @@ -118,15 +118,7 @@
1.15 struct array prefix_pool;
1.16 struct array file_string_pool;
1.17 struct array details_string_pool;
1.18 -
1.19 - struct razor_set_header *header;
1.20 - size_t header_size;
1.21 -
1.22 - struct razor_set_header *details_header;
1.23 - size_t details_header_size;
1.24 -
1.25 - struct razor_set_header *files_header;
1.26 - size_t files_header_size;
1.27 + struct razor_mapped_file *mapped_files;
1.28 };
1.29
1.30 struct import_entry {
2.1 --- a/librazor/razor.c Fri Jul 03 18:02:33 2009 +0100
2.2 +++ b/librazor/razor.c Fri Jul 03 19:06:29 2009 +0100
2.3 @@ -59,25 +59,27 @@
2.4 struct razor_set_section_index {
2.5 const char *name;
2.6 uint32_t offset;
2.7 + uint32_t flags;
2.8 };
2.9
2.10 +#define MAIN(type, field) \
2.11 + { type, offsetof(struct razor_set, field), RAZOR_SECTION_MAIN }
2.12 +#define FILES(type, field) \
2.13 + { type, offsetof(struct razor_set, field), RAZOR_SECTION_FILES }
2.14 +#define DETAILS(type, field) \
2.15 + { type, offsetof(struct razor_set, field), RAZOR_SECTION_DETAILS }
2.16 +
2.17 struct razor_set_section_index razor_sections[] = {
2.18 - { RAZOR_STRING_POOL, offsetof(struct razor_set, string_pool) },
2.19 - { RAZOR_PACKAGES, offsetof(struct razor_set, packages) },
2.20 - { RAZOR_PROPERTIES, offsetof(struct razor_set, properties) },
2.21 - { RAZOR_PACKAGE_POOL, offsetof(struct razor_set, package_pool) },
2.22 - { RAZOR_PROPERTY_POOL, offsetof(struct razor_set, property_pool) },
2.23 - { RAZOR_PREFIX_POOL, offsetof(struct razor_set, prefix_pool) },
2.24 -};
2.25 -
2.26 -struct razor_set_section_index razor_files_sections[] = {
2.27 - { RAZOR_FILES, offsetof(struct razor_set, files) },
2.28 - { RAZOR_FILE_POOL, offsetof(struct razor_set, file_pool) },
2.29 - { RAZOR_FILE_STRING_POOL, offsetof(struct razor_set, file_string_pool) },
2.30 -};
2.31 -
2.32 -struct razor_set_section_index razor_details_sections[] = {
2.33 - { RAZOR_DETAILS_STRING_POOL, offsetof(struct razor_set, details_string_pool) },
2.34 + MAIN(RAZOR_STRING_POOL, string_pool),
2.35 + MAIN(RAZOR_PACKAGES, packages),
2.36 + MAIN(RAZOR_PROPERTIES, properties),
2.37 + MAIN(RAZOR_PACKAGE_POOL, package_pool),
2.38 + MAIN(RAZOR_PROPERTY_POOL, property_pool),
2.39 + MAIN(RAZOR_PREFIX_POOL, prefix_pool),
2.40 + FILES(RAZOR_FILES, files),
2.41 + FILES(RAZOR_FILE_POOL, file_pool),
2.42 + FILES(RAZOR_FILE_STRING_POOL, file_string_pool),
2.43 + DETAILS(RAZOR_DETAILS_STRING_POOL, details_string_pool)
2.44 };
2.45
2.46 RAZOR_EXPORT struct razor_set *
2.47 @@ -111,37 +113,47 @@
2.48 return set;
2.49 }
2.50
2.51 -static int
2.52 -razor_set_bind_sections(struct razor_set *set,
2.53 - struct razor_set_header **header,
2.54 - size_t *header_size,
2.55 - struct razor_set_section_index section_index[],
2.56 - int section_index_size,
2.57 - const char *filename)
2.58 +struct razor_mapped_file {
2.59 + struct razor_set_header *header;
2.60 + size_t size;
2.61 + struct razor_mapped_file *next;
2.62 +};
2.63 +
2.64 +RAZOR_EXPORT int
2.65 +razor_set_bind_sections(struct razor_set *set, const char *filename)
2.66 {
2.67 struct razor_set_section *s, *sections;
2.68 + struct razor_mapped_file *file;
2.69 + const char *pool;
2.70 struct array *array;
2.71 - const char *pool;
2.72 - int i;
2.73 + int i, j;
2.74
2.75 - *header = razor_file_get_contents(filename, header_size);
2.76 - if (!*header)
2.77 + file = zalloc(sizeof *file);
2.78 + if (file == NULL)
2.79 return -1;
2.80
2.81 - sections = (void *) *header + sizeof **header;
2.82 - pool = (void *) sections + (*header)->num_sections * sizeof *sections;
2.83 + file->header = razor_file_get_contents(filename, &file->size);
2.84 + if (!file->header) {
2.85 + free(file);
2.86 + return -1;
2.87 + }
2.88
2.89 - for (i = 0; i < (*header)->num_sections; i++) {
2.90 - int j;
2.91 + file->next = set->mapped_files;
2.92 + set->mapped_files = file;
2.93 +
2.94 + sections = (void *) file->header + sizeof *file->header;
2.95 + pool = (void *) sections +
2.96 + file->header->num_sections * sizeof *sections;
2.97 +
2.98 + for (i = 0; i < file->header->num_sections; i++) {
2.99 s = sections + i;
2.100 - for (j = 0; j < section_index_size; j++)
2.101 - if (!strcmp(section_index[j].name,
2.102 - &pool[s->name]))
2.103 + for (j = 0; j < ARRAY_SIZE(razor_sections); j++)
2.104 + if (!strcmp(razor_sections[j].name, &pool[s->name]))
2.105 break;
2.106 - if (j == section_index_size)
2.107 + if (j == ARRAY_SIZE(razor_sections))
2.108 continue;
2.109 - array = (void *) set + section_index[j].offset;
2.110 - array->data = (void *) *header + s->offset;
2.111 + array = (void *) set + razor_sections[j].offset;
2.112 + array->data = (void *) file->header + s->offset;
2.113 array->size = s->size;
2.114 array->alloc = s->size;
2.115 }
2.116 @@ -155,149 +167,93 @@
2.117 struct razor_set *set;
2.118
2.119 set = zalloc(sizeof *set);
2.120 - if (razor_set_bind_sections(set, &set->header, &set->header_size,
2.121 - razor_sections, ARRAY_SIZE(razor_sections),
2.122 - filename)){
2.123 + if (razor_set_bind_sections(set, filename)){
2.124 free(set);
2.125 return NULL;
2.126 }
2.127 return set;
2.128 }
2.129
2.130 -RAZOR_EXPORT int
2.131 -razor_set_open_details(struct razor_set *set, const char *filename)
2.132 -{
2.133 - return razor_set_bind_sections(set, &set->details_header,
2.134 - &set->details_header_size,
2.135 - razor_details_sections,
2.136 - ARRAY_SIZE(razor_details_sections),
2.137 - filename);
2.138 -}
2.139 -
2.140 -RAZOR_EXPORT int
2.141 -razor_set_open_files(struct razor_set *set, const char *filename)
2.142 -{
2.143 - return razor_set_bind_sections(set, &set->files_header,
2.144 - &set->files_header_size,
2.145 - razor_files_sections,
2.146 - ARRAY_SIZE(razor_files_sections),
2.147 - filename);
2.148 -}
2.149 -
2.150 RAZOR_EXPORT void
2.151 razor_set_destroy(struct razor_set *set)
2.152 {
2.153 - struct array *a;
2.154 + struct razor_mapped_file *file, *next;
2.155 + struct array *array;
2.156 int i;
2.157
2.158 assert (set != NULL);
2.159
2.160 - if (set->header) {
2.161 - razor_file_free_contents(set->header, set->header_size);
2.162 + if (set->mapped_files == NULL) {
2.163 + for (i = 0; i < ARRAY_SIZE(razor_sections); i++) {
2.164 + array = (void *) set + razor_sections[i].offset;
2.165 + array_release(array);
2.166 + }
2.167 } else {
2.168 - for (i = 0; i < ARRAY_SIZE(razor_sections); i++) {
2.169 - a = (void *) set + razor_sections[i].offset;
2.170 - free(a->data);
2.171 - }
2.172 - }
2.173 -
2.174 - if (set->details_header) {
2.175 - razor_file_free_contents(set->details_header,
2.176 - set->details_header_size);
2.177 - } else {
2.178 - for (i = 0; i < ARRAY_SIZE(razor_details_sections); i++) {
2.179 - a = (void *) set + razor_details_sections[i].offset;
2.180 - free(a->data);
2.181 - }
2.182 - }
2.183 -
2.184 - if (set->files_header) {
2.185 - razor_file_free_contents(set->files_header,
2.186 - set->files_header_size);
2.187 - } else {
2.188 - for (i = 0; i < ARRAY_SIZE(razor_files_sections); i++) {
2.189 - a = (void *) set + razor_files_sections[i].offset;
2.190 - free(a->data);
2.191 + for (file = set->mapped_files; file != NULL; file = next) {
2.192 + next = file->next;
2.193 + razor_file_free_contents(file->header, file->size);
2.194 + free(file);
2.195 }
2.196 }
2.197
2.198 free(set);
2.199 }
2.200
2.201 -static int
2.202 -razor_set_write_sections_to_fd(struct razor_set *set, int fd,
2.203 - struct razor_set_section_index *sections,
2.204 - size_t array_size)
2.205 +RAZOR_EXPORT int
2.206 +razor_set_write_to_fd(struct razor_set *set, int fd, uint32_t section_mask)
2.207 {
2.208 struct razor_set_header header;
2.209 - struct razor_set_section *out_sections =
2.210 - malloc(array_size * sizeof *out_sections);
2.211 + struct razor_set_section sections[ARRAY_SIZE(razor_sections)];
2.212 struct hashtable table;
2.213 - struct array *a, pool;
2.214 + struct array pool, *arrays[ARRAY_SIZE(razor_sections)];
2.215 uint32_t offset;
2.216 - int i;
2.217 -
2.218 - header.magic = RAZOR_MAGIC;
2.219 - header.version = RAZOR_VERSION;
2.220 - header.num_sections = array_size;
2.221 - offset = sizeof header + array_size * sizeof *out_sections;
2.222 + int count, i, j;
2.223 + static const char padding[4];
2.224
2.225 array_init(&pool);
2.226 hashtable_init(&table, &pool);
2.227
2.228 - for (i = 0; i < array_size; i++)
2.229 - out_sections[i].name =
2.230 - hashtable_tokenize(&table, sections[i].name);
2.231 + j = 0;
2.232 + for (i = 0; i < ARRAY_SIZE(razor_sections); i++) {
2.233 + if ((razor_sections[i].flags & section_mask) == 0)
2.234 + continue;
2.235
2.236 - offset += pool.size;
2.237 + arrays[j] = (void *) set + razor_sections[i].offset;
2.238 + sections[j].name =
2.239 + hashtable_tokenize(&table, razor_sections[i].name);
2.240 + j++;
2.241 + }
2.242
2.243 - for (i = 0; i < array_size; i++) {
2.244 - a = (void *) set + sections[i].offset;
2.245 - out_sections[i].offset = offset;
2.246 - out_sections[i].size = a->size;
2.247 - offset += a->size;
2.248 + count = j;
2.249 + header.magic = RAZOR_MAGIC;
2.250 + header.version = RAZOR_VERSION;
2.251 + header.num_sections = count;
2.252 + offset = sizeof header + count * sizeof *sections + ALIGN(pool.size, 4);
2.253 +
2.254 + for (i = 0; i < count; i++) {
2.255 + sections[i].offset = offset;
2.256 + sections[i].size = arrays[i]->size;
2.257 + offset += ALIGN(arrays[i]->size, 4);
2.258 }
2.259
2.260 razor_write(fd, &header, sizeof header);
2.261 - razor_write(fd, out_sections, array_size * sizeof *out_sections);
2.262 + razor_write(fd, sections, count * sizeof *sections);
2.263 razor_write(fd, pool.data, pool.size);
2.264 + razor_write(fd, padding, PADDING(pool.size, 4));
2.265
2.266 - for (i = 0; i < array_size; i++) {
2.267 - a = (void *) set + sections[i].offset;
2.268 - razor_write(fd, a->data, a->size);
2.269 + for (i = 0; i < count; i++) {
2.270 + razor_write(fd, arrays[i]->data, arrays[i]->size);
2.271 + razor_write(fd, padding, PADDING(arrays[i]->size, 4));
2.272 }
2.273
2.274 - free(out_sections);
2.275 + array_release(&pool);
2.276 + hashtable_release(&table);
2.277
2.278 return 0;
2.279 }
2.280
2.281 RAZOR_EXPORT int
2.282 -razor_set_write_to_fd(struct razor_set *set, int fd,
2.283 - enum razor_repo_file_type type)
2.284 -{
2.285 - switch (type) {
2.286 - case RAZOR_REPO_FILE_MAIN:
2.287 - return razor_set_write_sections_to_fd(set, fd,
2.288 - razor_sections,
2.289 - ARRAY_SIZE(razor_sections));
2.290 -
2.291 - case RAZOR_REPO_FILE_DETAILS:
2.292 - return razor_set_write_sections_to_fd(set, fd,
2.293 - razor_details_sections,
2.294 - ARRAY_SIZE(razor_details_sections));
2.295 - case RAZOR_REPO_FILE_FILES:
2.296 - return razor_set_write_sections_to_fd(set, fd,
2.297 - razor_files_sections,
2.298 - ARRAY_SIZE(razor_files_sections));
2.299 - default:
2.300 - return -1;
2.301 - }
2.302 -}
2.303 -
2.304 -RAZOR_EXPORT int
2.305 -razor_set_write(struct razor_set *set, const char *filename,
2.306 - enum razor_repo_file_type type)
2.307 +razor_set_write(struct razor_set *set, const char *filename, uint32_t sections)
2.308 {
2.309 int fd, status;
2.310
2.311 @@ -305,7 +261,7 @@
2.312 if (fd < 0)
2.313 return -1;
2.314
2.315 - status = razor_set_write_to_fd(set, fd, type);
2.316 + status = razor_set_write_to_fd(set, fd, sections);
2.317 if (status) {
2.318 close(fd);
2.319 return status;
3.1 --- a/librazor/razor.h Fri Jul 03 18:02:33 2009 +0100
3.2 +++ b/librazor/razor.h Fri Jul 03 19:06:29 2009 +0100
3.3 @@ -23,10 +23,11 @@
3.4
3.5 #include <stdint.h>
3.6
3.7 -enum razor_repo_file_type {
3.8 - RAZOR_REPO_FILE_MAIN,
3.9 - RAZOR_REPO_FILE_DETAILS,
3.10 - RAZOR_REPO_FILE_FILES
3.11 +enum razor_section_type {
3.12 + RAZOR_SECTION_MAIN = 0x01,
3.13 + RAZOR_SECTION_DETAILS = 0x02,
3.14 + RAZOR_SECTION_FILES = 0x04,
3.15 + RAZOR_SECTION_ALL = 0x07
3.16 };
3.17
3.18 enum razor_detail_type {
3.19 @@ -95,13 +96,11 @@
3.20 struct razor_set *razor_set_create(void);
3.21 struct razor_set *razor_set_open(const char *filename);
3.22 void razor_set_destroy(struct razor_set *set);
3.23 -int razor_set_write_to_fd(struct razor_set *set, int fd,
3.24 - enum razor_repo_file_type type);
3.25 -int razor_set_write(struct razor_set *set, const char *filename,
3.26 - enum razor_repo_file_type type);
3.27 -
3.28 -int razor_set_open_details(struct razor_set *set, const char *filename);
3.29 -int razor_set_open_files(struct razor_set *set, const char *filename);
3.30 +int razor_set_write_to_fd(struct razor_set *set,
3.31 + int fd, uint32_t section_mask);
3.32 +int razor_set_write(struct razor_set *set,
3.33 + const char *filename, uint32_t setions);
3.34 +int razor_set_bind_sections(struct razor_set *set, const char *filename);
3.35
3.36 struct razor_package *
3.37 razor_set_get_package(struct razor_set *set, const char *package);
4.1 --- a/librazor/root.c Fri Jul 03 18:02:33 2009 +0100
4.2 +++ b/librazor/root.c Fri Jul 03 19:06:29 2009 +0100
4.3 @@ -42,9 +42,6 @@
4.4 #endif
4.5
4.6 static const char system_repo_filename[] = "system.rzdb";
4.7 -static const char system_repo_details_filename[] = "system-details.rzdb";
4.8 -static const char system_repo_files_filename[] = "system-files.rzdb";
4.9 -
4.10 static const char next_repo_filename[] = "system-next.rzdb";
4.11 #ifdef MSWIN_API
4.12 #define RAZOR_ROOT_PATH NULL
4.13 @@ -57,7 +54,6 @@
4.14 struct razor_set *system;
4.15 struct razor_set *next;
4.16 int fd;
4.17 - char root[PATH_MAX];
4.18 char path[PATH_MAX];
4.19 char new_path[PATH_MAX];
4.20 };
4.21 @@ -82,7 +78,7 @@
4.22 {
4.23 struct stat buf;
4.24 struct razor_set *set;
4.25 - char path[PATH_MAX], details_path[PATH_MAX], files_path[PATH_MAX];
4.26 + char path[PATH_MAX];
4.27
4.28 assert (root != NULL);
4.29
4.30 @@ -115,18 +111,12 @@
4.31 set = razor_set_create();
4.32 snprintf(path, sizeof path, "%s%s/%s",
4.33 root, razor_root_path, system_repo_filename);
4.34 - snprintf(details_path, sizeof details_path, "%s%s/%s",
4.35 - root, razor_root_path, system_repo_details_filename);
4.36 - snprintf(files_path, sizeof files_path, "%s%s/%s",
4.37 - root, razor_root_path, system_repo_files_filename);
4.38 if (stat(path, &buf) == 0) {
4.39 fprintf(stderr,
4.40 "a razor install root is already initialized\n");
4.41 return -1;
4.42 }
4.43 - if (razor_set_write(set, path, RAZOR_REPO_FILE_MAIN) < 0 ||
4.44 - razor_set_write(set, details_path, RAZOR_REPO_FILE_DETAILS) < 0 ||
4.45 - razor_set_write(set, files_path, RAZOR_REPO_FILE_FILES) < 0 ) {
4.46 + if (razor_set_write(set, path, RAZOR_SECTION_ALL) < 0) {
4.47 fprintf(stderr, "could not write initial package set\n");
4.48 return -1;
4.49 }
4.50 @@ -139,7 +129,6 @@
4.51 razor_root_open(const char *root)
4.52 {
4.53 struct razor_root *image;
4.54 - char details_path[PATH_MAX], files_path[PATH_MAX];
4.55
4.56 assert (root != NULL);
4.57
4.58 @@ -169,19 +158,9 @@
4.59
4.60 snprintf(image->path, sizeof image->path,
4.61 "%s%s/%s", root, razor_root_path, system_repo_filename);
4.62 - snprintf(details_path, sizeof details_path,
4.63 - "%s%s/%s", root, razor_root_path, system_repo_details_filename);
4.64 - snprintf(files_path, sizeof files_path,
4.65 - "%s%s/%s", root, razor_root_path, system_repo_files_filename);
4.66 -
4.67 - /* FIXME: We store the root path to make the hack in
4.68 - * razor_root_update() work. Need to get rid of this. */
4.69 - strcpy(image->root, root);
4.70
4.71 image->system = razor_set_open(image->path);
4.72 - if (image->system == NULL ||
4.73 - razor_set_open_details(image->system, details_path) ||
4.74 - razor_set_open_files(image->system, files_path)) {
4.75 + if (image->system == NULL) {
4.76 unlink(image->new_path);
4.77 close(image->fd);
4.78 free(image);
4.79 @@ -194,31 +173,15 @@
4.80 RAZOR_EXPORT struct razor_set *
4.81 razor_root_open_read_only(const char *root)
4.82 {
4.83 - char path[PATH_MAX], details_path[PATH_MAX], files_path[PATH_MAX];
4.84 - struct razor_set *set;
4.85 + char path[PATH_MAX];
4.86
4.87 assert (root != NULL);
4.88
4.89 razor_root_init();
4.90 snprintf(path, sizeof path, "%s%s/%s",
4.91 root, razor_root_path, system_repo_filename);
4.92 - snprintf(details_path, sizeof details_path,
4.93 - "%s%s/%s", root, razor_root_path, system_repo_details_filename);
4.94 - snprintf(files_path, sizeof files_path,
4.95 - "%s%s/%s", root, razor_root_path, system_repo_files_filename);
4.96
4.97 -
4.98 - set = razor_set_open(path);
4.99 - if (set == NULL)
4.100 - return NULL;
4.101 -
4.102 - if (razor_set_open_details(set, details_path) ||
4.103 - razor_set_open_files(set, files_path)) {
4.104 - razor_set_destroy(set);
4.105 - return NULL;
4.106 - }
4.107 -
4.108 - return set;
4.109 + return razor_set_open(path);
4.110 }
4.111
4.112 RAZOR_EXPORT struct razor_set *
4.113 @@ -245,27 +208,13 @@
4.114 RAZOR_EXPORT void
4.115 razor_root_update(struct razor_root *root, struct razor_set *next)
4.116 {
4.117 - char path[PATH_MAX];
4.118 -
4.119 assert (root != NULL);
4.120 assert (next != NULL);
4.121
4.122 razor_root_init();
4.123 - razor_set_write_to_fd(next, root->fd, RAZOR_REPO_FILE_MAIN);
4.124 + razor_set_write_to_fd(next, root->fd, RAZOR_SECTION_ALL);
4.125 root->next = next;
4.126
4.127 - /* FIXME: This is a pretty bad hack that just overwrites the
4.128 - * system details and files rzdb files before the transaction
4.129 - * succeeds. We need to fix this by merging the separate
4.130 - * details and files rzdb files back into the main rzdb
4.131 - * file. */
4.132 - snprintf(path, sizeof path,
4.133 - "%s%s/%s", root->root, razor_root_path, system_repo_details_filename);
4.134 - razor_set_write(next, path, RAZOR_REPO_FILE_DETAILS);
4.135 - snprintf(path, sizeof path,
4.136 - "%s%s/%s", root->root, razor_root_path, system_repo_files_filename);
4.137 - razor_set_write(next, path, RAZOR_REPO_FILE_FILES);
4.138 -
4.139 /* Sync the new repo file so the new package set is on disk
4.140 * before we start upgrading. */
4.141 fsync(root->fd);
5.1 --- a/src/main.c Fri Jul 03 18:02:33 2009 +0100
5.2 +++ b/src/main.c Fri Jul 03 19:06:29 2009 +0100
5.3 @@ -471,19 +471,10 @@
5.4 set = razor_set_create_from_yum();
5.5 if (set == NULL)
5.6 return 1;
5.7 - if (razor_set_write(set, rawhide_repo_filename, RAZOR_REPO_FILE_MAIN)) {
5.8 + if (razor_set_write(set, rawhide_repo_filename, RAZOR_SECTION_ALL)) {
5.9 perror(rawhide_repo_filename);
5.10 return -1;
5.11 }
5.12 - if (razor_set_write(set, "rawhide-details.rzdb",
5.13 - RAZOR_REPO_FILE_DETAILS)) {
5.14 - perror("rawhide-details.rzdb");
5.15 - return -1;
5.16 - }
5.17 - if (razor_set_write(set, "rawhide-files.rzdb", RAZOR_REPO_FILE_FILES)) {
5.18 - perror("rawhide-files.rzdb");
5.19 - return -1;
5.20 - }
5.21 razor_set_destroy(set);
5.22 printf("wrote %s\n", rawhide_repo_filename);
5.23
5.24 @@ -569,9 +560,7 @@
5.25 return 1;
5.26
5.27 upstream = razor_set_open(rawhide_repo_filename);
5.28 - if (upstream == NULL ||
5.29 - razor_set_open_details(upstream, "rawhide-details.rzdb") ||
5.30 - razor_set_open_files(upstream, "rawhide-files.rzdb"))
5.31 + if (upstream == NULL)
5.32 return 1;
5.33
5.34 trans = razor_transaction_create(set, upstream);
5.35 @@ -594,7 +583,7 @@
5.36 }
5.37
5.38 set = razor_transaction_commit(trans);
5.39 - razor_set_write(set, updated_repo_filename, RAZOR_REPO_FILE_MAIN);
5.40 + razor_set_write(set, updated_repo_filename, RAZOR_SECTION_ALL);
5.41 razor_transaction_destroy(trans);
5.42 razor_set_destroy(set);
5.43 razor_set_destroy(upstream);
5.44 @@ -737,9 +726,7 @@
5.45 printf("\nsaving\n");
5.46 set = razor_importer_finish(importer);
5.47
5.48 - razor_set_write(set, repo_filename, RAZOR_REPO_FILE_MAIN);
5.49 - razor_set_write(set, "system-details.rzdb", RAZOR_REPO_FILE_DETAILS);
5.50 - razor_set_write(set, "system-files.rzdb", RAZOR_REPO_FILE_FILES);
5.51 + razor_set_write(set, repo_filename, RAZOR_SECTION_ALL);
5.52 razor_set_destroy(set);
5.53 printf("wrote %s\n", repo_filename);
5.54
5.55 @@ -995,12 +982,10 @@
5.56
5.57 system = razor_root_get_system_set(root);
5.58 upstream = razor_set_open(rawhide_repo_filename);
5.59 - if (upstream == NULL ||
5.60 - razor_set_open_details(upstream, "rawhide-details.rzdb") ||
5.61 - razor_set_open_files(upstream, "rawhide-files.rzdb")) {
5.62 - fprintf(stderr, "couldn't open rawhide repo\n");
5.63 - razor_root_close(root);
5.64 - return 1;
5.65 + if (upstream == NULL) {
5.66 + fprintf(stderr, "couldn't open rawhide repo\n");
5.67 + razor_root_close(root);
5.68 + return 1;
5.69 }
5.70
5.71 if (relocations) {
5.72 @@ -1177,9 +1162,6 @@
5.73 if (set == NULL)
5.74 return 1;
5.75
5.76 - if (razor_set_open_details(set, "rawhide-details.rzdb"))
5.77 - return 1;
5.78 -
5.79 pi = razor_package_iterator_create(set);
5.80 while (razor_package_iterator_next(pi, &package,
5.81 RAZOR_DETAIL_NAME, &name,
6.1 --- a/src/rpm.c Fri Jul 03 18:02:33 2009 +0100
6.2 +++ b/src/rpm.c Fri Jul 03 19:06:29 2009 +0100
6.3 @@ -340,7 +340,6 @@
6.4 {
6.5 struct razor_package_query *query;
6.6 struct razor_package_iterator *pi;
6.7 - char *files;
6.8 int i;
6.9
6.10 if (option_all + option_whatprovides + option_whatrequires +
6.11 @@ -350,11 +349,6 @@
6.12 exit(1);
6.13 }
6.14
6.15 - files = "install/var/lib/razor/system-files.rzdb";
6.16 - if (option_file)
6.17 - if (razor_set_open_files(set, files))
6.18 - exit(1);
6.19 -
6.20 query = razor_package_query_create(set);
6.21
6.22 if (option_all) {
6.23 @@ -471,7 +465,7 @@
6.24 struct razor_set *set;
6.25 struct razor_package_iterator *pi;
6.26 struct razor_package *package;
6.27 - const char *name, *version, *arch, *details, *files;
6.28 + const char *name, *version, *arch;
6.29
6.30 if (option_package) {
6.31 set = create_set_from_command_line(argc, argv);
6.32 @@ -479,16 +473,6 @@
6.33 option_all = 1;
6.34 } else {
6.35 set = razor_root_open_read_only(option_root);
6.36 -
6.37 - /* FIXME: We need to figure out how to do this right. */
6.38 - details = "install/var/lib/razor/system-details.rzdb";
6.39 - if (option_info)
6.40 - if (razor_set_open_details(set, details))
6.41 - return;
6.42 - files = "install/var/lib/razor/system-files.rzdb";
6.43 - if (option_list)
6.44 - if (razor_set_open_files(set, files))
6.45 - return;
6.46 }
6.47
6.48 pi = get_query_packages(set, argc, argv);