9 #if defined(RPM_VENDOR_WINDRIVER)
13 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
17 #define _RPMIOB_INTERNAL
40 extern unsigned int *
keyids;
42 #define POPT_SHOWVERSION -999
43 #define POPT_SHOWRC -998
44 #define POPT_QUERYTAGS -997
45 #define POPT_PREDEFINE -996
46 #define POPT_UNDEFINE -994
180 fprintf(fp,
"rpmlib 0x%08x,0x%08x,0x%08x\n", (
unsigned)
rpmlibVersion(),
196 if ((te = strchr(t,
',')) != NULL)
211 const char * pre =
"";
212 const char * post =
"";
214 const char * val = NULL;
218 if (!strcmp(arg,
"-")) {
221 if ((arg[0] ==
'/' || strchr(arg,
' ') == NULL)
223 && S_ISREG(sb.st_mode)) {
229 val =
rpmExpand(pre, iob->b, post, NULL);
237 enum poptCallbackReason reason,
238 const struct poptOption * opt,
const char * arg,
247 if (opt->arg == NULL)
257 if (*t ==
'-') *t =
'_';
275 if (*t ==
'-') *t =
'_';
291 size_t val_len = fwrite(val, strlen(val), 1, stdout);
292 if (val[val_len - 1] !=
'\n')
293 fprintf(stdout,
"\n");
333 size_t nb = strlen(t) + (
sizeof(
",")-1) + strlen(arg) + 1;
349 N_(
"Add suggested packages to transaction"), NULL },
350 {
"anaconda",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
352 N_(
"Use anaconda \"presentation order\""), NULL},
353 {
"deploops",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
355 N_(
"Print dependency loops as warning"), NULL},
358 N_(
"Do not suggest missing dependency resolution(s)"), NULL},
359 {
"noconflicts",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
361 N_(
"Do not check added package conflicts"), NULL},
364 N_(
"Ignore added package requires on symlink targets"), NULL},
365 {
"noobsoletes",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
367 N_(
"Ignore added package obsoletes"), NULL},
370 N_(
"Ignore added package requires on file parent directory"), NULL},
371 {
"norequires",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
373 N_(
"Do not check added package requires"), NULL},
374 {
"noupgrade",
'\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
376 N_(
"Ignore added package upgrades"), NULL},
384 { NULL,
'\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
388 {
"debug",
'd', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_debug, -1,
389 N_(
"Debug generic operations"), NULL},
391 {
"predefine",
'\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, NULL,
POPT_PREDEFINE,
392 N_(
"Predefine MACRO with value EXPR"),
393 N_(
"'MACRO EXPR'") },
395 {
"define",
'D', POPT_ARG_STRING, NULL,
'D',
396 N_(
"Define MACRO with value EXPR"),
397 N_(
"'MACRO EXPR'") },
399 N_(
"Undefine MACRO"),
401 {
"eval",
'E', POPT_ARG_STRING, NULL,
'E',
402 N_(
"Print macro expansion of EXPR"),
405 N_(
"Read <FILE:...> instead of default file(s)"),
408 {
"rpmlua",
'\0', POPT_ARG_STRING, &
rpmluaFiles, 0,
409 N_(
"Read <FILE:...> instead of default RPM Lua file(s)"),
412 {
"rpmpopt",
'\0', POPT_ARG_STRING, NULL, 0,
413 N_(
"Read <FILE:...> instead of default POPT file(s)"),
417 N_(
"Specify target platform"),
N_(
"CPU-VENDOR-OS") },
420 N_(
"Don't verify package digest(s)"), NULL },
422 N_(
"Don't verify database header(s) when retrieved"), NULL },
424 N_(
"Don't verify package signature(s)"), NULL },
427 N_(
"Display known query tags"), NULL },
429 N_(
"Display macro and configuration values"), NULL },
431 N_(
"Print the version"), NULL },
433 {
"promoteepoch",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmds_nopromote, 0,
436 {
"fpsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_fps_debug, -1,
437 N_(
"Debug file FingerPrintS"), NULL},
438 {
"fsmdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_fsm_debug, -1,
439 N_(
"Debug payload File State Machine"), NULL},
440 {
"fsmthreads",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_fsm_threads, -1,
441 N_(
"Use threads for File State Machine"), NULL},
442 {
"hdrdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_hdr_debug, -1,
444 {
"hdrqfdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_hdrqf_debug, -1,
446 {
"macrosused",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmts_macros, -1,
447 N_(
"Display macros used"), NULL},
448 {
"pkgiodebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_pkgio_debug, -1,
450 {
"prtpkts",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_print_pkts, -1,
451 N_(
"Display OpenPGP (RFC 2440/4880) parsing"), NULL},
452 {
"psmdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_psm_debug, -1,
453 N_(
"Debug Package State Machine"), NULL},
454 {
"psmthreads",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_psm_threads, -1,
455 N_(
"Use threads for Package State Machine"), NULL},
456 {
"rpmdbdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmdb_debug, -1,
457 N_(
"Debug rpmdb DataBase"), NULL},
458 {
"rpmdsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmds_debug, -1,
459 N_(
"Debug rpmds Dependency Set"), NULL},
460 {
"rpmfcdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmfc_debug, -1,
461 N_(
"Debug rpmfc File Classifier"), NULL},
462 {
"rpmfidebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmfi_debug, -1,
463 N_(
"Debug rpmfi File Info"), NULL},
464 {
"rpmgidebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmgi_debug, -1,
465 N_(
"Debug rpmgi Generalized Iterator"), NULL},
466 {
"rpmmidebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmmi_debug, -1,
467 N_(
"Debug rpmmi Match Iterator"), NULL},
468 {
"rpmnsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmns_debug, -1,
469 N_(
"Debug rpmns Name Space"), NULL},
470 {
"rpmpsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmps_debug, -1,
471 N_(
"Debug rpmps Problem Set"), NULL},
472 {
"rpmsxdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmsx_debug, -1,
473 N_(
"Debug rpmsx SELinux Xattrs"), NULL},
474 {
"rpmtedebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmte_debug, -1,
475 N_(
"Debug rpmte Transaction Element"), NULL},
476 {
"rpmtsdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmts_debug, -1,
477 N_(
"Debug rpmts Transaction Set"), NULL},
478 {
"rpmwfdebug",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmwf_debug, -1,
479 N_(
"Debug rpmwf Wrapper Format"), NULL},
480 {
"stats",
'\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &
_rpmts_stats, -1,
481 N_(
"Display operation statistics"), NULL},
508 evr_tuple_order =
_free(evr_tuple_order);
509 evr_tuple_match =
_free(evr_tuple_match);
510 evr_tuple_mire =
mireFree(evr_tuple_mire);
514 _rpmjsI = rpmjsFree(_rpmjsI);
516 _rpmrubyI = rpmrubyFree(_rpmrubyI);
559 optCon = poptFreeContext(optCon);
561 #if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE)
572 static inline int checkfd(
const char * devnull,
int fdno,
int flags)
578 if (fstat(fdno, &sb) == -1 &&
errno == EBADF)
579 ret = (open(devnull, flags) == fdno) ? 1 : 2;
583 #if defined(RPM_VENDOR_WINDRIVER)
584 void setRuntimeRelocPaths(
void)
593 __usrlibrpm =
getenv(
"RPM_USRLIBRPM");
594 __etcrpm =
getenv(
"RPM_ETCRPM");
595 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
596 __localedir =
getenv(
"RPM_LOCALEDIR");
599 if ( __usrlibrpm == NULL ) {
604 if ( __etcrpm == NULL ) {
609 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
610 if ( __localedir == NULL ) {
629 #if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE)
645 {
static const char _devnull[] =
"/dev/null";
646 #if defined(STDIN_FILENO)
647 (void)
checkfd(_devnull, STDIN_FILENO, O_RDONLY);
649 #if defined(STDOUT_FILENO)
650 (void)
checkfd(_devnull, STDOUT_FILENO, O_WRONLY);
652 #if defined(STDERR_FILENO)
653 (void)
checkfd(_devnull, STDERR_FILENO, O_WRONLY);
657 #if defined(RPM_VENDOR_WINDRIVER)
658 (void) setRuntimeRelocPaths();
661 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
669 if (optionsTable == NULL) {
676 for (i = 1; i < argc; i++) {
677 if (strcmp(argv[i],
"--rpmpopt") == 0 && i+1 < argc) {
681 else if (strncmp(argv[i],
"--rpmpopt=", 10) == 0) {
688 optCon = poptGetContext(
__progname, argc, (
const char **)argv, optionsTable, 0);
691 #if defined(RPM_VENDOR_OPENPKG) || \
692 !defined(POPT_ERROR_BADCONFIG)
697 for (path = path_buf; path != NULL && *path !=
'\0'; path = path_next) {
702 path_next = strchr(path,
':');
703 if (path_next != NULL && *path_next ==
':')
706 path_next = path + strlen(path);
711 if ((xx =
rpmGlob(path, &ac, &av)) != 0)
715 for (i = 0; i < ac; i++) {
716 const char *fn = av[i];
720 rpmlog(
RPMLOG_WARNING,
"existing POPT configuration file \"%s\" considered INSECURE -- not loaded\n", fn);
724 (void) poptReadConfigFile(optCon, fn);
725 av[i] =
_free(av[i]);
729 path_buf =
_free(path_buf);
733 if ((xx = poptReadConfigFiles(optCon,
rpmpoptfiles)) != 0)
737 #if defined(RPM_VENDOR_WINDRIVER)
738 {
const char * poptAliasFn =
rpmGetPath(__usrlibrpm,
"/rpmpopt", NULL);
739 (void) poptReadConfigFile(optCon, poptAliasFn);
740 poptAliasFn =
_free(poptAliasFn);
746 (void) poptReadDefaultConfig(optCon, 1);
748 #if defined(RPM_VENDOR_WINDRIVER)
749 {
const char * poptExecPath =
rpmGetPath(__usrlibrpm, NULL);
750 poptSetExecPath(optCon, poptExecPath, 1);
751 poptExecPath =
_free(poptExecPath);
758 while ((rc = poptGetNextOpt(optCon)) > 0) {
759 const char * optArg = poptGetOptArg(optCon);
761 optArg =
_free(optArg);
766 fprintf(stderr,
_(
"%s: option table misconfigured (%d)\n"),
778 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),