2 * Copyright (c) 2009-2015, SUSE LLC.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
8 /* solv, a little software installer demoing the sat solver library */
11 * - understands globs for package names / dependencies
12 * - understands .arch suffix
13 * - installation of commandline packages
14 * - repository data caching
15 * - on demand loading of secondary repository data
16 * - gpg and checksum verification
19 * - fastestmirror implementation
21 * things available in the library but missing from solv:
22 * - vendor policy loading
23 * - multi version handling
29 #include <sys/utsname.h>
34 #include "selection.h"
37 #include "solverdebug.h"
38 #include "transaction.h"
41 #include "repo_autopattern.h"
45 #include "repoinfo_cache.h"
46 #include "repoinfo_download.h"
48 #if defined(ENABLE_RPMDB)
49 #include "fileprovides.h"
50 #include "fileconflicts.h"
53 #if defined(SUSE) || defined(FEDORA) || defined(MAGEIA)
54 #include "patchjobs.h"
66 pool_setarch(pool, un.machine);
71 yesno(const char *str, int other)
80 if (!(ip = fgets(inbuf, sizeof(inbuf), stdin)))
85 while (*ip == ' ' || *ip == '\t')
92 if (*ip == 'y' || *ip == 'n' || *ip == other)
93 return *ip == 'n' ? 0 : *ip;
99 nscallback(Pool *pool, void *data, Id name, Id evr)
102 if (name == NAMESPACE_LANGUAGE)
104 if (!strcmp(pool_id2str(pool, evr), "ja"))
106 if (!strcmp(pool_id2str(pool, evr), "de"))
108 if (!strcmp(pool_id2str(pool, evr), "en"))
110 if (!strcmp(pool_id2str(pool, evr), "en_US"))
120 showdiskusagechanges(Transaction *trans)
125 /* XXX: use mountpoints here */
126 memset(duc, 0, sizeof(duc));
128 duc[1].path = "/usr/share/man";
129 duc[2].path = "/sbin";
130 duc[3].path = "/etc";
131 transaction_calc_duchanges(trans, duc, 4);
132 for (i = 0; i < 4; i++)
133 printf("duchanges %s: %d K %d inodes\n", duc[i].path, duc[i].kbytes, duc[i].files);
138 find_repo(const char *name, Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
143 for (rp = name; *rp; rp++)
144 if (*rp <= '0' || *rp >= '9')
148 /* repo specified by number */
149 int rnum = atoi(name);
150 for (i = 0; i < nrepoinfos; i++)
152 struct repoinfo *cinfo = repoinfos + i;
153 if (!cinfo->enabled || !cinfo->repo)
156 return cinfo->repo->repoid;
161 /* repo specified by alias */
165 if (!strcasecmp(name, repo->name))
174 #define MODE_INSTALL 1
176 #define MODE_UPDATE 3
177 #define MODE_DISTUPGRADE 4
178 #define MODE_VERIFY 5
181 #define MODE_REPOLIST 8
182 #define MODE_SEARCH 9
187 fprintf(stderr, "Usage: solv COMMAND <select>\n");
188 fprintf(stderr, "\n");
189 fprintf(stderr, " dist-upgrade: replace installed packages with\n");
190 fprintf(stderr, " versions from the repositories\n");
191 fprintf(stderr, " erase: erase installed packages\n");
192 fprintf(stderr, " info: display package information\n");
193 fprintf(stderr, " install: install packages\n");
194 fprintf(stderr, " list: list packages\n");
195 fprintf(stderr, " repos: list enabled repositories\n");
196 fprintf(stderr, " search: search name/summary/description\n");
197 fprintf(stderr, " update: update installed packages\n");
198 fprintf(stderr, " verify: check dependencies of installed packages\n");
199 #if defined(SUSE) || defined(FEDORA) || defined(MAGEIA)
200 fprintf(stderr, " patch: install newest maintenance updates\n");
202 fprintf(stderr, "\n");
207 main(int argc, char **argv)
210 Repo *commandlinerepo = 0;
211 Id *commandlinepkgs = 0;
213 struct repoinfo *repoinfos, installedrepoinfo;
215 int mainmode = 0, mode = 0;
224 int archfilter_src = 0;
229 int keyname_depstr = 0;
231 int answer, acnt = 0;
236 while (argc && !strcmp(argv[0], "-d"))
244 if (!strcmp(argv[0], "install") || !strcmp(argv[0], "in"))
246 mainmode = MODE_INSTALL;
247 mode = SOLVER_INSTALL;
249 #if defined(SUSE) || defined(FEDORA) || defined(MAGEIA)
250 else if (!strcmp(argv[0], "patch"))
252 mainmode = MODE_PATCH;
253 mode = SOLVER_INSTALL;
256 else if (!strcmp(argv[0], "erase") || !strcmp(argv[0], "rm"))
258 mainmode = MODE_ERASE;
261 else if (!strcmp(argv[0], "list") || !strcmp(argv[0], "ls"))
263 mainmode = MODE_LIST;
266 else if (!strcmp(argv[0], "info"))
268 mainmode = MODE_INFO;
271 else if (!strcmp(argv[0], "search") || !strcmp(argv[0], "se"))
273 mainmode = MODE_SEARCH;
276 else if (!strcmp(argv[0], "verify"))
278 mainmode = MODE_VERIFY;
279 mode = SOLVER_VERIFY;
281 else if (!strcmp(argv[0], "update") || !strcmp(argv[0], "up"))
283 mainmode = MODE_UPDATE;
284 mode = SOLVER_UPDATE;
286 else if (!strcmp(argv[0], "dist-upgrade") || !strcmp(argv[0], "dup"))
288 mainmode = MODE_DISTUPGRADE;
289 mode = SOLVER_DISTUPGRADE;
291 else if (!strcmp(argv[0], "repos") || !strcmp(argv[0], "repolist") || !strcmp(argv[0], "lr"))
293 mainmode = MODE_REPOLIST;
301 if (argc > 2 && !strcmp(argv[1], "--root"))
307 else if (argc > 1 && !strcmp(argv[1], "--clean"))
313 else if (argc > 1 && !strcmp(argv[1], "--best"))
319 else if (argc > 1 && !strcmp(argv[1], "--depstr"))
325 else if (argc > 2 && !strcmp(argv[1], "--keyname"))
331 else if (argc > 2 && !strcmp(argv[1], "--testcase"))
342 pool = pool_create();
343 pool_set_rootdir(pool, rootdir);
347 const char *langs[] = {"de_DE", "de", "en"};
348 pool_set_languages(pool, langs, sizeof(langs)/sizeof(*langs));
352 pool_setloadcallback(pool, load_stub, 0);
354 pool->nscallback = nscallback;
357 pool_setdebuglevel(pool, debuglevel);
359 pool_set_flag(pool, POOL_FLAG_ADDFILEPROVIDESFILTERED, 1);
360 repoinfos = read_repoinfos(pool, &nrepoinfos);
361 sort_repoinfos(repoinfos, nrepoinfos);
363 if (mainmode == MODE_REPOLIST)
366 for (i = 0; i < nrepoinfos; i++)
368 struct repoinfo *cinfo = repoinfos + i;
371 printf("%d: %-20s %s (prio %d)\n", j++, cinfo->alias, cinfo->name, cinfo->priority);
375 memset(&installedrepoinfo, 0, sizeof(installedrepoinfo));
376 if (!read_installed_repo(&installedrepoinfo, pool))
378 read_repos(pool, repoinfos, nrepoinfos);
381 queue_init(&repofilter);
382 queue_init(&kindfilter);
383 queue_init(&archfilter);
386 if (!strcmp(argv[1], "-i"))
388 queue_push2(&repofilter, SOLVER_SOLVABLE_REPO | SOLVER_SETREPO, pool->installed->repoid);
392 else if (argc > 2 && (!strcmp(argv[1], "-r") || !strcmp(argv[1], "--repo")))
394 Id repoid = find_repo(argv[2], pool, repoinfos, nrepoinfos);
397 fprintf(stderr, "%s: no such repo\n", argv[2]);
400 /* SETVENDOR is actually wrong but useful */
401 queue_push2(&repofilter, SOLVER_SOLVABLE_REPO | SOLVER_SETREPO | SOLVER_SETVENDOR, repoid);
405 else if (argc > 2 && !strcmp(argv[1], "--arch"))
407 if (!strcmp(argv[2], "src") || !strcmp(argv[2], "nosrc"))
409 queue_push2(&archfilter, SOLVER_SOLVABLE_PROVIDES, pool_rel2id(pool, 0, pool_str2id(pool, argv[2], 1), REL_ARCH, 1));
413 else if (argc > 2 && (!strcmp(argv[1], "-t") || !strcmp(argv[1], "--type")))
415 const char *kind = argv[2];
416 if (!strcmp(kind, "srcpackage"))
418 /* hey! should use --arch! */
419 queue_push2(&archfilter, SOLVER_SOLVABLE_PROVIDES, pool_rel2id(pool, 0, ARCH_SRC, REL_ARCH, 1));
425 if (!strcmp(kind, "package"))
427 if (!strcmp(kind, "all"))
428 queue_push2(&kindfilter, SOLVER_SOLVABLE_ALL, 0);
430 queue_push2(&kindfilter, SOLVER_SOLVABLE_PROVIDES, pool_rel2id(pool, 0, pool_str2id(pool, kind, 1), REL_KIND, 1));
438 if (mainmode == MODE_SEARCH)
444 pool_createwhatprovides(pool);
446 dataiterator_init(&di, pool, 0, 0, 0, argv[1], SEARCH_SUBSTRING|SEARCH_NOCASE);
447 dataiterator_set_keyname(&di, SOLVABLE_NAME);
448 dataiterator_set_search(&di, 0, 0);
449 while (dataiterator_step(&di))
450 queue_push2(&sel, SOLVER_SOLVABLE, di.solvid);
451 dataiterator_set_keyname(&di, SOLVABLE_SUMMARY);
452 dataiterator_set_search(&di, 0, 0);
453 while (dataiterator_step(&di))
454 queue_push2(&sel, SOLVER_SOLVABLE, di.solvid);
455 dataiterator_set_keyname(&di, SOLVABLE_DESCRIPTION);
456 dataiterator_set_search(&di, 0, 0);
457 while (dataiterator_step(&di))
458 queue_push2(&sel, SOLVER_SOLVABLE, di.solvid);
459 dataiterator_free(&di);
460 if (repofilter.count)
461 selection_filter(pool, &sel, &repofilter);
462 if (archfilter.count)
463 selection_filter(pool, &sel, &archfilter);
464 if (kindfilter.count)
465 selection_filter(pool, &sel, &kindfilter);
468 selection_solvables(pool, &sel, &q);
470 for (i = 0; i < q.count; i++)
472 Solvable *s = pool_id2solvable(pool, q.elements[i]);
473 printf(" - %s [%s]: %s\n", pool_solvable2str(pool, s), s->repo->name, solvable_lookup_str(s, SOLVABLE_SUMMARY));
479 /* process command line packages */
480 if (mainmode == MODE_LIST || mainmode == MODE_INFO || mainmode == MODE_INSTALL)
482 for (i = 1; i < argc; i++)
484 if (!is_cmdline_package((const char *)argv[i]))
486 if (access(argv[i], R_OK))
491 if (!commandlinepkgs)
492 commandlinepkgs = solv_calloc(argc, sizeof(Id));
493 if (!commandlinerepo)
494 commandlinerepo = repo_create(pool, "@commandline");
495 p = add_cmdline_package(commandlinerepo, (const char *)argv[i]);
498 fprintf(stderr, "could not add '%s'\n", argv[i]);
501 commandlinepkgs[i] = p;
505 repo_internalize(commandlinerepo);
507 repo_add_autopattern(commandlinerepo, 0);
512 #if defined(ENABLE_RPMDB)
513 if (pool->disttype == DISTTYPE_RPM)
514 addfileprovides(pool);
516 pool_createwhatprovides(pool);
519 keyname = solv_dupjoin("solvable:", keyname, 0);
521 for (i = 1; i < argc; i++)
526 if (commandlinepkgs && commandlinepkgs[i])
528 queue_push2(&job, SOLVER_SOLVABLE, commandlinepkgs[i]);
532 flags = SELECTION_NAME|SELECTION_PROVIDES|SELECTION_GLOB;
533 flags |= SELECTION_CANON|SELECTION_DOTARCH|SELECTION_REL;
534 if (kindfilter.count)
535 flags |= SELECTION_SKIP_KIND;
536 if (mode == MODE_LIST || archfilter_src)
537 flags |= SELECTION_WITH_SOURCE;
538 if (argv[i][0] == '/')
539 flags |= SELECTION_FILELIST | (mode == MODE_ERASE ? SELECTION_INSTALLED_ONLY : 0);
540 if (keyname && keyname_depstr)
541 flags |= SELECTION_MATCH_DEPSTR;
543 rflags = selection_make(pool, &job2, argv[i], flags);
545 rflags = selection_make_matchdeps(pool, &job2, argv[i], flags, pool_str2id(pool, keyname, 1), 0);
546 if (repofilter.count)
547 selection_filter(pool, &job2, &repofilter);
548 if (archfilter.count)
549 selection_filter(pool, &job2, &archfilter);
550 if (kindfilter.count)
551 selection_filter(pool, &job2, &kindfilter);
554 flags |= SELECTION_NOCASE;
556 rflags = selection_make(pool, &job2, argv[i], flags);
558 rflags = selection_make_matchdeps(pool, &job2, argv[i], flags, pool_str2id(pool, keyname, 1), 0);
559 if (repofilter.count)
560 selection_filter(pool, &job2, &repofilter);
561 if (archfilter.count)
562 selection_filter(pool, &job2, &archfilter);
563 if (kindfilter.count)
564 selection_filter(pool, &job2, &kindfilter);
566 printf("[ignoring case for '%s']\n", argv[i]);
570 fprintf(stderr, "nothing matches '%s'\n", argv[i]);
573 if (rflags & SELECTION_FILELIST)
574 printf("[using file list match for '%s']\n", argv[i]);
575 if (rflags & SELECTION_PROVIDES)
576 printf("[using capability match for '%s']\n", argv[i]);
577 queue_insertn(&job, job.count, job2.count, job2.elements);
580 keyname = solv_free(keyname);
582 if (!job.count && (mainmode == MODE_UPDATE || mainmode == MODE_DISTUPGRADE || mainmode == MODE_VERIFY || repofilter.count || archfilter.count || kindfilter.count))
584 queue_push2(&job, SOLVER_SOLVABLE_ALL, 0);
585 if (repofilter.count)
586 selection_filter(pool, &job, &repofilter);
587 if (archfilter.count)
588 selection_filter(pool, &job, &archfilter);
589 if (kindfilter.count)
590 selection_filter(pool, &job, &kindfilter);
592 queue_free(&repofilter);
593 queue_free(&archfilter);
594 queue_free(&kindfilter);
596 if (!job.count && mainmode != MODE_PATCH)
598 printf("no package matched\n");
602 if (mainmode == MODE_LIST || mainmode == MODE_INFO)
604 /* list mode, no solver needed */
607 for (i = 0; i < job.count; i += 2)
611 pool_job2solvables(pool, &q, job.elements[i], job.elements[i + 1]);
612 for (j = 0; j < q.count; j++)
614 Solvable *s = pool_id2solvable(pool, q.elements[j]);
615 if (mainmode == MODE_INFO)
618 printf("Name: %s\n", pool_solvable2str(pool, s));
619 printf("Repo: %s\n", s->repo->name);
620 printf("Summary: %s\n", solvable_lookup_str(s, SOLVABLE_SUMMARY));
621 str = solvable_lookup_str(s, SOLVABLE_URL);
623 printf("Url: %s\n", str);
624 str = solvable_lookup_str(s, SOLVABLE_LICENSE);
626 printf("License: %s\n", str);
627 printf("Description:\n%s\n", solvable_lookup_str(s, SOLVABLE_DESCRIPTION));
633 const char *sum = solvable_lookup_str_lang(s, SOLVABLE_SUMMARY, "de", 1);
635 const char *sum = solvable_lookup_str_poollang(s, SOLVABLE_SUMMARY);
637 printf(" - %s [%s]\n", pool_solvable2str(pool, s), s->repo->name);
639 printf(" %s\n", sum);
646 free_repoinfos(repoinfos, nrepoinfos);
647 solv_free(commandlinepkgs);
651 #if defined(SUSE) || defined(FEDORA) || defined(MAGEIA)
652 if (mainmode == MODE_PATCH)
653 add_patchjobs(pool, &job);
657 for (i = 0; i < job.count; i += 2)
659 job.elements[i] |= mode;
660 if (mode == SOLVER_UPDATE && pool_isemptyupdatejob(pool, job.elements[i], job.elements[i + 1]))
661 job.elements[i] ^= SOLVER_UPDATE ^ SOLVER_INSTALL;
663 job.elements[i] |= SOLVER_CLEANDEPS;
665 job.elements[i] |= SOLVER_FORCEBEST;
670 queue_push2(&job, SOLVER_MULTIVERSION|SOLVER_SOLVABLE_PROVIDES, pool_str2id(pool, "multiversion(kernel)", 1));
673 queue_push2(&job, SOLVER_INSTALL|SOLVER_SOLVABLE_PROVIDES, pool_rel2id(pool, NAMESPACE_LANGUAGE, 0, REL_NAMESPACE, 1));
674 queue_push2(&job, SOLVER_ERASE|SOLVER_CLEANDEPS|SOLVER_SOLVABLE_PROVIDES, pool_rel2id(pool, NAMESPACE_LANGUAGE, 0, REL_NAMESPACE, 1));
678 solv = solver_create(pool);
679 solver_set_flag(solv, SOLVER_FLAG_SPLITPROVIDES, 1);
681 solver_set_flag(solv, SOLVER_FLAG_IGNORE_RECOMMENDED, 1);
683 #if defined(FEDORA) || defined(MAGEIA)
684 solver_set_flag(solv, SOLVER_FLAG_ALLOW_VENDORCHANGE, 1);
686 if (mainmode == MODE_ERASE)
687 solver_set_flag(solv, SOLVER_FLAG_ALLOW_UNINSTALL, 1); /* don't nag */
688 solver_set_flag(solv, SOLVER_FLAG_BEST_OBEY_POLICY, 1);
692 Id problem, solution;
695 pcnt = solver_solve(solv, &job);
698 printf("Writing solver testcase:\n");
699 if (!testcase_write(solv, testcase, TESTCASE_RESULT_TRANSACTION | TESTCASE_RESULT_PROBLEMS, 0, 0))
700 printf("%s\n", pool_errstr(pool));
705 pcnt = solver_problem_count(solv);
706 printf("Found %d problems:\n", pcnt);
707 for (problem = 1; problem <= pcnt; problem++)
710 printf("Problem %d/%d:\n", problem, pcnt);
711 solver_printprobleminfo(solv, problem);
713 scnt = solver_solution_count(solv, problem);
714 for (solution = 1; solution <= scnt; solution++)
716 printf("Solution %d:\n", solution);
717 solver_printsolution(solv, problem, solution);
722 char inbuf[128], *ip;
723 printf("Please choose a solution: ");
726 if (!(ip = fgets(inbuf, sizeof(inbuf), stdin)))
731 while (*ip == ' ' || *ip == '\t')
733 if (*ip >= '0' && *ip <= '9')
736 if (take >= 1 && take <= scnt)
752 solver_take_solution(solv, problem, take, &job);
756 trans = solver_create_transaction(solv);
757 if (!trans->steps.count)
759 printf("Nothing to do.\n");
760 transaction_free(trans);
764 free_repoinfos(repoinfos, nrepoinfos);
765 solv_free(commandlinepkgs);
769 /* display transaction to the user and ask for confirmation */
771 printf("Transaction summary:\n\n");
772 transaction_print(trans);
774 showdiskusagechanges(trans);
776 printf("install size change: %d K\n", transaction_calc_installsizechange(trans));
779 acnt = solver_alternatives_count(solv);
783 printf("Have one alternative:\n");
785 printf("Have %d alternatives:\n", acnt);
786 for (i = 1; i <= acnt; i++)
789 int atype = solver_get_alternative(solv, i, &id, &from, 0, 0, 0);
790 printf(" - %s\n", solver_alternative2str(solv, atype, id, from));
793 answer = yesno("OK to continue (y/n/a)? ", 'a');
796 answer = yesno("OK to continue (y/n)? ", 0);
804 queue_init(&choicesq);
805 queue_init(&answerq);
806 for (i = 1; i <= acnt; i++)
808 int atype = solver_get_alternative(solv, i, &id, &from, &chosen, &choicesq, 0);
809 printf("\n%s\n", solver_alternative2str(solv, atype, id, from));
810 for (j = 0; j < choicesq.count; j++)
812 Id p = choicesq.elements[j];
815 queue_push(&answerq, p);
816 printf("%6d: %s\n", answerq.count, pool_solvid2str(pool, p));
819 queue_free(&choicesq);
823 char inbuf[128], *ip;
825 printf("OK to continue (y/n), or number to change alternative: ");
828 if (!(ip = fgets(inbuf, sizeof(inbuf), stdin)))
833 while (*ip == ' ' || *ip == '\t')
835 if (*ip == '-' && ip[1] >= '0' && ip[1] <= '9')
840 if (*ip >= '0' && *ip <= '9')
843 if (take > 0 && take <= answerq.count)
845 Id p = answerq.elements[take - 1];
846 queue_free(&answerq);
847 queue_push2(&job, (neg ? SOLVER_DISFAVOR : SOLVER_FAVOR) | SOLVER_SOLVABLE_NAME, pool->solvables[p].name);
854 if (*ip == 'n' || *ip == 'y')
856 answer = *ip == 'n' ? 0 : *ip;
860 queue_free(&answerq);
865 transaction_free(trans);
869 free_repoinfos(repoinfos, nrepoinfos);
870 solv_free(commandlinepkgs);
874 /* download all new packages */
876 newpkgs = transaction_installedresult(trans, &checkq);
880 int downloadsize = 0;
881 for (i = 0; i < newpkgs; i++)
885 p = checkq.elements[i];
886 s = pool_id2solvable(pool, p);
887 downloadsize += solvable_lookup_sizek(s, SOLVABLE_DOWNLOADSIZE, 0);
889 printf("Downloading %d packages, %d K\n", newpkgs, downloadsize);
890 newpkgsfps = solv_calloc(newpkgs, sizeof(*newpkgsfps));
891 for (i = 0; i < newpkgs; i++)
895 struct repoinfo *cinfo;
897 p = checkq.elements[i];
898 s = pool_id2solvable(pool, p);
899 if (s->repo == commandlinerepo)
901 loc = solvable_lookup_location(s, 0);
904 if (!(newpkgsfps[i] = fopen(loc, "r")))
912 cinfo = s->repo->appdata;
913 if (!cinfo || cinfo->type == TYPE_INSTALLED)
915 printf("%s: no repository information\n", s->repo->name);
918 loc = solvable_lookup_location(s, 0);
920 continue; /* pseudo package? */
921 #if defined(ENABLE_RPMDB)
922 if (pool->installed && pool->installed->nsolvables)
924 if ((newpkgsfps[i] = trydeltadownload(s, loc)) != 0)
928 continue; /* delta worked! */
932 if ((newpkgsfps[i] = downloadpackage(s, loc)) == 0)
934 printf("\n%s: %s not found in repository\n", s->repo->name, loc);
943 #if defined(ENABLE_RPMDB) && (defined(SUSE) || defined(FEDORA) || defined(MANDRIVA) || defined(MAGEIA))
944 /* check for file conflicts */
948 queue_init(&conflicts);
949 if (checkfileconflicts(pool, &checkq, newpkgs, newpkgsfps, &conflicts))
951 if (yesno("Re-run solver (y/n/q)? ", 0))
953 for (i = 0; i < newpkgs; i++)
955 fclose(newpkgsfps[i]);
956 newpkgsfps = solv_free(newpkgsfps);
959 pool_add_fileconflicts_deps(pool, &conflicts);
960 queue_free(&conflicts);
964 queue_free(&conflicts);
968 /* and finally commit the transaction */
969 printf("Committing transaction:\n\n");
970 transaction_order(trans, 0);
971 for (i = 0; i < trans->steps.count; i++)
977 p = trans->steps.elements[i];
978 type = transaction_type(trans, p, SOLVER_TRANSACTION_RPM_ONLY);
981 case SOLVER_TRANSACTION_ERASE:
982 printf("erase %s\n", pool_solvid2str(pool, p));
983 commit_transactionelement(pool, type, p, 0);
985 case SOLVER_TRANSACTION_INSTALL:
986 case SOLVER_TRANSACTION_MULTIINSTALL:
987 printf("install %s\n", pool_solvid2str(pool, p));
988 for (j = 0; j < newpkgs; j++)
989 if (checkq.elements[j] == p)
991 fp = j < newpkgs ? newpkgsfps[j] : 0;
994 commit_transactionelement(pool, type, p, fp);
1003 for (i = 0; i < newpkgs; i++)
1005 fclose(newpkgsfps[i]);
1006 solv_free(newpkgsfps);
1007 queue_free(&checkq);
1008 transaction_free(trans);
1012 free_repoinfos(repoinfos, nrepoinfos);
1013 solv_free(commandlinepkgs);