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 fgets0(char *s, int size, FILE *stream)
50 main(int argc, char **argv)
52 const char **rpms = 0;
56 Pool *pool = pool_create();
60 const char *basefile = 0;
62 while ((c = getopt(argc, argv, "0b:m:")) >= 0)
81 if (!strcmp(manifest, "-"))
83 else if ((fp = fopen(manifest, "r")) == 0)
92 if (!fgets0(buf, sizeof(buf), fp))
97 if (!fgets(buf, sizeof(buf), fp))
99 if ((p = strchr(buf, '\n')) != 0)
102 rpms = sat_extend(rpms, nrpms, 1, sizeof(char *), 15);
103 rpms[nrpms++] = strdup(buf);
108 while (optind < argc)
110 rpms = sat_extend(rpms, nrpms, 1, sizeof(char *), 15);
111 rpms[nrpms++] = strdup(argv[optind++]);
113 repo = repo_create(pool, "rpms2solv");
114 repo_add_rpms(repo, rpms, nrpms, 0);
115 tool_write(repo, basefile, 0);
117 for (c = 0; c < nrpms; c++)
118 free((char *)rpms[c]);