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>
22 #include "repo_solv.h"
24 #include "repo_autopattern.h"
26 #include "common_write.h"
31 fprintf(stderr, "\nUsage:\n"
32 "mergesolv [file] [file] [...]\n"
33 " merges multiple solv files into one and writes it to stdout\n"
39 loadcallback (Pool *pool, Repodata *data, void *vdata)
42 const char *location = repodata_lookup_str(data, SOLVID_META, REPOSITORY_LOCATION);
47 fprintf(stderr, "Loading SOLV file %s\n", location);
48 fp = fopen (location, "r");
54 r = repo_add_solv(data->repo, fp, REPO_USE_LOADING|REPO_LOCALPOOL);
60 main(int argc, char **argv)
71 repo = repo_create(pool, "<mergesolv>");
73 while ((c = getopt(argc, argv, "ahX")) >= 0)
94 pool_setloadcallback(pool, loadcallback, 0);
96 for (; optind < argc; optind++)
99 if ((fp = fopen(argv[optind], "r")) == NULL)
101 perror(argv[optind]);
104 if (repo_add_solv(repo, fp, 0))
106 fprintf(stderr, "repo %s: %s\n", argv[optind], pool_errstr(pool));
113 repo_add_autopattern(repo, 0);
115 tool_write(repo, stdout);