00001 #ifndef H_RPMDS
00002 #define H_RPMDS
00003
00009 #include "rpmevr.h"
00010 #define _RPMNS_INTERNAL
00011 #include "rpmns.h"
00012 #include "rpmps.h"
00013
00016
00017
00018 extern int _rpmds_debug;
00019
00020
00023
00024 extern const char *_sysinfo_path;
00025
00028
00029
00030 extern int _rpmds_nopromote;
00031
00032
00033 #if defined(_RPMDS_INTERNAL)
00034
00037 struct rpmds_s {
00038
00039 const char * Type;
00040
00041 const char * DNEVR;
00042
00043 Header h;
00044
00045 const char ** N;
00046
00047 const char ** EVR;
00048
00049 evrFlags * Flags;
00050
00051 uint32_t * Color;
00052
00053 uint32_t * Refs;
00054
00055 int32_t * Result;
00056
00057 int (*EVRparse) (const char *evrstr, EVR_t evr);
00058 int (*EVRcmp) (const char *a, const char *b);
00059 struct rpmns_s ns;
00060
00061 const char * A;
00062 uint32_t BT;
00063 rpmTag tagN;
00064 uint32_t Count;
00065 int i;
00066 unsigned l;
00067 unsigned u;
00068 int nopromote;
00069
00070 int nrefs;
00071 };
00072 #endif
00073
00074 #if defined(_RPMPRCO_INTERNAL)
00075
00078 struct rpmPRCO_s {
00079
00080 rpmds * Pdsp;
00081
00082 rpmds * Rdsp;
00083
00084 rpmds * Cdsp;
00085
00086 rpmds * Odsp;
00087
00088 rpmds * Tdsp;
00089
00090 rpmds * Ddsp;
00091
00092 rpmds * Ldsp;
00093
00094 rpmds this;
00095
00096 rpmds P;
00097
00098 rpmds R;
00099
00100 rpmds C;
00101
00102 rpmds O;
00103
00104 rpmds T;
00105
00106 rpmds D;
00107
00108 rpmds L;
00109 };
00110 #endif
00111
00112 #ifdef __cplusplus
00113 extern "C" {
00114 #endif
00115
00124
00125 rpmds rpmdsUnlink ( rpmds ds,
00126 const char * msg)
00127 ;
00128
00130
00131
00132 rpmds XrpmdsUnlink ( rpmds ds,
00133 const char * msg, const char * fn, unsigned ln)
00134 ;
00135
00136 #define rpmdsUnlink(_ds, _msg) XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__)
00137
00144
00145 rpmds rpmdsLink ( rpmds ds, const char * msg)
00146 ;
00147
00149
00150 rpmds XrpmdsLink ( rpmds ds, const char * msg,
00151 const char * fn, unsigned ln)
00152 ;
00153 #define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__)
00154
00160
00161 rpmds rpmdsFree( rpmds ds)
00162 ;
00170
00171 rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
00172
00173 ;
00174
00180
00181 const char * rpmdsNewN(rpmds ds)
00182
00183 ;
00184
00191 char * rpmdsNewDNEVR(const char * dspfx, rpmds ds)
00192
00193 ;
00194
00202
00203 rpmds rpmdsThis(Header h, rpmTag tagN, evrFlags Flags)
00204 ;
00205
00214
00215 rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, evrFlags Flags)
00216 ;
00217
00223 int rpmdsCount( const rpmds ds)
00224 ;
00225
00231 int rpmdsIx( const rpmds ds)
00232 ;
00233
00240 int rpmdsSetIx( rpmds ds, int ix)
00241 ;
00242
00248
00249 extern const char * rpmdsDNEVR( const rpmds ds)
00250 ;
00251
00257
00258 extern const char * rpmdsN( rpmds ds)
00259
00260 ;
00261
00267
00268 extern const char * rpmdsEVR( const rpmds ds)
00269 ;
00270
00276 evrFlags rpmdsFlags( const rpmds ds)
00277 ;
00278
00284 rpmTag rpmdsTagN( const rpmds ds)
00285 ;
00286
00292
00293 extern const char * rpmdsA( const rpmds ds)
00294 ;
00295
00301 time_t rpmdsBT( const rpmds ds)
00302 ;
00303
00310 time_t rpmdsSetBT( const rpmds ds, time_t BT)
00311 ;
00312
00318 nsType rpmdsNSType( const rpmds ds)
00319 ;
00320
00334 int rpmdsNoPromote( const rpmds ds)
00335 ;
00336
00343 int rpmdsSetNoPromote( rpmds ds, int nopromote)
00344 ;
00345
00352
00353 void * rpmdsSetEVRparse( rpmds ds,
00354 int (*EVRparse)(const char *everstr, EVR_t evr))
00355 ;
00356
00363
00364 void * rpmdsSetEVRcmp( rpmds ds,
00365 int (*EVRcmp)(const char *a, const char *b))
00366 ;
00367
00373 uint32_t rpmdsColor( const rpmds ds)
00374 ;
00375
00382 uint32_t rpmdsSetColor( const rpmds ds, uint32_t color)
00383 ;
00384
00390 uint32_t rpmdsRefs( const rpmds ds)
00391 ;
00392
00399 uint32_t rpmdsSetRefs( const rpmds ds, uint32_t refs)
00400 ;
00401
00407 int32_t rpmdsResult( const rpmds ds)
00408 ;
00409
00416 int32_t rpmdsSetResult( const rpmds ds, int32_t result)
00417 ;
00418
00425
00426 void rpmdsNotify( rpmds ds, const char * where, int rc)
00427
00428 ;
00429
00430
00436 int rpmdsNext( rpmds ds)
00437 ;
00438
00444
00445 rpmds rpmdsInit( rpmds ds)
00446 ;
00447
00454 int rpmdsFind(rpmds ds, const rpmds ods)
00455 ;
00456
00463 int rpmdsMerge( rpmds * dsp, rpmds ods)
00464 ;
00465
00474 int rpmdsSearch( rpmds ds, rpmds ods)
00475 ;
00476
00483 int rpmdsCpuinfo( rpmds * dsp, const char * fn)
00484
00485 ;
00486
00493 int rpmdsRpmlib(rpmds * dsp, void * tblp)
00494 ;
00495
00502 int rpmdsSysinfo(rpmPRCO PRCO, const char * fn)
00503
00504
00505 ;
00506
00513 int rpmdsGetconf(rpmds * dsp, const char * path)
00514
00515
00516 ;
00517
00524 int rpmdsMergePRCO(void * context, rpmds ds)
00525 ;
00526
00532
00533 rpmPRCO rpmdsFreePRCO( rpmPRCO PRCO)
00534 ;
00535
00541 rpmPRCO rpmdsNewPRCO( Header h)
00542
00543 ;
00544
00551
00552 rpmds rpmdsFromPRCO( rpmPRCO PRCO, rpmTag tagN)
00553 ;
00554
00563 int rpmdsELF(const char * fn, int flags,
00564 int (*add) (void * context, rpmds ds), void * context)
00565
00566 ;
00567 #define RPMELF_FLAG_SKIPPROVIDES 0x1
00568 #define RPMELF_FLAG_SKIPREQUIRES 0x2
00569
00577 int rpmdsLdconfig(rpmPRCO PRCO, const char * fn)
00578
00579 ;
00580
00581 #if defined(__sun)
00582
00591 int rpmdsRldpath(rpmPRCO PRCO, const char * rldp)
00592
00593 ;
00594
00603 int rpmdsCrle(rpmPRCO PRCO, const char * fn)
00604
00605 ;
00606 #endif
00607
00614 struct utsname;
00615 int rpmdsUname(rpmds * dsp, const struct utsname * un)
00616
00617 ;
00618
00626 int rpmdsPipe(rpmds * dsp, rpmTag tagN, const char * cmd)
00627
00628
00629 ;
00630
00637 int rpmdsCompare(const rpmds A, const rpmds B)
00638 ;
00639
00648 void rpmdsProblem( rpmps ps, const char * pkgNEVR, const rpmds ds,
00649 const fnpyKey * suggestedKeys,
00650 int adding)
00651
00652 ;
00653
00661 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
00662
00663 ;
00664
00672 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
00673 ;
00674
00681 int rpmdsNegateRC(const rpmds ds, int rc)
00682 ;
00683
00684 #if !defined(SWIG)
00685
00690 static inline
00691 const char * rpmdsTagName( const rpmds ds)
00692
00693 {
00694 rpmTag tagN = rpmdsTagN(ds);
00695
00696 switch (tagN) {
00697 case RPMTAG_PROVIDENAME: return "Provides"; break;
00698 case RPMTAG_REQUIRENAME: return "Requires"; break;
00699 case RPMTAG_CONFLICTNAME: return "Conflicts"; break;
00700 case RPMTAG_OBSOLETENAME: return "Obsoletes"; break;
00701 case RPMTAG_TRIGGERNAME: return "Triggers"; break;
00702 case RPMTAG_DIRNAMES: return "Dirnames"; break;
00703 }
00704 return tagName(tagN);
00705 }
00706
00713 static inline
00714 int rpmdsPrint( rpmds ds, FILE * fp)
00715
00716
00717 {
00718 if (fp == NULL)
00719 fp = stderr;
00720 ds = rpmdsInit(ds);
00721 while (rpmdsNext(ds) >= 0)
00722 fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsTagName(ds), rpmdsDNEVR(ds)+2);
00723 return 0;
00724 }
00725
00732 static inline
00733 int rpmdsPrintResults( rpmds ds, FILE * fp)
00734
00735
00736 {
00737 if (fp == NULL)
00738 fp = stderr;
00739 ds = rpmdsInit(ds);
00740 while (rpmdsNext(ds) >= 0) {
00741 int rc = rpmdsResult(ds);
00742 if (rc > 0)
00743 continue;
00744 fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsTagName(ds), rpmdsDNEVR(ds)+2);
00745 }
00746 return 0;
00747 }
00748
00756
00757 static inline
00758 int rpmdsPrintClosure( rpmds P, rpmds R,
00759 FILE * fp)
00760
00761
00762 {
00763 int rc;
00764
00765
00766 (void) rpmdsSetResult(R, 0);
00767
00768
00769 R = rpmdsInit(R);
00770 while (rpmdsNext(R) >= 0)
00771 rc = rpmdsSearch(P, R);
00772
00773 return rpmdsPrintResults(R, fp);
00774 }
00775
00776 #endif
00777
00779 #ifdef __cplusplus
00780 }
00781 #endif
00782
00783 #endif