2 const char *__progname;
23 #define GETOPT_REBUILD 1003
24 #define GETOPT_RECOMPILE 1004
27 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
28 #include "signature.h"
35 MODE_QUERY = (1 << 0),
36 MODE_VERIFY = (1 << 3),
37 #define MODES_QV (MODE_QUERY | MODE_VERIFY)
39 MODE_INSTALL = (1 << 1),
40 MODE_ERASE = (1 << 2),
41 #define MODES_IE (MODE_INSTALL | MODE_ERASE)
43 MODE_BUILD = (1 << 4),
44 MODE_REBUILD = (1 << 5),
45 MODE_RECOMPILE = (1 << 8),
46 MODE_TARBUILD = (1 << 11),
47 #define MODES_BT (MODE_BUILD | MODE_TARBUILD | MODE_REBUILD | MODE_RECOMPILE)
49 MODE_CHECKSIG = (1 << 6),
50 MODE_RESIGN = (1 << 7),
51 #define MODES_K (MODE_CHECKSIG | MODE_RESIGN)
53 MODE_INITDB = (1 << 10),
54 MODE_REBUILDDB = (1 << 12),
55 MODE_VERIFYDB = (1 << 13),
56 #define MODES_DB (MODE_INITDB | MODE_REBUILDDB | MODE_VERIFYDB)
62 #define MODES_FOR_DBPATH (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
63 #define MODES_FOR_NODEPS (MODES_BT | MODES_IE | MODE_VERIFY)
64 #define MODES_FOR_TEST (MODES_BT | MODES_IE)
65 #define MODES_FOR_ROOT (MODES_BT | MODES_IE | MODES_QV | MODES_DB | MODES_K)
67 /* the structure describing the options we take and the defaults */
68 static struct poptOption optionsTable[] = {
71 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0,
72 N_("Query options (with -q or --query):"),
74 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0,
75 N_("Verify options (with -V or --verify):"),
78 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliQVSourcePoptTable, 0,
79 N_("Source options (with --query or --verify):"),
82 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliFtsPoptTable, 0,
83 N_("File tree walk options (with --ftswalk):"),
85 #endif /* IAM_RPMQV */
88 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmSignPoptTable, 0,
89 N_("Signature options:"),
94 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmDatabasePoptTable, 0,
95 N_("Database options:"),
97 #endif /* IAM_RPMDB */
100 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmBuildPoptTable, 0,
101 N_("Build options with [ <specfile> | <tarball> | <source package> ]:"),
103 #endif /* IAM_RPMBT */
106 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmInstallPoptTable, 0,
107 N_("Install/Upgrade/Erase options:"),
109 #endif /* IAM_RPMEIU */
111 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
112 N_("Common options for all rpm modes and executables:"),
121 /* MiNT cannot dynamically increase the stack. */
122 long _stksize = 64 * 1024L;
125 static void argerror(const char * desc)
127 fprintf(stderr, _("%s: %s\n"), __progname, desc);
131 static void printVersion(FILE * fp)
133 fprintf(fp, _("RPM version %s\n"), rpmEVR);
136 static void printBanner(FILE * fp)
138 fprintf(fp, _("Copyright (C) 1998-2002 - Red Hat, Inc.\n"));
139 fprintf(fp, _("This program may be freely redistributed under the terms of the GNU GPL\n"));
142 static void printUsage(poptContext con, FILE * fp, int flags)
149 poptPrintHelp(con, fp, flags);
151 poptPrintUsage(con, fp, flags);
156 #if !defined(__GLIBC__)
157 int main(int argc, const char ** argv, char ** envp)
159 int main(int argc, const char ** argv)
163 enum modes bigMode = MODE_UNKNOWN;
165 #if defined(IAM_RPMQV)
166 QVA_t qva = &rpmQVKArgs;
170 BTA_t ba = &rpmBTArgs;
174 struct rpmInstallArguments_s * ia = &rpmIArgs;
177 #if defined(IAM_RPMDB)
178 struct rpmDatabaseArguments_s * da = &rpmDBArgs;
181 #if defined(IAM_RPMK)
182 QVA_t ka = &rpmQVKArgs;
185 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
186 char * passPhrase = "";
201 #if HAVE_MCHECK_H && HAVE_MTRACE
202 mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
204 setprogname(argv[0]); /* Retrofit glibc __progname */
206 #if !defined(__GLIBC__)
210 /* XXX glibc churn sanity */
211 if (__progname == NULL) {
212 if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
213 else __progname = argv[0];
216 /* Set the major mode based on argv[0] */
218 if (!strcmp(__progname, "rpmb")) bigMode = MODE_BUILD;
219 if (!strcmp(__progname, "lt-rpmb")) bigMode = MODE_BUILD;
220 if (!strcmp(__progname, "rpmt")) bigMode = MODE_TARBUILD;
221 if (!strcmp(__progname, "rpmbuild")) bigMode = MODE_BUILD;
224 if (!strcmp(__progname, "rpmq")) bigMode = MODE_QUERY;
225 if (!strcmp(__progname, "lt-rpmq")) bigMode = MODE_QUERY;
226 if (!strcmp(__progname, "rpmv")) bigMode = MODE_VERIFY;
227 if (!strcmp(__progname, "rpmquery")) bigMode = MODE_QUERY;
228 if (!strcmp(__progname, "rpmverify")) bigMode = MODE_VERIFY;
231 if (!strcmp(__progname, "rpme")) bigMode = MODE_ERASE;
232 if (!strcmp(__progname, "rpmi")) bigMode = MODE_INSTALL;
233 if (!strcmp(__progname, "lt-rpmi")) bigMode = MODE_INSTALL;
234 if (!strcmp(__progname, "rpmu")) bigMode = MODE_INSTALL;
237 #if defined(IAM_RPMQV)
238 /* Jumpstart option from argv[0] if necessary. */
240 case MODE_QUERY: qva->qva_mode = 'q'; break;
241 case MODE_VERIFY: qva->qva_mode = 'V'; break;
242 case MODE_CHECKSIG: qva->qva_mode = 'K'; break;
243 case MODE_RESIGN: qva->qva_mode = 'R'; break;
259 #if defined(ENABLE_NLS)
260 /* set up the correct locale */
261 (void) setlocale(LC_ALL, "" );
263 bindtextdomain(PACKAGE, LOCALEDIR);
267 rpmSetVerbosity(RPMMESS_NORMAL); /* XXX silly use by showrc */
269 /* Make a first pass through the arguments, looking for --rcfile */
270 /* We need to handle that before dealing with the rest of the arguments. */
271 optCon = poptGetContext(__progname, argc, argv, optionsTable, 0);
272 (void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
273 #if RPM_USES_POPTREADDEFAULTCONFIG
274 (void) poptReadDefaultConfig(optCon, 1);
276 poptSetExecPath(optCon, RPMCONFIGDIR, 1);
278 while ((arg = poptGetNextOpt(optCon)) > 0) {
279 optArg = poptGetOptArg(optCon);
283 fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
289 fprintf(stderr, "%s: %s\n",
290 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
298 switch (ba->buildMode) {
299 case 'b': bigMode = MODE_BUILD; break;
300 case 't': bigMode = MODE_TARBUILD; break;
301 case 'B': bigMode = MODE_REBUILD; break;
302 case 'C': bigMode = MODE_RECOMPILE; break;
305 if ((ba->buildAmount & RPMBUILD_RMSOURCE) && bigMode == MODE_UNKNOWN)
306 bigMode = MODE_BUILD;
308 if ((ba->buildAmount & RPMBUILD_RMSPEC) && bigMode == MODE_UNKNOWN)
309 bigMode = MODE_BUILD;
311 if (ba->buildRootOverride && bigMode != MODE_BUILD &&
312 bigMode != MODE_REBUILD && bigMode != MODE_TARBUILD) {
313 argerror("--buildroot may only be used during package builds");
315 #endif /* IAM_RPMBT */
318 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_DB)) {
320 if (bigMode != MODE_UNKNOWN)
321 argerror(_("only one major mode may be specified"));
323 bigMode = MODE_INITDB;
326 if (bigMode != MODE_UNKNOWN)
327 argerror(_("only one major mode may be specified"));
329 bigMode = MODE_REBUILDDB;
332 if (bigMode != MODE_UNKNOWN)
333 argerror(_("only one major mode may be specified"));
335 bigMode = MODE_VERIFYDB;
338 #endif /* IAM_RPMDB */
341 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_QV)) {
342 switch (qva->qva_mode) {
343 case 'q': bigMode = MODE_QUERY; break;
344 case 'V': bigMode = MODE_VERIFY; break;
347 if (qva->qva_sourceCount) {
348 if (qva->qva_sourceCount > 2)
349 argerror(_("one type of query/verify may be performed at a "
352 if (qva->qva_flags && (bigMode & ~MODES_QV))
353 argerror(_("unexpected query flags"));
355 if (qva->qva_queryFormat && (bigMode & ~MODES_QV))
356 argerror(_("unexpected query format"));
358 if (qva->qva_source != RPMQV_PACKAGE && (bigMode & ~MODES_QV))
359 argerror(_("unexpected query source"));
361 #endif /* IAM_RPMQV */
364 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_IE))
365 { int iflags = (ia->installInterfaceFlags &
366 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL));
367 int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
370 argerror(_("only one major mode may be specified"));
372 bigMode = MODE_INSTALL;
374 bigMode = MODE_ERASE;
376 #endif /* IAM_RPMEIU */
379 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_K)) {
380 switch (ka->qva_mode) {
384 case RPMSIGN_IMPORT_PUBKEY:
385 case RPMSIGN_CHK_SIGNATURE:
386 bigMode = MODE_CHECKSIG;
389 case RPMSIGN_ADD_SIGNATURE:
390 case RPMSIGN_NEW_SIGNATURE:
391 case RPMSIGN_DEL_SIGNATURE:
392 bigMode = MODE_RESIGN;
393 ka->sign = (ka->qva_mode != RPMSIGN_DEL_SIGNATURE);
397 #endif /* IAM_RPMK */
399 #if defined(IAM_RPMEIU)
400 if (!( bigMode == MODE_INSTALL ) &&
401 (ia->probFilter & (RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_OLDPACKAGE)))
402 argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
403 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_FORCERELOCATE))
404 argerror(_("files may only be relocated during package installation"));
406 if (ia->relocations && ia->prefix)
407 argerror(_("cannot use --prefix with --relocate or --excludepath"));
409 if (bigMode != MODE_INSTALL && ia->relocations)
410 argerror(_("--relocate and --excludepath may only be used when installing new packages"));
412 if (bigMode != MODE_INSTALL && ia->prefix)
413 argerror(_("--prefix may only be used when installing new packages"));
415 if (ia->prefix && ia->prefix[0] != '/')
416 argerror(_("arguments to --prefix must begin with a /"));
418 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_HASH))
419 argerror(_("--hash (-h) may only be specified during package "
422 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_PERCENT))
423 argerror(_("--percent may only be specified during package "
426 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_REPLACEPKG))
427 argerror(_("--replacepkgs may only be specified during package "
430 if (bigMode != MODE_INSTALL && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
431 argerror(_("--excludedocs may only be specified during package "
434 if (bigMode != MODE_INSTALL && ia->incldocs)
435 argerror(_("--includedocs may only be specified during package "
438 if (ia->incldocs && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
439 argerror(_("only one of --excludedocs and --includedocs may be "
442 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREARCH))
443 argerror(_("--ignorearch may only be specified during package "
446 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREOS))
447 argerror(_("--ignoreos may only be specified during package "
450 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
451 (ia->probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
452 argerror(_("--ignoresize may only be specified during package "
455 if ((ia->eraseInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_ERASE)
456 argerror(_("--allmatches may only be specified during package "
459 if ((ia->transFlags & RPMTRANS_FLAG_ALLFILES) && bigMode != MODE_INSTALL)
460 argerror(_("--allfiles may only be specified during package "
463 if ((ia->transFlags & RPMTRANS_FLAG_JUSTDB) &&
464 bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
465 argerror(_("--justdb may only be specified during package "
466 "installation and erasure"));
468 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
469 (ia->transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
470 argerror(_("script disabling options may only be specified during "
471 "package installation and erasure"));
473 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
474 (ia->transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
475 argerror(_("trigger disabling options may only be specified during "
476 "package installation and erasure"));
478 if (ia->noDeps & (bigMode & ~MODES_FOR_NODEPS))
479 argerror(_("--nodeps may only be specified during package "
480 "building, rebuilding, recompilation, installation,"
481 "erasure, and verification"));
483 if ((ia->transFlags & RPMTRANS_FLAG_TEST) && (bigMode & ~MODES_FOR_TEST))
484 argerror(_("--test may only be specified during package installation, "
485 "erasure, and building"));
486 #endif /* IAM_RPMEIU */
488 if (rpmcliRootDir && rpmcliRootDir[1] && (bigMode & ~MODES_FOR_ROOT))
489 argerror(_("--root (-r) may only be specified during "
490 "installation, erasure, querying, and "
491 "database rebuilds"));
494 switch (urlIsURL(rpmcliRootDir)) {
496 if (bigMode & MODES_FOR_ROOT)
499 if (rpmcliRootDir[0] != '/')
500 argerror(_("arguments to --root (-r) must begin with a /"));
505 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
507 #if defined(IAM_RPMBT)
510 #if defined(IAM_RPMK)
515 if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD ||
516 bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD)
522 if ((av = poptGetArgs(optCon)) == NULL) {
523 fprintf(stderr, _("no files to sign\n"));
527 if (stat(*av, &sb)) {
528 fprintf(stderr, _("cannot access file %s\n"), *av);
539 if (poptPeekArg(optCon)) {
540 int sigTag = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY);
545 #ifdef DYING /* XXX gpg can now be used for RSA signatures. */
546 if ((sigTag == RPMSIGTAG_PGP || sigTag == RPMSIGTAG_PGP5) &&
547 !rpmDetectPGPVersion(NULL)) {
548 fprintf(stderr, _("pgp not found: "));
556 passPhrase = rpmGetPassPhrase(_("Enter pass phrase: "), sigTag);
557 if (passPhrase == NULL) {
558 fprintf(stderr, _("Pass phrase check failed\n"));
562 fprintf(stderr, _("Pass phrase is good.\n"));
563 passPhrase = xstrdup(passPhrase);
567 _("Invalid %%_signature spec in macro file.\n"));
574 argerror(_("--sign may only be used during package building"));
577 /* Make rpmLookupSignatureType() return 0 ("none") from now on */
578 (void) rpmLookupSignatureType(RPMLOOKUPSIG_DISABLE);
580 #endif /* IAM_RPMBT || IAM_RPMK */
582 if (rpmcliPipeOutput) {
585 if (!(pipeChild = fork())) {
587 (void) dup2(p[0], STDIN_FILENO);
589 (void) execl("/bin/sh", "/bin/sh", "-c", rpmcliPipeOutput, NULL);
590 fprintf(stderr, _("exec failed\n"));
594 (void) dup2(p[1], STDOUT_FILENO);
599 (void) rpmtsSetRootDir(ts, rpmcliRootDir);
603 ec = rpmtsInitDB(ts, 0644);
607 { rpmVSFlags vsflags = rpmExpandNumeric("%{_vsflags_rebuilddb}");
608 rpmVSFlags ovsflags = rpmtsSetVSFlags(ts, vsflags);
609 ec = rpmtsRebuildDB(ts);
610 vsflags = rpmtsSetVSFlags(ts, ovsflags);
613 ec = rpmtsVerifyDB(ts);
615 #endif /* IAM_RPMDB */
622 while (!rpmIsVerbose())
623 rpmIncreaseVerbosity();
625 if (!poptPeekArg(optCon))
626 argerror(_("no packages files given for rebuild"));
629 RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL | RPMBUILD_CHECK;
630 if (bigMode == MODE_REBUILD) {
631 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
632 ba->buildAmount |= RPMBUILD_RMSOURCE;
633 ba->buildAmount |= RPMBUILD_RMSPEC;
634 ba->buildAmount |= RPMBUILD_CLEAN;
635 ba->buildAmount |= RPMBUILD_RMBUILD;
638 while ((pkg = poptGetArg(optCon))) {
639 const char * specFile = NULL;
642 ec = rpmInstallSource(ts, pkg, &specFile, &ba->cookie);
644 ba->rootdir = rpmcliRootDir;
645 ba->passPhrase = passPhrase;
646 ec = build(ts, specFile, ba, rpmcliRcfile);
648 ba->cookie = _free(ba->cookie);
649 specFile = _free(specFile);
660 while (!rpmIsVerbose())
661 rpmIncreaseVerbosity();
663 switch (ba->buildChar) {
665 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
667 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
668 ba->buildAmount |= RPMBUILD_CLEAN;
670 ba->buildAmount |= RPMBUILD_INSTALL;
671 ba->buildAmount |= RPMBUILD_CHECK;
672 if ((ba->buildChar == 'i') && ba->shortCircuit)
675 ba->buildAmount |= RPMBUILD_BUILD;
676 if ((ba->buildChar == 'c') && ba->shortCircuit)
679 ba->buildAmount |= RPMBUILD_PREP;
683 ba->buildAmount |= RPMBUILD_FILECHECK;
686 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
690 if (!poptPeekArg(optCon)) {
691 if (bigMode == MODE_BUILD)
692 argerror(_("no spec files given for build"));
694 argerror(_("no tar files given for build"));
697 while ((pkg = poptGetArg(optCon))) {
698 ba->rootdir = rpmcliRootDir;
699 ba->passPhrase = passPhrase;
701 ec = build(ts, pkg, ba, rpmcliRcfile);
705 (void) rpmReadConfigFiles(rpmcliRcfile, NULL);
708 #endif /* IAM_RPMBT */
712 if (ia->noDeps) ia->eraseInterfaceFlags |= UNINSTALL_NODEPS;
714 if (!poptPeekArg(optCon)) {
716 argerror(_("no packages given for erase"));
717 ia->transFlags |= RPMTRANS_FLAG_NOMD5;
718 ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
719 ec += rpmRollback(ts, ia, NULL);
721 ec += rpmErase(ts, ia, (const char **) poptGetArgs(optCon));
727 /* RPMTRANS_FLAG_KEEPOBSOLETE */
730 if (ia->transFlags & RPMTRANS_FLAG_NODOCS) {
732 } else if (rpmExpandNumeric("%{_excludedocs}"))
733 ia->transFlags |= RPMTRANS_FLAG_NODOCS;
736 if (ia->noDeps) ia->installInterfaceFlags |= INSTALL_NODEPS;
738 /* we've already ensured !(!ia->prefix && !ia->relocations) */
740 ia->relocations = xmalloc(2 * sizeof(*ia->relocations));
741 ia->relocations[0].oldPath = NULL; /* special case magic */
742 ia->relocations[0].newPath = ia->prefix;
743 ia->relocations[1].oldPath = NULL;
744 ia->relocations[1].newPath = NULL;
745 } else if (ia->relocations) {
746 ia->relocations = xrealloc(ia->relocations,
747 sizeof(*ia->relocations) * (ia->numRelocations + 1));
748 ia->relocations[ia->numRelocations].oldPath = NULL;
749 ia->relocations[ia->numRelocations].newPath = NULL;
752 if (!poptPeekArg(optCon)) {
754 argerror(_("no packages given for install"));
755 ia->transFlags |= RPMTRANS_FLAG_NOMD5;
756 ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
757 ec += rpmRollback(ts, ia, NULL);
759 /* FIX: ia->relocations[0].newPath undefined */
760 ec += rpmInstall(ts, ia, (const char **)poptGetArgs(optCon));
764 #endif /* IAM_RPMEIU */
768 if (!poptPeekArg(optCon)
769 && !(qva->qva_source == RPMQV_ALL || qva->qva_source == RPMQV_HDLIST))
770 argerror(_("no arguments given for query"));
772 qva->qva_specQuery = rpmspecQuery;
773 ec = rpmcliQuery(ts, qva, (const char **) poptGetArgs(optCon));
774 qva->qva_specQuery = NULL;
778 { rpmVerifyFlags verifyFlags = VERIFY_ALL;
780 verifyFlags &= ~qva->qva_flags;
781 qva->qva_flags = (rpmQueryFlags) verifyFlags;
783 if (!poptPeekArg(optCon)
784 && !(qva->qva_source == RPMQV_ALL || qva->qva_source == RPMQV_HDLIST))
785 argerror(_("no arguments given for verify"));
786 ec = rpmcliVerify(ts, qva, (const char **) poptGetArgs(optCon));
788 #endif /* IAM_RPMQV */
792 { rpmVerifyFlags verifyFlags =
793 (VERIFY_MD5|VERIFY_DIGEST|VERIFY_SIGNATURE);
795 verifyFlags &= ~ka->qva_flags;
796 ka->qva_flags = (rpmQueryFlags) verifyFlags;
799 if (!poptPeekArg(optCon))
800 argerror(_("no arguments given"));
801 ka->passPhrase = passPhrase;
802 ec = rpmcliSign(ts, ka, (const char **)poptGetArgs(optCon));
804 #endif /* IAM_RPMK */
806 #if !defined(IAM_RPMQV)
810 #if !defined(IAM_RPMK)
814 #if !defined(IAM_RPMDB)
819 #if !defined(IAM_RPMBT)
825 #if !defined(IAM_RPMEIU)
830 if (poptPeekArg(optCon) != NULL || argc <= 1 || rpmIsVerbose()) {
831 printUsage(optCon, stdout, 0);
837 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
839 #endif /* IAM_RPMBT || IAM_RPMK */
843 optCon = poptFreeContext(optCon);
845 rpmFreeMacros(rpmCLIMacroContext);
849 (void) fclose(stdout);
850 (void) waitpid(pipeChild, &status, 0);
853 /* keeps memory leak checkers quiet */
856 dbiTags = _free(dbiTags);
859 qva->qva_queryFormat = _free(qva->qva_queryFormat);
864 ba->buildRootOverride = _free(ba->buildRootOverride);
865 ba->targets = _free(ba->targets);
869 if (ia->relocations != NULL)
870 for (i = 0; i < ia->numRelocations; i++)
871 ia->relocations[i].oldPath = _free(ia->relocations[i].oldPath);
872 ia->relocations = _free(ia->relocations);
875 #if HAVE_MCHECK_H && HAVE_MTRACE
876 muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
879 /* XXX don't overflow single byte exit status */
880 if (ec > 255) ec = 255;