9 #if defined(RPM_VENDOR_WINDRIVER)
13 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
17 #define _RPMIOB_INTERNAL
41 #define QVA_ISSET(_qvaflags, _FLAG) ((_qvaflags) & (VERIFY_##_FLAG))
43 #define VSF_ISSET(_vsflags, _FLAG) ((_vsflags) & (RPMVSF_##_FLAG))
44 #define VSF_SET(_vsflags, _FLAG) \
45 (*((unsigned *)&(_vsflags)) |= (RPMVSF_##_FLAG))
46 #define VSF_CLR(_vsflags, _FLAG) \
47 (*((unsigned *)&(_vsflags)) &= ~(RPMVSF_##_FLAG))
49 GENfree(
unsigned int *)
53 #define QVA_ISSET(_qvaflags, _FLAG) ((_qvaflags) & (VERIFY_##_FLAG))
55 #define VSF_ISSET(_vsflags, _FLAG) ((_vsflags) & (RPMVSF_##_FLAG))
56 #define VSF_SET(_vsflags, _FLAG) (_vsflags) |= (RPMVSF_##_FLAG)
57 #define VSF_CLR(_vsflags, _FLAG) (_vsflags) &= ~(RPMVSF_##_FLAG)
62 extern unsigned int *
keyids;
64 #define POPT_SHOWVERSION -999
65 #define POPT_SHOWRC -998
66 #define POPT_QUERYTAGS -997
67 #define POPT_PREDEFINE -996
68 #define POPT_UNDEFINE -994
199 fprintf(fp,
"rpmlib 0x%08x,0x%08x,0x%08x\n", (
unsigned)
rpmlibVersion(),
210 if (rpmcliInitialized < 0) {
212 if (rpmcliTargets != NULL) {
215 if ((te = strchr(t,
',')) != NULL)
221 if (rpmcliInitialized)
231 const char * pre =
"";
232 const char * post =
"";
234 const char * val = NULL;
238 if (!strcmp(arg,
"-")) {
241 if ((arg[0] ==
'/' || strchr(arg,
' ') == NULL)
243 && S_ISREG(sb.st_mode)) {
249 val =
rpmExpand(pre, iob->b, post, NULL);
257 enum poptCallbackReason reason,
258 const struct poptOption * opt,
const char * arg,
267 if (opt->arg == NULL)
277 if (*t ==
'-') *t =
'_';
295 if (*t ==
'-') *t =
'_';
311 size_t val_len = fwrite(val, strlen(val), 1, stdout);
312 if (val_len > 0 && val[val_len - 1] !=
'\n')
313 fprintf(stdout,
"\n");
334 #if defined(SUPPORT_NOSIGNATURES)
345 #if defined(SUPPORT_NOSIGNATURES)
356 #if defined(SUPPORT_NOSIGNATURES)
363 if (rpmcliTargets == NULL)
367 char * t = (
char *) rpmcliTargets;
368 size_t nb = strlen(t) + (
sizeof(
",")-1) + strlen(arg) + 1;
384 N_(
"Add packages to resolve dependencies"), NULL },
385 {
"anaconda",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
387 N_(
"Use anaconda \"presentation order\""), NULL},
388 {
"deploops",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
390 N_(
"Print dependency loops as warning"), NULL},
393 N_(
"Do not suggest missing dependency resolution(s)"), NULL},
394 {
"noconflicts",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
396 N_(
"Do not check added package conflicts"), NULL},
399 N_(
"Ignore added package requires on symlink targets"), NULL},
400 {
"noobsoletes",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
402 N_(
"Ignore added package obsoletes"), NULL},
405 N_(
"Ignore added package requires on file parent directory"), NULL},
406 {
"norequires",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
408 N_(
"Do not check added package requires"), NULL},
409 {
"noupgrade",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
411 N_(
"Ignore added package upgrades"), NULL},
419 { NULL,
'\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
423 {
"debug",
'd', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_debug, -1,
424 N_(
"Debug generic operations"), NULL},
426 {
"predefine",
'\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, NULL,
POPT_PREDEFINE,
427 N_(
"Predefine MACRO with value EXPR"),
428 N_(
"'MACRO EXPR'") },
430 {
"define",
'D', POPT_ARG_STRING, NULL,
'D',
431 N_(
"Define MACRO with value EXPR"),
432 N_(
"'MACRO EXPR'") },
434 N_(
"Undefine MACRO"),
436 {
"eval",
'E', POPT_ARG_STRING, NULL,
'E',
437 N_(
"Print macro expansion of EXPR"),
440 N_(
"Read <FILE:...> instead of default file(s)"),
443 {
"rpmlua",
'\0', POPT_ARG_STRING, &rpmluaFiles, 0,
444 N_(
"Read <FILE:...> instead of default RPM Lua file(s)"),
447 {
"rpmpopt",
'\0', POPT_ARG_STRING, NULL, 0,
448 N_(
"Read <FILE:...> instead of default POPT file(s)"),
452 N_(
"Specify target platform"),
N_(
"CPU-VENDOR-OS") },
455 N_(
"Don't verify package digest(s)"), NULL },
457 N_(
"Don't verify database header(s) when retrieved"), NULL },
459 N_(
"Don't verify package signature(s)"), NULL },
462 N_(
"Display known query tags"), NULL },
464 N_(
"Display macro and configuration values"), NULL },
466 N_(
"Print the version"), NULL },
468 {
"promoteepoch",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmds_nopromote, 0,
471 {
"fpsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_fps_debug, -1,
472 N_(
"Debug file FingerPrintS"), NULL},
473 {
"fsmdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_fsm_debug, -1,
474 N_(
"Debug payload File State Machine"), NULL},
475 {
"fsmthreads",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_fsm_threads, -1,
476 N_(
"Use threads for File State Machine"), NULL},
477 {
"hdrdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_hdr_debug, -1,
479 {
"hdrqfdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_hdrqf_debug, -1,
481 {
"macrosused",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmts_macros, -1,
482 N_(
"Display macros used"), NULL},
483 {
"pkgiodebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_pkgio_debug, -1,
485 {
"prtpkts",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_print_pkts, -1,
486 N_(
"Display OpenPGP (RFC 2440/4880) parsing"), NULL},
487 {
"psmdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_psm_debug, -1,
488 N_(
"Debug Package State Machine"), NULL},
489 {
"psmthreads",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_psm_threads, -1,
490 N_(
"Use threads for Package State Machine"), NULL},
491 {
"rpmdsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmds_debug, -1,
492 N_(
"Debug rpmds Dependency Set"), NULL},
493 {
"rpmfcdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmfc_debug, -1,
494 N_(
"Debug rpmfc File Classifier"), NULL},
495 {
"rpmfidebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmfi_debug, -1,
496 N_(
"Debug rpmfi File Info"), NULL},
497 {
"rpmgidebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmgi_debug, -1,
498 N_(
"Debug rpmgi Generalized Iterator"), NULL},
499 {
"rpmmidebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmmi_debug, -1,
500 N_(
"Debug rpmmi Match Iterator"), NULL},
501 {
"rpmnsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmns_debug, -1,
502 N_(
"Debug rpmns Name Space"), NULL},
503 {
"rpmpsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmps_debug, -1,
504 N_(
"Debug rpmps Problem Set"), NULL},
505 {
"rpmtedebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmte_debug, -1,
506 N_(
"Debug rpmte Transaction Element"), NULL},
507 {
"rpmtsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmts_debug, -1,
508 N_(
"Debug rpmts Transaction Set"), NULL},
509 {
"rpmwfdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmwf_debug, -1,
510 N_(
"Debug rpmwf Wrapper Format"), NULL},
511 {
"stats",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmts_stats, -1,
512 N_(
"Display operation statistics"), NULL},
532 #if defined(HAVE_SQLITE3_H)
545 evr_tuple_order =
_free(evr_tuple_order);
546 evr_tuple_match =
_free(evr_tuple_match);
547 evr_tuple_mire =
mireFree(evr_tuple_mire);
556 _rpmmdbI = rpmmdbFree(_rpmmdbI);
580 #if defined(HAVE_SQLITE3_H)
596 rpmcliTargets =
_free(rpmcliTargets);
598 keyids =
_free(keyids);
604 optCon = poptFreeContext(optCon);
606 #if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE)
617 static inline int checkfd(
const char * devnull,
int fdno,
int flags)
623 if (fstat(fdno, &sb) == -1 &&
errno == EBADF)
624 ret = (open(devnull, flags) == fdno) ? 1 : 2;
628 #if defined(RPM_VENDOR_WINDRIVER)
629 void setRuntimeRelocPaths(
void)
638 __usrlibrpm =
getenv(
"RPM_USRLIBRPM");
639 __etcrpm =
getenv(
"RPM_ETCRPM");
640 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
641 __localedir =
getenv(
"RPM_LOCALEDIR");
644 if ( __usrlibrpm == NULL ) {
649 if ( __etcrpm == NULL ) {
654 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
655 if ( __localedir == NULL ) {
674 #if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE)
690 {
static const char _devnull[] =
"/dev/null";
691 #if defined(STDIN_FILENO)
692 (void)
checkfd(_devnull, STDIN_FILENO, O_RDONLY);
694 #if defined(STDOUT_FILENO)
695 (void)
checkfd(_devnull, STDOUT_FILENO, O_WRONLY);
697 #if defined(STDERR_FILENO)
698 (void)
checkfd(_devnull, STDERR_FILENO, O_WRONLY);
702 #if defined(RPM_VENDOR_WINDRIVER)
703 (void) setRuntimeRelocPaths();
706 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
714 if (optionsTable == NULL) {
721 for (i = 1; i < argc; i++) {
722 if (strcmp(argv[i],
"--rpmpopt") == 0 && i+1 < argc) {
723 rpmpoptfiles = argv[i+1];
726 else if (strncmp(argv[i],
"--rpmpopt=", 10) == 0) {
727 rpmpoptfiles = argv[i]+10;
733 {
static const char lt_[] =
"lt-";
735 if (!strncmp(s, lt_,
sizeof(lt_)-1))
738 optCon = poptGetContext(s, argc, (
const char **)argv, optionsTable, 0);
742 #if defined(RPM_VENDOR_OPENPKG) || \
743 !defined(POPT_ERROR_BADCONFIG)
744 {
char * path_buf =
xstrdup(rpmpoptfiles);
748 for (path = path_buf; path != NULL && *path !=
'\0'; path = path_next) {
753 path_next = strchr(path,
':');
754 if (path_next != NULL && *path_next ==
':')
757 path_next = path + strlen(path);
762 if ((xx =
rpmGlob(path, &ac, &av)) != 0)
766 for (i = 0; i < ac; i++) {
767 const char *fn = av[i];
771 rpmlog(
RPMLOG_WARNING,
"existing POPT configuration file \"%s\" considered INSECURE -- not loaded\n", fn);
775 (void) poptReadConfigFile(optCon, fn);
776 av[i] =
_free(av[i]);
780 path_buf =
_free(path_buf);
784 if ((xx = poptReadConfigFiles(optCon, rpmpoptfiles)) != 0)
785 rpmlog(
RPMLOG_WARNING,
"existing POPT configuration file \"%s\" considered INSECURE -- not loaded\n", rpmpoptfiles);
788 #if defined(RPM_VENDOR_WINDRIVER)
789 {
const char * poptAliasFn =
rpmGetPath(__usrlibrpm,
"/rpmpopt", NULL);
790 (void) poptReadConfigFile(optCon, poptAliasFn);
791 poptAliasFn =
_free(poptAliasFn);
797 (void) poptReadDefaultConfig(optCon, 1);
799 #if defined(RPM_VENDOR_WINDRIVER)
800 {
const char * poptExecPath =
rpmGetPath(__usrlibrpm, NULL);
801 poptSetExecPath(optCon, poptExecPath, 1);
802 poptExecPath =
_free(poptExecPath);
809 while ((rc = poptGetNextOpt(optCon)) > 0) {
810 const char * optArg = poptGetOptArg(optCon);
812 optArg =
_free(optArg);
817 fprintf(stderr,
_(
"%s: option table misconfigured (%d)\n"),
829 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),