- permit alias/exec description/arg text to be set from popt config.
- use rpmqv.c, not rpm.c, as rpm's main() routine.
CVS patchset: 4923
CVS date: 2001/07/07 19:15:17
- expose rpmShowProgress() and rpmVerifyDigest() in rpmcli.h.
- portability: avoid st_mtime, gendiff uses basename, etc (#47497).
- glibc-2.0.x has not __va_copy().
- - popthelp.c: static copy of stpcpy/stpncpy for the deprived (#47500).
+ - popthelp.c: don't use stpcpy to avoid portability grief (#47500).
+ - permit alias/exec description/arg text to be set from popt config.
+ - use rpmqv.c, not rpm.c, as rpm's main() routine.
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.
@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm
-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]*
-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm
- -@$(__CHMOD) 0755 $(DESTDIR)$(varprefix)/lib/rpm/Desktop
-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.*
.PHONY: unsetgid
#include "debug.h"
struct rpmSignArguments_s rpmKArgs =
- { RESIGN_CHK_SIGNATURE, CHECKSIG_ALL, 0, NULL };
+ { RESIGN_NONE, CHECKSIG_ALL, 0, NULL };
#define POPT_ADDSIGN 1005
#define POPT_RESIGN 1006
* Bit(s) to control rpmReSign() operation.
*/
typedef enum rpmResignFlags_e {
- RESIGN_CHK_SIGNATURE = 0, /*!< from --checksig */
+ RESIGN_NONE = 0,
+ RESIGN_CHK_SIGNATURE = 1, /*!< from --checksig */
RESIGN_NEW_SIGNATURE, /*!< from --resign */
RESIGN_ADD_SIGNATURE /*!< from --addsign */
} rpmResignFlags;
fi
AC_CHECK_FUNCS(strerror mtrace)
-dnl AC_CHECK_FUNCS(gettext)
-dnl AC_CHECK_FUNCS(dgettext)
AC_CHECK_FUNC(setreuid, [], [
AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
])
con->finalArgv, con->finalArgvAlloced, con->finalArgvCount @*/
/*@modifies con @*/
{
+ poptItem item;
int i;
if (con->execs == NULL || con->numExecs <= 0) /* XXX can't happen */
return 0;
- i = con->numExecs - 1;
- if (longName) {
- while (i >= 0 && (!con->execs[i].longName ||
- strcmp(con->execs[i].longName, longName))) i--;
- } else {
- while (i >= 0 &&
- con->execs[i].shortName != shortName) i--;
- }
+ for (i = con->numExecs - 1; i >= 0; i--) {
+ item = con->execs + i;
+ if (longName && !(item->option.longName &&
+ !strcmp(longName, item->option.longName)))
+ continue;
+ else if (shortName != item->option.shortName)
+ continue;
+ break;
+ }
if (i < 0) return 0;
+
if (con->flags & POPT_CONTEXT_NO_EXEC)
return 1;
static int handleAlias(/*@special@*/ poptContext con,
/*@null@*/ const char * longName, char shortName,
/*@keep@*/ /*@null@*/ const char * nextCharArg)
- /*@uses con->aliases, con->numAliases, con->optionStack,
- con->os, con->os->currAlias, con->os->currAlias->longName @*/
+ /*@uses con->aliases, con->numAliases, con->optionStack, con->os,
+ con->os->currAlias, con->os->currAlias->option.longName @*/
/*@modifies con @*/
{
+ poptItem item = con->os->currAlias;
int rc;
int i;
- if (con->os->currAlias && con->os->currAlias->longName && longName &&
- /*@-nullpass@*/ /* LCL: con->os->currAlias->longName != NULL */
- !strcmp(con->os->currAlias->longName, longName))
- /*@=nullpass@*/
- return 0;
- if (con->os->currAlias && shortName &&
- shortName == con->os->currAlias->shortName)
- return 0;
+ if (item) {
+ if (longName && (item->option.longName &&
+ !strcmp(longName, item->option.longName)))
+ return 0;
+ if (shortName && shortName == item->option.shortName)
+ return 0;
+ }
if (con->aliases == NULL || con->numAliases <= 0) /* XXX can't happen */
return 0;
- i = con->numAliases - 1;
- if (longName) {
- while (i >= 0 && (!con->aliases[i].longName ||
- strcmp(con->aliases[i].longName, longName))) i--;
- } else {
- while (i >= 0 &&
- con->aliases[i].shortName != shortName) i--;
- }
+ for (i = con->numAliases - 1; i >= 0; i--) {
+ item = con->aliases + i;
+ if (longName && !(item->option.longName &&
+ !strcmp(longName, item->option.longName)))
+ continue;
+ else if (shortName != item->option.shortName)
+ continue;
+ break;
+ }
if (i < 0) return 0;
if ((con->os - con->optionStack + 1) == POPT_OPTION_DEPTH)
static int execCommand(poptContext con)
/*@modifies fileSystem @*/
{
+ poptItem item = con->doExec;
const char ** argv;
int argc = 0;
- const char ** sargv;
- int sargc = 0;
int rc;
- if (con->doExec == NULL || con->doExec->script == NULL) /*XXX can't happen*/
+ if (item == NULL) /*XXX can't happen*/
return POPT_ERROR_NOARG;
- rc = poptParseArgvString(con->doExec->script, &sargc, &sargv);
- if (rc) return rc;
- if (sargv == NULL || sargc < 1 ||
- (!con->execAbsolute && strchr(sargv[0], '/')))
+ if (item->argv == NULL || item->argc < 1 ||
+ (!con->execAbsolute && strchr(item->argv[0], '/')))
return POPT_ERROR_NOARG;
argv = malloc(sizeof(*argv) *
- (6 + sargc + con->numLeftovers + con->finalArgvCount));
+ (6 + item->argc + con->numLeftovers + con->finalArgvCount));
if (argv == NULL) return POPT_ERROR_MALLOC; /* XXX can't happen */
- if (!strchr(sargv[0], '/') && con->execPath) {
- char *s = alloca(strlen(con->execPath) + strlen(sargv[0]) + sizeof("/"));
- sprintf(s, "%s/%s", con->execPath, sargv[0]);
+ if (!strchr(item->argv[0], '/') && con->execPath) {
+ char *s = alloca(strlen(con->execPath) + strlen(item->argv[0]) + sizeof("/"));
+ sprintf(s, "%s/%s", con->execPath, item->argv[0]);
argv[argc] = s;
} else {
- argv[argc] = findProgramPath(sargv[0]);
+ argv[argc] = findProgramPath(item->argv[0]);
}
if (argv[argc++] == NULL) return POPT_ERROR_NOARG;
- if (sargc > 1) {
- memcpy(argv + argc, sargv + 1, sizeof(*argv) * (sargc - 1));
- argc += (sargc - 1);
+ if (item->argc > 1) {
+ memcpy(argv + argc, item->argv + 1, sizeof(*argv) * (item->argc - 1));
+ argc += (item->argc - 1);
}
if (con->finalArgv != NULL && con->finalArgvCount > 0) {
argv[argc] = NULL;
#ifdef __hpux
- (void) setresuid(getuid(), getuid(),-1);
+ rc = setresuid(getuid(), getuid(),-1);
+ if (rc) return POPT_ERROR_ERRNO;
#else
/*
* XXX " ... on BSD systems setuid() should be preferred over setreuid()"
* XXX from Norbert Warmuth <nwarmuth@privat.circular.de>
*/
#if defined(HAVE_SETUID)
- (void) setuid(getuid());
+ rc = setuid(getuid());
+ if (rc) return POPT_ERROR_ERRNO;
#elif defined (HAVE_SETREUID)
- (void) setreuid(getuid(), getuid()); /*hlauer: not portable to hpux9.01 */
+ rc = setreuid(getuid(), getuid()); /*hlauer: not portable to hpux9.01 */
+ if (rc) return POPT_ERROR_ERRNO;
#else
; /* Can't drop privileges */
#endif
}
#endif
- (void) execvp(argv[0], (char *const *)argv);
+ rc = execvp(argv[0], (char *const *)argv);
return POPT_ERROR_ERRNO;
}
poptContext poptFreeContext(poptContext con)
{
+ poptItem item;
int i;
if (con == NULL) return con;
if (con->aliases != NULL)
for (i = 0; i < con->numAliases; i++) {
- con->aliases[i].longName = _free(con->aliases[i].longName);
- con->aliases[i].argv = _free(con->aliases[i].argv);
+ item = con->aliases + i;
+ /*@-modobserver -observertrans -dependenttrans@*/
+ item->option.longName = _free(item->option.longName);
+ item->option.descrip = _free(item->option.descrip);
+ item->option.argDescrip = _free(item->option.argDescrip);
+ /*@=modobserver =observertrans =dependenttrans@*/
+ item->argv = _free(item->argv);
}
+ con->aliases = _free(con->aliases);
if (con->execs != NULL)
for (i = 0; i < con->numExecs; i++) {
- con->execs[i].longName = _free(con->execs[i].longName);
- con->execs[i].script = _free(con->execs[i].script);
+ item = con->execs + i;
+ /*@-modobserver -observertrans -dependenttrans@*/
+ item->option.longName = _free(item->option.longName);
+ item->option.descrip = _free(item->option.descrip);
+ item->option.argDescrip = _free(item->option.argDescrip);
+ /*@=modobserver =observertrans =dependenttrans@*/
+ item->argv = _free(item->argv);
}
con->execs = _free(con->execs);
con->leftovers = _free(con->leftovers);
con->finalArgv = _free(con->finalArgv);
con->appName = _free(con->appName);
- con->aliases = _free(con->aliases);
con->otherHelp = _free(con->otherHelp);
con->execPath = _free(con->execPath);
con->arg_strip = PBM_FREE(con->arg_strip);
int poptAddAlias(poptContext con, struct poptAlias newAlias,
/*@unused@*/ int flags)
{
- int aliasNum = con->numAliases++;
+ poptItem item = alloca(sizeof(*item));
+ memset(item, 0, sizeof(*item));
+ item->option.longName = newAlias.longName;
+ item->option.shortName = newAlias.shortName;
+ item->option.argInfo = POPT_ARGFLAG_DOC_HIDDEN;
+ item->option.arg = 0;
+ item->option.val = 0;
+ item->option.descrip = NULL;
+ item->option.argDescrip = NULL;
+ item->argc = newAlias.argc;
+ item->argv = newAlias.argv;
+ return poptAddItem(con, item, 0);
+}
- /* SunOS won't realloc(NULL, ...) */
- if (con->aliases == NULL)
- con->aliases = malloc(con->numAliases * sizeof(newAlias));
- else
- con->aliases = realloc(con->aliases,
- con->numAliases * sizeof(newAlias));
-
- if (con->aliases) {
- struct poptAlias * alias = con->aliases + aliasNum;
-
- alias->longName = (newAlias.longName)
- /*@-nullpass@*/ /* FIX: malloc can return NULL. */
- ? strcpy(malloc(strlen(newAlias.longName) + 1), newAlias.longName)
- /*@=nullpass@*/
- : NULL;
- alias->shortName = newAlias.shortName;
- alias->argc = newAlias.argc;
- alias->argv = newAlias.argv;
+int poptAddItem(poptContext con, poptItem newItem, int flags)
+{
+ poptItem * items, item;
+ int * nitems;
+
+ switch (flags) {
+ case 1:
+ items = &con->execs;
+ nitems = &con->numExecs;
+ break;
+ case 0:
+ items = &con->aliases;
+ nitems = &con->numAliases;
+ break;
+ default:
+ return 1;
+ /*@notreached@*/ break;
}
+ *items = realloc((*items), ((*nitems) + 1) * sizeof(**items));
+ if ((*items) == NULL)
+ return 1;
+
+ item = (*items) + (*nitems);
+
+ item->option.longName =
+ (newItem->option.longName ? xstrdup(newItem->option.longName) : NULL);
+ item->option.shortName = newItem->option.shortName;
+ item->option.argInfo = newItem->option.argInfo;
+ item->option.arg = newItem->option.arg;
+ item->option.val = newItem->option.val;
+ item->option.descrip =
+ (newItem->option.descrip ? xstrdup(newItem->option.descrip) : NULL);
+ item->option.argDescrip =
+ (newItem->option.argDescrip ? xstrdup(newItem->option.argDescrip) : NULL);
+ item->argc = newItem->argc;
+ item->argv = newItem->argv;
+
+ (*nitems)++;
+
return 0;
}
};
/** \ingroup popt
+ * A popt alias argument for poptAddAlias().
*/
struct poptAlias {
/*@owned@*/ /*@null@*/ const char * longName; /*!< may be NULL */
};
/** \ingroup popt
+ * A popt alias or exec argument for poptAddItem().
+ */
+typedef struct poptItem_s {
+ struct poptOption option; /*!< alias/exec name(s) and description. */
+ int argc; /*!< (alias) no. of args. */
+/*@owned@*/ const char ** argv; /*!< (alias) args, must be free()able. */
+} * poptItem;
+
+/** \ingroup popt
* \name Auto-generated help/usage
*/
/*@{*/
+
+/**
+ * Empty table marker to enable displaying popt alias/exec options.
+ */
+extern struct poptOption poptAliasOptions[];
+#define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptions, \
+ 0, "Options implemented via popt alias/exec:", NULL },
+
+/**
+ * Auto help table options.
+ */
extern struct poptOption poptHelpOptions[];
#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
0, "Help options:", NULL },
+
#define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
/*@}*/
/** \ingroup popt
* Add alias to context.
* @todo Pass alias by reference, not value.
+ * @deprecated Use poptAddItem instead.
* @param con context
* @param alias alias to add
* @param flags (unused)
- * @return 0 always
+ * @return 0 on success
*/
+/*@unused@*/
int poptAddAlias(poptContext con, struct poptAlias alias, int flags)
/*@modifies con @*/;
/** \ingroup popt
+ * Add alias/exec item to context.
+ * @param con context
+ * @param item alias/exec item to add
+ * @param flags 0 for alias, 1 for exec
+ * @return 0 on success
+ */
+int poptAddItem(poptContext con, poptItem newItem, int flags)
+ /*@modifies con @*/;
+
+/** \ingroup popt
* Read configuration file.
* @param con context
* @param fn file name to read
#include "system.h"
#include "poptint.h"
-/*@-mustmod@*/ /* LCL: *line is modified @*/
+/*@-compmempass@*/ /* FIX: item->option.longName kept, not dependent. */
static void configLine(poptContext con, char * line)
- /*@modifies *line, con->execs, con->numExecs @*/
+ /*@modifies con @*/
{
int nameLength = strlen(con->appName);
- const char * opt;
- struct poptAlias alias;
const char * entryType;
- const char * longName = NULL;
- char shortName = '\0';
+ const char * opt;
+ poptItem item = alloca(sizeof(*item));
+ int i, j;
+ memset(item, 0, sizeof(*item));
+
if (strncmp(line, con->appName, nameLength)) return;
line += nameLength;
if (*line == '\0' || !isspace(*line)) return;
+
while (*line != '\0' && isspace(*line)) line++;
entryType = line;
-
while (*line == '\0' || !isspace(*line)) line++;
*line++ = '\0';
+
while (*line != '\0' && isspace(*line)) line++;
if (*line == '\0') return;
opt = line;
+ if (opt[0] == '-' && opt[1] == '-')
+ item->option.longName = opt + 2;
+ else if (opt[0] == '-' && !opt[2])
+ item->option.shortName = opt[1];
while (*line == '\0' || !isspace(*line)) line++;
*line++ = '\0';
while (*line != '\0' && isspace(*line)) line++;
if (*line == '\0') return;
-
- if (opt[0] == '-' && opt[1] == '-')
- longName = opt + 2;
- else if (opt[0] == '-' && !opt[2])
- shortName = opt[1];
-
- if (!strcmp(entryType, "alias")) {
- if (poptParseArgvString(line, &alias.argc, &alias.argv)) return;
- alias.longName = longName, alias.shortName = shortName;
- (void) poptAddAlias(con, alias, 0);
- } else if (!strcmp(entryType, "exec")) {
- con->execs = realloc(con->execs,
- sizeof(*con->execs) * (con->numExecs + 1));
- if (con->execs == NULL) return; /* XXX can't happen */
- if (longName)
- con->execs[con->numExecs].longName = xstrdup(longName);
- else
- con->execs[con->numExecs].longName = NULL;
-
- con->execs[con->numExecs].shortName = shortName;
- con->execs[con->numExecs].script = xstrdup(line);
-
- /*@-noeffect@*/ /* LCL: broken? */
- con->numExecs++;
- /*@=noeffect@*/
+ if (poptParseArgvString(line, &item->argc, &item->argv)) return;
+
+ /*@-modobserver@*/
+ item->option.argInfo = POPT_ARGFLAG_DOC_HIDDEN;
+ for (i = 0, j = 0; i < item->argc; i++, j++) {
+ const char * f;
+ if (!strncmp(item->argv[i], "--POPTdesc=", sizeof("--POPTdesc=")-1)) {
+ f = item->argv[i] + sizeof("--POPTdesc=");
+ if (f[0] == '$' && f[1] == '"') f++;
+ item->option.descrip = f;
+ item->option.argInfo &= ~POPT_ARGFLAG_DOC_HIDDEN;
+ j--;
+ } else
+ if (!strncmp(item->argv[i], "--POPTargs=", sizeof("--POPTargs=")-1)) {
+ f = item->argv[i] + sizeof("--POPTargs=");
+ if (f[0] == '$' && f[1] == '"') f++;
+ item->option.argDescrip = f;
+ item->option.argInfo &= ~POPT_ARGFLAG_DOC_HIDDEN;
+ item->option.argInfo |= POPT_ARG_STRING;
+ j--;
+ } else
+ if (j != i)
+ item->argv[j] = item->argv[i];
}
+ if (j != i)
+ item->argv[j] = NULL;
+ /*@=modobserver@*/
+
+ if (!strcmp(entryType, "alias"))
+ (void) poptAddItem(con, item, 0);
+ else if (!strcmp(entryType, "exec"))
+ (void) poptAddItem(con, item, 1);
}
-/*@=mustmod@*/
+/*@=compmempass@*/
int poptReadConfigFile(poptContext con, const char * fn)
{
#include "system.h"
#include "poptint.h"
+/**
+ * @param con context
+ * @param key option(s)
+ */
static void displayArgs(poptContext con,
/*@unused@*/ enum poptCallbackReason foo,
struct poptOption * key,
#ifdef NOTYET
static int show_option_defaults = 0;
#endif
+
+/**
+ * Empty table marker to enable displaying popt alias/exec options.
+ */
+struct poptOption poptAliasOptions[] = {
+ POPT_TABLEEND
+};
+
+/**
+ * Auto help table options.
+ */
/*@-castfcnptr@*/
struct poptOption poptHelpOptions[] = {
{ NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL, NULL },
} ;
/*@=castfcnptr@*/
+/**
+ * @param table option(s)
+ */
/*@observer@*/ /*@null@*/ static const char *const
getTableTranslationDomain(/*@null@*/ const struct poptOption *table)
/*@*/
return NULL;
}
+/**
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
/*@observer@*/ /*@null@*/ static const char *const
getArgDescrip(const struct poptOption * opt,
/*@-paramuse@*/ /* FIX: wazzup? */
}
}
-static /*@only@*/ /*@null@*/ char * singleOptionDefaultValue(int lineLength,
+/**
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
+static /*@only@*/ /*@null@*/ char *
+singleOptionDefaultValue(int lineLength,
const struct poptOption * opt,
/*@-paramuse@*/ /* FIX: i18n macros disable with lclint */
/*@null@*/ const char * translation_domain)
if (l == NULL) return NULL; /* XXX can't happen */
*le = '\0';
*le++ = '(';
- le = stpcpy(le, defstr);
+ strcpy(le, defstr); le += strlen(le);
*le++ = ':';
*le++ = ' ';
if (opt->arg) /* XXX programmer error */
} break;
case POPT_ARG_STRING:
{ const char * s = *(const char **)opt->arg;
- if (s == NULL)
- le = stpcpy(le, "null");
- else {
+ if (s == NULL) {
+ strcpy(le, "null"); le += strlen(le);
+ } else {
size_t slen = 4*lineLength - (le - l) - sizeof("\"...\")");
*le++ = '"';
- le = stpncpy(le, s, slen);
- if (slen < strlen(s))
- le = stpcpy(le, "...");
+ strncpy(le, s, slen); le[slen] = '\0'; le += strlen(le);
+ if (slen < strlen(s)) {
+ strcpy(le, "..."); le += strlen(le);
+ }
*le++ = '"';
}
} break;
return l;
}
+/**
+ * @param fp output file handle
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
static void singleOptionHelp(FILE * fp, int maxLeftCol,
const struct poptOption * opt,
/*@null@*/ const char * translation_domain)
if (t) {
char * te = t;
*te = '\0';
- if (help) te = stpcpy(te, help);
- (void) stpcpy( stpcpy( te, " "), defs);
+ if (help) {
+ strcpy(te, help); te += strlen(te);
+ }
+ *te++ = ' ';
+ strcpy(te, defs);
defs = _free(defs);
}
defs = t;
case POPT_ARG_DOUBLE:
case POPT_ARG_STRING:
*le++ = '=';
- le = stpcpy(le, argDescrip);
+ strcpy(le, argDescrip); le += strlen(le);
break;
default:
break;
}
} else {
*le++ = '=';
- le = stpcpy(le, argDescrip);
+ strcpy(le, argDescrip); le += strlen(le);
}
if (opt->argInfo & POPT_ARGFLAG_OPTIONAL)
*le++ = ']';
left = _free(left);
}
+/**
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
static int maxArgWidth(const struct poptOption * opt,
/*@null@*/ const char * translation_domain)
/*@*/
return max;
}
-static void singleTableHelp(FILE * fp,
+/**
+ * Display popt alias and exec help.
+ * @param fp output file handle
+ * @param items alias/exec array
+ * @param nitems no. of alias/exec entries
+ * @param translation_domain translation domain
+ */
+static void itemHelp(FILE * fp,
+ /*@null@*/ poptItem items, int nitems, int left,
+ /*@null@*/ const char * translation_domain)
+ /*@modifies *fp, fileSystem @*/
+{
+ poptItem item;
+ int i;
+
+ if (items != NULL)
+ for (i = 0, item = items; i < nitems; i++, item++) {
+ const struct poptOption * opt;
+ opt = &item->option;
+ if ((opt->longName || opt->shortName) &&
+ !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN))
+ singleOptionHelp(fp, left, opt, translation_domain);
+ }
+}
+
+/**
+ * @param fp output file handle
+ * @param table option(s)
+ * @param translation_domain translation domain
+ */
+static void singleTableHelp(poptContext con, FILE * fp,
/*@null@*/ const struct poptOption * table, int left,
/*@null@*/ const char * translation_domain)
/*@modifies *fp, fileSystem @*/
const struct poptOption * opt;
const char *sub_transdom;
+ if (table == poptAliasOptions) {
+ itemHelp(fp, con->aliases, con->numAliases, left, NULL);
+ itemHelp(fp, con->execs, con->numExecs, left, NULL);
+ return;
+ }
+
if (table != NULL)
for (opt = table; (opt->longName || opt->shortName || opt->arg); opt++) {
if ((opt->longName || opt->shortName) &&
if (table != NULL)
for (opt = table; (opt->longName || opt->shortName || opt->arg); opt++) {
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
- sub_transdom = getTableTranslationDomain(opt->arg);
- if (sub_transdom == NULL)
- sub_transdom = translation_domain;
+ if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_INCLUDE_TABLE)
+ continue;
+ sub_transdom = getTableTranslationDomain(opt->arg);
+ if (sub_transdom == NULL)
+ sub_transdom = translation_domain;
- if (opt->descrip)
- fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
+ if (opt->descrip)
+ fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
- singleTableHelp(fp, opt->arg, left, sub_transdom);
- }
+ singleTableHelp(con, fp, opt->arg, left, sub_transdom);
}
}
+/**
+ * @param con context
+ * @param fp output file handle
+ */
static int showHelpIntro(poptContext con, FILE * fp)
/*@modifies *fp, fileSystem @*/
{
fprintf(fp, " %s\n", POPT_("[OPTION...]"));
leftColWidth = maxArgWidth(con->options, NULL);
- singleTableHelp(fp, con->options, leftColWidth, NULL);
+ singleTableHelp(con, fp, con->options, leftColWidth, NULL);
}
+/**
+ * @param fp output file handle
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
static int singleOptionUsage(FILE * fp, int cursor,
const struct poptOption * opt,
/*@null@*/ const char *translation_domain)
return cursor + len + 1;
}
-static int singleTableUsage(FILE * fp,
+/**
+ * Display popt alias and exec usage.
+ * @param fp output file handle
+ * @param item alias/exec array
+ * @param nitems no. of ara/exec entries
+ * @param translation_domain translation domain
+ */
+static int itemUsage(FILE * fp, int cursor, poptItem item, int nitems,
+ /*@null@*/ const char * translation_domain)
+ /*@modifies *fp, fileSystem @*/
+{
+ int i;
+
+ /*@-branchstate@*/ /* FIX: W2DO? */
+ if (item != NULL)
+ for (i = 0; i < nitems; i++, item++) {
+ const struct poptOption * opt;
+ opt = &item->option;
+ if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INTL_DOMAIN) {
+ translation_domain = (const char *)opt->arg;
+ } else if ((opt->longName || opt->shortName) &&
+ !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) {
+ cursor = singleOptionUsage(fp, cursor, opt, translation_domain);
+ }
+ }
+ /*@=branchstate@*/
+
+ return cursor;
+}
+
+/**
+ * @param fp output file handle
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
+static int singleTableUsage(poptContext con, FILE * fp,
int cursor, const struct poptOption * opt,
/*@null@*/ const char * translation_domain)
/*@modifies *fp, fileSystem @*/
translation_domain = (const char *)opt->arg;
} else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
if (opt->arg) /* XXX program error */
- cursor = singleTableUsage(fp, cursor, opt->arg, translation_domain);
+ cursor = singleTableUsage(con, fp, cursor, opt->arg,
+ translation_domain);
} else if ((opt->longName || opt->shortName) &&
!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) {
cursor = singleOptionUsage(fp, cursor, opt, translation_domain);
return cursor;
}
+/**
+ * Return concatenated short options for display.
+ * @param opt option(s)
+ * @param fp output file handle
+ * @retval str concatenation of short options
+ * @return length of display string
+ */
static int showShortOptions(const struct poptOption * opt, FILE * fp,
/*@null@*/ char * str)
/*@modifies *str, *fp, fileSystem @*/
cursor = showHelpIntro(con, fp);
cursor += showShortOptions(con->options, fp, NULL);
- (void) singleTableUsage(fp, cursor, con->options, NULL);
+ (void) singleTableUsage(con, fp, cursor, con->options, NULL);
+ (void) itemUsage(fp, cursor, con->aliases, con->numAliases, NULL);
+ (void) itemUsage(fp, cursor, con->execs, con->numExecs, NULL);
if (con->otherHelp) {
cursor += strlen(con->otherHelp) + 1;
int next;
/*@only@*/ /*@null@*/ const char * nextArg;
/*@keep@*/ /*@null@*/ const char * nextCharArg;
-/*@dependent@*/ /*@null@*/ struct poptAlias * currAlias;
+/*@dependent@*/ /*@null@*/ poptItem currAlias;
int stuffed;
};
-struct execEntry {
-/*@owned@*/ /*@null@*/ const char * longName;
- char shortName;
-/*@only@*/ /*@null@*/ const char * script;
-};
-
struct poptContext_s {
struct optionStackEntry optionStack[POPT_OPTION_DEPTH];
/*@dependent@*/ struct optionStackEntry * os;
/*@keep@*/ const struct poptOption * options;
int restLeftover;
/*@only@*/ /*@null@*/ const char * appName;
-/*@only@*/ /*@null@*/ struct poptAlias * aliases;
+/*@only@*/ /*@null@*/ poptItem aliases;
int numAliases;
int flags;
-/*@owned@*/ /*@null@*/ struct execEntry * execs;
+/*@owned@*/ /*@null@*/ poptItem execs;
int numExecs;
/*@only@*/ /*@null@*/ const char ** finalArgv;
int finalArgvCount;
int finalArgvAlloced;
-/*@dependent@*/ /*@null@*/ struct execEntry * doExec;
+/*@dependent@*/ /*@null@*/ poptItem doExec;
/*@only@*/ const char * execPath;
int execAbsolute;
/*@only@*/ const char * otherHelp;
*/
/*@{*/
-/** \ingroup python
+/**
*/
static PyObject * rpmtransCreate(PyObject * self, PyObject * args) {
rpmtransObject * o;
return (void *) o;
}
-/** \ingroup python
+/**
*/
static PyObject * doAddMacro(PyObject * self, PyObject * args) {
char * name, * val;
return Py_None;
}
-/** \ingroup python
+/**
*/
static PyObject * doDelMacro(PyObject * self, PyObject * args) {
char * name;
return Py_None;
}
-/** \ingroup python
+/**
*/
static PyObject * archScore(PyObject * self, PyObject * args) {
char * arch;
return Py_BuildValue("i", score);
}
-/** \ingroup python
+/**
*/
static int psGetArchScore(Header h) {
void * pkgArch;
return rpmMachineScore(RPM_MACHTABLE_INSTARCH, pkgArch);
}
-/** \ingroup python
+/**
*/
static int pkgCompareVer(void * first, void * second) {
struct packageInfo ** a = first;
return rpmVersionCompare((*b)->h, (*a)->h);
}
-/** \ingroup python
+/**
*/
static void pkgSort(struct pkgSet * psp) {
int i;
psp->numPackages = i;
}
-/** \ingroup python
+/**
*/
static PyObject * findUpgradeSet(PyObject * self, PyObject * args) {
PyObject * hdrList, * result;
return result;
}
-/** \ingroup python
+/**
*/
static PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) {
hdrObject * h;
return Py_BuildValue("(Ni)", h, isSource);
}
-/** \ingroup python
+/**
*/
static PyObject * hdrLoad(PyObject * self, PyObject * args) {
char * obj, * copy=NULL;
return (PyObject *) h;
}
-/** \ingroup python
+/**
*/
static PyObject * rpmInitDB(PyObject * self, PyObject * args) {
char *root;
return(Py_None);
}
-/** \ingroup python
+/**
*/
static rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) {
rpmdbObject * o;
return o;
}
-/** \ingroup python
+/**
*/
static PyObject * rebuildDB (PyObject * self, PyObject * args) {
char * root = "";
return Py_BuildValue("i", rpmdbRebuild(root));
}
-/** \ingroup python
+/**
*/
static PyObject * rpmReadHeaders (FD_t fd) {
PyObject * list;
return list;
}
-/** \ingroup python
+/**
*/
static PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args) {
FD_t fd;
return list;
}
-/** \ingroup python
+/**
*/
static PyObject * rpmHeaderFromFile(PyObject * self, PyObject * args) {
char * filespec;
return list;
}
-/** \ingroup python
+/**
* This assumes the order of list matches the order of the new headers, and
* throws an exception if that isn't true.
*/
return Py_None;
}
-/** \ingroup python
+/**
*/
static PyObject * errorCB = NULL, * errorData = NULL;
-/** \ingroup python
+/**
*/
static void errorcb (void)
{
Py_DECREF (result);
}
-/** \ingroup python
+/**
*/
static PyObject * errorSetCallback (PyObject * self, PyObject * args) {
if (errorCB != NULL) {
return PyCObject_FromVoidPtr(rpmErrorSetCallback (errorcb), NULL);
}
-/** \ingroup python
+/**
*/
static PyObject * errorString (PyObject * self, PyObject * args) {
return PyString_FromString(rpmErrorString ());
}
-/** \ingroup python
+/**
*/
static PyObject * versionCompare (PyObject * self, PyObject * args) {
hdrObject * h1, * h2;
return Py_BuildValue("i", rpmvercmp(r1, r2));
}
-/** \ingroup python
+/**
*/
static PyObject * checkSig (PyObject * self, PyObject * args) {
char * filename;
}
/* hack to get the current header that's in the transaction set */
-/** \ingroup python
+/**
*/
static PyObject * getTsHeader (PyObject * self, PyObject * args) {
hdrObject * h;
return (PyObject *) Py_None;
}
-/** \ingroup python
+/**
*/
typedef struct FDlist_t FDlist;
-/** \ingroup python
+/**
*/
struct FDlist_t {
FILE *f;
FDlist *next;
} ;
-/** \ingroup python
+/**
*/
static FDlist *fdhead = NULL;
-/** \ingroup python
+/**
*/
static FDlist *fdtail = NULL;
-/** \ingroup python
+/**
*/
static int closeCallback(FILE * f) {
FDlist *node, *last;
return 0;
}
-/** \ingroup python
+/**
*/
static PyObject * doFopen(PyObject * self, PyObject * args) {
char * path, * mode;
return PyFile_FromFile (node->f, path, mode, closeCallback);
}
-/** \ingroup python
+/**
*/
static PyMethodDef rpmModuleMethods[] = {
{ "TransactionSet", (PyCFunction) rpmtransCreate, METH_VARARGS, NULL },
{ NULL }
} ;
-/** \ingroup python
+/**
*/
void initrpm(void) {
PyObject * m, * d, *o, * tag = NULL, * dict;
*/
/*@{*/
-/** \ingroup rpmio
+/**
*/
typedef ssize_t fdio_read_function_t (void *cookie, char *buf, size_t nbytes);
-/** \ingroup rpmio
+/**
*/
typedef ssize_t fdio_write_function_t (void *cookie, const char *buf, size_t nbytes);
-/** \ingroup rpmio
+/**
*/
typedef int fdio_seek_function_t (void *cookie, _libio_pos_t pos, int whence);
-/** \ingroup rpmio
+/**
*/
typedef int fdio_close_function_t (void *cookie);
-/** \ingroup rpmio
+/**
*/
typedef /*@only@*/ /*@null@*/ FD_t fdio_ref_function_t ( /*@only@*/ void * cookie,
const char * msg, const char * file, unsigned line);
-/** \ingroup rpmio
+/**
*/
typedef /*@only@*/ /*@null@*/ FD_t fdio_deref_function_t ( /*@only@*/ FD_t fd,
const char * msg, const char * file, unsigned line);
-/** \ingroup rpmio
+/**
*/
typedef /*@only@*/ /*@null@*/ FD_t fdio_new_function_t (const char * msg,
const char * file, unsigned line);
-/** \ingroup rpmio
+/**
*/
typedef int fdio_fileno_function_t (void * cookie);
-/** \ingroup rpmio
+/**
*/
typedef FD_t fdio_open_function_t (const char * path, int flags, mode_t mode);
-/** \ingroup rpmio
+/**
*/
typedef FD_t fdio_fopen_function_t (const char * path, const char * fmode);
-/** \ingroup rpmio
+/**
*/
typedef void * fdio_ffileno_function_t (FD_t fd);
-/** \ingroup rpmio
+/**
*/
typedef int fdio_fflush_function_t (FD_t fd);
/*@}*/
*/
/*@{*/
-/** \ingroup rpmio
+/**
* strerror(3) clone.
*/
/*@-redecl@*/
/*@*/;
/*@=redecl@*/
-/** \ingroup rpmio
+/**
* fread(3) clone.
*/
size_t Fread(/*@out@*/ void * buf, size_t size, size_t nmemb, FD_t fd)
/*@modifies fd, *buf, fileSystem @*/;
-/** \ingroup rpmio
+/**
* fwrite(3) clone.
*/
size_t Fwrite(const void * buf, size_t size, size_t nmemb, FD_t fd)
/*@modifies fd, fileSystem @*/;
-/** \ingroup rpmio
+/**
* fseek(3) clone.
*/
int Fseek(FD_t fd, _libio_off_t offset, int whence)
/*@modifies fileSystem @*/;
-/** \ingroup rpmio
+/**
* fclose(3) clone.
*/
int Fclose( /*@killref@*/ FD_t fd)
/*@modifies fd, fileSystem @*/;
-/** \ingroup rpmio
+/**
*/
/*@null@*/ FD_t Fdopen(FD_t fd, const char * fmode)
/*@modifies fd, fileSystem @*/;
-/** \ingroup rpmio
+/**
* fopen(3) clone.
*/
/*@null@*/ FD_t Fopen(/*@null@*/ const char * path,
/*@modifies fileSystem @*/;
-/** \ingroup rpmio
+/**
* fflush(3) clone.
*/
int Fflush(/*@null@*/ FD_t fd)
/*@modifies fd, fileSystem @*/;
-/** \ingroup rpmio
+/**
* ferror(3) clone.
*/
int Ferror(/*@null@*/ FD_t fd)
/*@*/;
-/** \ingroup rpmio
+/**
* fileno(3) clone.
*/
int Fileno(FD_t fd)
/*@*/;
-/** \ingroup rpmio
+/**
* fcntl(2) clone.
*/
int Fcntl(FD_t fd, int op, void *lip)
/*@modifies fd, *lip, fileSystem @*/;
-/** \ingroup rpmio
+/**
* pread(2) clone.
*/
ssize_t Pread(FD_t fd, void * buf, size_t count, _libio_off_t offset)
/*@modifies fd, *buf, fileSystem @*/;
-/** \ingroup rpmio
+/**
* pwrite(2) clone.
*/
ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset)
*/
/*@{*/
-/** \ingroup rpmrpc
+/**
* mkdir(2) clone.
*/
int Mkdir(const char * path, mode_t mode)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* chdir(2) clone.
*/
int Chdir(const char * path)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* rmdir(2) clone.
*/
int Rmdir(const char * path)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* rename(2) clone.
*/
int Rename(const char * oldpath, const char * newpath)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* link(2) clone.
*/
int Link(const char * oldpath, const char * newpath)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* unlink(2) clone.
*/
int Unlink(const char * path)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* readlink(2) clone.
*/
int Readlink(const char * path, char * buf, size_t bufsiz)
/*@modifies *buf, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* stat(2) clone.
*/
int Stat(const char * path, /*@out@*/ struct stat * st)
/*@modifies *st, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* lstat(2) clone.
*/
int Lstat(const char * path, /*@out@*/ struct stat * st)
/*@modifies *st, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* access(2) clone.
*/
int Access(const char * path, int amode)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* glob(3) clone.
*/
int Glob(const char * pattern, int flags,
/*@out@*/ glob_t * pglob)
/*@modifies *pglob, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* globfree(3) clone.
*/
void Globfree( /*@only@*/ glob_t * pglob)
/*@modifies *pglob, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* opendir(3) clone.
*/
/*@null@*/ DIR * Opendir(const char * name)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* readdir(3) clone.
*/
/*@null@*/ struct dirent * Readdir(DIR * dir)
/*@modifies *dir, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* closedir(3) clone.
*/
int Closedir(/*@only@*/ DIR * dir)
# whenever a new version of RPM is installed.
rpm alias --scripts --qf '\
-%|PREIN?{preinstall script\
+%|PREIN?{preinstall scriptlet\
%|PREINPROG?{ (through %{PREINPROG})}|:\n%{PREIN}\n}:\
{%|PREINPROG?{preinstall program: %{PREINPROG}\n}|}|\
\
-%|POSTIN?{postinstall script\
+%|POSTIN?{postinstall scriptlet\
%|POSTINPROG?{ (through %{POSTINPROG})}|:\n%{POSTIN}\n}:\
{%|POSTINPROG?{postinstall program: %{POSTINPROG}\n}|}|\
\
-%|PREUN?{preuninstall script\
+%|PREUN?{preuninstall scriptlet\
%|PREUNPROG?{ (through %{PREUNPROG})}|:\n%{PREUN}\n}:\
{%|PREUNPROG?{preuninstall program: %{PREUNPROG}\n}|}|\
\
-%|POSTUN?{postuninstall script\
+%|POSTUN?{postuninstall scriptlet\
%|POSTUNPROG?{ (through %{POSTUNPROG})}|:\n%{POSTUN}\n}:\
{%|POSTUNPROG?{postuninstall program: %{POSTUNPROG}\n}|}|\
\
-%|VERIFYSCRIPT?{verify script:\n%{VERIFYSCRIPT}\n}|\
-'
+%|VERIFYSCRIPT?{verify scriptlet:\n%{VERIFYSCRIPT}\n}|\
+' \
+ --POPTdesc=$"list install/erase scriptlets from package(s)"
rpm alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] || chmod %7.7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \
--pipe "grep -v \(none\) | sed 's/chmod .../chmod /' | sh"
rpm alias --conflicts --qf \
- "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]"
+ "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]" \
+ --POPTdesc=$"list capabilities this package conflicts with"
rpm alias --obsoletes --qf \
- "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]"
+ "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]" \
+ --POPTdesc=$"list other packages removed by installing this package"
rpm alias --provides --qf \
- "[%{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]"
-
-# XXX prereq output is part of requires for query
-#rpm alias --prereq --qf '[%{PREREQ}:depflags\n]'
+ "[%{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]" \
+ --POPTdesc=$"list capabilities that this package provides"
rpm alias --requires --qf \
- "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]"
+ "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]" \
+ --POPTdesc=$"list capabilities required by package(s)"
rpm alias -R --requires
rpm alias --info --qf 'Name : %-27{NAME} Relocations: %|PREFIXES?{[%{PREFIXES} ]}:{(not relocateable)}|\n\
%|PACKAGER?{Packager : %{PACKAGER}\n}|\
%|URL?{URL : %{URL}\n}|\
Summary : %{SUMMARY}\n\
-Description :\n%{DESCRIPTION}\n'
+Description :\n%{DESCRIPTION}\n' \
+ --POPTdesc=$"list descriptive information from package(s)"
-rpm alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n\n%{CHANGELOGTEXT}\n\n]'
+rpm alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n\n%{CHANGELOGTEXT}\n\n]' \
+ --POPTdesc=$"list change logs for this package"
rpm alias --triggerscripts --qf '\
[trigger%{TRIGGERTYPE} script (through %{TRIGGERSCRIPTPROG}) -- %{TRIGGERCONDS}\n\
%{TRIGGERSCRIPTS}\n]'
-rpm alias --triggers --triggerscripts
+rpm alias --triggers --triggerscripts \
+ --POPTdesc=$"list trigger scriptlets from package(s)"
rpm alias --last --qf '%|INSTALLTIME?{%{INSTALLTIME}}:{000000000}| %{NAME}-%{VERSION}-%{RELEASE} %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n' \
- --pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' "
+ --pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' " \
+ --POPTdesc=$"list package(s) by install time, most recent first"
-rpm alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]'
+rpm alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
+ --POPTdesc=$"list all files from each package"
rpm alias --redhatprovides -q --define '_dbpath /usr/lib/rpmdb/%{_arch}-%{_vendor}-%{_os}/redhat' --whatprovides
rpm alias --redhatrequires -q --define '_dbpath /usr/lib/rpmdb/%{_arch}-%{_vendor}-%{_os}/redhat' --whatrequires
rpm alias --with --define "_with_!#:+ --with-!#:+"
rpm alias --without --define "_without_!#:+ --without-!#:+"
#==============================================================================
-rpmb alias --dbpath --define '_dbpath !#:+'
+rpmb alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmb alias --ftpport --define '_ftpport !#:+'
rpmb alias --ftpproxy --define '_ftpproxy !#:+'
rpmb alias --httpport --define '_httpport !#:+'
rpmb alias --with --define "_with_!#:+ --with-!#:+"
rpmb alias --without --define "_without_!#:+ --without-!#:+"
#==============================================================================
-rpmbuild alias --dbpath --define '_dbpath !#:+'
+rpmbuild alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmbuild alias --ftpport --define '_ftpport !#:+'
rpmbuild alias --ftpproxy --define '_ftpproxy !#:+'
rpmbuild alias --httpport --define '_httpport !#:+'
rpmbuild alias --with --define "_with_!#:+ --with-!#:+"
rpmbuild alias --without --define "_without_!#:+ --without-!#:+"
#==============================================================================
-rpmd alias --dbpath --define '_dbpath !#:+'
+rpmd alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmd alias --ftpport --define '_ftpport !#:+'
rpmd alias --ftpproxy --define '_ftpproxy !#:+'
rpmd alias --httpport --define '_httpport !#:+'
rpmd alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmdb alias --dbpath --define '_dbpath !#:+'
+rpmdb alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmdb alias --ftpport --define '_ftpport !#:+'
rpmdb alias --ftpproxy --define '_ftpproxy !#:+'
rpmdb alias --httpport --define '_httpport !#:+'
rpmdb alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpme alias --dbpath --define '_dbpath !#:+'
+rpme alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpme alias --ftpport --define '_ftpport !#:+'
rpme alias --ftpproxy --define '_ftpproxy !#:+'
rpme alias --httpport --define '_httpport !#:+'
rpme alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmi alias --dbpath --define '_dbpath !#:+'
+rpmi alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmi alias --ftpport --define '_ftpport !#:+'
rpmi alias --ftpproxy --define '_ftpproxy !#:+'
rpmi alias --httpport --define '_httpport !#:+'
rpmi alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmk alias --dbpath --define '_dbpath !#:+'
+rpmk alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmk alias --ftpport --define '_ftpport !#:+'
rpmk alias --ftpproxy --define '_ftpproxy !#:+'
rpmk alias --httpport --define '_httpport !#:+'
rpmk alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmq alias --dbpath --define '_dbpath !#:+'
+rpmq alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmq alias --ftpport --define '_ftpport !#:+'
rpmq alias --ftpproxy --define '_ftpproxy !#:+'
rpmq alias --httpport --define '_httpport !#:+'
rpmq alias --httpproxy --define '_httpproxy !#:+'
rpmq alias --scripts --qf '\
-%|PREIN?{preinstall script\
+%|PREIN?{preinstall scriptlet\
%|PREINPROG?{ (through %{PREINPROG})}|:\n%{PREIN}\n}:\
{%|PREINPROG?{preinstall program: %{PREINPROG}\n}|}|\
\
-%|POSTIN?{postinstall script\
+%|POSTIN?{postinstall scriptlet\
%|POSTINPROG?{ (through %{POSTINPROG})}|:\n%{POSTIN}\n}:\
{%|POSTINPROG?{postinstall program: %{POSTINPROG}\n}|}|\
\
-%|PREUN?{preuninstall script\
+%|PREUN?{preuninstall scriptlet\
%|PREUNPROG?{ (through %{PREUNPROG})}|:\n%{PREUN}\n}:\
{%|PREUNPROG?{preuninstall program: %{PREUNPROG}\n}|}|\
\
-%|POSTUN?{postuninstall script\
+%|POSTUN?{postuninstall scriptlet\
%|POSTUNPROG?{ (through %{POSTUNPROG})}|:\n%{POSTUN}\n}:\
{%|POSTUNPROG?{postuninstall program: %{POSTUNPROG}\n}|}|\
\
-%|VERIFYSCRIPT?{verify script:\n%{VERIFYSCRIPT}\n}|\
-'
+%|VERIFYSCRIPT?{verify scriptlet:\n%{VERIFYSCRIPT}\n}|\
+' \
+ --POPTdesc=$"list install/erase scriptlets from package(s)"
rpmq alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] || chmod %7.7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \
--pipe "grep -v \(none\) | sed 's/chmod .../chmod /' | sh"
--pipe "(echo 'ch() { chown -- \"$1\" \"$3\";chgrp -- \"$2\" \"$3\"; }';grep -v \(none\))|sh"
rpmq alias --conflicts --qf \
- "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]"
+ "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]" \
+ --POPTdesc=$"list capabilities this package conflicts with"
rpmq alias --obsoletes --qf \
- "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]"
+ "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]" \
+ --POPTdesc=$"list other packages removed by installing this package"
rpmq alias --provides --qf \
- "[%{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]"
+ "[%{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]" \
+ --POPTdesc=$"list capabilities that this package provides"
# XXX prereq output is part of requires for query
#rpmq alias --prereq --qf '[%{PREREQ}:depflags\n]'
rpmq alias --requires --qf \
- "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]"
+ "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]" \
+ --POPTdesc=$"list capabilities required by package(s)"
rpmq alias -R --requires
rpmq alias --info --qf 'Name : %-27{NAME} Relocations: %|PREFIXES?{[%{PREFIXES} ]}:{(not relocateable)}|\n\
%|PACKAGER?{Packager : %{PACKAGER}\n}|\
%|URL?{URL : %{URL}\n}|\
Summary : %{SUMMARY}\n\
-Description :\n%{DESCRIPTION}\n'
+Description :\n%{DESCRIPTION}\n' \
+ --POPTdesc=$"list descriptive information from package(s)"
-rpmq alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n\n%{CHANGELOGTEXT}\n\n]'
+rpmq alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n\n%{CHANGELOGTEXT}\n\n]' \
+ --POPTdesc=$"list change logs for this package"
rpmq alias --triggerscripts --qf '\
[trigger%{TRIGGERTYPE} script (through %{TRIGGERSCRIPTPROG}) -- %{TRIGGERCONDS}\n\
%{TRIGGERSCRIPTS}\n]'
-rpmq alias --triggers --triggerscripts
+rpmq alias --triggers --triggerscripts \
+ --POPTdesc=$"list trigger scriptlets from package(s)"
rpmq alias --last --qf '%|INSTALLTIME?{%{INSTALLTIME}}:{000000000}| %{NAME}-%{VERSION}-%{RELEASE} %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n' \
- --pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' "
+ --pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' " \
+ --POPTdesc=$"list package(s) by install time, most recent first"
-rpmq alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]'
+rpmq alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
+ --POPTdesc=$"list all files from each package"
#==============================================================================
-rpmu alias --dbpath --define '_dbpath !#:+'
+rpmu alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmu alias --ftpport --define '_ftpport !#:+'
rpmu alias --ftpproxy --define '_ftpproxy !#:+'
rpmu alias --httpport --define '_httpport !#:+'
rpmu alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmv alias --dbpath --define '_dbpath !#:+'
+rpmv alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmv alias --ftpport --define '_ftpport !#:+'
rpmv alias --ftpproxy --define '_ftpproxy !#:+'
rpmv alias --httpport --define '_httpport !#:+'
N_("provide less detailed output"), NULL},
{ "verbose", 'v', 0, 0, 'v',
N_("provide more detailed output"), NULL},
- { "define", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, 0, GETOPT_DEFINEMACRO,
+ { "define", '\0', POPT_ARG_STRING, 0, GETOPT_DEFINEMACRO,
N_("define macro <name> with value <body>"),
N_("'<name> <body>'") },
- { "eval", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, 0, GETOPT_EVALMACRO,
+ { "eval", '\0', POPT_ARG_STRING, 0, GETOPT_EVALMACRO,
N_("print macro expansion of <expr>+"),
N_("<expr>+") },
{ "pipe", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, &pipeOutput, 0,
N_("Common options for all rpm modes:"),
NULL },
+ POPT_AUTOALIAS
POPT_AUTOHELP
POPT_TABLEEND
};
#ifdef IAM_RPMK
memset(ka, 0, sizeof(*ka));
- ka->addSign = RESIGN_CHK_SIGNATURE;
+ ka->addSign = RESIGN_NONE;
ka->checksigFlags = CHECKSIG_ALL;
#endif
#ifdef IAM_RPMK
switch (ka->addSign) {
+ case RESIGN_NONE:
+ break;
case RESIGN_CHK_SIGNATURE:
bigMode = MODE_CHECKSIG;
break;
case RESIGN_NEW_SIGNATURE:
bigMode = MODE_RESIGN;
break;
+
}
#endif /* IAM_RPMK */