2 const char *__progname;
18 #include "rpmdb_internal.h" /* XXX for freeing dbiTags */
24 #define GETOPT_REBUILD 1003
25 #define GETOPT_RECOMPILE 1004
28 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
29 #include "signature.h"
36 MODE_QUERY = (1 << 0),
37 MODE_VERIFY = (1 << 3),
38 #define MODES_QV (MODE_QUERY | MODE_VERIFY)
40 MODE_INSTALL = (1 << 1),
41 MODE_ERASE = (1 << 2),
42 #define MODES_IE (MODE_INSTALL | MODE_ERASE)
44 MODE_BUILD = (1 << 4),
45 MODE_REBUILD = (1 << 5),
46 MODE_RECOMPILE = (1 << 8),
47 MODE_TARBUILD = (1 << 11),
48 #define MODES_BT (MODE_BUILD | MODE_TARBUILD | MODE_REBUILD | MODE_RECOMPILE)
50 MODE_CHECKSIG = (1 << 6),
51 MODE_RESIGN = (1 << 7),
52 #define MODES_K (MODE_CHECKSIG | MODE_RESIGN)
54 MODE_INITDB = (1 << 10),
55 MODE_REBUILDDB = (1 << 12),
56 MODE_VERIFYDB = (1 << 13),
57 #define MODES_DB (MODE_INITDB | MODE_REBUILDDB | MODE_VERIFYDB)
63 #define MODES_FOR_DBPATH (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
64 #define MODES_FOR_NODEPS (MODES_BT | MODES_IE | MODE_VERIFY)
65 #define MODES_FOR_TEST (MODES_BT | MODES_IE)
66 #define MODES_FOR_ROOT (MODES_BT | MODES_IE | MODES_QV | MODES_DB | MODES_K)
68 /* the structure describing the options we take and the defaults */
69 static struct poptOption optionsTable[] = {
72 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0,
73 N_("Query options (with -q or --query):"),
75 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0,
76 N_("Verify options (with -V or --verify):"),
79 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliQVSourcePoptTable, 0,
80 N_("Source options (with --query or --verify):"),
83 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliFtsPoptTable, 0,
84 N_("File tree walk options (with --ftswalk):"),
86 #endif /* IAM_RPMQV */
89 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmSignPoptTable, 0,
90 N_("Signature options:"),
95 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmDatabasePoptTable, 0,
96 N_("Database options:"),
98 #endif /* IAM_RPMDB */
101 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmBuildPoptTable, 0,
102 N_("Build options with [ <specfile> | <tarball> | <source package> ]:"),
104 #endif /* IAM_RPMBT */
107 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmInstallPoptTable, 0,
108 N_("Install/Upgrade/Erase options:"),
110 #endif /* IAM_RPMEIU */
112 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
113 N_("Common options for all rpm modes and executables:"),
122 /* MiNT cannot dynamically increase the stack. */
123 long _stksize = 64 * 1024L;
126 static void argerror(const char * desc)
128 fprintf(stderr, _("%s: %s\n"), __progname, desc);
132 static void printVersion(FILE * fp)
134 fprintf(fp, _("RPM version %s\n"), rpmEVR);
137 static void printBanner(FILE * fp)
139 fprintf(fp, _("Copyright (C) 1998-2002 - Red Hat, Inc.\n"));
140 fprintf(fp, _("This program may be freely redistributed under the terms of the GNU GPL\n"));
143 static void printUsage(poptContext con, FILE * fp, int flags)
150 poptPrintHelp(con, fp, flags);
152 poptPrintUsage(con, fp, flags);
157 #if !defined(__GLIBC__)
158 int main(int argc, char *argv[], char ** envp)
160 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 = "";
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 #if !defined(__GLIBC__)
211 /* XXX glibc churn sanity */
212 if (__progname == NULL) {
213 if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
214 else __progname = argv[0];
217 /* Set the major mode based on argv[0] */
219 if (!strcmp(__progname, "rpmb")) bigMode = MODE_BUILD;
220 if (!strcmp(__progname, "lt-rpmb")) bigMode = MODE_BUILD;
221 if (!strcmp(__progname, "rpmt")) bigMode = MODE_TARBUILD;
222 if (!strcmp(__progname, "rpmbuild")) bigMode = MODE_BUILD;
225 if (!strcmp(__progname, "rpmq")) bigMode = MODE_QUERY;
226 if (!strcmp(__progname, "lt-rpmq")) bigMode = MODE_QUERY;
227 if (!strcmp(__progname, "rpmv")) bigMode = MODE_VERIFY;
228 if (!strcmp(__progname, "rpmquery")) bigMode = MODE_QUERY;
229 if (!strcmp(__progname, "rpmverify")) bigMode = MODE_VERIFY;
232 if (!strcmp(__progname, "rpme")) bigMode = MODE_ERASE;
233 if (!strcmp(__progname, "rpmi")) bigMode = MODE_INSTALL;
234 if (!strcmp(__progname, "lt-rpmi")) bigMode = MODE_INSTALL;
235 if (!strcmp(__progname, "rpmu")) bigMode = MODE_INSTALL;
238 #if defined(IAM_RPMQV)
239 /* Jumpstart option from argv[0] if necessary. */
241 case MODE_QUERY: qva->qva_mode = 'q'; break;
242 case MODE_VERIFY: qva->qva_mode = 'V'; break;
243 case MODE_CHECKSIG: qva->qva_mode = 'K'; break;
244 case MODE_RESIGN: qva->qva_mode = 'R'; break;
260 #if defined(ENABLE_NLS)
261 /* set up the correct locale */
262 (void) setlocale(LC_ALL, "" );
264 bindtextdomain(PACKAGE, LOCALEDIR);
268 rpmSetVerbosity(RPMMESS_NORMAL); /* XXX silly use by showrc */
270 /* Make a first pass through the arguments, looking for --rcfile */
271 /* We need to handle that before dealing with the rest of the arguments. */
272 optCon = poptGetContext(__progname, argc, argv, optionsTable, 0);
273 (void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
274 #if RPM_USES_POPTREADDEFAULTCONFIG
275 (void) poptReadDefaultConfig(optCon, 1);
277 poptSetExecPath(optCon, RPMCONFIGDIR, 1);
279 while ((arg = poptGetNextOpt(optCon)) > 0) {
280 optArg = poptGetOptArg(optCon);
284 fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
290 fprintf(stderr, "%s: %s\n",
291 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
299 switch (ba->buildMode) {
300 case 'b': bigMode = MODE_BUILD; break;
301 case 't': bigMode = MODE_TARBUILD; break;
302 case 'B': bigMode = MODE_REBUILD; break;
303 case 'C': bigMode = MODE_RECOMPILE; break;
306 if ((ba->buildAmount & RPMBUILD_RMSOURCE) && bigMode == MODE_UNKNOWN)
307 bigMode = MODE_BUILD;
309 if ((ba->buildAmount & RPMBUILD_RMSPEC) && bigMode == MODE_UNKNOWN)
310 bigMode = MODE_BUILD;
312 if (ba->buildRootOverride && bigMode != MODE_BUILD &&
313 bigMode != MODE_REBUILD && bigMode != MODE_TARBUILD) {
314 argerror("--buildroot may only be used during package builds");
316 #endif /* IAM_RPMBT */
319 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_DB)) {
321 if (bigMode != MODE_UNKNOWN)
322 argerror(_("only one major mode may be specified"));
324 bigMode = MODE_INITDB;
327 if (bigMode != MODE_UNKNOWN)
328 argerror(_("only one major mode may be specified"));
330 bigMode = MODE_REBUILDDB;
333 if (bigMode != MODE_UNKNOWN)
334 argerror(_("only one major mode may be specified"));
336 bigMode = MODE_VERIFYDB;
339 #endif /* IAM_RPMDB */
342 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_QV)) {
343 switch (qva->qva_mode) {
344 case 'q': bigMode = MODE_QUERY; break;
345 case 'V': bigMode = MODE_VERIFY; break;
348 if (qva->qva_sourceCount) {
349 if (qva->qva_sourceCount > 2)
350 argerror(_("one type of query/verify may be performed at a "
353 if (qva->qva_flags && (bigMode & ~MODES_QV))
354 argerror(_("unexpected query flags"));
356 if (qva->qva_queryFormat && (bigMode & ~MODES_QV))
357 argerror(_("unexpected query format"));
359 if (qva->qva_source != RPMQV_PACKAGE && (bigMode & ~MODES_QV))
360 argerror(_("unexpected query source"));
362 #endif /* IAM_RPMQV */
365 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_IE))
366 { int iflags = (ia->installInterfaceFlags &
367 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL));
368 int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
371 argerror(_("only one major mode may be specified"));
373 bigMode = MODE_INSTALL;
375 bigMode = MODE_ERASE;
377 #endif /* IAM_RPMEIU */
380 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_K)) {
381 switch (ka->qva_mode) {
385 case RPMSIGN_IMPORT_PUBKEY:
386 case RPMSIGN_CHK_SIGNATURE:
387 bigMode = MODE_CHECKSIG;
390 case RPMSIGN_ADD_SIGNATURE:
391 case RPMSIGN_NEW_SIGNATURE:
392 case RPMSIGN_DEL_SIGNATURE:
393 bigMode = MODE_RESIGN;
394 ka->sign = (ka->qva_mode != RPMSIGN_DEL_SIGNATURE);
398 #endif /* IAM_RPMK */
400 #if defined(IAM_RPMEIU)
401 if (!( bigMode == MODE_INSTALL ) &&
402 (ia->probFilter & (RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_OLDPACKAGE)))
403 argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
404 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_FORCERELOCATE))
405 argerror(_("files may only be relocated during package installation"));
407 if (ia->relocations && ia->prefix)
408 argerror(_("cannot use --prefix with --relocate or --excludepath"));
410 if (bigMode != MODE_INSTALL && ia->relocations)
411 argerror(_("--relocate and --excludepath may only be used when installing new packages"));
413 if (bigMode != MODE_INSTALL && ia->prefix)
414 argerror(_("--prefix may only be used when installing new packages"));
416 if (ia->prefix && ia->prefix[0] != '/')
417 argerror(_("arguments to --prefix must begin with a /"));
419 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_HASH))
420 argerror(_("--hash (-h) may only be specified during package "
423 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_PERCENT))
424 argerror(_("--percent may only be specified during package "
427 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_REPLACEPKG))
428 argerror(_("--replacepkgs may only be specified during package "
431 if (bigMode != MODE_INSTALL && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
432 argerror(_("--excludedocs may only be specified during package "
435 if (bigMode != MODE_INSTALL && ia->incldocs)
436 argerror(_("--includedocs may only be specified during package "
439 if (ia->incldocs && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
440 argerror(_("only one of --excludedocs and --includedocs may be "
443 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREARCH))
444 argerror(_("--ignorearch may only be specified during package "
447 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREOS))
448 argerror(_("--ignoreos may only be specified during package "
451 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
452 (ia->probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
453 argerror(_("--ignoresize may only be specified during package "
456 if ((ia->eraseInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_ERASE)
457 argerror(_("--allmatches may only be specified during package "
460 if ((ia->transFlags & RPMTRANS_FLAG_ALLFILES) && bigMode != MODE_INSTALL)
461 argerror(_("--allfiles may only be specified during package "
464 if ((ia->transFlags & RPMTRANS_FLAG_JUSTDB) &&
465 bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
466 argerror(_("--justdb may only be specified during package "
467 "installation and erasure"));
469 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
470 (ia->transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
471 argerror(_("script disabling options may only be specified during "
472 "package installation and erasure"));
474 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
475 (ia->transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
476 argerror(_("trigger disabling options may only be specified during "
477 "package installation and erasure"));
479 if (ia->noDeps & (bigMode & ~MODES_FOR_NODEPS))
480 argerror(_("--nodeps may only be specified during package "
481 "building, rebuilding, recompilation, installation,"
482 "erasure, and verification"));
484 if ((ia->transFlags & RPMTRANS_FLAG_TEST) && (bigMode & ~MODES_FOR_TEST))
485 argerror(_("--test may only be specified during package installation, "
486 "erasure, and building"));
487 #endif /* IAM_RPMEIU */
489 if (rpmcliRootDir && rpmcliRootDir[1] && (bigMode & ~MODES_FOR_ROOT))
490 argerror(_("--root (-r) may only be specified during "
491 "installation, erasure, querying, and "
492 "database rebuilds"));
495 switch (urlIsURL(rpmcliRootDir)) {
497 if (bigMode & MODES_FOR_ROOT)
500 if (rpmcliRootDir[0] != '/')
501 argerror(_("arguments to --root (-r) must begin with a /"));
506 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
508 #if defined(IAM_RPMBT)
511 #if defined(IAM_RPMK)
516 if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD ||
517 bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD)
523 if ((av = poptGetArgs(optCon)) == NULL) {
524 fprintf(stderr, _("no files to sign\n"));
528 if (stat(*av, &sb)) {
529 fprintf(stderr, _("cannot access file %s\n"), *av);
540 if (poptPeekArg(optCon)) {
541 int sigTag = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY);
546 #ifdef DYING /* XXX gpg can now be used for RSA signatures. */
547 if ((sigTag == RPMSIGTAG_PGP || sigTag == RPMSIGTAG_PGP5) &&
548 !rpmDetectPGPVersion(NULL)) {
549 fprintf(stderr, _("pgp not found: "));
557 passPhrase = rpmGetPassPhrase(_("Enter pass phrase: "), sigTag);
558 if (passPhrase == NULL) {
559 fprintf(stderr, _("Pass phrase check failed\n"));
563 fprintf(stderr, _("Pass phrase is good.\n"));
564 passPhrase = xstrdup(passPhrase);
568 _("Invalid %%_signature spec in macro file.\n"));
575 argerror(_("--sign may only be used during package building"));
578 /* Make rpmLookupSignatureType() return 0 ("none") from now on */
579 (void) rpmLookupSignatureType(RPMLOOKUPSIG_DISABLE);
581 #endif /* IAM_RPMBT || IAM_RPMK */
583 if (rpmcliPipeOutput) {
586 if (!(pipeChild = fork())) {
588 (void) dup2(p[0], STDIN_FILENO);
590 (void) execl("/bin/sh", "/bin/sh", "-c", rpmcliPipeOutput, NULL);
591 fprintf(stderr, _("exec failed\n"));
595 (void) dup2(p[1], STDOUT_FILENO);
600 (void) rpmtsSetRootDir(ts, rpmcliRootDir);
604 ec = rpmtsInitDB(ts, 0644);
608 { rpmVSFlags vsflags = rpmExpandNumeric("%{_vsflags_rebuilddb}");
609 rpmVSFlags ovsflags = rpmtsSetVSFlags(ts, vsflags);
610 ec = rpmtsRebuildDB(ts);
611 vsflags = rpmtsSetVSFlags(ts, ovsflags);
614 ec = rpmtsVerifyDB(ts);
616 #endif /* IAM_RPMDB */
623 while (!rpmIsVerbose())
624 rpmIncreaseVerbosity();
626 if (!poptPeekArg(optCon))
627 argerror(_("no packages files given for rebuild"));
630 RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL | RPMBUILD_CHECK;
631 if (bigMode == MODE_REBUILD) {
632 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
633 ba->buildAmount |= RPMBUILD_RMSOURCE;
634 ba->buildAmount |= RPMBUILD_RMSPEC;
635 ba->buildAmount |= RPMBUILD_CLEAN;
636 ba->buildAmount |= RPMBUILD_RMBUILD;
639 while ((pkg = poptGetArg(optCon))) {
640 const char * specFile = NULL;
643 ec = rpmInstallSource(ts, pkg, &specFile, &ba->cookie);
645 ba->rootdir = rpmcliRootDir;
646 ba->passPhrase = passPhrase;
647 ec = build(ts, specFile, ba, rpmcliRcfile);
649 ba->cookie = _free(ba->cookie);
650 specFile = _free(specFile);
661 while (!rpmIsVerbose())
662 rpmIncreaseVerbosity();
664 switch (ba->buildChar) {
666 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
668 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
669 ba->buildAmount |= RPMBUILD_CLEAN;
671 ba->buildAmount |= RPMBUILD_INSTALL;
672 ba->buildAmount |= RPMBUILD_CHECK;
673 if ((ba->buildChar == 'i') && ba->shortCircuit)
676 ba->buildAmount |= RPMBUILD_BUILD;
677 if ((ba->buildChar == 'c') && ba->shortCircuit)
680 ba->buildAmount |= RPMBUILD_PREP;
684 ba->buildAmount |= RPMBUILD_FILECHECK;
687 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
691 if (!poptPeekArg(optCon)) {
692 if (bigMode == MODE_BUILD)
693 argerror(_("no spec files given for build"));
695 argerror(_("no tar files given for build"));
698 while ((pkg = poptGetArg(optCon))) {
699 ba->rootdir = rpmcliRootDir;
700 ba->passPhrase = passPhrase;
702 ec = build(ts, pkg, ba, rpmcliRcfile);
706 (void) rpmReadConfigFiles(rpmcliRcfile, NULL);
709 #endif /* IAM_RPMBT */
713 if (ia->noDeps) ia->eraseInterfaceFlags |= UNINSTALL_NODEPS;
715 if (!poptPeekArg(optCon)) {
717 argerror(_("no packages given for erase"));
718 ia->transFlags |= RPMTRANS_FLAG_NOMD5;
719 ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
720 ec += rpmRollback(ts, ia, NULL);
722 ec += rpmErase(ts, ia, (const char **) poptGetArgs(optCon));
728 /* RPMTRANS_FLAG_KEEPOBSOLETE */
731 if (ia->transFlags & RPMTRANS_FLAG_NODOCS) {
733 } else if (rpmExpandNumeric("%{_excludedocs}"))
734 ia->transFlags |= RPMTRANS_FLAG_NODOCS;
737 if (ia->noDeps) ia->installInterfaceFlags |= INSTALL_NODEPS;
739 /* we've already ensured !(!ia->prefix && !ia->relocations) */
741 ia->relocations = xmalloc(2 * sizeof(*ia->relocations));
742 ia->relocations[0].oldPath = NULL; /* special case magic */
743 ia->relocations[0].newPath = ia->prefix;
744 ia->relocations[1].oldPath = NULL;
745 ia->relocations[1].newPath = NULL;
746 } else if (ia->relocations) {
747 ia->relocations = xrealloc(ia->relocations,
748 sizeof(*ia->relocations) * (ia->numRelocations + 1));
749 ia->relocations[ia->numRelocations].oldPath = NULL;
750 ia->relocations[ia->numRelocations].newPath = NULL;
753 if (!poptPeekArg(optCon)) {
755 argerror(_("no packages given for install"));
756 ia->transFlags |= RPMTRANS_FLAG_NOMD5;
757 ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
758 ec += rpmRollback(ts, ia, NULL);
760 /* FIX: ia->relocations[0].newPath undefined */
761 ec += rpmInstall(ts, ia, (const char **)poptGetArgs(optCon));
765 #endif /* IAM_RPMEIU */
769 if (!poptPeekArg(optCon)
770 && !(qva->qva_source == RPMQV_ALL || qva->qva_source == RPMQV_HDLIST))
771 argerror(_("no arguments given for query"));
773 qva->qva_specQuery = rpmspecQuery;
774 ec = rpmcliQuery(ts, qva, (const char **) poptGetArgs(optCon));
775 qva->qva_specQuery = NULL;
779 { rpmVerifyFlags verifyFlags = VERIFY_ALL;
781 verifyFlags &= ~qva->qva_flags;
782 qva->qva_flags = (rpmQueryFlags) verifyFlags;
784 if (!poptPeekArg(optCon)
785 && !(qva->qva_source == RPMQV_ALL || qva->qva_source == RPMQV_HDLIST))
786 argerror(_("no arguments given for verify"));
787 ec = rpmcliVerify(ts, qva, (const char **) poptGetArgs(optCon));
789 #endif /* IAM_RPMQV */
793 { rpmVerifyFlags verifyFlags =
794 (VERIFY_MD5|VERIFY_DIGEST|VERIFY_SIGNATURE);
796 verifyFlags &= ~ka->qva_flags;
797 ka->qva_flags = (rpmQueryFlags) verifyFlags;
800 if (!poptPeekArg(optCon))
801 argerror(_("no arguments given"));
802 ka->passPhrase = passPhrase;
803 ec = rpmcliSign(ts, ka, (const char **)poptGetArgs(optCon));
805 #endif /* IAM_RPMK */
807 #if !defined(IAM_RPMQV)
811 #if !defined(IAM_RPMK)
815 #if !defined(IAM_RPMDB)
820 #if !defined(IAM_RPMBT)
826 #if !defined(IAM_RPMEIU)
831 if (poptPeekArg(optCon) != NULL || argc <= 1 || rpmIsVerbose()) {
832 printUsage(optCon, stdout, 0);
838 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
840 #endif /* IAM_RPMBT || IAM_RPMK */
844 optCon = poptFreeContext(optCon);
846 rpmFreeMacros(rpmCLIMacroContext);
850 (void) fclose(stdout);
851 (void) waitpid(pipeChild, &status, 0);
854 /* keeps memory leak checkers quiet */
857 /* XXX FIXME: hide this in the api */
858 dbiTags = _free(dbiTags);
861 qva->qva_queryFormat = _free(qva->qva_queryFormat);
866 ba->buildRootOverride = _free(ba->buildRootOverride);
867 ba->targets = _free(ba->targets);
871 if (ia->relocations != NULL)
872 for (i = 0; i < ia->numRelocations; i++)
873 ia->relocations[i].oldPath = _free(ia->relocations[i].oldPath);
874 ia->relocations = _free(ia->relocations);
877 #if HAVE_MCHECK_H && HAVE_MTRACE
878 muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
881 /* XXX don't overflow single byte exit status */
882 if (ec > 255) ec = 255;