5 #if defined(IAM_RPM) || defined(__LCLINT__)
22 #define GETOPT_REBUILD 1003
23 #define GETOPT_RECOMPILE 1004
26 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
27 #include "signature.h"
34 MODE_QUERY = (1 << 0),
35 MODE_VERIFY = (1 << 3),
36 MODE_QUERYTAGS = (1 << 9),
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 */
69 static struct poptOption optionsTable[] = {
71 /* XXX colliding options */
72 #if defined(IAM_RPMQV) || defined(IAM_RPMEIU)
73 { NULL, 'i', POPT_ARGFLAG_DOC_HIDDEN, 0, 'i', NULL, NULL},
77 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0,
78 N_("Query options (with -q or --query):"),
80 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0,
81 N_("Verify options (with -V or --verify):"),
83 #endif /* IAM_RPMQV */
86 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmSignPoptTable, 0,
87 N_("Signature options:"),
92 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmDatabasePoptTable, 0,
93 N_("Database options:"),
95 #endif /* IAM_RPMDB */
98 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmBuildPoptTable, 0,
99 N_("Build options with [ <specfile> | <tarball> | <source package> ]:"),
101 #endif /* IAM_RPMBT */
104 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmInstallPoptTable, 0,
105 N_("Install/Upgrade/Erase options:"),
107 #endif /* IAM_RPMEIU */
109 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
110 N_("Common options for all rpm modes:"),
119 /* MiNT cannot dynamically increase the stack. */
120 long _stksize = 64 * 1024L;
123 /*@exits@*/ static void argerror(const char * desc)
124 /*@globals __assert_program_name, fileSystem @*/
125 /*@modifies fileSystem @*/
127 fprintf(stderr, _("%s: %s\n"), __progname, desc);
131 static void printVersion(FILE * fp)
132 /*@globals rpmEVR, fileSystem @*/
133 /*@modifies *fp, fileSystem @*/
135 fprintf(fp, _("RPM version %s\n"), rpmEVR);
138 static void printBanner(FILE * fp)
139 /*@globals fileSystem @*/
140 /*@modifies *fp, fileSystem @*/
142 fprintf(fp, _("Copyright (C) 1998-2002 - Red Hat, Inc.\n"));
143 fprintf(fp, _("This program may be freely redistributed under the terms of the GNU GPL\n"));
146 static void printUsage(poptContext con, FILE * fp, int flags)
147 /*@globals rpmEVR, fileSystem, internalState @*/
148 /*@modifies *fp, fileSystem, internalState @*/
155 poptPrintHelp(con, fp, flags);
157 poptPrintUsage(con, fp, flags);
160 /*@-bounds@*/ /* LCL: segfault */
161 /*@-mods@*/ /* FIX: shrug */
162 #if !defined(__GLIBC__) && !defined(__LCLINT__)
163 int main(int argc, const char ** argv, /*@unused@*/ char ** envp)
165 int main(int argc, const char ** argv)
167 /*@globals __assert_program_name, rpmEVR, RPMVERSION,
168 rpmGlobalMacroContext, rpmCLIMacroContext,
169 fileSystem, internalState@*/
170 /*@modifies __assert_program_name,
171 fileSystem, internalState@*/
174 enum modes bigMode = MODE_UNKNOWN;
177 QVA_t qva = &rpmQVKArgs;
181 BTA_t ba = &rpmBTArgs;
185 struct rpmInstallArguments_s * ia = &rpmIArgs;
188 #if defined(IAM_RPMDB)
189 struct rpmDatabaseArguments_s * da = &rpmDBArgs;
192 #if defined(IAM_RPMK)
193 QVA_t ka = &rpmQVKArgs;
196 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
197 char * passPhrase = "";
212 #if HAVE_MCHECK_H && HAVE_MTRACE
214 mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
217 setprogname(argv[0]); /* Retrofit glibc __progname */
219 #if !defined(__GLIBC__) && !defined(__LCLINT__)
223 /* XXX glibc churn sanity */
224 if (__progname == NULL) {
225 if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
226 else __progname = argv[0];
229 /* Set the major mode based on argv[0] */
232 if (!strcmp(__progname, "rpmb")) bigMode = MODE_BUILD;
233 if (!strcmp(__progname, "rpmt")) bigMode = MODE_TARBUILD;
234 if (!strcmp(__progname, "rpmbuild")) bigMode = MODE_BUILD;
237 if (!strcmp(__progname, "rpmq")) bigMode = MODE_QUERY;
238 if (!strcmp(__progname, "rpmv")) bigMode = MODE_VERIFY;
239 if (!strcmp(__progname, "rpmquery")) bigMode = MODE_QUERY;
240 if (!strcmp(__progname, "rpmverify")) bigMode = MODE_VERIFY;
243 if (!strcmp(__progname, "rpme")) bigMode = MODE_ERASE;
244 if (!strcmp(__progname, "rpmi")) bigMode = MODE_INSTALL;
245 if (!strcmp(__progname, "rpmu")) bigMode = MODE_INSTALL;
249 /* XXX Eliminate query linkage loop */
250 /*@-type@*/ /* FIX: casts? */
251 parseSpecVec = parseSpec;
252 freeSpecVec = freeSpec;
255 /* set up the correct locale */
256 (void) setlocale(LC_ALL, "" );
259 #define LOCALEDIR "/usr/share/locale"
261 bindtextdomain(PACKAGE, LOCALEDIR);
264 rpmSetVerbosity(RPMMESS_NORMAL); /* XXX silly use by showrc */
266 /* Make a first pass through the arguments, looking for --rcfile */
267 /* We need to handle that before dealing with the rest of the arguments. */
268 /*@-nullpass -temptrans@*/
269 optCon = poptGetContext(__progname, argc, argv, optionsTable, 0);
270 /*@=nullpass =temptrans@*/
271 (void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
272 (void) poptReadDefaultConfig(optCon, 1);
273 poptSetExecPath(optCon, RPMCONFIGDIR, 1);
275 while ((arg = poptGetNextOpt(optCon)) > 0) {
276 optArg = poptGetOptArg(optCon);
280 /* XXX options used in multiple rpm modes */
282 #if defined(IAM_RPMQV) || defined(IAM_RPMEIU)
285 if (bigMode == MODE_QUERY || qva->qva_mode == 'q') {
286 /*@-nullassign -readonlytrans@*/
287 const char * infoCommand[] = { "--info", NULL };
288 /*@=nullassign =readonlytrans@*/
289 (void) poptStuffArgs(optCon, infoCommand);
293 if (bigMode == MODE_INSTALL ||
294 (ia->installInterfaceFlags &
295 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL)))
297 else if (bigMode == MODE_UNKNOWN) {
298 /*@-nullassign -readonlytrans@*/
299 const char * installCommand[] = { "--install", NULL };
300 /*@=nullassign =readonlytrans@*/
301 (void) poptStuffArgs(optCon, installCommand);
305 /*@switchbreak@*/ break;
306 #endif /* IAM_RPMQV || IAM_RPMEIU */
309 fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
315 fprintf(stderr, "%s: %s\n",
316 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
324 switch (ba->buildMode) {
325 case 'b': bigMode = MODE_BUILD; break;
326 case 't': bigMode = MODE_TARBUILD; break;
327 case 'B': bigMode = MODE_REBUILD; break;
328 case 'C': bigMode = MODE_RECOMPILE; break;
331 if ((ba->buildAmount & RPMBUILD_RMSOURCE) && bigMode == MODE_UNKNOWN)
332 bigMode = MODE_BUILD;
334 if ((ba->buildAmount & RPMBUILD_RMSPEC) && bigMode == MODE_UNKNOWN)
335 bigMode = MODE_BUILD;
337 if (ba->buildRootOverride && bigMode != MODE_BUILD &&
338 bigMode != MODE_REBUILD && bigMode != MODE_TARBUILD) {
339 argerror("--buildroot may only be used during package builds");
341 #endif /* IAM_RPMBT */
344 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_DB)) {
346 if (bigMode != MODE_UNKNOWN)
347 argerror(_("only one major mode may be specified"));
349 bigMode = MODE_INITDB;
352 if (bigMode != MODE_UNKNOWN)
353 argerror(_("only one major mode may be specified"));
355 bigMode = MODE_REBUILDDB;
358 if (bigMode != MODE_UNKNOWN)
359 argerror(_("only one major mode may be specified"));
361 bigMode = MODE_VERIFYDB;
364 #endif /* IAM_RPMDB */
367 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_QV)) {
368 switch (qva->qva_mode) {
369 case 'q': bigMode = MODE_QUERY; break;
370 case 'V': bigMode = MODE_VERIFY; break;
371 case 'Q': bigMode = MODE_QUERYTAGS; break;
374 if (qva->qva_sourceCount) {
375 if (qva->qva_sourceCount > 2)
376 argerror(_("one type of query/verify may be performed at a "
379 if (qva->qva_flags && (bigMode & ~MODES_QV))
380 argerror(_("unexpected query flags"));
382 if (qva->qva_queryFormat && (bigMode & ~MODES_QV))
383 argerror(_("unexpected query format"));
385 if (qva->qva_source != RPMQV_PACKAGE && (bigMode & ~MODES_QV))
386 argerror(_("unexpected query source"));
388 #endif /* IAM_RPMQV */
391 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_IE))
392 { int iflags = (ia->installInterfaceFlags &
393 (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL));
394 int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
397 argerror(_("only one major mode may be specified"));
399 bigMode = MODE_INSTALL;
401 bigMode = MODE_ERASE;
403 #endif /* IAM_RPMQV */
406 if (bigMode == MODE_UNKNOWN || (bigMode & MODES_K)) {
407 switch (ka->qva_mode) {
411 case RPMSIGN_IMPORT_PUBKEY:
412 case RPMSIGN_CHK_SIGNATURE:
413 bigMode = MODE_CHECKSIG;
416 case RPMSIGN_ADD_SIGNATURE:
417 case RPMSIGN_NEW_SIGNATURE:
418 bigMode = MODE_RESIGN;
423 #endif /* IAM_RPMK */
425 #if defined(IAM_RPMEIU)
426 if (!( bigMode == MODE_INSTALL ) &&
427 (ia->probFilter & (RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES | RPMPROB_FILTER_OLDPACKAGE)))
428 argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
429 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_FORCERELOCATE))
430 argerror(_("files may only be relocated during package installation"));
432 if (ia->relocations && ia->prefix)
433 argerror(_("only one of --prefix or --relocate may be used"));
435 if (bigMode != MODE_INSTALL && ia->relocations)
436 argerror(_("--relocate and --excludepath may only be used when installing new packages"));
438 if (bigMode != MODE_INSTALL && ia->prefix)
439 argerror(_("--prefix may only be used when installing new packages"));
441 if (ia->prefix && ia->prefix[0] != '/')
442 argerror(_("arguments to --prefix must begin with a /"));
444 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_HASH))
445 argerror(_("--hash (-h) may only be specified during package "
448 if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_PERCENT))
449 argerror(_("--percent may only be specified during package "
452 if (bigMode != MODE_INSTALL &&
453 (ia->probFilter & (RPMPROB_FILTER_REPLACEOLDFILES|RPMPROB_FILTER_REPLACENEWFILES)))
454 argerror(_("--replacefiles may only be specified during package "
457 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_REPLACEPKG))
458 argerror(_("--replacepkgs may only be specified during package "
461 if (bigMode != MODE_INSTALL && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
462 argerror(_("--excludedocs may only be specified during package "
465 if (bigMode != MODE_INSTALL && ia->incldocs)
466 argerror(_("--includedocs may only be specified during package "
469 if (ia->incldocs && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
470 argerror(_("only one of --excludedocs and --includedocs may be "
473 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREARCH))
474 argerror(_("--ignorearch may only be specified during package "
477 if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREOS))
478 argerror(_("--ignoreos may only be specified during package "
481 if (bigMode != MODE_INSTALL &&
482 (ia->probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
483 argerror(_("--ignoresize may only be specified during package "
486 if ((ia->eraseInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_ERASE)
487 argerror(_("--allmatches may only be specified during package "
490 if ((ia->transFlags & RPMTRANS_FLAG_ALLFILES) && bigMode != MODE_INSTALL)
491 argerror(_("--allfiles may only be specified during package "
494 if ((ia->transFlags & RPMTRANS_FLAG_JUSTDB) &&
495 bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
496 argerror(_("--justdb may only be specified during package "
497 "installation and erasure"));
499 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
500 (ia->transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
501 argerror(_("script disabling options may only be specified during "
502 "package installation and erasure"));
504 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
505 (ia->transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
506 argerror(_("trigger disabling options may only be specified during "
507 "package installation and erasure"));
509 if (ia->noDeps & (bigMode & ~MODES_FOR_NODEPS))
510 argerror(_("--nodeps may only be specified during package "
511 "building, rebuilding, recompilation, installation,"
512 "erasure, and verification"));
514 if ((ia->transFlags & RPMTRANS_FLAG_TEST) && (bigMode & ~MODES_FOR_TEST))
515 argerror(_("--test may only be specified during package installation, "
516 "erasure, and building"));
517 #endif /* IAM_RPMEIU */
519 if (rpmcliRootDir && rpmcliRootDir[1] && (bigMode & ~MODES_FOR_ROOT))
520 argerror(_("--root (-r) may only be specified during "
521 "installation, erasure, querying, and "
522 "database rebuilds"));
525 switch (urlIsURL(rpmcliRootDir)) {
527 if (bigMode & MODES_FOR_ROOT)
531 if (rpmcliRootDir[0] != '/')
532 argerror(_("arguments to --root (-r) must begin with a /"));
537 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
539 #if defined(IAM_RPMBT)
542 #if defined(IAM_RPMK)
548 if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD ||
549 bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD)
555 if ((av = poptGetArgs(optCon)) == NULL) {
556 fprintf(stderr, _("no files to sign\n"));
560 if (stat(*av, &sb)) {
561 fprintf(stderr, _("cannot access file %s\n"), *av);
572 if (poptPeekArg(optCon)) {
574 switch (sigTag = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) {
578 if ((sigTag == RPMSIGTAG_PGP || sigTag == RPMSIGTAG_PGP5) &&
579 !rpmDetectPGPVersion(NULL)) {
580 fprintf(stderr, _("pgp not found: "));
585 passPhrase = rpmGetPassPhrase(_("Enter pass phrase: "), sigTag);
586 if (passPhrase == NULL) {
587 fprintf(stderr, _("Pass phrase check failed\n"));
591 fprintf(stderr, _("Pass phrase is good.\n"));
592 passPhrase = xstrdup(passPhrase);
596 _("Invalid %%_signature spec in macro file.\n"));
599 /*@notreached@*/ break;
603 argerror(_("--sign may only be used during package building"));
606 /* Make rpmLookupSignatureType() return 0 ("none") from now on */
607 (void) rpmLookupSignatureType(RPMLOOKUPSIG_DISABLE);
610 #endif /* IAM_RPMBT || IAM_RPMK */
612 if (rpmcliPipeOutput) {
615 if (!(pipeChild = fork())) {
617 (void) dup2(p[0], STDIN_FILENO);
619 (void) execl("/bin/sh", "/bin/sh", "-c", rpmcliPipeOutput, NULL);
620 fprintf(stderr, _("exec failed\n"));
624 (void) dup2(p[1], STDOUT_FILENO);
629 (void) rpmtsSetRootDir(ts, rpmcliRootDir);
633 (void) rpmtsInitDB(ts, 0644);
637 { int vsflags = rpmExpandNumeric("%{_vsflags_rebuilddb}");
638 (void)rpmtsSetVerifySigFlags(ts, (vsflags & ~_RPMTS_VSF_VERIFY_LEGACY));
639 ec = rpmtsRebuildDB(ts);
642 ec = rpmtsVerifyDB(ts);
644 #endif /* IAM_RPMDB */
651 while (!rpmIsVerbose())
652 rpmIncreaseVerbosity();
654 if (!poptPeekArg(optCon))
655 argerror(_("no packages files given for rebuild"));
657 ba->buildAmount = RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL;
658 if (bigMode == MODE_REBUILD) {
659 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
660 ba->buildAmount |= RPMBUILD_RMSOURCE;
661 ba->buildAmount |= RPMBUILD_RMSPEC;
662 ba->buildAmount |= RPMBUILD_CLEAN;
663 ba->buildAmount |= RPMBUILD_RMBUILD;
666 while ((pkg = poptGetArg(optCon))) {
667 const char * specFile = NULL;
670 ec = rpmInstallSource(ts, pkg, &specFile, &ba->cookie);
672 ba->rootdir = rpmcliRootDir;
673 ba->passPhrase = passPhrase;
674 ec = build(ts, specFile, ba, rpmcliRcfile);
676 ba->cookie = _free(ba->cookie);
677 specFile = _free(specFile);
680 /*@loopbreak@*/ break;
688 while (!rpmIsVerbose())
689 rpmIncreaseVerbosity();
691 switch (ba->buildChar) {
693 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
696 ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
697 ba->buildAmount |= RPMBUILD_CLEAN;
700 ba->buildAmount |= RPMBUILD_INSTALL;
701 if ((ba->buildChar == 'i') && ba->shortCircuit)
702 /*@innerbreak@*/ break;
705 ba->buildAmount |= RPMBUILD_BUILD;
706 if ((ba->buildChar == 'c') && ba->shortCircuit)
707 /*@innerbreak@*/ break;
710 ba->buildAmount |= RPMBUILD_PREP;
711 /*@innerbreak@*/ break;
714 ba->buildAmount |= RPMBUILD_FILECHECK;
715 /*@innerbreak@*/ break;
717 ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
718 /*@innerbreak@*/ break;
721 if (!poptPeekArg(optCon)) {
722 if (bigMode == MODE_BUILD)
723 argerror(_("no spec files given for build"));
725 argerror(_("no tar files given for build"));
728 while ((pkg = poptGetArg(optCon))) {
729 ba->rootdir = rpmcliRootDir;
730 ba->passPhrase = passPhrase;
732 ec = build(ts, pkg, ba, rpmcliRcfile);
734 /*@loopbreak@*/ break;
736 (void) rpmReadConfigFiles(rpmcliRcfile, NULL);
739 #endif /* IAM_RPMBT */
743 if (ia->noDeps) ia->eraseInterfaceFlags |= UNINSTALL_NODEPS;
745 if (!poptPeekArg(optCon)) {
747 argerror(_("no packages given for erase"));
748 ia->transFlags |= RPMTRANS_FLAG_NOMD5;
749 ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
750 ec += rpmRollback(ts, ia, NULL);
752 ec += rpmErase(ts, ia, (const char **) poptGetArgs(optCon));
758 /* RPMTRANS_FLAG_KEEPOBSOLETE */
761 if (ia->transFlags & RPMTRANS_FLAG_NODOCS)
763 else if (rpmExpandNumeric("%{_excludedocs}"))
764 ia->transFlags |= RPMTRANS_FLAG_NODOCS;
767 if (ia->noDeps) ia->installInterfaceFlags |= INSTALL_NODEPS;
769 /* we've already ensured !(!ia->prefix && !ia->relocations) */
772 ia->relocations = xmalloc(2 * sizeof(*ia->relocations));
773 ia->relocations[0].oldPath = NULL; /* special case magic */
774 ia->relocations[0].newPath = ia->prefix;
775 ia->relocations[1].oldPath = NULL;
776 ia->relocations[1].newPath = NULL;
777 } else if (ia->relocations) {
778 ia->relocations = xrealloc(ia->relocations,
779 sizeof(*ia->relocations) * (ia->numRelocations + 1));
780 ia->relocations[ia->numRelocations].oldPath = NULL;
781 ia->relocations[ia->numRelocations].newPath = NULL;
785 if (!poptPeekArg(optCon)) {
787 argerror(_("no packages given for install"));
788 ia->transFlags |= RPMTRANS_FLAG_NOMD5;
789 ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
790 /*@i@*/ ec += rpmRollback(ts, ia, NULL);
792 /*@-compdef -compmempass@*/ /* FIX: ia->relocations[0].newPath undefined */
793 ec += rpmInstall(ts, ia, (const char **)poptGetArgs(optCon));
794 /*@=compdef =compmempass@*/
798 #endif /* IAM_RPMEIU */
802 if (qva->qva_source != RPMQV_ALL && !poptPeekArg(optCon))
803 argerror(_("no arguments given for query"));
804 ec = rpmcliQuery(ts, qva, (const char **) poptGetArgs(optCon));
805 /* XXX don't overflow single byte exit status */
806 if (ec > 255) ec = 255;
810 { rpmVerifyFlags verifyFlags = VERIFY_ALL;
812 verifyFlags &= ~qva->qva_flags;
813 qva->qva_flags = (rpmQueryFlags) verifyFlags;
815 if (qva->qva_source != RPMQV_ALL && !poptPeekArg(optCon))
816 argerror(_("no arguments given for verify"));
817 ec = rpmcliVerify(ts, qva, (const char **) poptGetArgs(optCon));
818 /* XXX don't overflow single byte exit status */
819 if (ec > 255) ec = 255;
824 argerror(_("unexpected arguments to --querytags "));
826 rpmDisplayQueryTags(stdout);
828 #endif /* IAM_RPMQV */
832 { rpmVerifyFlags verifyFlags =
833 (VERIFY_MD5|VERIFY_DIGEST|VERIFY_SIGNATURE);
835 verifyFlags &= ~ka->qva_flags;
836 ka->qva_flags = (rpmQueryFlags) verifyFlags;
839 if (!poptPeekArg(optCon))
840 argerror(_("no arguments given"));
841 ka->passPhrase = passPhrase;
842 ec = rpmcliSign(ts, ka, (const char **)poptGetArgs(optCon));
843 /* XXX don't overflow single byte exit status */
844 if (ec > 255) ec = 255;
846 #endif /* IAM_RPMK */
848 #if !defined(IAM_RPMQV)
853 #if !defined(IAM_RPMK)
857 #if !defined(IAM_RPMDB)
862 #if !defined(IAM_RPMBT)
868 #if !defined(IAM_RPMEIU)
873 if (poptPeekArg(optCon) != NULL || argc <= 1 || rpmIsVerbose())
874 printUsage(optCon, stdout, 0);
878 #if defined(IAM_RPMBT) || defined(IAM_RPMK)
880 #endif /* IAM_RPMBT || IAM_RPMK */
884 optCon = poptFreeContext(optCon);
886 /*@i@*/ rpmFreeMacros(rpmCLIMacroContext);
890 (void) fclose(stdout);
891 (void) waitpid(pipeChild, &status, 0);
894 /* keeps memory leak checkers quiet */
897 /*@i@*/ urlFreeCache();
899 dbiTags = _free(dbiTags);
902 qva->qva_queryFormat = _free(qva->qva_queryFormat);
906 ba->buildRootOverride = _free(ba->buildRootOverride);
907 ba->targets = _free(ba->targets);
911 if (ia->relocations != NULL)
912 for (i = 0; i < ia->numRelocations; i++)
913 ia->relocations[i].oldPath = _free(ia->relocations[i].oldPath);
914 ia->relocations = _free(ia->relocations);
917 #if HAVE_MCHECK_H && HAVE_MTRACE
919 muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */