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"
24 #include "common_write.h"
29 fprintf(stderr, "\nUsage:\n"
30 "mergesolv [file] [file] [...]\n"
31 " merges multiple solv files into one and writes it to stdout\n"
37 loadcallback (Pool *pool, Repodata *data, void *vdata)
40 const char *location = repodata_lookup_str(data, SOLVID_META, REPOSITORY_LOCATION);
45 fprintf(stderr, "Loading SOLV file %s\n", location);
46 fp = fopen (location, "r");
52 r = repo_add_solv(data->repo, fp, REPO_USE_LOADING|REPO_LOCALPOOL);
58 main(int argc, char **argv)
62 const char *basefile = 0;
67 repo = repo_create(pool, "<mergesolv>");
69 while ((c = getopt(argc, argv, "ahb:")) >= 0)
87 pool_setloadcallback(pool, loadcallback, 0);
89 for (; optind < argc; optind++)
92 if ((fp = fopen(argv[optind], "r")) == NULL)
97 repo_add_solv(repo, fp, 0);
100 tool_write(repo, basefile, 0);