- use rpmfiClass underneath --fileclass.
CVS patchset: 5985
CVS date: 2002/12/29 22:31:00
- add rpmfi methods to access color, class, and dependencies.
- don't segfault with packages produced by rpm-2.93 (#80618).
- python: eliminate hash.[ch] and upgrade.[ch], methods too.
+ - fix :armor query extension, tgpg mktmp handling (#80684).
+ - use rpmfiClass() underneath --fileclass.
4.0.4 -> 4.1:
- loosely wire beecrypt library into rpm.
void rpmfiBuildFClasses(Header h,
/*@out@*/ const char *** fclassp, /*@out@*/ int * fcp)
{
- HGE_t hge = (HGE_t)headerGetEntryMinMemory;
- HFD_t hfd = headerFreeData;
- const char ** cdict;
- const int_32 * fcdictx;
- int_32 ncdict, nfcdictx;
+ int scareMem = 1;
+ rpmfi fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, scareMem);
+ int ac;
const char ** av;
- int_32 ac = 0;
+ const char * FClass;
size_t nb;
- rpmTagType fct, cdt;
char * t;
- int i, j, xx;
- if (!hge(h, RPMTAG_FILESIZES, NULL, (void **) NULL, &ac) || ac == 0) {
- if (fclassp) *fclassp = NULL;
- if (fcp) *fcp = 0;
- return; /* no file list */
+ if ((ac = rpmfiFC(fi)) <= 0) {
+ av = NULL;
+ ac = 0;
+ goto exit;
}
- fcdictx = NULL;
- nfcdictx = 0;
- xx = hge(h, RPMTAG_FILECLASS, &fct, (void **) &fcdictx, &nfcdictx);
- cdict = NULL;
- ncdict = 0;
- xx = hge(h, RPMTAG_CLASSDICT, &cdt, (void **) &cdict, &ncdict);
-
+ /* Compute size of file class argv array blob. */
nb = (ac + 1) * sizeof(*av);
- for (i = 0; i < ac; i++) {
- if (fcdictx != NULL && cdict != NULL) {
- j = fcdictx[i];
-assert(j < ncdict);
- nb += strlen(cdict[j]);
- }
+ fi = rpmfiInit(fi, 0);
+ if (fi != NULL)
+ while (rpmfiNext(fi) >= 0) {
+ FClass = rpmfiFClass(fi);
+ if (FClass && *FClass != '\0')
+ nb += strlen(FClass);
nb += 1;
}
+ /* Create and load file class argv array. */
av = xmalloc(nb);
t = ((char *) av) + ((ac + 1) * sizeof(*av));
- /*@-branchstate@*/
- for (i = 0; i < ac; i++) {
- av[i] = t;
- if (fcdictx != NULL && cdict != NULL) {
- j = fcdictx[i];
- t = stpcpy(t, cdict[j]);
- }
+ ac = 0;
+ fi = rpmfiInit(fi, 0);
+ if (fi != NULL)
+ while (rpmfiNext(fi) >= 0) {
+ FClass = rpmfiFClass(fi);
+ av[ac++] = t;
+ if (FClass && *FClass != '\0')
+ t = stpcpy(t, FClass);
*t++ = '\0';
}
av[ac] = NULL;
/*@=branchstate@*/
- cdict = hfd(cdict, cdt);
- fcdictx = hfd(fcdictx, fct);
-
+exit:
+ fi = rpmfiFree(fi);
/*@-branchstate@*/
if (fclassp)
*fclassp = av;
void rpmfiBuildFDeps(Header h, rpmTag tagN,
/*@out@*/ const char *** fdepsp, /*@out@*/ int * fcp)
{
+ int scareMem = 1;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- int scareMem = 1;
char deptype = 'R';
char mydt;
rpmds ds;
/**
* Create and load a file info set.
- * @param ts transaction set
+ * @param ts transaction set (NULL skips path relocation)
* @param h header
* @param tagN RPMTAG_BASENAMES
* @param scareMem Use pointers to refcounted header memory?
* Sun Dec 29 2002 Jeff Johnson <jbj@redhat.com> 4.2-0.46
- don't segfault with packages produced by rpm-2.93 (#80618).
- python: eliminate hash.[ch] and upgrade.[ch], methods too.
+- fix :armor query extension, tgpg mktmp handling (#80684).
+- use rpmfiClass() underneath --fileclass.
* Sat Dec 28 2002 Jeff Johnson <jbj@redhat.com> 4.2-0.45
- error if querying with iterator on different sized arrays.
/*@=boundswrite@*/
/**
+ * Call a header extension only once, saving results.
* @param h header
* @param fn
* @retval *typeptr
case RPM_STRING_TYPE:
if (tagtype)
- val = tagtype(RPM_STRING_ARRAY_TYPE, data, buf, tag->pad, 0);
+ val = tagtype(RPM_STRING_TYPE, data, buf, tag->pad, 0);
if (val) {
need = strlen(val);
}
if (tagtype)
- val = tagtype(RPM_INT32_TYPE, &intVal, buf, tag->pad, element);
+ val = tagtype(RPM_INT32_TYPE, &intVal, buf, tag->pad, element);
if (val) {
need = strlen(val);
break;
case RPM_BIN_TYPE:
+ /* XXX HACK ALERT: element field abused as no. bytes of binary data. */
if (tagtype)
val = tagtype(RPM_BIN_TYPE, data, buf, tag->pad, count);
if (val) {
- need = count; /* XXX broken iff RPM_BIN_TYPE extension */
+ need = strlen(val);
} else {
#ifdef NOTYET
val = memcpy(xmalloc(count), data, count);
rpmq alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
--POPTdesc=$"list all files from each package"
+
+rpmq alias --fileclass --qf '[%{FILENAMES}\t%{FILECLASS}\n]' \
+ --POPTdesc=$"list file names with classes"
+
+rpmq alias --filecolor --qf '[%{FILENAMES}\t%{FILECOLOR}\n]' \
+ --POPTdesc=$"list file names with colors"
+
+rpmq alias --fileprovide --qf '[%{FILENAMES}\t%{FILEPROVIDE}\n]' \
+ --POPTdesc=$"list file names with provides"
+
+rpmq alias --filerequire --qf '[%{FILENAMES}\t%{FILEREQUIRE}\n]' \
+ --POPTdesc=$"list file names with requires"
+
#==============================================================================
rpmquery alias --dbpath --define '_dbpath !#:+' \
--POPTdesc=$"use database in DIRECTORY" \
rpmquery alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
--POPTdesc=$"list all files from each package"
+
+rpmquery alias --fileclass --qf '[%{FILENAMES}\t%{FILECLASS}\n]' \
+ --POPTdesc=$"list file names with classes"
+
+rpmquery alias --filecolor --qf '[%{FILENAMES}\t%{FILECOLOR}\n]' \
+ --POPTdesc=$"list file names with colors"
+
+rpmquery alias --fileprovide --qf '[%{FILENAMES}\t%{FILEPROVIDE}\n]' \
+ --POPTdesc=$"list file names with provides"
+
+rpmquery alias --filerequire --qf '[%{FILENAMES}\t%{FILEREQUIRE}\n]' \
+ --POPTdesc=$"list file names with requires"
+
#==============================================================================
rpmu alias --dbpath --define '_dbpath !#:+' \
--POPTdesc=$"use database in DIRECTORY" \
#!/bin/sh
+
for pkg in $*
do
if [ "$pkg" = "" -o ! -e "$pkg" ]; then
exit 1
fi
- plaintext=`mktemp $0-$$.XXXXXX`
- detached=`mktemp $0-$$.XXXXXX`
+ plaintext=`mktemp /tmp/tgpg-$$.XXXXXX`
+ detached=`mktemp /tmp/tgpg-$$.XXXXXX`
# --- Extract detached signature
rpm -qp -vv --qf '%{siggpg:armor}' $pkg > $detached