rpm  5.4.10
rpmds.h
Go to the documentation of this file.
1 #ifndef H_RPMDS
2 #define H_RPMDS
3 
9 #include <rpmevr.h>
10 #define _RPMNS_INTERNAL
11 #include <rpmns.h>
12 #include <rpmps.h>
13 
16 /*@-exportlocal@*/
17 /*@unchecked@*/
18 extern int _rpmds_debug;
19 /*@=exportlocal@*/
20 
23 /*@unchecked@*/ /*@observer@*/ /*@owned@*/ /*@null@*/
24 extern const char *_sysinfo_path;
25 
28 /*@-exportlocal@*/
29 /*@unchecked@*/
30 extern int _rpmds_nopromote;
31 /*@=exportlocal@*/
32 
33 #if defined(_RPMDS_INTERNAL)
34 #include <mire.h>
35 
39 struct rpmds_s {
40  struct rpmioItem_s _item;
41 /*@observer@*/
42  const char * Type;
43 /*@only@*/ /*@null@*/
44  const char * DNEVR;
45 /*@refcounted@*/ /*@null@*/
46  Header h;
47 /*@only@*/ /*@relnull@*/
48  const char ** N;
49 /*@only@*/ /*@relnull@*/
50  const char ** EVR;
51 /*@only@*/ /*@relnull@*/
52  evrFlags * Flags;
53 /*@only@*/ /*@null@*/
54  rpmuint32_t * Color;
55 /*@only@*/ /*@null@*/
56  rpmuint32_t * Refs;
57 /*@only@*/ /*@null@*/
58  rpmint32_t * Result;
59 /*@null@*/
60  int (*EVRparse) (const char *evrstr, EVR_t evr); /* EVR parsing. */
61  int (*EVRcmp) (const char *a, const char *b); /* EVR comparison. */
62  struct rpmns_s ns;
63 /*@only@*/ /*@null@*/
64  miRE exclude;
65  int nexclude;
66 /*@only@*/ /*@null@*/
67  miRE include;
68  int ninclude;
69 /*@only@*/ /*@null@*/
70  const char * A;
71  rpmuint32_t BT;
72  rpmTag tagN;
73  rpmuint32_t Count;
74  int i;
75  unsigned l;
76  unsigned u;
77  int nopromote;
78 #if defined(__LCLINT__)
79 /*@refs@*/
80  int nrefs;
81 #endif
82 };
83 #endif /* _RPMDS_INTERNAL */
84 
85 #if defined(_RPMPRCO_INTERNAL)
86 
89 struct rpmPRCO_s {
90  struct rpmioItem_s _item;
91 /*@dependent@*/ /*@relnull@*/
92  rpmds * Pdsp;
93 /*@dependent@*/ /*@relnull@*/
94  rpmds * Rdsp;
95 /*@dependent@*/ /*@relnull@*/
96  rpmds * Cdsp;
97 /*@dependent@*/ /*@relnull@*/
98  rpmds * Odsp;
99 /*@dependent@*/ /*@relnull@*/
100  rpmds * Tdsp;
101 /*@dependent@*/ /*@relnull@*/
102  rpmds * Ddsp;
103 /*@dependent@*/ /*@relnull@*/
104  rpmds * Ldsp;
105 /*@refcounted@*/ /*@null@*/
106  rpmds my;
107 /*@refcounted@*/ /*@null@*/
108  rpmds P;
109 /*@refcounted@*/ /*@null@*/
110  rpmds R;
111 /*@refcounted@*/ /*@null@*/
112  rpmds C;
113 /*@refcounted@*/ /*@null@*/
114  rpmds O;
115 /*@refcounted@*/ /*@null@*/
116  rpmds T;
117 /*@refcounted@*/ /*@null@*/
118  rpmds D;
119 /*@refcounted@*/ /*@null@*/
120  rpmds L;
121 #if defined(__LCLINT__)
122 /*@refs@*/
123  int nrefs;
124 #endif
125 };
126 #endif /* _RPMPRCO_INTERNAL */
127 
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
131 
134 
141 /*@unused@*/ /*@null@*/
142 rpmds rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
143  /*@null@*/ const char * msg)
144  /*@modifies ds @*/;
145 #define rpmdsUnlink(_ds, _msg) \
146  ((rpmds)rpmioUnlinkPoolItem((rpmioItem)(_ds), _msg, __FILE__, __LINE__))
147 
154 /*@unused@*/ /*@newref@*/ /*@null@*/
155 rpmds rpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg)
156  /*@modifies ds @*/;
157 #define rpmdsLink(_ds, _msg) \
158  ((rpmds)rpmioLinkPoolItem((rpmioItem)(_ds), _msg, __FILE__, __LINE__))
159 
165 /*@null@*/
166 rpmds rpmdsFree(/*@killref@*/ /*@null@*/ rpmds ds)
167  /*@modifies ds @*/;
168 #define rpmdsFree(_ds) \
169  ((rpmds)rpmioFreePoolItem((rpmioItem)(_ds), __FUNCTION__, __FILE__, __LINE__))
170 
178 /*@null@*/
179 rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
180  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
181  /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
182 
188 /*@dependent@*/ /*@observer@*/ /*@null@*/
189 const char * rpmdsNewN(rpmds ds)
190  /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
191  /*@modifies ds, rpmGlobalMacroContext, internalState @*/;
192 
199 char * rpmdsNewDNEVR(const char * dspfx, rpmds ds)
200  /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
201  /*@modifies ds, rpmGlobalMacroContext, internalState @*/;
202 
210 /*@null@*/
211 rpmds rpmdsThis(Header h, rpmTag tagN, evrFlags Flags)
212  /*@globals internalState @*/
213  /*@modifies internalState @*/;
214 
223 /*@null@*/
224 rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, evrFlags Flags)
225  /*@*/;
226 
232 int rpmdsCount(/*@null@*/ const rpmds ds)
233  /*@*/;
234 
240 int rpmdsIx(/*@null@*/ const rpmds ds)
241  /*@*/;
242 
249 int rpmdsSetIx(/*@null@*/ rpmds ds, int ix)
250  /*@modifies ds @*/;
251 
257 /*@observer@*/ /*@relnull@*/
258 extern const char * rpmdsDNEVR(/*@null@*/ const rpmds ds)
259  /*@*/;
260 
266 /*@observer@*/ /*@null@*/
267 extern const char * rpmdsN(/*@null@*/ rpmds ds)
268  /*@globals internalState @*/
269  /*@modifies internalState @*/;
270 
276 /*@observer@*/ /*@relnull@*/
277 extern const char * rpmdsEVR(/*@null@*/ const rpmds ds)
278  /*@*/;
279 
285 evrFlags rpmdsFlags(/*@null@*/ const rpmds ds)
286  /*@*/;
287 
293 rpmTag rpmdsTagN(/*@null@*/ const rpmds ds)
294  /*@*/;
295 
301 /*@observer@*/ /*@relnull@*/
302 extern const char * rpmdsA(/*@null@*/ const rpmds ds)
303  /*@*/;
304 
310 time_t rpmdsBT(/*@null@*/ const rpmds ds)
311  /*@*/;
312 
319 time_t rpmdsSetBT(/*@null@*/ const rpmds ds, time_t BT)
320  /*@modifies ds @*/;
321 
327 nsType rpmdsNSType(/*@null@*/ const rpmds ds)
328  /*@*/;
329 
343 int rpmdsNoPromote(/*@null@*/ const rpmds ds)
344  /*@*/;
345 
352 int rpmdsSetNoPromote(/*@null@*/ rpmds ds, int nopromote)
353  /*@modifies ds @*/;
354 
361 /*@null@*/
362 void * rpmdsSetEVRparse(/*@null@*/ rpmds ds,
363  /*@null@*/ int (*EVRparse)(const char *everstr, EVR_t evr))
364  /*@modifies ds @*/;
365 
372 /*@null@*/
373 void * rpmdsSetEVRcmp(/*@null@*/ rpmds ds,
374  /*@null@*/ int (*EVRcmp)(const char *a, const char *b))
375  /*@modifies ds @*/;
376 
382 rpmuint32_t rpmdsColor(/*@null@*/ const rpmds ds)
383  /*@*/;
384 
391 rpmuint32_t rpmdsSetColor(/*@null@*/ const rpmds ds, rpmuint32_t color)
392  /*@modifies ds @*/;
393 
399 /*@null@*/
400 void * rpmdsExclude(/*@null@*/ const rpmds ds)
401  /*@*/;
402 
408 int rpmdsNExclude(/*@null@*/ const rpmds ds)
409  /*@*/;
410 
416 /*@null@*/
417 void * rpmdsInclude(/*@null@*/ const rpmds ds)
418  /*@*/;
419 
425 int rpmdsNInclude(/*@null@*/ const rpmds ds)
426  /*@*/;
427 
433 rpmuint32_t rpmdsRefs(/*@null@*/ const rpmds ds)
434  /*@*/;
435 
442 rpmuint32_t rpmdsSetRefs(/*@null@*/ const rpmds ds, rpmuint32_t refs)
443  /*@modifies ds @*/;
444 
450 rpmint32_t rpmdsResult(/*@null@*/ const rpmds ds)
451  /*@*/;
452 
459 rpmint32_t rpmdsSetResult(/*@null@*/ const rpmds ds, rpmint32_t result)
460  /*@modifies ds @*/;
461 
468 /*@-globuse@*/ /* FIX: rpmMessage annotation is a lie */
469 void rpmdsNotify(/*@null@*/ rpmds ds, /*@null@*/ const char * where, int rc)
470  /*@globals fileSystem @*/
471  /*@modifies fileSystem @*/;
472 /*@=globuse@*/
473 
479 int rpmdsNext(/*@null@*/ rpmds ds)
480  /*@modifies ds @*/;
481 
487 /*@null@*/
488 rpmds rpmdsInit(/*@null@*/ rpmds ds)
489  /*@modifies ds @*/;
490 
497 int rpmdsFind(rpmds ds, /*@null@*/ const rpmds ods)
498  /*@modifies ds @*/;
499 
506 int rpmdsMerge(/*@null@*/ /*@out@*/ rpmds * dsp, /*@null@*/ rpmds ods)
507  /*@modifies *dsp, ods @*/;
508 
517 int rpmdsSearch(/*@null@*/ rpmds ds, /*@null@*/ rpmds ods)
518  /*@modifies ds, ods @*/;
519 
522 /*@unchecked@*/ /*@null@*/
523 extern const char * _cpuinfo_path;
524 
531 int rpmdsCpuinfo(/*@out@*/ rpmds * dsp, /*@null@*/ const char * fn)
532  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
533  /*@modifies *dsp, rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/;
534 
541 int rpmdsRpmlib(rpmds * dsp, /*@null@*/ void * tblp)
542  /*@modifies *dsp @*/;
543 
550 int rpmdsSysinfo(rpmPRCO PRCO, /*@null@*/ const char * fn)
551  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
552  /*@modifies PRCO, rpmGlobalMacroContext, h_errno,
553  fileSystem, internalState @*/;
554 
561 int rpmdsGetconf(rpmds * dsp, /*@null@*/ const char * path)
562  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
563  /*@modifies *dsp, rpmGlobalMacroContext, h_errno,
564  fileSystem, internalState @*/;
565 
572 int rpmdsMergePRCO(void * context, rpmds ds)
573  /*@modifies context, ds @*/;
574 
580 /*@null@*/
581 rpmPRCO rpmdsFreePRCO(/*@only@*/ /*@null@*/ rpmPRCO PRCO)
582  /*@modifies PRCO @*/;
583 
589 rpmPRCO rpmdsNewPRCO(/*@null@*/ Header h)
590  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
591  /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
592 
599 /*@null@*/
600 rpmds rpmdsFromPRCO(/*@null@*/ rpmPRCO PRCO, rpmTag tagN)
601  /*@*/;
602 
611 int rpmdsELF(const char * fn, int flags,
612  int (*add) (void * context, rpmds ds), void * context)
613  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
614  /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
615 #define RPMELF_FLAG_SKIPPROVIDES 0x1 /*<! rpmdsELF: skip provides */
616 #define RPMELF_FLAG_SKIPREQUIRES 0x2 /*<! rpmdsELF: skip requires */
617 
625 int rpmdsLdconfig(rpmPRCO PRCO, /*@null@*/ const char * fn)
626  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
627  /*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/;
628 
629 #if defined(__sun)
630 
639 int rpmdsRldpath(rpmPRCO PRCO, /*@null@*/ const char * rldp)
640  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
641  /*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/;
642 
651 int rpmdsCrle(rpmPRCO PRCO, /*@null@*/ const char * fn)
652  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
653  /*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/;
654 #endif
655 
662 struct utsname;
663 int rpmdsUname(rpmds * dsp, /*@null@*/ const struct utsname * un)
664  /*@globals internalState @*/
665  /*@modifies *dsp, internalState @*/;
666 
674 int rpmdsPipe(rpmds * dsp, rpmTag tagN, /*@null@*/ const char * cmd)
675  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
676  /*@modifies *dsp, rpmGlobalMacroContext, h_errno,
677  fileSystem, internalState @*/;
678 
685 int rpmdsCompare(const rpmds A, const rpmds B)
686  /*@*/;
687 
694 int rpmdsMatch(const rpmds A, rpmds B)
695  /*@modifies B @*/;
696 
705 void rpmdsProblem(/*@null@*/ rpmps ps, const char * pkgNEVR, const rpmds ds,
706  /*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys,
707  int adding)
708  /*@globals internalState @*/
709  /*@modifies ps, internalState @*/;
710 
718 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
719  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
720  /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
721 
729 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
730  /*@globals internalState @*/
731  /*@modifies internalState @*/;
732 
739 int rpmdsNegateRC(const rpmds ds, int rc)
740  /*@*/;
741 
747 /*@observer@*/
748 const char * rpmdsType(/*@null@*/ const rpmds ds)
749  /*@*/;
750 
751 #if !defined(SWIG)
752 
758 /*@unused@*/ static inline
759 int rpmdsPrint(/*@null@*/ rpmds ds, /*@null@*/ FILE * fp)
760  /*@globals fileSystem @*/
761  /*@modifies ds, *fp, fileSystem @*/
762 {
763  if (fp == NULL)
764  fp = stderr;
765  ds = rpmdsInit(ds);
766  while (rpmdsNext(ds) >= 0)
767  fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsType(ds), rpmdsDNEVR(ds)+2);
768  return 0;
769 }
770 
777 /*@unused@*/ static inline
778 int rpmdsPrintResults(/*@null@*/ rpmds ds, /*@null@*/ FILE * fp)
779  /*@globals fileSystem @*/
780  /*@modifies ds, *fp, fileSystem @*/
781 {
782  if (fp == NULL)
783  fp = stderr;
784  ds = rpmdsInit(ds);
785  while (rpmdsNext(ds) >= 0) {
786  rpmint32_t rc = rpmdsResult(ds);
787  if (rc > 0)
788  continue;
789  fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsType(ds), rpmdsDNEVR(ds)+2);
790  }
791  return 0;
792 }
793 
801 /*@-mods@*/ /* XXX LCL wonky */
802 /*@unused@*/ static inline
803 int rpmdsPrintClosure(/*@null@*/ rpmds P, /*@null@*/ rpmds R,
804  /*@null@*/ FILE * fp)
805  /*@globals fileSystem @*/
806  /*@modifies P, R, *fp, fileSystem @*/
807 {
808  int rc;
809 
810  /* Allocate the R results array (to be filled in by rpmdsSearch). */
811  (void) rpmdsSetResult(R, 0); /* allocate result array. */
812 
813  /* Collect the rpmdsSearch results (in the R dependency set). */
814  R = rpmdsInit(R);
815  while (rpmdsNext(R) >= 0)
816  rc = rpmdsSearch(P, R);
817 
818  return rpmdsPrintResults(R, fp);
819 }
820 /*@=mods@*/
821 #endif
822 
824 #ifdef __cplusplus
825 }
826 #endif
827 
828 #endif /* H_RPMDS */