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
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 =
"";
241 if ((arg[0] ==
'/' || strchr(arg,
' ') ==
NULL)
243 && S_ISREG(sb.st_mode)) {
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')
318 con = rpmcliFini(con);
324 con = rpmcliFini(con);
329 con = rpmcliFini(con);
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},
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);
580 #if defined(HAVE_SQLITE3_H)
596 rpmcliTargets =
_free(rpmcliTargets);
604 optCon = poptFreeContext(optCon);
606 #if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE)
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)
694 #if defined(STDOUT_FILENO)
697 #if defined(STDERR_FILENO)
702 #if defined(RPM_VENDOR_WINDRIVER)
703 (
void) setRuntimeRelocPaths();
706 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
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)
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);
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);
799 #if defined(RPM_VENDOR_WINDRIVER)
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),
const char * evr_tuple_match
#define RPMCLI_POPT_TARGETPLATFORM
rpmioPool _rpmrubyPool
The pool of Ruby interpreter instances.
rpmlog(RPMLOG_ERR,"%s\n", buf)
struct poptOption rpmcliDepFlagsPoptTable[]
char * getenv(const char *name)
#define VSF_SET(_vsflags, _FLAG)
char * xstrdup(const char *str)
rpmjs rpmjsFree(rpmjs js)
Destroy a js interpreter.
int rpmReadConfigFiles(const char *file, const char *target)
char * rpmGetPath(const char *path,...)
Return (malloc'ed) expanded, canonicalized, file path.
static char *size_t nb
fgets(3) analogue that reads \ continuations.
MacroContext rpmCLIMacroContext
static struct poptOption optionsTable[]
int setenv(const char *name, const char *value, int replace)
int Stat(const char *path, struct stat *st)
stat(2) clone.
Access mounted file system information.
void poptReadDefaultConfig(optCon, 1)
rpmiob rpmiobFree(rpmiob iob)
Destroy a I/O buffer instance.
rpmiob rpmiobAppend(rpmiob iob, const char *s, size_t nl)
Append string to I/O buffer.
#define RPMCLI_POPT_NODIGEST
const char * evr_tuple_order
#define bindtextdomain(Domain, Directory)
int rpmiobSlurp(const char *fn, rpmiob *iobp)
int rpmGlob(const char *patterns, int *argcPtr, const char ***argvPtr)
Return URL path(s) from a (URL prefixed) pattern glob.
rpmuint32_t rpmlibVendor(void)
miRE mireFree(miRE mire)
Free pattern container.
pgpVSFlags pgpDigVSFlags
Disabler bits(s) for signature/digest checking.
assert(key->size==sizeof(hdrNum))
rpmQueryFlags rpmcliQueryFlags
Bit(s) from common command line options.
void rpmnsClean(void)
Clean global name space dependency sets.
#define RPMCLI_POPT_NOHDRCHK
static const char * rpmcliEvalSlurp(const char *arg)
static int checkfd(const char *devnull, int fdno, int flags)
static int rpmcliInitialized
const char * rpmMacrofiles
List of macro files to read when configuring rpm.
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
#define VSF_CLR(_vsflags, _FLAG)
#define POPT_ARGFLAG_TOGGLE
static int xisspace(int c)
#define setlocale(Category, Locale)
int rpmDefineMacro(MacroContext mc, const char *macro, int level)
Define macro in context.
rpmSetVerbosity(RPMLOG_NOTICE)
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
void rpmFreeFilesystems(void)
Release storage used by file system usage cache.
Embedded Ruby interpreter.
rpmuint32_t rpmlibVersion(void)
rpmiob rpmiobNew(size_t len)
Create an I/O buffer.
rpmuint32_t rpmlibTimestamp(void)
rpmruby rpmrubyFree(rpmruby ruby)
Destroys a Ruby interpreter instance.
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
return strcmp(ame->name, bme->name)
#define RPMCLI_POPT_NOSIGNATURE
char * stpcpy(char *dest, const char *src)
void rpmcliConfigured(void)
Make sure that rpm configuration has been read.
void rpmDisplayQueryTags(FILE *fp, headerTagTableEntry _rpmTagTable, headerSprintfExtension _rpmHeaderFormats)
Display list of tags that can be used in –queryformat.
int rpmSecuritySaneFile(const char *filename)
Check whether configuration file is moderately secure to load.
enum rpmQueryFlags_e rpmQueryFlags
Bit(s) to control rpmQuery() operation, stored in qva_flags.
static const char * rpmpoptfiles
#define textdomain(Domain)
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
struct poptOption rpmioAllPoptTable[]
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
static void printVersion(FILE *fp)
Display rpm version.
static void rpmcliAllArgCallback(poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, const void *data)
_rpmrubyI
Current (global) interpreter instance.
poptSetExecPath(optCon, USRLIBRPM, 1)
int _hdr_stats
Global header stats enabler.
rpmioPool rpmioFreePool(rpmioPool pool)
Reclaim memory pool items.
int rpmUndefineMacro(MacroContext mc, const char *macro)
Undefine macro in context.
#define rpmIncreaseVerbosity()
const char * rpmcliTargets