2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
9 * rpms2solv - create a solv file from multiple rpms
13 #include <sys/types.h>
22 #include "repo_rpmdb.h"
23 #include "repo_solv.h"
24 #include "common_write.h"
27 main(int argc, char **argv)
29 const char **rpms = 0;
32 Pool *pool = pool_create();
37 const char *basefile = 0;
39 while ((c = getopt(argc, argv, "b:m:")) >= 0)
55 if (!strcmp(manifest, "-"))
57 else if ((fp = fopen(manifest, "r")) == 0)
62 while(fgets(buf, sizeof(buf), fp))
64 if ((p = strchr(buf, '\n')) != 0)
66 rpms = sat_extend(rpms, nrpms, 1, sizeof(char *), 15);
67 rpms[nrpms++] = strdup(buf);
74 rpms = sat_extend(rpms, nrpms, 1, sizeof(char *), 15);
75 rpms[nrpms++] = strdup(argv[optind++]);
77 repo = repo_create(pool, "rpms2solv");
78 repodata = repo_add_repodata(repo, 0);
79 repo_add_rpms(repo, repodata, rpms, nrpms);
81 repodata_internalize(repodata);
82 tool_write(repo, basefile, 0);
84 for (c = 0; c < nrpms; c++)
85 free((char *)rpms[c]);