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
00025 extern int _rpmds_nopromote;
00026
00027
00028 #if defined(_RPMDS_INTERNAL)
00029
00032 struct rpmds_s {
00033
00034 const char * Type;
00035
00036 const char * DNEVR;
00037
00038 Header h;
00039
00040 const char ** N;
00041
00042 const char ** EVR;
00043
00044 int_32 * Flags;
00045
00046 uint_32 * Color;
00047
00048 int_32 * Refs;
00049
00050 int_32 * Result;
00051
00052 int (*EVRparse) (const char *evrstr, EVR_t evr);
00053 int (*EVRcmp) (const char *a, const char *b);
00054 struct rpmns_s ns;
00055
00056 const char * A;
00057 int_32 BT;
00058 rpmTag tagN;
00059 rpmTagType Nt, EVRt, Ft;
00060 int_32 Count;
00061 int i;
00062 unsigned l;
00063 unsigned u;
00064 int nopromote;
00065
00066 int nrefs;
00067 };
00068 #endif
00069
00070 #if defined(_RPMPRCO_INTERNAL)
00071
00074 struct rpmPRCO_s {
00075
00076 rpmds * Pdsp;
00077
00078 rpmds * Rdsp;
00079
00080 rpmds * Cdsp;
00081
00082 rpmds * Odsp;
00083
00084 rpmds * Tdsp;
00085
00086 rpmds * Ddsp;
00087
00088 rpmds * Ldsp;
00089
00090 rpmds this;
00091
00092 rpmds P;
00093
00094 rpmds R;
00095
00096 rpmds C;
00097
00098 rpmds O;
00099
00100 rpmds T;
00101
00102 rpmds D;
00103
00104 rpmds L;
00105 };
00106 #endif
00107
00108 #ifdef __cplusplus
00109 extern "C" {
00110 #endif
00111
00120
00121 rpmds rpmdsUnlink ( rpmds ds,
00122 const char * msg)
00123 ;
00124
00126
00127
00128 rpmds XrpmdsUnlink ( rpmds ds,
00129 const char * msg, const char * fn, unsigned ln)
00130 ;
00131
00132 #define rpmdsUnlink(_ds, _msg) XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__)
00133
00140
00141 rpmds rpmdsLink ( rpmds ds, const char * msg)
00142 ;
00143
00145
00146 rpmds XrpmdsLink ( rpmds ds, const char * msg,
00147 const char * fn, unsigned ln)
00148 ;
00149 #define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__)
00150
00156
00157 rpmds rpmdsFree( rpmds ds)
00158 ;
00166
00167 rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
00168
00169 ;
00170
00176 const char * rpmdsNewN(rpmds ds)
00177
00178 ;
00179
00186 char * rpmdsNewDNEVR(const char * dspfx, rpmds ds)
00187
00188 ;
00189
00197
00198 rpmds rpmdsThis(Header h, rpmTag tagN, int_32 Flags)
00199 ;
00200
00209
00210 rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
00211 ;
00212
00218 int rpmdsCount( const rpmds ds)
00219 ;
00220
00226 int rpmdsIx( const rpmds ds)
00227 ;
00228
00235 int rpmdsSetIx( rpmds ds, int ix)
00236 ;
00237
00243
00244 extern const char * rpmdsDNEVR( const rpmds ds)
00245 ;
00246
00252
00253 extern const char * rpmdsN( rpmds ds)
00254 ;
00255
00261
00262 extern const char * rpmdsEVR( const rpmds ds)
00263 ;
00264
00270 int_32 rpmdsFlags( const rpmds ds)
00271 ;
00272
00278 rpmTag rpmdsTagN( const rpmds ds)
00279 ;
00280
00286
00287 extern const char * rpmdsA( const rpmds ds)
00288 ;
00289
00295 time_t rpmdsBT( const rpmds ds)
00296 ;
00297
00304 time_t rpmdsSetBT( const rpmds ds, time_t BT)
00305 ;
00306
00312 nsType rpmdsNSType( const rpmds ds)
00313 ;
00314
00328 int rpmdsNoPromote( const rpmds ds)
00329 ;
00330
00337 int rpmdsSetNoPromote( rpmds ds, int nopromote)
00338 ;
00339
00346
00347 void * rpmdsSetEVRparse( rpmds ds,
00348 int (*EVRparse)(const char *everstr, EVR_t evr))
00349 ;
00350
00357
00358 void * rpmdsSetEVRcmp( rpmds ds,
00359 int (*EVRcmp)(const char *a, const char *b))
00360 ;
00361
00367 uint_32 rpmdsColor( const rpmds ds)
00368 ;
00369
00376 uint_32 rpmdsSetColor( const rpmds ds, uint_32 color)
00377 ;
00378
00384 int_32 rpmdsRefs( const rpmds ds)
00385 ;
00386
00393 int_32 rpmdsSetRefs( const rpmds ds, int_32 refs)
00394 ;
00395
00401 int_32 rpmdsResult( const rpmds ds)
00402 ;
00403
00410 int_32 rpmdsSetResult( const rpmds ds, int_32 result)
00411 ;
00412
00419
00420 void rpmdsNotify( rpmds ds, const char * where, int rc)
00421
00422 ;
00423
00424
00430 int rpmdsNext( rpmds ds)
00431 ;
00432
00438
00439 rpmds rpmdsInit( rpmds ds)
00440 ;
00441
00448 int rpmdsFind(rpmds ds, const rpmds ods)
00449 ;
00450
00457 int rpmdsMerge( rpmds * dsp, rpmds ods)
00458 ;
00459
00468 int rpmdsSearch( rpmds ds, rpmds ods)
00469 ;
00470
00477 int rpmdsCpuinfo( rpmds * dsp, const char * fn)
00478
00479 ;
00480
00487 int rpmdsRpmlib(rpmds * dsp, void * tblp)
00488 ;
00489
00496 int rpmdsSysinfo(rpmPRCO PRCO, const char * fn)
00497
00498
00499 ;
00500
00507 int rpmdsGetconf(rpmds * dsp, const char * path)
00508
00509
00510 ;
00511
00518 int rpmdsMergePRCO(void * context, rpmds ds)
00519 ;
00520
00526
00527 rpmPRCO rpmdsFreePRCO( rpmPRCO PRCO)
00528 ;
00529
00535 rpmPRCO rpmdsNewPRCO( Header h)
00536
00537 ;
00538
00545
00546 rpmds rpmdsFromPRCO( rpmPRCO PRCO, rpmTag tagN)
00547 ;
00548
00557 int rpmdsELF(const char * fn, int flags,
00558 int (*add) (void * context, rpmds ds), void * context)
00559
00560 ;
00561 #define RPMELF_FLAG_SKIPPROVIDES 0x1
00562 #define RPMELF_FLAG_SKIPREQUIRES 0x2
00563
00571 int rpmdsLdconfig(rpmPRCO PRCO, const char * fn)
00572
00573 ;
00574
00575 #if defined(__sun)
00576
00585 int rpmdsRldpath(rpmPRCO PRCO, const char * rldp)
00586
00587 ;
00588
00597 int rpmdsCrle(rpmPRCO PRCO, const char * fn)
00598
00599 ;
00600 #endif
00601
00608 int rpmdsUname(rpmds * dsp, const struct utsname * un)
00609
00610 ;
00611
00619 int rpmdsPipe(rpmds * dsp, int_32 tagN, const char * cmd)
00620
00621
00622 ;
00623
00630 int rpmdsCompare(const rpmds A, const rpmds B)
00631 ;
00632
00641 void rpmdsProblem( rpmps ps, const char * pkgNEVR, const rpmds ds,
00642 const fnpyKey * suggestedKeys,
00643 int adding)
00644 ;
00645
00653 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
00654
00655 ;
00656
00664 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
00665 ;
00666
00673 int rpmdsNegateRC(const rpmds ds, int rc)
00674 ;
00675
00676 #if !defined(SWIG)
00677
00682 static inline
00683 const char * rpmdsTagName( const rpmds ds)
00684
00685 {
00686 int tagN = rpmdsTagN(ds);
00687
00688 switch (tagN) {
00689 case RPMTAG_PROVIDENAME: return "Provides"; break;
00690 case RPMTAG_REQUIRENAME: return "Requires"; break;
00691 case RPMTAG_CONFLICTNAME: return "Conflicts"; break;
00692 case RPMTAG_OBSOLETENAME: return "Obsoletes"; break;
00693 case RPMTAG_TRIGGERNAME: return "Triggers"; break;
00694 case RPMTAG_DIRNAMES: return "Dirnames"; break;
00695 }
00696 return tagName(tagN);
00697 }
00698
00705 static inline
00706 int rpmdsPrint( rpmds ds, FILE * fp)
00707
00708
00709 {
00710 if (fp == NULL)
00711 fp = stderr;
00712 ds = rpmdsInit(ds);
00713 while (rpmdsNext(ds) >= 0)
00714 fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsTagName(ds), rpmdsDNEVR(ds)+2);
00715 return 0;
00716 }
00717
00724 static inline
00725 int rpmdsPrintResults( rpmds ds, FILE * fp)
00726
00727
00728 {
00729 if (fp == NULL)
00730 fp = stderr;
00731 ds = rpmdsInit(ds);
00732 while (rpmdsNext(ds) >= 0) {
00733 int rc = rpmdsResult(ds);
00734 if (rc > 0)
00735 continue;
00736 fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsTagName(ds), rpmdsDNEVR(ds)+2);
00737 }
00738 return 0;
00739 }
00740
00748
00749 static inline
00750 int rpmdsPrintClosure( rpmds P, rpmds R,
00751 FILE * fp)
00752
00753
00754 {
00755 int rc;
00756
00757
00758 (void) rpmdsSetResult(R, 0);
00759
00760
00761 R = rpmdsInit(R);
00762 while (rpmdsNext(R) >= 0)
00763 rc = rpmdsSearch(P, R);
00764
00765 return rpmdsPrintResults(R, fp);
00766 }
00767
00768 #endif
00769
00771 #ifdef __cplusplus
00772 }
00773 #endif
00774
00775 #endif