10 #define GETOPT_ADDSIGN 1005
11 #define GETOPT_RESIGN 1006
12 #define GETOPT_DBPATH 1010
13 #define GETOPT_REBUILDDB 1013
14 #define GETOPT_INSTALL 1014
15 #define GETOPT_RELOCATE 1016
16 #define GETOPT_SHOWRC 1018
17 #define GETOPT_EXCLUDEPATH 1019
18 #define GETOPT_DEFINEMACRO 1020
19 #define GETOPT_EVALMACRO 1021
20 #define GETOPT_RCFILE 1022
21 #define GETOPT_VERIFYDB 1023
25 MODE_QUERY = (1 << 0),
26 MODE_INSTALL = (1 << 1),
27 MODE_ERASE = (1 << 2),
28 MODE_VERIFY = (1 << 3),
29 MODE_BUILD = (1 << 4),
30 MODE_REBUILD = (1 << 5),
31 MODE_CHECKSIG = (1 << 6),
32 MODE_RESIGN = (1 << 7),
33 MODE_RECOMPILE = (1 << 8),
34 MODE_QUERYTAGS = (1 << 9),
35 MODE_INITDB = (1 << 10),
36 MODE_TARBUILD = (1 << 11),
37 MODE_REBUILDDB = (1 << 12),
38 MODE_VERIFYDB = (1 << 13)
41 #define MODES_QV (MODE_QUERY | MODE_VERIFY)
42 #define MODES_BT (MODE_BUILD | MODE_TARBUILD | MODE_REBUILD | MODE_RECOMPILE)
43 #define MODES_IE (MODE_INSTALL | MODE_ERASE)
44 #define MODES_DB (MODE_INITDB | MODE_REBUILDDB | MODE_VERIFYDB)
45 #define MODES_K (MODE_CHECKSIG | MODES_RESIGN)
47 #define MODES_FOR_DBPATH (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
48 #define MODES_FOR_NODEPS (MODES_BT | MODES_IE | MODE_VERIFY)
49 #define MODES_FOR_TEST (MODES_BT | MODES_IE)
50 #define MODES_FOR_ROOT (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
52 /* the flags for the various options */
54 static int allMatches;
60 extern int _fsm_debug;
61 extern int _ftp_debug;
64 static int ignoreArch;
66 static int ignoreSize;
83 static int noTriggers;
89 static int noUsageMsg;
90 static int oldPackage;
91 static char * pipeOutput;
102 static int replaceFiles;
103 static int replacePackages;
104 static char * rootdir;
105 extern int _rpmio_debug;
106 static int showPercents;
110 extern int _url_debug;
111 extern int _noDirTokens;
112 extern int _useDbiMajor;
114 static int showVersion;
115 extern const char * rpmNAME;
116 extern const char * rpmEVR;
119 extern struct MacroContext_s rpmCLIMacroContext;
121 extern struct rpmBuildArguments_s rpmBTArgs;
123 /* the structure describing the options we take and the defaults */
124 static struct poptOption optionsTable[] = {
125 { "addsign", '\0', 0, 0, GETOPT_ADDSIGN, NULL, NULL},
126 { "allfiles", '\0', 0, &allFiles, 0, NULL, NULL},
127 { "allmatches", '\0', 0, &allMatches, 0, NULL, NULL},
128 { "apply", '\0', 0, &applyOnly, 0, NULL, NULL},
129 { "badreloc", '\0', 0, &badReloc, 0, NULL, NULL},
130 { "checksig", 'K', 0, 0, 'K', NULL, NULL},
131 { "define", '\0', POPT_ARG_STRING, 0, GETOPT_DEFINEMACRO,NULL, NULL},
132 { "dirstash", '\0', POPT_ARG_VAL, &dirStash, 1, NULL, NULL},
133 { "dirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 0, NULL, NULL},
134 { "erase", 'e', 0, 0, 'e', NULL, NULL},
135 { "eval", '\0', POPT_ARG_STRING, 0, GETOPT_EVALMACRO, NULL, NULL},
136 { "excludedocs", '\0', 0, &excldocs, 0, NULL, NULL},
137 { "excludepath", '\0', POPT_ARG_STRING, 0, GETOPT_EXCLUDEPATH, NULL, NULL},
138 { "force", '\0', 0, &force, 0, NULL, NULL},
139 { "freshen", 'F', 0, 0, 'F', NULL, NULL},
140 { "fsmdebug", '\0', POPT_ARG_VAL, &_fsm_debug, -1, NULL, NULL},
141 { "ftpdebug", '\0', POPT_ARG_VAL, &_ftp_debug, -1, NULL, NULL},
142 { "hash", 'h', 0, &showHash, 0, NULL, NULL},
143 { "help", '\0', 0, &help, 0, NULL, NULL},
144 { NULL, 'i', 0, 0, 'i', NULL, NULL},
145 { "ignorearch", '\0', 0, &ignoreArch, 0, NULL, NULL},
146 { "ignoreos", '\0', 0, &ignoreOs, 0, NULL, NULL},
147 { "ignoresize", '\0', 0, &ignoreSize, 0, NULL, NULL},
148 { "includedocs", '\0', 0, &incldocs, 0, NULL, NULL},
149 { "initdb", '\0', 0, &initdb, 0, NULL, NULL},
150 /* info and install both using 'i' is dumb */
151 { "install", '\0', 0, 0, GETOPT_INSTALL, NULL, NULL},
152 { "justdb", '\0', 0, &justdb, 0, NULL, NULL},
153 { "macros", '\0', POPT_ARG_STRING, ¯ofiles, 0, NULL, NULL},
154 { "nodeps", '\0', 0, &noDeps, 0, NULL, NULL},
155 { "nodirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 1, NULL, NULL},
156 { "nogpg", '\0', 0, &noGpg, 0, NULL, NULL},
157 #if HAVE_LIBIO_H && defined(_G_IO_IO_FILE_VERSION)
158 { "nolibio", '\0', POPT_ARG_VAL, &noLibio, 1, NULL, NULL},
160 { "nomd5", '\0', 0, &noMd5, 0, NULL, NULL},
161 { "noorder", '\0', 0, &noOrder, 0, NULL, NULL},
162 { "nopgp", '\0', 0, &noPgp, 0, NULL, NULL},
164 { "noscripts", '\0', 0, &noScripts, 0, NULL, NULL},
165 { "nopre", '\0', 0, &noPre, 0, NULL, NULL},
166 { "nopost", '\0', 0, &noPost, 0, NULL, NULL},
167 { "nopreun", '\0', 0, &noPreun, 0, NULL, NULL},
168 { "nopostun", '\0', 0, &noPostun, 0, NULL, NULL},
170 { "notriggers", '\0', 0, &noTriggers, 0, NULL, NULL},
171 { "notriggerprein", '\0', 0, &noTPrein, 0, NULL, NULL},
172 { "notriggerin", '\0', 0, &noTIn, 0, NULL, NULL},
173 { "notriggerun", '\0', 0, &noTUn, 0, NULL, NULL},
174 { "notriggerpostun", '\0', 0, &noTPostun, 0, NULL, NULL},
176 { "oldpackage", '\0', 0, &oldPackage, 0, NULL, NULL},
177 { "percent", '\0', 0, &showPercents, 0, NULL, NULL},
178 { "pipe", '\0', POPT_ARG_STRING, &pipeOutput, 0, NULL, NULL},
179 { "pkgcommit", '\0', POPT_ARG_VAL, &pkgCommit, 1, NULL, NULL},
180 { "pkgundo", '\0', POPT_ARG_VAL, &pkgUndo, 1, NULL, NULL},
181 { "prefix", '\0', POPT_ARG_STRING, &prefix, 0, NULL, NULL},
182 { "quiet", '\0', 0, &quiet, 0, NULL, NULL},
184 { "rcfile", '\0', POPT_ARG_STRING, &rcfile, 0, NULL, NULL},
186 { "rcfile", '\0', 0, 0, GETOPT_RCFILE, NULL, NULL},
188 { "rebuilddb", '\0', 0, 0, GETOPT_REBUILDDB, NULL, NULL},
189 { "verifydb", '\0', 0, 0, GETOPT_VERIFYDB, NULL, NULL},
190 { "relocate", '\0', POPT_ARG_STRING, 0, GETOPT_RELOCATE, NULL, NULL},
191 { "repackage", '\0', POPT_ARG_VAL, &rePackage, 1, NULL, NULL},
192 { "replacefiles", '\0', 0, &replaceFiles, 0, NULL, NULL},
193 { "replacepkgs", '\0', 0, &replacePackages, 0, NULL, NULL},
194 { "resign", '\0', 0, 0, GETOPT_RESIGN, NULL, NULL},
195 { "root", 'r', POPT_ARG_STRING, &rootdir, 0, NULL, NULL},
196 { "rpmiodebug", '\0', POPT_ARG_VAL, &_rpmio_debug, -1, NULL, NULL},
197 { "showrc", '\0', 0, &showrc, GETOPT_SHOWRC, NULL, NULL},
198 { "sign", '\0', 0, &signIt, 0, NULL, NULL},
199 { "test", '\0', 0, &test, 0, NULL, NULL},
200 { "commit", '\0', POPT_ARG_VAL, &tsCommit, 1, NULL, NULL},
201 { "undo", '\0', POPT_ARG_VAL, &tsUndo, 1, NULL, NULL},
202 { "upgrade", 'U', 0, 0, 'U', NULL, NULL},
203 { "urldebug", '\0', POPT_ARG_VAL, &_url_debug, -1, NULL, NULL},
204 { "uninstall", 'u', 0, 0, 'u', NULL, NULL},
205 { "verbose", 'v', 0, 0, 'v', NULL, NULL},
206 { "version", '\0', 0, &showVersion, 0, NULL, NULL},
208 { NULL, '\0', POPT_ARG_INCLUDE_TABLE,
209 rpmQVSourcePoptTable, 0, (void *) &rpmQVArgs, NULL },
210 { NULL, '\0', POPT_ARG_INCLUDE_TABLE,
211 rpmQueryPoptTable, 0, (void *) &rpmQVArgs, NULL },
212 { NULL, '\0', POPT_ARG_INCLUDE_TABLE,
213 rpmVerifyPoptTable, 0, (void *) &rpmQVArgs, NULL },
215 { NULL, '\0', POPT_ARG_INCLUDE_TABLE,
216 rpmBuildPoptTable, 0, (void *) &rpmBTArgs, NULL },
218 { 0, 0, 0, 0, 0, NULL, NULL }
222 /* MiNT cannot dynamically increase the stack. */
223 long _stksize = 64 * 1024L;
226 static void argerror(const char * desc) {
227 fprintf(stderr, _("rpm: %s\n"), desc);
231 static void printHelp(void);
232 static void printVersion(void);
233 static void printBanner(void);
234 static void printUsage(void);
235 static void printHelpLine(char * prefix, char * help);
237 static void printVersion(void) {
238 fprintf(stdout, _("RPM version %s\n"), rpmEVR);
241 static void printBanner(void) {
242 puts(_("Copyright (C) 1998-2000 - Red Hat, Inc."));
243 puts(_("This program may be freely redistributed under the terms of the GNU GPL"));
246 static void printUsage(void) {
251 puts(_("Usage: rpm {--help}"));
252 puts(_(" rpm {--version}"));
253 puts(_(" rpm {--initdb} [--dbpath <dir>]"));
254 puts(_(" rpm {--install -i} [-v] [--hash -h] [--percent] [--force] [--test]"));
255 puts(_(" [--replacepkgs] [--replacefiles] [--root <dir>]"));
256 puts(_(" [--excludedocs] [--includedocs] [--noscripts]"));
257 puts(_(" [--rcfile <file>] [--ignorearch] [--dbpath <dir>]"));
258 puts(_(" [--prefix <dir>] [--ignoreos] [--nodeps] [--allfiles]"));
259 puts(_(" [--ftpproxy <host>] [--ftpport <port>]"));
260 puts(_(" [--httpproxy <host>] [--httpport <port>]"));
261 puts(_(" [--justdb] [--noorder] [--relocate oldpath=newpath]"));
262 puts(_(" [--badreloc] [--notriggers] [--excludepath <path>]"));
263 puts(_(" [--ignoresize] file1.rpm ... fileN.rpm"));
264 puts(_(" rpm {--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test]"));
265 puts(_(" [--oldpackage] [--root <dir>] [--noscripts]"));
266 puts(_(" [--excludedocs] [--includedocs] [--rcfile <file>]"));
267 puts(_(" [--ignorearch] [--dbpath <dir>] [--prefix <dir>] "));
268 puts(_(" [--ftpproxy <host>] [--ftpport <port>]"));
269 puts(_(" [--httpproxy <host>] [--httpport <port>] "));
270 puts(_(" [--ignoreos] [--nodeps] [--allfiles] [--justdb]"));
271 puts(_(" [--noorder] [--relocate oldpath=newpath]"));
272 puts(_(" [--badreloc] [--excludepath <path>] [--ignoresize]"));
273 puts(_(" file1.rpm ... fileN.rpm"));
274 puts(_(" rpm {--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R]"));
275 puts(_(" [--scripts] [--root <dir>] [--rcfile <file>]"));
276 puts(_(" [--whatprovides] [--whatrequires] [--requires]"));
277 puts(_(" [--triggeredby]"));
278 puts(_(" [--ftpproxy <host>] [--ftpport <port>]"));
279 puts(_(" [--httpproxy <host>] [--httpport <port>]"));
280 puts(_(" [--provides] [--triggers] [--dump]"));
281 puts(_(" [--changelog] [--dbpath <dir>] [targets]"));
282 puts(_(" rpm {--verify -V -y} [-afpg] [--root <dir>] [--rcfile <file>]"));
283 puts(_(" [--dbpath <dir>] [--nodeps] [--nofiles] [--noscripts]"));
284 puts(_(" [--nomd5] [targets]"));
285 puts(_(" rpm {--setperms} [-afpg] [target]"));
286 puts(_(" rpm {--setugids} [-afpg] [target]"));
287 puts(_(" rpm {--freshen -F} file1.rpm ... fileN.rpm"));
288 puts(_(" rpm {--erase -e} [--root <dir>] [--noscripts] [--rcfile <file>]"));
289 puts(_(" [--dbpath <dir>] [--nodeps] [--allmatches]"));
290 puts(_(" [--justdb] [--notriggers] package1 ... packageN"));
291 puts(_(" rpm {--resign} [--rcfile <file>] package1 package2 ... packageN"));
292 puts(_(" rpm {--addsign} [--rcfile <file>] package1 package2 ... packageN"));
293 puts(_(" rpm {--checksig -K} [--nopgp] [--nogpg] [--nomd5] [--rcfile <file>]"));
294 puts(_(" package1 ... packageN"));
295 puts(_(" rpm {--rebuilddb} [--rcfile <file>] [--dbpath <dir>]"));
296 puts(_(" rpm {--verifydb} [--rcfile <file>] [--dbpath <dir>]"));
297 puts(_(" rpm {--querytags}"));
300 static void printHelpLine(char * prefix, char * help) {
301 int indentLength = strlen(prefix) + 3;
302 int lineLength = 79 - indentLength;
303 int helpLength = strlen(help);
307 fprintf(stdout, "%s - ", prefix);
309 while (helpLength > lineLength) {
310 ch = help + lineLength - 1;
311 while (ch > help && !isspace(*ch)) ch--;
312 if (ch == help) break; /* give up */
313 while (ch > (help + 1) && isspace(*ch)) ch--;
316 sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength);
317 fprintf(stdout, format, help, " ");
319 while (isspace(*help) && *help) help++;
320 helpLength = strlen(help);
323 if (helpLength) puts(help);
326 static void printHelp(void) {
332 printHelpLine( " --help ",
333 _("print this message"));
334 printHelpLine( " --version ",
335 _("print the version of rpm being used"));
338 puts( _(" All modes support the following arguments:"));
339 printHelpLine(_(" --define '<name> <body>'"),
340 _("define macro <name> with value <body>"));
341 printHelpLine(_(" --eval '<name>+' "),
342 _("print the expansion of macro <name> to stdout"));
343 printHelpLine(_(" --pipe <cmd> "),
344 _("send stdout to <cmd>"));
345 printHelpLine(_(" --rcfile <file> "),
346 _("use <file> instead of /etc/rpmrc and $HOME/.rpmrc"));
347 printHelpLine( " --showrc ",
348 _("display final rpmrc and macro configuration"));
349 printHelpLine( " -v ",
350 _("be a little more verbose"));
351 printHelpLine( " -vv ",
352 _("be incredibly verbose (for debugging)"));
355 puts( _(" Install, upgrade and query (with -p) allow URL's to be used in place"));
356 puts( _(" of file names as well as the following options:"));
357 printHelpLine(_(" --ftpproxy <host> "),
358 _("hostname or IP of ftp proxy"));
359 printHelpLine(_(" --ftpport <port> "),
360 _("port number of ftp server (or proxy)"));
361 printHelpLine(_(" --httpproxy <host> "),
362 _("hostname or IP of http proxy"));
363 printHelpLine(_(" --httpport <port> "),
364 _("port number of http server (or proxy)"));
367 printHelpLine( " -q, --query ",
369 printHelpLine(_(" --dbpath <dir> "),
370 _("use <dir> as the directory for the database"));
371 printHelpLine(_(" --queryformat <qfmt>"),
372 _("use <qfmt> as the header format (implies --info)"));
373 printHelpLine(_(" --root <dir> "),
374 _("use <dir> as the top level directory"));
375 puts( _(" Package specification options:"));
376 printHelpLine( " -a, --all ",
377 _("query all packages"));
378 printHelpLine(_(" -f <file>+ "),
379 _("query package owning <file>"));
380 printHelpLine(_(" -p <packagefile>+ "),
381 _("query (uninstalled) package <packagefile>"));
382 printHelpLine(_(" --triggeredby <pkg>"),
383 _("query packages triggered by <pkg>"));
384 printHelpLine(_(" --whatprovides <cap>"),
385 _("query packages which provide <cap> capability"));
386 printHelpLine(_(" --whatrequires <cap>"),
387 _("query packages which require <cap> capability"));
388 puts( _(" Information selection options:"));
389 printHelpLine( " -i, --info ",
390 _("display package information"));
391 printHelpLine( " --changelog ",
392 _("display the package's change log"));
393 printHelpLine( " -l ",
394 _("display package file list"));
395 printHelpLine( " -s ",
396 _("show file states (implies -l)"));
397 printHelpLine( " -d ",
398 _("list only documentation files (implies -l)"));
399 printHelpLine( " -c ",
400 _("list only configuration files (implies -l)"));
401 printHelpLine( " --dump ",
402 _("show all verifiable information for each file (must be used with -l, -c, or -d)"));
403 printHelpLine( " --provides ",
404 _("list capabilities package provides"));
405 printHelpLine( " -R, --requires ",
406 _("list package dependencies"));
407 printHelpLine( " --scripts ",
408 _("print the various [un]install scripts"));
409 printHelpLine( " --triggers ",
410 _("show the trigger scripts contained in the package"));
413 printHelpLine( " -V, -y, --verify ",
414 _("verify a package installation using the same same package specification options as -q"));
415 printHelpLine(_(" --dbpath <dir> "),
416 _("use <dir> as the directory for the database"));
417 printHelpLine(_(" --root <dir> "),
418 _("use <dir> as the top level directory"));
419 printHelpLine( " --nodeps ",
420 _("do not verify package dependencies"));
421 printHelpLine( " --nomd5 ",
422 _("do not verify file md5 checksums"));
423 printHelpLine( " --nofiles ",
424 _("do not verify file attributes"));
425 printHelpLine( " --querytags ",
426 _("list the tags that can be used in a query format"));
429 puts( _(" --install <packagefile>"));
430 printHelpLine(_(" -i <packagefile> "),
431 _("install package"));
432 printHelpLine(_(" --excludepath <path>"),
433 _("skip files in path <path>"));
434 printHelpLine(_(" --relocate <oldpath>=<newpath>"),
435 _("relocate files from <oldpath> to <newpath>"));
436 printHelpLine( " --badreloc ",
437 _("relocate files in non-relocateable package"));
438 printHelpLine(_(" --prefix <dir> "),
439 _("relocate the package to <dir>, if relocatable"));
440 printHelpLine(_(" --dbpath <dir> "),
441 _("use <dir> as the directory for the database"));
442 printHelpLine( " --excludedocs ",
443 _("do not install documentation"));
444 printHelpLine( " --force ",
445 _("short hand for --replacepkgs --replacefiles"));
446 printHelpLine( " -h, --hash ",
447 _("print hash marks as package installs (good with -v)"));
448 printHelpLine( " --allfiles ",
449 _("install all files, even configurations which might "
450 "otherwise be skipped"));
451 printHelpLine( " --ignorearch ",
452 _("don't verify package architecture"));
453 printHelpLine( " --ignoresize ",
454 _("don't check disk space before installing"));
455 printHelpLine( " --ignoreos ",
456 _("don't verify package operating system"));
457 printHelpLine( " --includedocs ",
458 _("install documentation"));
459 printHelpLine( " --justdb ",
460 _("update the database, but do not modify the filesystem"));
461 printHelpLine( " --nodeps ",
462 _("do not verify package dependencies"));
463 printHelpLine( " --noorder ",
464 _("do not reorder package installation to satisfy dependencies"));
465 printHelpLine( " --noscripts ",
466 _("don't execute any installation scripts"));
467 printHelpLine( " --notriggers ",
468 _("don't execute any scripts triggered by this package"));
469 printHelpLine( " --percent ",
470 _("print percentages as package installs"));
471 printHelpLine( " --replacefiles ",
472 _("install even if the package replaces installed files"));
473 printHelpLine( " --replacepkgs ",
474 _("reinstall if the package is already present"));
475 printHelpLine(_(" --root <dir> "),
476 _("use <dir> as the top level directory"));
477 printHelpLine( " --test ",
478 _("don't install, but tell if it would work or not"));
481 puts( _(" --upgrade <packagefile>"));
482 printHelpLine(_(" -U <packagefile> "),
483 _("upgrade package (same options as --install, plus)"));
484 printHelpLine( " --oldpackage ",
485 _("upgrade to an old version of the package (--force on upgrades does this automatically)"));
487 puts( _(" --erase <package>"));
488 printHelpLine(_(" -e <package> "),
489 _("erase (uninstall) package"));
490 printHelpLine( " --allmatches ",
491 _("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"));
492 printHelpLine(_(" --dbpath <dir> "),
493 _("use <dir> as the directory for the database"));
494 printHelpLine( " --justdb ",
495 _("update the database, but do not modify the filesystem"));
496 printHelpLine( " --nodeps ",
497 _("do not verify package dependencies"));
498 printHelpLine( " --noorder ",
499 _("do not reorder package installation to satisfy dependencies"));
500 printHelpLine( " --noscripts ",
501 _("do not execute any package specific scripts"));
502 printHelpLine( " --notriggers ",
503 _("don't execute any scripts triggered by this package"));
504 printHelpLine(_(" --root <dir> "),
505 _("use <dir> as the top level directory"));
507 puts( _(" -b<stage> <spec> "));
508 printHelpLine(_(" -t<stage> <tarball> "),
509 _("build package, where <stage> is one of:"));
510 printHelpLine( " p ",
511 _("prep (unpack sources and apply patches)"));
512 printHelpLine( " l ",
513 _("list check (do some cursory checks on %files)"));
514 printHelpLine( " c ",
515 _("compile (prep and compile)"));
516 printHelpLine( " i ",
517 _("install (prep, compile, install)"));
518 printHelpLine( " b ",
519 _("binary package (prep, compile, install, package)"));
520 printHelpLine( " a ",
521 _("bin/src package (prep, compile, install, package)"));
522 printHelpLine( " --short-circuit ",
523 _("skip straight to specified stage (only for c,i)"));
524 printHelpLine( " --clean ",
525 _("remove build tree when done"));
526 printHelpLine( " --rmsource ",
527 _("remove sources when done"));
528 printHelpLine( " --rmspec ",
529 _("remove spec file when done"));
530 printHelpLine( " --sign ",
531 _("generate PGP/GPG signature"));
532 printHelpLine(_(" --buildroot <dir> "),
533 _("use <dir> as the build root"));
534 printHelpLine(_(" --target=<platform>+"),
535 _("build the packages for the build targets platform1...platformN."));
536 printHelpLine( " --nobuild ",
537 _("do not execute any stages"));
539 printHelpLine(_(" --rebuild <src_pkg> "),
540 _("install source package, build binary package and remove spec file, sources, patches, and icons."));
541 printHelpLine(_(" --recompile <src_pkg> "),
542 _("like --rebuild, but don't build any package"));
545 printHelpLine(_(" --resign <pkg>+ "),
546 _("sign a package (discard current signature)"));
547 printHelpLine(_(" --addsign <pkg>+ "),
548 _("add a signature to a package"));
549 puts( _(" --checksig <pkg>+"));
550 printHelpLine(_(" -K <pkg>+ "),
551 _("verify package signature"));
552 printHelpLine( " --nopgp ",
553 _("skip any PGP signatures"));
554 printHelpLine( " --nogpg ",
555 _("skip any GPG signatures"));
556 printHelpLine( " --nomd5 ",
557 _("skip any MD5 signatures"));
560 printHelpLine( " --initdb ",
561 _("make sure a valid database exists"));
562 printHelpLine( " --rebuilddb ",
563 _("rebuild database from existing database"));
564 printHelpLine( " --verifydb ",
565 _("verify database files"));
566 printHelpLine(_(" --dbpath <dir> "),
567 _("use <dir> as the directory for the database"));
568 printHelpLine( " --root <dir> ",
569 _("use <dir> as the top level directory"));
572 printHelpLine( " --setperms ",
573 _("set the file permissions to those in the package database"
574 " using the same package specification options as -q"));
575 printHelpLine( " --setugids ",
576 _("set the file owner and group to those in the package "
577 "database using the same package specification options as "
581 int main(int argc, const char ** argv)
583 enum modes bigMode = MODE_UNKNOWN;
584 QVA_t qva = &rpmQVArgs;
586 rpmtransFlags transFlags = RPMTRANS_FLAG_NONE;
587 rpmInstallInterfaceFlags installInterfaceFlags = INSTALL_NONE;
588 rpmEraseInterfaceFlags eraseInterfaceFlags = UNINSTALL_NONE;
590 int checksigFlags = 0;
591 rpmResignFlags addSign = RESIGN_NEW_SIGNATURE;
592 char * passPhrase = "";
596 char * errString = NULL;
601 rpmRelocation * relocations = NULL;
602 int numRelocations = 0;
608 #if HAVE_MCHECK_H && HAVE_MTRACE
609 mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
611 setprogname(argv[0]); /* Retrofit glibc __progname */
613 /* set the defaults for the various command line options */
631 #if HAVE_LIBIO_H && defined(_G_IO_IO_FILE_VERSION)
669 /* XXX Eliminate query linkage loop */
670 parseSpecVec = parseSpec;
671 freeSpecVec = freeSpec;
673 /* set up the correct locale */
674 setlocale(LC_ALL, "" );
677 #define LOCALEDIR "/usr/share/locale"
679 bindtextdomain(PACKAGE, LOCALEDIR);
682 rpmSetVerbosity(RPMMESS_NORMAL); /* XXX silly use by showrc */
684 /* Make a first pass through the arguments, looking for --rcfile */
685 /* We need to handle that before dealing with the rest of the arguments. */
686 optCon = poptGetContext("rpm", argc, argv, optionsTable, 0);
687 poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
688 poptReadDefaultConfig(optCon, 1);
689 poptSetExecPath(optCon, RPMCONFIGDIR, 1);
691 /* reading rcfile early makes it easy to override */
692 /* XXX only --rcfile (and --showrc) need this pre-parse */
694 while ((arg = poptGetNextOpt(optCon)) > 0) {
697 rpmIncreaseVerbosity(); /* XXX silly use by showrc */
704 if (rpmReadConfigFiles(rcfile, NULL))
712 rpmSetVerbosity(RPMMESS_NORMAL); /* XXX silly use by showrc */
714 poptResetContext(optCon);
716 if (qva->qva_queryFormat) free((void *)qva->qva_queryFormat);
717 memset(qva, 0, sizeof(*qva));
718 qva->qva_source = RPMQV_PACKAGE;
722 while ((arg = poptGetNextOpt(optCon)) > 0) {
723 optArg = poptGetOptArg(optCon);
727 if (bigMode != MODE_UNKNOWN && bigMode != MODE_CHECKSIG)
728 argerror(_("only one major mode may be specified"));
729 bigMode = MODE_CHECKSIG;
733 if (bigMode != MODE_UNKNOWN && bigMode != MODE_ERASE)
734 argerror(_("only one major mode may be specified"));
735 bigMode = MODE_ERASE;
736 rpmMessage(RPMMESS_ERROR, _("-u and --uninstall are deprecated and no"
738 rpmMessage(RPMMESS_ERROR, _("Use -e or --erase instead.\n"));
742 if (bigMode != MODE_UNKNOWN && bigMode != MODE_ERASE)
743 argerror(_("only one major mode may be specified"));
744 bigMode = MODE_ERASE;
748 rpmIncreaseVerbosity();
752 if (bigMode == MODE_QUERY) {
753 const char * infoCommand[] = { "--info", NULL };
754 poptStuffArgs(optCon, infoCommand);
755 } else if (bigMode == MODE_INSTALL)
757 else if (bigMode == MODE_UNKNOWN) {
758 const char * installCommand[] = { "--install", NULL };
759 poptStuffArgs(optCon, installCommand);
764 if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
765 argerror(_("only one major mode may be specified"));
766 bigMode = MODE_INSTALL;
770 if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
771 argerror(_("only one major mode may be specified"));
772 bigMode = MODE_INSTALL;
777 if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
778 argerror(_("only one major mode may be specified"));
779 bigMode = MODE_INSTALL;
780 upgrade = 1; /* Freshen implies upgrade */
785 if (bigMode != MODE_UNKNOWN && bigMode != MODE_RESIGN)
786 argerror(_("only one major mode may be specified"));
787 bigMode = MODE_RESIGN;
788 addSign = RESIGN_NEW_SIGNATURE;
793 if (bigMode != MODE_UNKNOWN && bigMode != MODE_RESIGN)
794 argerror(_("only one major mode may be specified"));
795 bigMode = MODE_RESIGN;
796 addSign = RESIGN_ADD_SIGNATURE;
800 case GETOPT_DEFINEMACRO:
801 rpmDefineMacro(NULL, optArg, RMIL_CMDLINE);
802 rpmDefineMacro(&rpmCLIMacroContext, optArg, RMIL_CMDLINE);
806 case GETOPT_EVALMACRO:
807 { const char *val = rpmExpand(optArg, NULL);
808 fprintf(stdout, "%s\n", val);
813 case GETOPT_REBUILDDB:
814 if (bigMode != MODE_UNKNOWN && bigMode != MODE_REBUILDDB)
815 argerror(_("only one major mode may be specified"));
816 bigMode = MODE_REBUILDDB;
819 case GETOPT_VERIFYDB:
820 if (bigMode != MODE_UNKNOWN && bigMode != MODE_VERIFYDB)
821 argerror(_("only one major mode may be specified"));
822 bigMode = MODE_VERIFYDB;
825 case GETOPT_RELOCATE:
827 argerror(_("relocations must begin with a /"));
828 if (!(errString = strchr(optArg, '=')))
829 argerror(_("relocations must contain a ="));
831 if (*errString != '/')
832 argerror(_("relocations must have a / following the ="));
833 relocations = xrealloc(relocations,
834 sizeof(*relocations) * (numRelocations + 1));
835 relocations[numRelocations].oldPath = optArg;
836 relocations[numRelocations++].newPath = errString;
839 case GETOPT_EXCLUDEPATH:
841 argerror(_("exclude paths must begin with a /"));
843 relocations = xrealloc(relocations,
844 sizeof(*relocations) * (numRelocations + 1));
845 relocations[numRelocations].oldPath = optArg;
846 relocations[numRelocations++].newPath = NULL;
850 fprintf(stderr, _("The --rcfile option has been eliminated.\n"));
851 fprintf(stderr, _("Use --macros with a colon separated list of macro files to read.\n"));
853 /*@notreached@*/ break;
856 fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
862 rpmSetVerbosity(RPMMESS_QUIET);
864 if (showVersion) printVersion();
865 if (help) printHelp();
868 fprintf(stderr, "%s: %s\n",
869 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
874 if (bigMode == MODE_UNKNOWN && qva->qva_mode != ' ') {
875 switch (qva->qva_mode) {
876 case 'q': bigMode = MODE_QUERY; break;
877 case 'V': bigMode = MODE_VERIFY; break;
878 case 'Q': bigMode = MODE_QUERYTAGS; break;
883 if (bigMode != MODE_UNKNOWN)
884 argerror(_("only one major mode may be specified"));
886 bigMode = MODE_INITDB;
889 if (qva->qva_sourceCount) {
890 if (qva->qva_sourceCount > 1)
891 argerror(_("one type of query/verify may be performed at a "
895 if (qva->qva_flags && (bigMode & ~MODES_QV))
896 argerror(_("unexpected query flags"));
898 if (qva->qva_queryFormat && (bigMode & ~MODES_QV))
899 argerror(_("unexpected query format"));
901 if (qva->qva_source != RPMQV_PACKAGE && (bigMode & ~MODES_QV))
902 argerror(_("unexpected query source"));
904 if (!(bigMode == MODE_INSTALL) && force)
905 argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
907 if (bigMode != MODE_INSTALL && badReloc)
908 argerror(_("files may only be relocated during package installation"));
910 if (relocations && prefix)
911 argerror(_("only one of --prefix or --relocate may be used"));
913 if (bigMode != MODE_INSTALL && relocations)
914 argerror(_("--relocate and --excludepath may only be used when installing new packages"));
916 if (bigMode != MODE_INSTALL && prefix)
917 argerror(_("--prefix may only be used when installing new packages"));
919 if (prefix && prefix[0] != '/')
920 argerror(_("arguments to --prefix must begin with a /"));
922 if (bigMode != MODE_INSTALL && showHash)
923 argerror(_("--hash (-h) may only be specified during package "
926 if (bigMode != MODE_INSTALL && showPercents)
927 argerror(_("--percent may only be specified during package "
930 if (bigMode != MODE_INSTALL && replaceFiles)
931 argerror(_("--replacefiles may only be specified during package "
934 if (bigMode != MODE_INSTALL && replacePackages)
935 argerror(_("--replacepkgs may only be specified during package "
938 if (bigMode != MODE_INSTALL && excldocs)
939 argerror(_("--excludedocs may only be specified during package "
942 if (bigMode != MODE_INSTALL && incldocs)
943 argerror(_("--includedocs may only be specified during package "
946 if (excldocs && incldocs)
947 argerror(_("only one of --excludedocs and --includedocs may be "
950 if (bigMode != MODE_INSTALL && ignoreArch)
951 argerror(_("--ignorearch may only be specified during package "
954 if (bigMode != MODE_INSTALL && ignoreOs)
955 argerror(_("--ignoreos may only be specified during package "
958 if (bigMode != MODE_INSTALL && ignoreSize)
959 argerror(_("--ignoresize may only be specified during package "
962 if (allMatches && bigMode != MODE_ERASE)
963 argerror(_("--allmatches may only be specified during package "
966 if (allFiles && bigMode != MODE_INSTALL)
967 argerror(_("--allfiles may only be specified during package "
970 if (justdb && bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
971 argerror(_("--justdb may only be specified during package "
972 "installation and erasure"));
974 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
975 bigMode != MODE_VERIFY &&
976 (noScripts | noPre | noPost | noPreun | noPostun |
977 noTriggers | noTPrein | noTIn | noTUn | noTPostun))
978 argerror(_("script disabling options may only be specified during package "
979 "installation, erasure, and verification"));
981 if (bigMode != MODE_INSTALL && applyOnly)
982 argerror(_("--apply may only be specified during package "
985 if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
986 (noTriggers | noTPrein | noTIn | noTUn | noTPostun))
987 argerror(_("trigger disabling options may only be specified during package "
988 "installation and erasure"));
990 if (noDeps & (bigMode & ~MODES_FOR_NODEPS))
991 argerror(_("--nodeps may only be specified during package "
992 "building, rebuilding, recompilation, installation,"
993 "erasure, and verification"));
995 if (test && (bigMode & ~MODES_FOR_TEST))
996 argerror(_("--test may only be specified during package installation, "
997 "erasure, and building"));
999 if (rootdir[1] && (bigMode & ~MODES_FOR_ROOT))
1000 argerror(_("--root (-r) may only be specified during "
1001 "installation, erasure, querying, and "
1002 "database rebuilds"));
1005 switch (urlIsURL(rootdir)) {
1007 if (bigMode & MODES_FOR_ROOT)
1010 case URL_IS_UNKNOWN:
1011 if (rootdir[0] != '/')
1012 argerror(_("arguments to --root (-r) must begin with a /"));
1017 if (oldPackage && !upgrade)
1018 argerror(_("--oldpackage may only be used during upgrades"));
1020 if (noPgp && bigMode != MODE_CHECKSIG)
1021 argerror(_("--nopgp may only be used during signature checking"));
1023 if (noGpg && bigMode != MODE_CHECKSIG)
1024 argerror(_("--nogpg may only be used during signature checking"));
1026 if (noMd5 && bigMode != MODE_CHECKSIG && bigMode != MODE_VERIFY)
1027 argerror(_("--nomd5 may only be used during signature checking and "
1028 "package verification"));
1031 if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD ||
1032 bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD) {
1037 if ((argv = poptGetArgs(optCon)) == NULL) {
1038 fprintf(stderr, _("no files to sign\n"));
1042 if (stat(*argv, &sb)) {
1043 fprintf(stderr, _("cannot access file %s\n"), *argv);
1049 if (errors) return errors;
1051 if (poptPeekArg(optCon)) {
1052 switch (sigTag = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) {
1056 if ((sigTag == RPMSIGTAG_PGP || sigTag == RPMSIGTAG_PGP5) &&
1057 !rpmDetectPGPVersion(NULL)) {
1058 fprintf(stderr, _("pgp not found: "));
1062 passPhrase = rpmGetPassPhrase(_("Enter pass phrase: "), sigTag);
1063 if (passPhrase == NULL) {
1064 fprintf(stderr, _("Pass phrase check failed\n"));
1067 fprintf(stderr, _("Pass phrase is good.\n"));
1068 passPhrase = xstrdup(passPhrase);
1072 _("Invalid %%_signature spec in macro file.\n"));
1074 /*@notreached@*/ break;
1078 argerror(_("--sign may only be used during package building"));
1081 /* Make rpmLookupSignatureType() return 0 ("none") from now on */
1082 rpmLookupSignatureType(RPMLOOKUPSIG_DISABLE);
1088 if (!(pipeChild = fork())) {
1090 dup2(p[0], STDIN_FILENO);
1092 execl("/bin/sh", "/bin/sh", "-c", pipeOutput, NULL);
1093 fprintf(stderr, _("exec failed\n"));
1097 dup2(p[1], STDOUT_FILENO);
1103 if (!showVersion && !help && !noUsageMsg) printUsage();
1106 case MODE_REBUILDDB:
1107 ec = rpmdbRebuild(rootdir);
1111 ec = rpmdbVerify(rootdir);
1114 case MODE_QUERYTAGS:
1116 argerror(_("unexpected arguments to --querytags "));
1118 rpmDisplayQueryTags(stdout);
1122 rpmdbInit(rootdir, 0644);
1126 if (!poptPeekArg(optCon))
1127 argerror(_("no packages given for signature check"));
1128 if (!noPgp) checksigFlags |= CHECKSIG_PGP;
1129 if (!noGpg) checksigFlags |= CHECKSIG_GPG;
1130 if (!noMd5) checksigFlags |= CHECKSIG_MD5;
1131 ec = rpmCheckSig(checksigFlags, (const char **)poptGetArgs(optCon));
1132 /* XXX don't overflow single byte exit status */
1133 if (ec > 255) ec = 255;
1137 if (!poptPeekArg(optCon))
1138 argerror(_("no packages given for signing"));
1139 ec = rpmReSign(addSign, passPhrase, (const char **)poptGetArgs(optCon));
1140 /* XXX don't overflow single byte exit status */
1141 if (ec > 255) ec = 255;
1145 case MODE_RECOMPILE:
1153 if (!poptPeekArg(optCon))
1154 argerror(_("no packages given for uninstall"));
1156 if (noScripts) transFlags |= (_noTransScripts | _noTransTriggers);
1157 if (noPre) transFlags |= RPMTRANS_FLAG_NOPRE;
1158 if (noPost) transFlags |= RPMTRANS_FLAG_NOPOST;
1159 if (noPreun) transFlags |= RPMTRANS_FLAG_NOPREUN;
1160 if (noPostun) transFlags |= RPMTRANS_FLAG_NOPOSTUN;
1162 if (noTriggers) transFlags |= _noTransTriggers;
1163 if (noTPrein) transFlags |= RPMTRANS_FLAG_NOTRIGGERPREIN;
1164 if (noTIn) transFlags |= RPMTRANS_FLAG_NOTRIGGERIN;
1165 if (noTUn) transFlags |= RPMTRANS_FLAG_NOTRIGGERUN;
1166 if (noTPostun) transFlags |= RPMTRANS_FLAG_NOTRIGGERPOSTUN;
1168 if (test) transFlags |= RPMTRANS_FLAG_TEST;
1169 if (justdb) transFlags |= RPMTRANS_FLAG_JUSTDB;
1170 if (dirStash) transFlags |= RPMTRANS_FLAG_DIRSTASH;
1171 if (rePackage) transFlags |= RPMTRANS_FLAG_REPACKAGE;
1172 if (pkgCommit) transFlags |= RPMTRANS_FLAG_PKGCOMMIT;
1173 if (pkgUndo) transFlags |= RPMTRANS_FLAG_PKGUNDO;
1174 if (tsCommit) transFlags |= RPMTRANS_FLAG_COMMIT;
1175 if (tsUndo) transFlags |= RPMTRANS_FLAG_UNDO;
1177 if (noDeps) eraseInterfaceFlags |= UNINSTALL_NODEPS;
1178 if (allMatches) eraseInterfaceFlags |= UNINSTALL_ALLMATCHES;
1180 ec = rpmErase(rootdir, (const char **)poptGetArgs(optCon),
1181 transFlags, eraseInterfaceFlags);
1186 probFilter |= RPMPROB_FILTER_REPLACEPKG |
1187 RPMPROB_FILTER_REPLACEOLDFILES |
1188 RPMPROB_FILTER_REPLACENEWFILES |
1189 RPMPROB_FILTER_OLDPACKAGE;
1191 if (replaceFiles) probFilter |= RPMPROB_FILTER_REPLACEOLDFILES |
1192 RPMPROB_FILTER_REPLACENEWFILES;
1193 if (badReloc) probFilter |= RPMPROB_FILTER_FORCERELOCATE;
1194 if (replacePackages) probFilter |= RPMPROB_FILTER_REPLACEPKG;
1195 if (oldPackage) probFilter |= RPMPROB_FILTER_OLDPACKAGE;
1196 if (ignoreArch) probFilter |= RPMPROB_FILTER_IGNOREARCH;
1197 if (ignoreOs) probFilter |= RPMPROB_FILTER_IGNOREOS;
1198 if (ignoreSize) probFilter |= RPMPROB_FILTER_DISKSPACE;
1201 transFlags = (_noTransScripts | _noTransTriggers |
1202 RPMTRANS_FLAG_APPLYONLY | RPMTRANS_FLAG_PKGCOMMIT);
1204 if (test) transFlags |= RPMTRANS_FLAG_TEST;
1205 /* RPMTRANS_FLAG_BUILD_PROBS */
1207 if (noScripts) transFlags |= (_noTransScripts | _noTransTriggers);
1208 if (noPre) transFlags |= RPMTRANS_FLAG_NOPRE;
1209 if (noPost) transFlags |= RPMTRANS_FLAG_NOPOST;
1210 if (noPreun) transFlags |= RPMTRANS_FLAG_NOPREUN;
1211 if (noPostun) transFlags |= RPMTRANS_FLAG_NOPOSTUN;
1213 if (noTriggers) transFlags |= RPMTRANS_FLAG_NOTRIGGERS;
1214 if (noTPrein) transFlags |= RPMTRANS_FLAG_NOTRIGGERPREIN;
1215 if (noTIn) transFlags |= RPMTRANS_FLAG_NOTRIGGERIN;
1216 if (noTUn) transFlags |= RPMTRANS_FLAG_NOTRIGGERUN;
1217 if (noTPostun) transFlags |= RPMTRANS_FLAG_NOTRIGGERPOSTUN;
1219 if (justdb) transFlags |= RPMTRANS_FLAG_JUSTDB;
1222 transFlags |= RPMTRANS_FLAG_NODOCS;
1223 else if (rpmExpandNumeric("%{_excludedocs}"))
1224 transFlags |= RPMTRANS_FLAG_NODOCS;
1226 if (allFiles) transFlags |= RPMTRANS_FLAG_ALLFILES;
1227 if (dirStash) transFlags |= RPMTRANS_FLAG_DIRSTASH;
1228 if (rePackage) transFlags |= RPMTRANS_FLAG_REPACKAGE;
1229 if (pkgCommit) transFlags |= RPMTRANS_FLAG_PKGCOMMIT;
1230 if (pkgUndo) transFlags |= RPMTRANS_FLAG_PKGUNDO;
1231 if (tsCommit) transFlags |= RPMTRANS_FLAG_COMMIT;
1232 if (tsUndo) transFlags |= RPMTRANS_FLAG_UNDO;
1233 /* RPMTRANS_FLAG_KEEPOBSOLETE */
1235 if (showPercents) installInterfaceFlags |= INSTALL_PERCENT;
1236 if (showHash) installInterfaceFlags |= INSTALL_HASH;
1237 if (noDeps) installInterfaceFlags |= INSTALL_NODEPS;
1238 if (noOrder) installInterfaceFlags |= INSTALL_NOORDER;
1239 if (upgrade) installInterfaceFlags |= INSTALL_UPGRADE;
1240 if (freshen) installInterfaceFlags |= (INSTALL_UPGRADE|INSTALL_FRESHEN);
1242 if (!poptPeekArg(optCon))
1243 argerror(_("no packages given for install"));
1245 /* we've already ensured !(!prefix && !relocations) */
1247 relocations = alloca(2 * sizeof(*relocations));
1248 relocations[0].oldPath = NULL; /* special case magic */
1249 relocations[0].newPath = prefix;
1250 relocations[1].oldPath = relocations[1].newPath = NULL;
1251 } else if (relocations) {
1252 relocations = xrealloc(relocations,
1253 sizeof(*relocations) * (numRelocations + 1));
1254 relocations[numRelocations].oldPath = NULL;
1255 relocations[numRelocations].newPath = NULL;
1258 ec += rpmInstall(rootdir, (const char **)poptGetArgs(optCon),
1259 transFlags, installInterfaceFlags, probFilter,
1264 qva->qva_prefix = rootdir;
1265 if (qva->qva_source == RPMQV_ALL) {
1266 if (poptPeekArg(optCon))
1267 argerror(_("extra arguments given for query of all packages"));
1269 ec = rpmQuery(qva, RPMQV_ALL, NULL);
1271 if (!poptPeekArg(optCon))
1272 argerror(_("no arguments given for query"));
1273 while ((pkg = poptGetArg(optCon)))
1274 ec += rpmQuery(qva, qva->qva_source, pkg);
1279 verifyFlags = VERIFY_ALL;
1280 verifyFlags &= ~qva->qva_flags;
1281 if (noDeps) verifyFlags &= ~VERIFY_DEPS;
1282 if (noScripts) verifyFlags &= ~VERIFY_SCRIPT;
1283 if (noMd5) verifyFlags &= ~VERIFY_MD5;
1285 qva->qva_prefix = rootdir;
1286 qva->qva_flags = verifyFlags;
1287 if (qva->qva_source == RPMQV_ALL) {
1288 if (poptPeekArg(optCon))
1289 argerror(_("extra arguments given for verify of all packages"));
1290 ec = rpmVerify(qva, RPMQV_ALL, NULL);
1292 if (!poptPeekArg(optCon))
1293 argerror(_("no arguments given for verify"));
1294 while ((pkg = poptGetArg(optCon)))
1295 ec += rpmVerify(qva, qva->qva_source, pkg);
1300 optCon = poptFreeContext(optCon);
1301 rpmFreeMacros(NULL);
1302 rpmFreeMacros(&rpmCLIMacroContext);
1307 (void)waitpid(pipeChild, &status, 0);
1310 /* keeps memory leak checkers quiet */
1314 if (qva->qva_queryFormat) free((void *)qva->qva_queryFormat);
1316 #if HAVE_MCHECK_H && HAVE_MTRACE
1317 muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */