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>
21 #include "repo_solv.h"
23 #include "repo_autopattern.h"
25 #include "common_write.h"
30 fprintf(stderr, "\nUsage:\n"
31 "mergesolv [file] [file] [...]\n"
32 " merges multiple solv files into one and writes it to stdout\n"
38 loadcallback (Pool *pool, Repodata *data, void *vdata)
41 const char *location = repodata_lookup_str(data, SOLVID_META, REPOSITORY_LOCATION);
46 fprintf(stderr, "Loading SOLV file %s\n", location);
47 fp = fopen (location, "r");
53 r = repo_add_solv(data->repo, fp, REPO_USE_LOADING|REPO_LOCALPOOL);
59 main(int argc, char **argv)
63 const char *basefile = 0;
71 repo = repo_create(pool, "<mergesolv>");
73 while ((c = getopt(argc, argv, "ahb:X")) >= 0)
97 pool_setloadcallback(pool, loadcallback, 0);
99 for (; optind < argc; optind++)
102 if ((fp = fopen(argv[optind], "r")) == NULL)
104 perror(argv[optind]);
107 if (repo_add_solv(repo, fp, 0))
109 fprintf(stderr, "repo %s: %s\n", argv[optind], pool_errstr(pool));
116 repo_add_autopattern(repo, 0);
118 tool_write(repo, basefile, 0);