2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
13 #include <sys/types.h>
23 #include "repo_solv.h"
25 #include "repo_autopattern.h"
27 #include "common_write.h"
32 fprintf(stderr, "\nUsage:\n"
33 "mergesolv [file] [file] [...]\n"
34 " merges multiple solv files into one and writes it to stdout\n"
40 loadcallback (Pool *pool, Repodata *data, void *vdata)
43 const char *location = repodata_lookup_str(data, SOLVID_META, REPOSITORY_LOCATION);
48 fprintf(stderr, "Loading SOLV file %s\n", location);
49 fp = fopen (location, "r");
55 r = repo_add_solv(data->repo, fp, REPO_USE_LOADING|REPO_LOCALPOOL);
61 main(int argc, char **argv)
65 const char *basefile = 0;
73 repo = repo_create(pool, "<mergesolv>");
75 while ((c = getopt(argc, argv, "ahb:X")) >= 0)
99 pool_setloadcallback(pool, loadcallback, 0);
101 for (; optind < argc; optind++)
104 if ((fp = fopen(argv[optind], "r")) == NULL)
106 perror(argv[optind]);
109 if (repo_add_solv(repo, fp, 0))
111 fprintf(stderr, "repo %s: %s\n", argv[optind], pool_errstr(pool));
118 repo_add_autopattern(repo, 0);
120 tool_write(repo, basefile, 0);