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)
70 /* the structure describing the options we take and the defaults */
71 static struct poptOption optionsTable[] = {
74 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0,
75 N_("Query options (with -q or --query):"),
77 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0,
78 N_("Verify options (with -V or --verify):"),
81 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliQVSourcePoptTable, 0,
82 N_("Source options (with --query or --verify):"),
85 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliFtsPoptTable, 0,
86 N_("File tree walk options (with --ftswalk):"),
88 #endif /* IAM_RPMQV */
91 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmSignPoptTable, 0,
92 N_("Signature options:"),
97 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmDatabasePoptTable, 0,
98 N_("Database options:"),
100 #endif /* IAM_RPMDB */
103 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmBuildPoptTable, 0,
104 N_("Build options with [ <specfile> | <tarball> | <source package> ]:"),
106 #endif /* IAM_RPMBT */
109 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmInstallPoptTable, 0,
110 N_("Install/Upgrade/Erase options:"),
112 #endif /* IAM_RPMEIU */
114 { "quiet", '\0', 0, &quiet, 0, NULL, NULL},
116 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
117 N_("Common options for all rpm modes and executables:"),
126 /* MiNT cannot dynamically increase the stack. */
127 long _stksize = 64 * 1024L;
130 static void argerror(const char * desc)
132 fprintf(stderr, _("%s: %s\n"), __progname, desc);
136 static void printVersion(FILE * fp)
138 fprintf(fp, _("RPM version %s\n"), rpmEVR);
141 static void printBanner(FILE * fp)
143 fprintf(fp, _("Copyright (C) 1998-2002 - Red Hat, Inc.\n"));
144 fprintf(fp, _("This program may be freely redistributed under the terms of the GNU GPL\n"));
147 static void printUsage(poptContext con, FILE * fp, int flags)
154 poptPrintHelp(con, fp, flags);
156 poptPrintUsage(con, fp, flags);
159 int main(int argc, char *argv[])
162 enum modes bigMode = MODE_UNKNOWN;
164 #if defined(IAM_RPMQV)
165 QVA_t qva = &rpmQVKArgs;
169 BTA_t ba = &rpmBTArgs;
173 struct rpmInstallArguments_s * ia = &rpmIArgs;
176 #if defined(IAM_RPMDB)
177 struct rpmDatabaseArguments_s * da = &rpmDBArgs;
180 #if defined(IAM_RPMK)
181 QVA_t ka = &rpmQVKArgs;
184 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
185 char * passPhrase = "";
200 #if HAVE_MCHECK_H && HAVE_MTRACE
201 mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
203 setprogname(argv[0]); /* Retrofit glibc __progname */
205 /* XXX glibc churn sanity */
206 if (__progname == NULL) {
207 if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
208 else __progname = argv[0];
211 /* Set the major mode based on argv[0] */
213 if (!strcmp(__progname, "rpmb")) bigMode = MODE_BUILD;
214 if (!strcmp(__progname, "lt-rpmb")) bigMode = MODE_BUILD;
215 if (!strcmp(__progname, "rpmt")) bigMode = MODE_TARBUILD;
216 if (!strcmp(__progname, "rpmbuild")) bigMode = MODE_BUILD;
219 if (!strcmp(__progname, "rpmq")) bigMode = MODE_QUERY;
220 if (!strcmp(__progname, "lt-rpmq")) bigMode = MODE_QUERY;
221 if (!strcmp(__progname, "rpmv")) bigMode = MODE_VERIFY;
222 if (!strcmp(__progname, "rpmquery")) bigMode = MODE_QUERY;
223 if (!strcmp(__progname, "rpmverify")) bigMode = MODE_VERIFY;
226 if (!strcmp(__progname, "rpme")) bigMode = MODE_ERASE;
227 if (!strcmp(__progname, "rpmi")) bigMode = MODE_INSTALL;
228 if (!strcmp(__progname, "lt-rpmi")) bigMode = MODE_INSTALL;
229 if (!strcmp(__progname, "rpmu")) bigMode = MODE_INSTALL;
232 #if defined(IAM_RPMQV)
233 /* Jumpstart option from argv[0] if necessary. */
235 case MODE_QUERY: qva->qva_mode = 'q'; break;
236 case MODE_VERIFY: qva->qva_mode = 'V'; break;
237 case MODE_CHECKSIG: qva->qva_mode = 'K'; break;
238 case MODE_RESIGN: qva->qva_mode = 'R'; break;
254 #if defined(ENABLE_NLS)
255 /* set up the correct locale */
256 (void) setlocale(LC_ALL, "" );
258 bindtextdomain(PACKAGE, LOCALEDIR);
262 rpmSetVerbosity(RPMLOG_NOTICE); /* XXX silly use by showrc */
264 /* Make a first pass through the arguments, looking for --rcfile */
265 /* We need to handle that before dealing with the rest of the arguments. */
266 /* XXX popt argv definition should be fixed instead of casting... */
267 optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0);
268 (void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
269 #if RPM_USES_POPTREADDEFAULTCONFIG
270 (void) poptReadDefaultConfig(optCon, 1);
272 poptSetExecPath(optCon, RPMCONFIGDIR, 1);
274 while ((arg = poptGetNextOpt(optCon)) > 0) {
275 optArg = poptGetOptArg(optCon);
279 fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
285 fprintf(stderr, "%s: %s\n",
286 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
294 switch (ba->buildMode) {
295 case 'b': bigMode = MODE_BUILD; break;
296 case 't': bigMode = MODE_TARBUILD; break;
297 case 'B': bigMode = MODE_REBUILD; break;
298 case 'C': bigMode = MODE_RECOMPILE; break;
301 if ((ba->buildAmount & RPMBUILD_RMSOURCE) && bigMode == MODE_UNKNOWN)
302 bigMode = MODE_BUILD;
304 if ((ba->buildAmount & RPMBUILD_RMSPEC) && bigMode == MODE_UNKNOWN)
305 bigMode = MODE_BUILD;
307 if (ba->buildRootOverride && bigMode != MODE_BUILD &&
308 bigMode != MODE_REBUILD && bigMode != MODE_TARBUILD) {
309 argerror("--buildroot may only be used during package builds");
311 #endif /* IAM_RPMBT */
314 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_DB)) {
316 if (bigMode != MODE_UNKNOWN)
317 argerror(_("only one major mode may be specified"));
319 bigMode = MODE_INITDB;
322 if (bigMode != MODE_UNKNOWN)
323 argerror(_("only one major mode may be specified"));
325 bigMode = MODE_REBUILDDB;
328 if (bigMode != MODE_UNKNOWN)
329 argerror(_("only one major mode may be specified"));
331 bigMode = MODE_VERIFYDB;
334 #endif /* IAM_RPMDB */
337 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_QV)) {
338 switch (qva->qva_mode) {
339 case 'q': bigMode = MODE_QUERY; break;
340 case 'V': bigMode = MODE_VERIFY; break;
343 if (qva->qva_sourceCount) {
344 if (qva->qva_sourceCount > 2)
345 argerror(_("one type of query/verify may be performed at a "
348 if (qva->qva_flags && (bigMode & ~MODES_QV))
349 argerror(_("unexpected query flags"));
351 if (qva->qva_queryFormat && (bigMode & ~MODES_QV))
352 argerror(_("unexpected query format"));
354 if (qva->qva_source != RPMQV_PACKAGE && (bigMode & ~MODES_QV))
355 argerror(_("unexpected query source"));
357 #endif /* IAM_RPMQV */
360 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_IE))
361 { int iflags = (ia->installInterfaceFlags &
362 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL));
363 int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
366 argerror(_("only one major mode may be specified"));
368 bigMode = MODE_INSTALL;
370 bigMode = MODE_ERASE;
372 #endif /* IAM_RPMEIU */
375 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_K)) {
376 switch (ka->qva_mode) {
380 case RPMSIGN_IMPORT_PUBKEY:
381 case RPMSIGN_CHK_SIGNATURE:
382 bigMode = MODE_CHECKSIG;
385 case RPMSIGN_ADD_SIGNATURE:
386 case RPMSIGN_NEW_SIGNATURE:
387 case RPMSIGN_DEL_SIGNATURE:
388 bigMode = MODE_RESIGN;
389 ka->sign = (ka->qva_mode != RPMSIGN_DEL_SIGNATURE);
393 #endif /* IAM_RPMK */
395 #if defined(IAM_RPMEIU)
396 if (!( bigMode == MODE_INSTALL ) &&
397 (ia->probFilter & (RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_OLDPACKAGE)))
398 argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
399 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_FORCERELOCATE))
400 argerror(_("files may only be relocated during package installation"));
402 if (ia->relocations && ia->prefix)
403 argerror(_("cannot use --prefix with --relocate or --excludepath"));
405 if (bigMode != MODE_INSTALL && ia->relocations)
406 argerror(_("--relocate and --excludepath may only be used when installing new packages"));
408 if (bigMode != MODE_INSTALL && ia->prefix)
409 argerror(_("--prefix may only be used when installing new packages"));
411 if (ia->prefix && ia->prefix[0] != '/')
412 argerror(_("arguments to --prefix must begin with a /"));
414 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_HASH))
415 argerror(_("--hash (-h) may only be specified during package "
418 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_PERCENT))
419 argerror(_("--percent may only be specified during package "
422 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_REPLACEPKG))
423 argerror(_("--replacepkgs may only be specified during package "
426 if (bigMode != MODE_INSTALL && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
427 argerror(_("--excludedocs may only be specified during package "
430 if (bigMode != MODE_INSTALL && ia->incldocs)
431 argerror(_("--includedocs may only be specified during package "
434 if (ia->incldocs && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
435 argerror(_("only one of --excludedocs and --includedocs may be "
438 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREARCH))
439 argerror(_("--ignorearch may only be specified during package "
442 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREOS))
443 argerror(_("--ignoreos may only be specified during package "
446 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
447 (ia->probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
448 argerror(_("--ignoresize may only be specified during package "
451 if ((ia->eraseInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_ERASE)
452 argerror(_("--allmatches may only be specified during package "
455 if ((ia->transFlags & RPMTRANS_FLAG_ALLFILES) && bigMode != MODE_INSTALL)
456 argerror(_("--allfiles may only be specified during package "
459 if ((ia->transFlags & RPMTRANS_FLAG_JUSTDB) &&
460 bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
461 argerror(_("--justdb may only be specified during package "
462 "installation and erasure"));
464 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
465 (ia->transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
466 argerror(_("script disabling options may only be specified during "
467 "package installation and erasure"));
469 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
470 (ia->transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
471 argerror(_("trigger disabling options may only be specified during "
472 "package installation and erasure"));
474 if (ia->noDeps & (bigMode & ~MODES_FOR_NODEPS))
475 argerror(_("--nodeps may only be specified during package "
476 "building, rebuilding, recompilation, installation,"
477 "erasure, and verification"));
479 if ((ia->transFlags & RPMTRANS_FLAG_TEST) && (bigMode & ~MODES_FOR_TEST))
480 argerror(_("--test may only be specified during package installation, "
481 "erasure, and building"));
482 #endif /* IAM_RPMEIU */
484 if (rpmcliRootDir && rpmcliRootDir[1] && (bigMode & ~MODES_FOR_ROOT))
485 argerror(_("--root (-r) may only be specified during "
486 "installation, erasure, querying, and "
487 "database rebuilds"));
490 switch (urlIsURL(rpmcliRootDir)) {
492 if (bigMode & MODES_FOR_ROOT)
495 if (rpmcliRootDir[0] != '/')
496 argerror(_("arguments to --root (-r) must begin with a /"));
502 rpmSetVerbosity(RPMLOG_WARNING);
504 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
506 #if defined(IAM_RPMBT)
509 #if defined(IAM_RPMK)
514 if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD ||
515 bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD)
521 if ((av = poptGetArgs(optCon)) == NULL) {
522 fprintf(stderr, _("no files to sign\n"));
526 if (stat(*av, &sb)) {
527 fprintf(stderr, _("cannot access file %s\n"), *av);
538 if (poptPeekArg(optCon)) {
539 int sigTag = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY);
544 #ifdef DYING /* XXX gpg can now be used for RSA signatures. */
545 if ((sigTag == RPMSIGTAG_PGP || sigTag == RPMSIGTAG_PGP5) &&
546 !rpmDetectPGPVersion(NULL)) {
547 fprintf(stderr, _("pgp not found: "));
555 passPhrase = rpmGetPassPhrase(_("Enter pass phrase: "), sigTag);
556 if (passPhrase == NULL) {
557 fprintf(stderr, _("Pass phrase check failed\n"));
561 fprintf(stderr, _("Pass phrase is good.\n"));
562 passPhrase = xstrdup(passPhrase);
566 _("Invalid %%_signature spec in macro file.\n"));
573 argerror(_("--sign may only be used during package building"));
576 /* Make rpmLookupSignatureType() return 0 ("none") from now on */
577 (void) rpmLookupSignatureType(RPMLOOKUPSIG_DISABLE);
579 #endif /* IAM_RPMBT || IAM_RPMK */
581 if (rpmcliPipeOutput) {
584 if (!(pipeChild = fork())) {
586 (void) dup2(p[0], STDIN_FILENO);
588 (void) execl("/bin/sh", "/bin/sh", "-c", rpmcliPipeOutput, NULL);
589 fprintf(stderr, _("exec failed\n"));
593 (void) dup2(p[1], STDOUT_FILENO);
598 (void) rpmtsSetRootDir(ts, rpmcliRootDir);
602 ec = rpmtsInitDB(ts, 0644);
606 { rpmVSFlags vsflags = rpmExpandNumeric("%{_vsflags_rebuilddb}");
607 rpmVSFlags ovsflags = rpmtsSetVSFlags(ts, vsflags);
608 ec = rpmtsRebuildDB(ts);
609 vsflags = rpmtsSetVSFlags(ts, ovsflags);
612 ec = rpmtsVerifyDB(ts);
614 #endif /* IAM_RPMDB */
621 while (!rpmIsVerbose())
622 rpmIncreaseVerbosity();
624 if (!poptPeekArg(optCon))
625 argerror(_("no packages files given for rebuild"));
628 RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL | RPMBUILD_CHECK;
629 if (bigMode == MODE_REBUILD) {
630 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
631 ba->buildAmount |= RPMBUILD_RMSOURCE;
632 ba->buildAmount |= RPMBUILD_RMSPEC;
633 ba->buildAmount |= RPMBUILD_CLEAN;
634 ba->buildAmount |= RPMBUILD_RMBUILD;
637 while ((pkg = poptGetArg(optCon))) {
638 const char * specFile = NULL;
641 ec = rpmInstallSource(ts, pkg, &specFile, &ba->cookie);
643 ba->rootdir = rpmcliRootDir;
644 ba->passPhrase = passPhrase;
645 ec = build(ts, specFile, ba, rpmcliRcfile);
647 ba->cookie = _free(ba->cookie);
648 specFile = _free(specFile);
659 if (!quiet) while (!rpmIsVerbose())
660 rpmIncreaseVerbosity();
662 switch (ba->buildChar) {
664 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
666 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
667 ba->buildAmount |= RPMBUILD_CLEAN;
669 ba->buildAmount |= RPMBUILD_INSTALL;
670 ba->buildAmount |= RPMBUILD_CHECK;
671 if ((ba->buildChar == 'i') && ba->shortCircuit)
674 ba->buildAmount |= RPMBUILD_BUILD;
675 if ((ba->buildChar == 'c') && ba->shortCircuit)
678 ba->buildAmount |= RPMBUILD_PREP;
682 ba->buildAmount |= RPMBUILD_FILECHECK;
685 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
689 if (!poptPeekArg(optCon)) {
690 if (bigMode == MODE_BUILD)
691 argerror(_("no spec files given for build"));
693 argerror(_("no tar files given for build"));
696 while ((pkg = poptGetArg(optCon))) {
697 ba->rootdir = rpmcliRootDir;
698 ba->passPhrase = passPhrase;
700 ec = build(ts, pkg, ba, rpmcliRcfile);
704 (void) rpmReadConfigFiles(rpmcliRcfile, NULL);
707 #endif /* IAM_RPMBT */
711 if (ia->noDeps) ia->eraseInterfaceFlags |= UNINSTALL_NODEPS;
713 if (!poptPeekArg(optCon)) {
715 argerror(_("no packages given for erase"));
716 ia->transFlags |= RPMTRANS_FLAG_NOMD5;
717 ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
718 ec += rpmRollback(ts, ia, NULL);
720 ec += rpmErase(ts, ia, (const char **) poptGetArgs(optCon));
726 /* RPMTRANS_FLAG_KEEPOBSOLETE */
729 if (ia->transFlags & RPMTRANS_FLAG_NODOCS) {
731 } else if (rpmExpandNumeric("%{_excludedocs}"))
732 ia->transFlags |= RPMTRANS_FLAG_NODOCS;
735 if (ia->noDeps) ia->installInterfaceFlags |= INSTALL_NODEPS;
737 /* we've already ensured !(!ia->prefix && !ia->relocations) */
739 ia->relocations = xmalloc(2 * sizeof(*ia->relocations));
740 ia->relocations[0].oldPath = NULL; /* special case magic */
741 ia->relocations[0].newPath = ia->prefix;
742 ia->relocations[1].oldPath = NULL;
743 ia->relocations[1].newPath = NULL;
744 } else if (ia->relocations) {
745 ia->relocations = xrealloc(ia->relocations,
746 sizeof(*ia->relocations) * (ia->numRelocations + 1));
747 ia->relocations[ia->numRelocations].oldPath = NULL;
748 ia->relocations[ia->numRelocations].newPath = NULL;
751 if (!poptPeekArg(optCon)) {
753 argerror(_("no packages given for install"));
754 ia->transFlags |= RPMTRANS_FLAG_NOMD5;
755 ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
756 ec += rpmRollback(ts, ia, NULL);
758 /* FIX: ia->relocations[0].newPath undefined */
759 ec += rpmInstall(ts, ia, (const char **)poptGetArgs(optCon));
763 #endif /* IAM_RPMEIU */
767 if (!poptPeekArg(optCon)
768 && !(qva->qva_source == RPMQV_ALL || qva->qva_source == RPMQV_HDLIST))
769 argerror(_("no arguments given for query"));
771 qva->qva_specQuery = rpmspecQuery;
772 ec = rpmcliQuery(ts, qva, (const char **) poptGetArgs(optCon));
773 qva->qva_specQuery = NULL;
777 { rpmVerifyFlags verifyFlags = VERIFY_ALL;
779 verifyFlags &= ~qva->qva_flags;
780 qva->qva_flags = (rpmQueryFlags) verifyFlags;
782 if (!poptPeekArg(optCon)
783 && !(qva->qva_source == RPMQV_ALL || qva->qva_source == RPMQV_HDLIST))
784 argerror(_("no arguments given for verify"));
785 ec = rpmcliVerify(ts, qva, (const char **) poptGetArgs(optCon));
787 #endif /* IAM_RPMQV */
791 { rpmVerifyFlags verifyFlags =
792 (VERIFY_MD5|VERIFY_DIGEST|VERIFY_SIGNATURE);
794 verifyFlags &= ~ka->qva_flags;
795 ka->qva_flags = (rpmQueryFlags) verifyFlags;
798 if (!poptPeekArg(optCon))
799 argerror(_("no arguments given"));
800 ka->passPhrase = passPhrase;
801 ec = rpmcliSign(ts, ka, (const char **)poptGetArgs(optCon));
803 #endif /* IAM_RPMK */
805 #if !defined(IAM_RPMQV)
809 #if !defined(IAM_RPMK)
813 #if !defined(IAM_RPMDB)
818 #if !defined(IAM_RPMBT)
824 #if !defined(IAM_RPMEIU)
829 if (poptPeekArg(optCon) != NULL || argc <= 1 || rpmIsVerbose()) {
830 printUsage(optCon, stdout, 0);
836 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
838 #endif /* IAM_RPMBT || IAM_RPMK */
842 optCon = poptFreeContext(optCon);
844 rpmFreeMacros(rpmCLIMacroContext);
848 (void) fclose(stdout);
849 (void) waitpid(pipeChild, &status, 0);
852 /* keeps memory leak checkers quiet */
853 rpmFreeFilesystems();
855 /* XXX FIXME: hide this in the api */
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;