2 const char *__progname;
14 #include <rpm/rpmcli.h>
15 #include <rpm/rpmlib.h> /* RPMSIGTAG, rpmReadPackageFile .. */
16 #include <rpm/rpmbuild.h>
17 #include <rpm/rpmlog.h>
18 #include <rpm/rpmfileutil.h>
20 #include <rpm/rpmdb.h>
21 #include <rpm/rpmps.h>
22 #include <rpm/rpmts.h>
26 #define GETOPT_REBUILD 1003
27 #define GETOPT_RECOMPILE 1004
30 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
31 #include "lib/signature.h"
38 MODE_QUERY = (1 << 0),
39 MODE_VERIFY = (1 << 3),
40 #define MODES_QV (MODE_QUERY | MODE_VERIFY)
42 MODE_INSTALL = (1 << 1),
43 MODE_ERASE = (1 << 2),
44 #define MODES_IE (MODE_INSTALL | MODE_ERASE)
46 MODE_BUILD = (1 << 4),
47 MODE_REBUILD = (1 << 5),
48 MODE_RECOMPILE = (1 << 8),
49 MODE_TARBUILD = (1 << 11),
50 #define MODES_BT (MODE_BUILD | MODE_TARBUILD | MODE_REBUILD | MODE_RECOMPILE)
52 MODE_CHECKSIG = (1 << 6),
53 MODE_RESIGN = (1 << 7),
54 #define MODES_K (MODE_CHECKSIG | MODE_RESIGN)
56 MODE_INITDB = (1 << 10),
57 MODE_REBUILDDB = (1 << 12),
58 MODE_VERIFYDB = (1 << 13),
59 #define MODES_DB (MODE_INITDB | MODE_REBUILDDB | MODE_VERIFYDB)
65 #define MODES_FOR_DBPATH (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
66 #define MODES_FOR_NODEPS (MODES_BT | MODES_IE | MODE_VERIFY)
67 #define MODES_FOR_TEST (MODES_BT | MODES_IE)
68 #define MODES_FOR_ROOT (MODES_BT | MODES_IE | MODES_QV | MODES_DB | MODES_K)
72 /* the structure describing the options we take and the defaults */
73 static struct poptOption optionsTable[] = {
76 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0,
77 N_("Query options (with -q or --query):"),
79 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0,
80 N_("Verify options (with -V or --verify):"),
83 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliQVSourcePoptTable, 0,
84 N_("Source options (with --query or --verify):"),
87 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliFtsPoptTable, 0,
88 N_("File tree walk options (with --ftswalk):"),
90 #endif /* IAM_RPMQV */
93 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmSignPoptTable, 0,
94 N_("Signature options:"),
99 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmDatabasePoptTable, 0,
100 N_("Database options:"),
102 #endif /* IAM_RPMDB */
105 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmBuildPoptTable, 0,
106 N_("Build options with [ <specfile> | <tarball> | <source package> ]:"),
108 #endif /* IAM_RPMBT */
111 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmInstallPoptTable, 0,
112 N_("Install/Upgrade/Erase options:"),
114 #endif /* IAM_RPMEIU */
116 { "quiet", '\0', 0, &quiet, 0, NULL, NULL},
118 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
119 N_("Common options for all rpm modes and executables:"),
128 /* MiNT cannot dynamically increase the stack. */
129 long _stksize = 64 * 1024L;
132 static void argerror(const char * desc)
134 fprintf(stderr, _("%s: %s\n"), __progname, desc);
138 static void printVersion(FILE * fp)
140 fprintf(fp, _("RPM version %s\n"), rpmEVR);
143 static void printBanner(FILE * fp)
145 fprintf(fp, _("Copyright (C) 1998-2002 - Red Hat, Inc.\n"));
146 fprintf(fp, _("This program may be freely redistributed under the terms of the GNU GPL\n"));
149 static void printUsage(poptContext con, FILE * fp, int flags)
156 poptPrintHelp(con, fp, flags);
158 poptPrintUsage(con, fp, flags);
161 int main(int argc, char *argv[])
164 enum modes bigMode = MODE_UNKNOWN;
166 #if defined(IAM_RPMQV)
167 QVA_t qva = &rpmQVKArgs;
171 BTA_t ba = &rpmBTArgs;
175 struct rpmInstallArguments_s * ia = &rpmIArgs;
178 #if defined(IAM_RPMDB)
179 struct rpmDatabaseArguments_s * da = &rpmDBArgs;
182 #if defined(IAM_RPMK)
183 QVA_t ka = &rpmQVKArgs;
186 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
187 char * passPhrase = "";
192 const char *optArg, *poptCtx;
202 #if HAVE_MCHECK_H && HAVE_MTRACE
203 mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
205 setprogname(argv[0]); /* Retrofit glibc __progname */
207 /* XXX glibc churn sanity */
208 if (__progname == NULL) {
209 if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
210 else __progname = argv[0];
213 /* Set the major mode based on argv[0] */
215 if (!strcmp(__progname, "rpmbuild")) bigMode = MODE_BUILD;
218 if (!strcmp(__progname, "rpmquery")) bigMode = MODE_QUERY;
219 if (!strcmp(__progname, "rpmverify")) bigMode = MODE_VERIFY;
222 #if defined(IAM_RPMQV)
223 /* Jumpstart option from argv[0] if necessary. */
225 case MODE_QUERY: qva->qva_mode = 'q'; break;
226 case MODE_VERIFY: qva->qva_mode = 'V'; break;
227 case MODE_CHECKSIG: qva->qva_mode = 'K'; break;
228 case MODE_RESIGN: qva->qva_mode = 'R'; break;
244 #if defined(ENABLE_NLS)
245 /* set up the correct locale */
246 (void) setlocale(LC_ALL, "" );
248 bindtextdomain(PACKAGE, LOCALEDIR);
252 rpmSetVerbosity(RPMLOG_NOTICE); /* XXX silly use by showrc */
254 /* Only build has it's own set of aliases, everything else uses rpm */
256 poptCtx = "rpmbuild";
261 /* Make a first pass through the arguments, looking for --rcfile */
262 /* We need to handle that before dealing with the rest of the arguments. */
263 /* XXX popt argv definition should be fixed instead of casting... */
264 optCon = poptGetContext(poptCtx, argc, (const char **)argv, optionsTable, 0);
266 char *poptfile = rpmGenPath(rpmConfigDir(), LIBRPMALIAS_FILENAME, NULL);
267 (void) poptReadConfigFile(optCon, poptfile);
270 (void) poptReadDefaultConfig(optCon, 1);
271 poptSetExecPath(optCon, rpmConfigDir(), 1);
273 while ((arg = poptGetNextOpt(optCon)) > 0) {
274 optArg = poptGetOptArg(optCon);
278 fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
284 fprintf(stderr, "%s: %s\n",
285 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
293 switch (ba->buildMode) {
294 case 'b': bigMode = MODE_BUILD; break;
295 case 't': bigMode = MODE_TARBUILD; break;
296 case 'B': bigMode = MODE_REBUILD; break;
297 case 'C': bigMode = MODE_RECOMPILE; break;
300 if ((ba->buildAmount & RPMBUILD_RMSOURCE) && bigMode == MODE_UNKNOWN)
301 bigMode = MODE_BUILD;
303 if ((ba->buildAmount & RPMBUILD_RMSPEC) && bigMode == MODE_UNKNOWN)
304 bigMode = MODE_BUILD;
306 if (ba->buildRootOverride && bigMode != MODE_BUILD &&
307 bigMode != MODE_REBUILD && bigMode != MODE_TARBUILD) {
308 argerror("--buildroot may only be used during package builds");
310 #endif /* IAM_RPMBT */
313 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_DB)) {
315 if (bigMode != MODE_UNKNOWN)
316 argerror(_("only one major mode may be specified"));
318 bigMode = MODE_INITDB;
321 if (bigMode != MODE_UNKNOWN)
322 argerror(_("only one major mode may be specified"));
324 bigMode = MODE_REBUILDDB;
327 if (bigMode != MODE_UNKNOWN)
328 argerror(_("only one major mode may be specified"));
330 bigMode = MODE_VERIFYDB;
333 #endif /* IAM_RPMDB */
336 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_QV)) {
337 switch (qva->qva_mode) {
338 case 'q': bigMode = MODE_QUERY; break;
339 case 'V': bigMode = MODE_VERIFY; break;
342 if (qva->qva_sourceCount) {
343 if (qva->qva_sourceCount > 2)
344 argerror(_("one type of query/verify may be performed at a "
347 if (qva->qva_flags && (bigMode & ~MODES_QV))
348 argerror(_("unexpected query flags"));
350 if (qva->qva_queryFormat && (bigMode & ~MODES_QV))
351 argerror(_("unexpected query format"));
353 if (qva->qva_source != RPMQV_PACKAGE && (bigMode & ~MODES_QV))
354 argerror(_("unexpected query source"));
356 #endif /* IAM_RPMQV */
359 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_IE))
360 { int iflags = (ia->installInterfaceFlags &
361 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL));
362 int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
365 argerror(_("only one major mode may be specified"));
367 bigMode = MODE_INSTALL;
369 bigMode = MODE_ERASE;
371 #endif /* IAM_RPMEIU */
374 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_K)) {
375 switch (ka->qva_mode) {
379 case RPMSIGN_IMPORT_PUBKEY:
380 case RPMSIGN_CHK_SIGNATURE:
381 bigMode = MODE_CHECKSIG;
384 case RPMSIGN_ADD_SIGNATURE:
385 case RPMSIGN_NEW_SIGNATURE:
386 case RPMSIGN_DEL_SIGNATURE:
387 bigMode = MODE_RESIGN;
388 ka->sign = (ka->qva_mode != RPMSIGN_DEL_SIGNATURE);
392 #endif /* IAM_RPMK */
394 #if defined(IAM_RPMEIU)
395 if (!( bigMode == MODE_INSTALL ) &&
396 (ia->probFilter & (RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_OLDPACKAGE)))
397 argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
398 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_FORCERELOCATE))
399 argerror(_("files may only be relocated during package installation"));
401 if (ia->relocations && ia->prefix)
402 argerror(_("cannot use --prefix with --relocate or --excludepath"));
404 if (bigMode != MODE_INSTALL && ia->relocations)
405 argerror(_("--relocate and --excludepath may only be used when installing new packages"));
407 if (bigMode != MODE_INSTALL && ia->prefix)
408 argerror(_("--prefix may only be used when installing new packages"));
410 if (ia->prefix && ia->prefix[0] != '/')
411 argerror(_("arguments to --prefix must begin with a /"));
413 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_HASH))
414 argerror(_("--hash (-h) may only be specified during package "
417 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_PERCENT))
418 argerror(_("--percent may only be specified during package "
421 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_REPLACEPKG))
422 argerror(_("--replacepkgs may only be specified during package "
425 if (bigMode != MODE_INSTALL && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
426 argerror(_("--excludedocs may only be specified during package "
429 if (bigMode != MODE_INSTALL && ia->incldocs)
430 argerror(_("--includedocs may only be specified during package "
433 if (ia->incldocs && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
434 argerror(_("only one of --excludedocs and --includedocs may be "
437 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREARCH))
438 argerror(_("--ignorearch may only be specified during package "
441 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREOS))
442 argerror(_("--ignoreos may only be specified during package "
445 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
446 (ia->probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
447 argerror(_("--ignoresize may only be specified during package "
450 if ((ia->installInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_ERASE)
451 argerror(_("--allmatches may only be specified during package "
454 if ((ia->transFlags & RPMTRANS_FLAG_ALLFILES) && bigMode != MODE_INSTALL)
455 argerror(_("--allfiles may only be specified during package "
458 if ((ia->transFlags & RPMTRANS_FLAG_JUSTDB) &&
459 bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
460 argerror(_("--justdb may only be specified during package "
461 "installation and erasure"));
463 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE && bigMode != MODE_VERIFY &&
464 (ia->transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
465 argerror(_("script disabling options may only be specified during "
466 "package installation and erasure"));
468 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE && bigMode != MODE_VERIFY &&
469 (ia->transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
470 argerror(_("trigger disabling options may only be specified during "
471 "package installation and erasure"));
473 if (ia->noDeps & (bigMode & ~MODES_FOR_NODEPS))
474 argerror(_("--nodeps may only be specified during package "
475 "building, rebuilding, recompilation, installation,"
476 "erasure, and verification"));
478 if ((ia->transFlags & RPMTRANS_FLAG_TEST) && (bigMode & ~MODES_FOR_TEST))
479 argerror(_("--test may only be specified during package installation, "
480 "erasure, and building"));
481 #endif /* IAM_RPMEIU */
483 if (rpmcliRootDir && rpmcliRootDir[1] && (bigMode & ~MODES_FOR_ROOT))
484 argerror(_("--root (-r) may only be specified during "
485 "installation, erasure, querying, and "
486 "database rebuilds"));
489 switch (urlIsURL(rpmcliRootDir)) {
491 if (bigMode & MODES_FOR_ROOT)
494 if (rpmcliRootDir[0] != '/')
495 argerror(_("arguments to --root (-r) must begin with a /"));
501 rpmSetVerbosity(RPMLOG_WARNING);
503 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
505 #if defined(IAM_RPMBT)
508 #if defined(IAM_RPMK)
513 if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD ||
514 bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD)
520 if ((av = poptGetArgs(optCon)) == NULL) {
521 fprintf(stderr, _("no files to sign\n"));
525 if (stat(*av, &sb)) {
526 fprintf(stderr, _("cannot access file %s\n"), *av);
537 if (poptPeekArg(optCon)) {
538 int sigTag = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY);
543 #ifdef DYING /* XXX gpg can now be used for RSA signatures. */
544 if ((sigTag == RPMSIGTAG_PGP || sigTag == RPMSIGTAG_PGP5) &&
545 !rpmDetectPGPVersion(NULL)) {
546 fprintf(stderr, _("pgp not found: "));
554 passPhrase = rpmGetPassPhrase(_("Enter pass phrase: "), sigTag);
555 if (passPhrase == NULL) {
556 fprintf(stderr, _("Pass phrase check failed\n"));
560 fprintf(stderr, _("Pass phrase is good.\n"));
561 passPhrase = xstrdup(passPhrase);
565 _("Invalid %%_signature spec in macro file.\n"));
572 argerror(_("--sign may only be used during package building"));
575 /* Make rpmLookupSignatureType() return 0 ("none") from now on */
576 (void) rpmLookupSignatureType(RPMLOOKUPSIG_DISABLE);
578 #endif /* IAM_RPMBT || IAM_RPMK */
580 if (rpmcliPipeOutput) {
582 fprintf(stderr, _("creating a pipe for --pipe failed: %m\n"));
586 if (!(pipeChild = fork())) {
587 (void) signal(SIGPIPE, SIG_DFL);
589 (void) dup2(p[0], STDIN_FILENO);
591 (void) execl("/bin/sh", "/bin/sh", "-c", rpmcliPipeOutput, NULL);
592 fprintf(stderr, _("exec failed\n"));
596 (void) dup2(p[1], STDOUT_FILENO);
601 (void) rpmtsSetRootDir(ts, rpmcliRootDir);
605 ec = rpmtsInitDB(ts, 0644);
609 { rpmVSFlags vsflags = rpmExpandNumeric("%{_vsflags_rebuilddb}");
610 rpmVSFlags ovsflags = rpmtsSetVSFlags(ts, vsflags);
611 ec = rpmtsRebuildDB(ts);
612 vsflags = rpmtsSetVSFlags(ts, ovsflags);
615 ec = rpmtsVerifyDB(ts);
617 #endif /* IAM_RPMDB */
624 while (!rpmIsVerbose())
625 rpmIncreaseVerbosity();
627 if (!poptPeekArg(optCon))
628 argerror(_("no packages files given for rebuild"));
631 RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL | RPMBUILD_CHECK;
632 if (bigMode == MODE_REBUILD) {
633 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
634 ba->buildAmount |= RPMBUILD_RMSOURCE;
635 ba->buildAmount |= RPMBUILD_RMSPEC;
636 ba->buildAmount |= RPMBUILD_CLEAN;
637 ba->buildAmount |= RPMBUILD_RMBUILD;
640 while ((pkg = poptGetArg(optCon))) {
641 char * specFile = NULL;
644 ec = rpmInstallSource(ts, pkg, &specFile, &ba->cookie);
646 ba->rootdir = rpmcliRootDir;
647 ba->passPhrase = passPhrase;
648 ec = build(ts, specFile, ba, rpmcliRcfile);
650 ba->cookie = _free(ba->cookie);
651 specFile = _free(specFile);
662 if (!quiet) while (!rpmIsVerbose())
663 rpmIncreaseVerbosity();
665 switch (ba->buildChar) {
667 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
669 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
670 ba->buildAmount |= RPMBUILD_CLEAN;
672 ba->buildAmount |= RPMBUILD_INSTALL;
673 ba->buildAmount |= RPMBUILD_CHECK;
674 if ((ba->buildChar == 'i') && ba->shortCircuit)
677 ba->buildAmount |= RPMBUILD_BUILD;
678 if ((ba->buildChar == 'c') && ba->shortCircuit)
681 ba->buildAmount |= RPMBUILD_PREP;
685 ba->buildAmount |= RPMBUILD_FILECHECK;
688 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
692 if (!poptPeekArg(optCon)) {
693 if (bigMode == MODE_BUILD)
694 argerror(_("no spec files given for build"));
696 argerror(_("no tar files given for build"));
699 while ((pkg = poptGetArg(optCon))) {
700 ba->rootdir = rpmcliRootDir;
701 ba->passPhrase = passPhrase;
703 ec = build(ts, pkg, ba, rpmcliRcfile);
707 (void) rpmReadConfigFiles(rpmcliRcfile, NULL);
710 #endif /* IAM_RPMBT */
714 if (ia->noDeps) ia->installInterfaceFlags |= UNINSTALL_NODEPS;
716 if (!poptPeekArg(optCon)) {
717 argerror(_("no packages given for erase"));
719 ec += rpmErase(ts, ia, (ARGV_const_t) poptGetArgs(optCon));
725 /* RPMTRANS_FLAG_KEEPOBSOLETE */
728 if (ia->transFlags & RPMTRANS_FLAG_NODOCS) {
730 } else if (rpmExpandNumeric("%{_excludedocs}"))
731 ia->transFlags |= RPMTRANS_FLAG_NODOCS;
734 if (ia->noDeps) ia->installInterfaceFlags |= INSTALL_NODEPS;
736 /* we've already ensured !(!ia->prefix && !ia->relocations) */
738 ia->relocations = xmalloc(2 * sizeof(*ia->relocations));
739 ia->relocations[0].oldPath = NULL; /* special case magic */
740 ia->relocations[0].newPath = ia->prefix;
741 ia->relocations[1].oldPath = NULL;
742 ia->relocations[1].newPath = NULL;
743 } else if (ia->relocations) {
744 ia->relocations = xrealloc(ia->relocations,
745 sizeof(*ia->relocations) * (ia->numRelocations + 1));
746 ia->relocations[ia->numRelocations].oldPath = NULL;
747 ia->relocations[ia->numRelocations].newPath = NULL;
750 if (!poptPeekArg(optCon)) {
751 argerror(_("no packages given for install"));
753 /* FIX: ia->relocations[0].newPath undefined */
754 ec += rpmInstall(ts, ia, (ARGV_t) poptGetArgs(optCon));
758 #endif /* IAM_RPMEIU */
762 if (!poptPeekArg(optCon)
763 && !(qva->qva_source == RPMQV_ALL || qva->qva_source == RPMQV_HDLIST))
764 argerror(_("no arguments given for query"));
766 qva->qva_specQuery = rpmspecQuery;
767 ec = rpmcliQuery(ts, qva, (ARGV_const_t) poptGetArgs(optCon));
768 qva->qva_specQuery = NULL;
772 { rpmVerifyFlags verifyFlags = VERIFY_ALL;
774 verifyFlags &= ~qva->qva_flags;
775 qva->qva_flags = (rpmQueryFlags) verifyFlags;
777 if (!poptPeekArg(optCon)
778 && !(qva->qva_source == RPMQV_ALL || qva->qva_source == RPMQV_HDLIST))
779 argerror(_("no arguments given for verify"));
780 ec = rpmcliVerify(ts, qva, (ARGV_const_t) poptGetArgs(optCon));
782 #endif /* IAM_RPMQV */
786 { rpmVerifyFlags verifyFlags =
787 (VERIFY_FILEDIGEST|VERIFY_DIGEST|VERIFY_SIGNATURE);
789 verifyFlags &= ~ka->qva_flags;
790 ka->qva_flags = (rpmQueryFlags) verifyFlags;
793 if (!poptPeekArg(optCon))
794 argerror(_("no arguments given"));
795 ka->passPhrase = passPhrase;
796 ec = rpmcliSign(ts, ka, (ARGV_const_t) poptGetArgs(optCon));
798 #endif /* IAM_RPMK */
800 #if !defined(IAM_RPMQV)
804 #if !defined(IAM_RPMK)
808 #if !defined(IAM_RPMDB)
813 #if !defined(IAM_RPMBT)
819 #if !defined(IAM_RPMEIU)
824 if (poptPeekArg(optCon) != NULL || argc <= 1 || rpmIsVerbose()) {
825 printUsage(optCon, stderr, 0);
835 optCon = poptFreeContext(optCon);
837 rpmFreeMacros(rpmCLIMacroContext);
841 (void) fclose(stdout);
842 (void) waitpid(pipeChild, &status, 0);
845 /* keeps memory leak checkers quiet */
846 rpmFreeFilesystems();
850 qva->qva_queryFormat = _free(qva->qva_queryFormat);
855 ba->buildRootOverride = _free(ba->buildRootOverride);
856 ba->targets = _free(ba->targets);
860 if (ia->relocations != NULL)
861 for (i = 0; i < ia->numRelocations; i++)
862 ia->relocations[i].oldPath = _free(ia->relocations[i].oldPath);
863 ia->relocations = _free(ia->relocations);
866 #if HAVE_MCHECK_H && HAVE_MTRACE
867 muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
870 /* XXX Avoid exit status overflow. Status 255 is special to xargs(1) */
871 if (ec > 254) ec = 254;