2 const char *__progname;
14 #include <rpm/rpmcli.h>
15 #include <rpm/rpmbuild.h>
16 #include <rpm/rpmlog.h>
18 #include <rpm/rpmdb.h>
19 #include "rpmdb/rpmdb_internal.h" /* XXX for freeing dbiTags */
20 #include <rpm/rpmps.h>
21 #include <rpm/rpmts.h>
25 #define GETOPT_REBUILD 1003
26 #define GETOPT_RECOMPILE 1004
29 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
30 #include "lib/signature.h"
37 MODE_QUERY = (1 << 0),
38 MODE_VERIFY = (1 << 3),
39 #define MODES_QV (MODE_QUERY | MODE_VERIFY)
41 MODE_INSTALL = (1 << 1),
42 MODE_ERASE = (1 << 2),
43 #define MODES_IE (MODE_INSTALL | MODE_ERASE)
45 MODE_BUILD = (1 << 4),
46 MODE_REBUILD = (1 << 5),
47 MODE_RECOMPILE = (1 << 8),
48 MODE_TARBUILD = (1 << 11),
49 #define MODES_BT (MODE_BUILD | MODE_TARBUILD | MODE_REBUILD | MODE_RECOMPILE)
51 MODE_CHECKSIG = (1 << 6),
52 MODE_RESIGN = (1 << 7),
53 #define MODES_K (MODE_CHECKSIG | MODE_RESIGN)
55 MODE_INITDB = (1 << 10),
56 MODE_REBUILDDB = (1 << 12),
57 MODE_VERIFYDB = (1 << 13),
58 #define MODES_DB (MODE_INITDB | MODE_REBUILDDB | MODE_VERIFYDB)
64 #define MODES_FOR_DBPATH (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
65 #define MODES_FOR_NODEPS (MODES_BT | MODES_IE | MODE_VERIFY)
66 #define MODES_FOR_TEST (MODES_BT | MODES_IE)
67 #define MODES_FOR_ROOT (MODES_BT | MODES_IE | MODES_QV | MODES_DB | MODES_K)
71 /* the structure describing the options we take and the defaults */
72 static struct poptOption optionsTable[] = {
75 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0,
76 N_("Query options (with -q or --query):"),
78 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0,
79 N_("Verify options (with -V or --verify):"),
82 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliQVSourcePoptTable, 0,
83 N_("Source options (with --query or --verify):"),
86 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliFtsPoptTable, 0,
87 N_("File tree walk options (with --ftswalk):"),
89 #endif /* IAM_RPMQV */
92 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmSignPoptTable, 0,
93 N_("Signature options:"),
98 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmDatabasePoptTable, 0,
99 N_("Database options:"),
101 #endif /* IAM_RPMDB */
104 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmBuildPoptTable, 0,
105 N_("Build options with [ <specfile> | <tarball> | <source package> ]:"),
107 #endif /* IAM_RPMBT */
110 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmInstallPoptTable, 0,
111 N_("Install/Upgrade/Erase options:"),
113 #endif /* IAM_RPMEIU */
115 { "quiet", '\0', 0, &quiet, 0, NULL, NULL},
117 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
118 N_("Common options for all rpm modes and executables:"),
127 /* MiNT cannot dynamically increase the stack. */
128 long _stksize = 64 * 1024L;
131 static void argerror(const char * desc)
133 fprintf(stderr, _("%s: %s\n"), __progname, desc);
137 static void printVersion(FILE * fp)
139 fprintf(fp, _("RPM version %s\n"), rpmEVR);
142 static void printBanner(FILE * fp)
144 fprintf(fp, _("Copyright (C) 1998-2002 - Red Hat, Inc.\n"));
145 fprintf(fp, _("This program may be freely redistributed under the terms of the GNU GPL\n"));
148 static void printUsage(poptContext con, FILE * fp, int flags)
155 poptPrintHelp(con, fp, flags);
157 poptPrintUsage(con, fp, flags);
160 int main(int argc, 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 /* XXX glibc churn sanity */
207 if (__progname == NULL) {
208 if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
209 else __progname = argv[0];
212 /* Set the major mode based on argv[0] */
214 if (!strcmp(__progname, "rpmb")) bigMode = MODE_BUILD;
215 if (!strcmp(__progname, "lt-rpmb")) bigMode = MODE_BUILD;
216 if (!strcmp(__progname, "rpmt")) bigMode = MODE_TARBUILD;
217 if (!strcmp(__progname, "rpmbuild")) bigMode = MODE_BUILD;
220 if (!strcmp(__progname, "rpmq")) bigMode = MODE_QUERY;
221 if (!strcmp(__progname, "lt-rpmq")) bigMode = MODE_QUERY;
222 if (!strcmp(__progname, "rpmv")) bigMode = MODE_VERIFY;
223 if (!strcmp(__progname, "rpmquery")) bigMode = MODE_QUERY;
224 if (!strcmp(__progname, "rpmverify")) bigMode = MODE_VERIFY;
227 if (!strcmp(__progname, "rpme")) bigMode = MODE_ERASE;
228 if (!strcmp(__progname, "rpmi")) bigMode = MODE_INSTALL;
229 if (!strcmp(__progname, "lt-rpmi")) bigMode = MODE_INSTALL;
230 if (!strcmp(__progname, "rpmu")) bigMode = MODE_INSTALL;
233 #if defined(IAM_RPMQV)
234 /* Jumpstart option from argv[0] if necessary. */
236 case MODE_QUERY: qva->qva_mode = 'q'; break;
237 case MODE_VERIFY: qva->qva_mode = 'V'; break;
238 case MODE_CHECKSIG: qva->qva_mode = 'K'; break;
239 case MODE_RESIGN: qva->qva_mode = 'R'; break;
255 #if defined(ENABLE_NLS)
256 /* set up the correct locale */
257 (void) setlocale(LC_ALL, "" );
259 bindtextdomain(PACKAGE, LOCALEDIR);
263 rpmSetVerbosity(RPMLOG_NOTICE); /* XXX silly use by showrc */
265 /* Make a first pass through the arguments, looking for --rcfile */
266 /* We need to handle that before dealing with the rest of the arguments. */
267 /* XXX popt argv definition should be fixed instead of casting... */
268 optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0);
269 (void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
270 #if RPM_USES_POPTREADDEFAULTCONFIG
271 (void) poptReadDefaultConfig(optCon, 1);
273 poptSetExecPath(optCon, RPMCONFIGDIR, 1);
275 while ((arg = poptGetNextOpt(optCon)) > 0) {
276 optArg = poptGetOptArg(optCon);
280 fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
286 fprintf(stderr, "%s: %s\n",
287 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
295 switch (ba->buildMode) {
296 case 'b': bigMode = MODE_BUILD; break;
297 case 't': bigMode = MODE_TARBUILD; break;
298 case 'B': bigMode = MODE_REBUILD; break;
299 case 'C': bigMode = MODE_RECOMPILE; break;
302 if ((ba->buildAmount & RPMBUILD_RMSOURCE) && bigMode == MODE_UNKNOWN)
303 bigMode = MODE_BUILD;
305 if ((ba->buildAmount & RPMBUILD_RMSPEC) && bigMode == MODE_UNKNOWN)
306 bigMode = MODE_BUILD;
308 if (ba->buildRootOverride && bigMode != MODE_BUILD &&
309 bigMode != MODE_REBUILD && bigMode != MODE_TARBUILD) {
310 argerror("--buildroot may only be used during package builds");
312 #endif /* IAM_RPMBT */
315 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_DB)) {
317 if (bigMode != MODE_UNKNOWN)
318 argerror(_("only one major mode may be specified"));
320 bigMode = MODE_INITDB;
323 if (bigMode != MODE_UNKNOWN)
324 argerror(_("only one major mode may be specified"));
326 bigMode = MODE_REBUILDDB;
329 if (bigMode != MODE_UNKNOWN)
330 argerror(_("only one major mode may be specified"));
332 bigMode = MODE_VERIFYDB;
335 #endif /* IAM_RPMDB */
338 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_QV)) {
339 switch (qva->qva_mode) {
340 case 'q': bigMode = MODE_QUERY; break;
341 case 'V': bigMode = MODE_VERIFY; break;
344 if (qva->qva_sourceCount) {
345 if (qva->qva_sourceCount > 2)
346 argerror(_("one type of query/verify may be performed at a "
349 if (qva->qva_flags && (bigMode & ~MODES_QV))
350 argerror(_("unexpected query flags"));
352 if (qva->qva_queryFormat && (bigMode & ~MODES_QV))
353 argerror(_("unexpected query format"));
355 if (qva->qva_source != RPMQV_PACKAGE && (bigMode & ~MODES_QV))
356 argerror(_("unexpected query source"));
358 #endif /* IAM_RPMQV */
361 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_IE))
362 { int iflags = (ia->installInterfaceFlags &
363 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL));
364 int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
367 argerror(_("only one major mode may be specified"));
369 bigMode = MODE_INSTALL;
371 bigMode = MODE_ERASE;
373 #endif /* IAM_RPMEIU */
376 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_K)) {
377 switch (ka->qva_mode) {
381 case RPMSIGN_IMPORT_PUBKEY:
382 case RPMSIGN_CHK_SIGNATURE:
383 bigMode = MODE_CHECKSIG;
386 case RPMSIGN_ADD_SIGNATURE:
387 case RPMSIGN_NEW_SIGNATURE:
388 case RPMSIGN_DEL_SIGNATURE:
389 bigMode = MODE_RESIGN;
390 ka->sign = (ka->qva_mode != RPMSIGN_DEL_SIGNATURE);
394 #endif /* IAM_RPMK */
396 #if defined(IAM_RPMEIU)
397 if (!( bigMode == MODE_INSTALL ) &&
398 (ia->probFilter & (RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_OLDPACKAGE)))
399 argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
400 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_FORCERELOCATE))
401 argerror(_("files may only be relocated during package installation"));
403 if (ia->relocations && ia->prefix)
404 argerror(_("cannot use --prefix with --relocate or --excludepath"));
406 if (bigMode != MODE_INSTALL && ia->relocations)
407 argerror(_("--relocate and --excludepath may only be used when installing new packages"));
409 if (bigMode != MODE_INSTALL && ia->prefix)
410 argerror(_("--prefix may only be used when installing new packages"));
412 if (ia->prefix && ia->prefix[0] != '/')
413 argerror(_("arguments to --prefix must begin with a /"));
415 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_HASH))
416 argerror(_("--hash (-h) may only be specified during package "
419 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_PERCENT))
420 argerror(_("--percent may only be specified during package "
423 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_REPLACEPKG))
424 argerror(_("--replacepkgs may only be specified during package "
427 if (bigMode != MODE_INSTALL && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
428 argerror(_("--excludedocs may only be specified during package "
431 if (bigMode != MODE_INSTALL && ia->incldocs)
432 argerror(_("--includedocs may only be specified during package "
435 if (ia->incldocs && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
436 argerror(_("only one of --excludedocs and --includedocs may be "
439 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREARCH))
440 argerror(_("--ignorearch may only be specified during package "
443 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREOS))
444 argerror(_("--ignoreos may only be specified during package "
447 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
448 (ia->probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
449 argerror(_("--ignoresize may only be specified during package "
452 if ((ia->eraseInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_ERASE)
453 argerror(_("--allmatches may only be specified during package "
456 if ((ia->transFlags & RPMTRANS_FLAG_ALLFILES) && bigMode != MODE_INSTALL)
457 argerror(_("--allfiles may only be specified during package "
460 if ((ia->transFlags & RPMTRANS_FLAG_JUSTDB) &&
461 bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
462 argerror(_("--justdb may only be specified during package "
463 "installation and erasure"));
465 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
466 (ia->transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
467 argerror(_("script disabling options may only be specified during "
468 "package installation and erasure"));
470 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
471 (ia->transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
472 argerror(_("trigger disabling options may only be specified during "
473 "package installation and erasure"));
475 if (ia->noDeps & (bigMode & ~MODES_FOR_NODEPS))
476 argerror(_("--nodeps may only be specified during package "
477 "building, rebuilding, recompilation, installation,"
478 "erasure, and verification"));
480 if ((ia->transFlags & RPMTRANS_FLAG_TEST) && (bigMode & ~MODES_FOR_TEST))
481 argerror(_("--test may only be specified during package installation, "
482 "erasure, and building"));
483 #endif /* IAM_RPMEIU */
485 if (rpmcliRootDir && rpmcliRootDir[1] && (bigMode & ~MODES_FOR_ROOT))
486 argerror(_("--root (-r) may only be specified during "
487 "installation, erasure, querying, and "
488 "database rebuilds"));
491 switch (urlIsURL(rpmcliRootDir)) {
493 if (bigMode & MODES_FOR_ROOT)
496 if (rpmcliRootDir[0] != '/')
497 argerror(_("arguments to --root (-r) must begin with a /"));
503 rpmSetVerbosity(RPMLOG_WARNING);
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 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 if (!quiet) 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, stderr, 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 */
854 rpmFreeFilesystems();
856 /* XXX FIXME: hide this in the api */
857 dbiTags = _free(dbiTags);
860 qva->qva_queryFormat = _free(qva->qva_queryFormat);
865 ba->buildRootOverride = _free(ba->buildRootOverride);
866 ba->targets = _free(ba->targets);
870 if (ia->relocations != NULL)
871 for (i = 0; i < ia->numRelocations; i++)
872 ia->relocations[i].oldPath = _constfree(ia->relocations[i].oldPath);
873 ia->relocations = _free(ia->relocations);
876 #if HAVE_MCHECK_H && HAVE_MTRACE
877 muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
880 /* XXX don't overflow single byte exit status */
881 if (ec > 255) ec = 255;