Annotation of rpm2html/rpmdata.h, revision 1.54

1.1       veillard    1: /*
                      2:  * rpmdata.h : describes the data gathered for each RPM analyzed.
                      3:  *
1.32      veillard    4:  * See Copyright for the status of this software.
1.1       veillard    5:  *
1.54    ! veillard    6:  * $Id: rpmdata.h,v 1.53 2000/11/28 12:18:07 veillard Exp $
1.1       veillard    7:  */
                      8: 
                      9: #ifndef __RPMDATA_H__
                     10: #define __RPMDATA_H__
                     11: 
1.26      httpng     12: #include <sys/types.h>
1.44      daniel     13: #if defined(HAVE_RPM_RPMIO_H)
                     14: #include <rpm/rpmio.h>
                     15: #endif
1.1       veillard   16: #include <rpm/header.h>
                     17: 
                     18: /*
1.45      daniel     19:  * Structure associated with a local directory containing RPM files.
1.6       veillard   20:  */
                     21: 
1.16      veillard   22: #define MAX_ARCHS      (sizeof(int) * 8)
1.6       veillard   23: 
                     24: typedef struct rpm_dir {
                     25:     struct rpm_dir *next;      /* next in list */
1.48      veillard   26:     int no;                    /* ID in SQL base */
                     27:     int vendor;                        /* vendor ID in SQL base */
1.14      veillard   28:     char *color;               /* The bgcolor for the pages :-) */
                     29:     char *dir;                 /* where to store the HTML files */
1.21      veillard   30:     char *subdir;              /* subdirectory for multiple archive */
1.8       veillard   31:     char *ftp;                 /* The host URL it's mirrored from */
                     32:     char *ftpsrc;              /* The host URL where src.rpm can be found */
1.14      veillard   33:     char *host;                 /* Hostname for the server */
                     34:     char *mail;                        /* mail contact for this directory */
                     35:     char *maint;               /* Maintainer name for this directory */
                     36:     char *name;                        /* Name for this repository */
                     37:     char *rpmdir;               /* The local repository */
1.6       veillard   38:     char *trust;               /* Confidences in the files */
1.14      veillard   39:     char *url;                 /* The output URL */
                     40:     int   files;               /* number of files */
                     41:     int   installbase;         /* Is this from an installed base */
                     42:     int   size;                        /* aggregated size of files */
                     43:     int   nb_mirrors;          /* numbers of mirrors */
1.29      veillard   44:     int   max_mirrors;         /* numbers of slot allocated */
                     45:     char **mirrors;             /* Urls for download */
1.35      daniel     46:     int   html;                        /* Should we build the HTML pages */
1.23      veillard   47:     int   build_tree;          /* Should we build the filesystem tree */
1.42      daniel     48:     int   follow_symlinks;     /* Should we follow all symlinks */
                     49:     int   rpm_symlinks;                /* Should we open links to RPM files */
1.23      veillard   50:     struct rpm_realdir *root;  /* The corresponding filesystem tree */
1.46      daniel     51:     char *dbpath;               /* The rpm db path */   /* Added by A. Gibert */  
1.6       veillard   52: } rpmDir, *rpmDirPtr;
                     53: 
                     54: /*
1.45      daniel     55:  * Structure associated with a local directory containing HTML files.
1.22      veillard   56:  * We build a tree providing an actual map of the generated site.
                     57:  */
                     58: 
                     59: typedef struct rpm_subdir {
                     60:     struct rpm_subdir *parent; /* Parent directory ususally .. */
                     61:     char  *name;               /* subdirectory name */
                     62:     char  *color;              /* Color for the HTML output */
                     63:     char  *htmlpath;           /* full path w.r.t. rpm2html_url */
                     64:     char  *rpmpath;            /* full path w.r.t. rpm2html_dir */
1.36      daniel     65:     int    html;               /* Should we build the HTML pages */
1.22      veillard   66:     int    nb_subdirs;         /* number of subdirectories */
1.28      veillard   67:     int    max_subdirs;                /* number of subdirectories allocated */
                     68:     struct rpm_subdir **subdirs;/* list of the subdirectories */ 
1.22      veillard   69: } rpmSubdir, *rpmSubdirPtr;
                     70: 
                     71: /*
1.45      daniel     72:  * Structure associated with a real directory containing files owned
1.23      veillard   73:  * by RPM packages. It reflect the content of user's filesystem if
                     74:  * it installed the packages.
                     75:  */
                     76: 
                     77: #define RPM_ELEM_DIRECTORY     0x1   /* File or directory ? */
                     78: 
                     79: typedef struct rpm_realdir {
                     80:     struct rpm_realdir *parent;        /* Parent directory */
                     81:     char  *name;               /* directory name */
                     82:     int    nb_elem;            /* number of files (and subdirs)  */
                     83:     int    max_elem;           /* size of allocated arrays       */
                     84:                                 /* pointers to an array of either */
                     85:     void **elems;               /* filename or subdir rpm_realdir */
                     86:     char **names;               /* pointer to the array of names  */
                     87:     char  *flags;               /* pointer to array of flags      */
                     88: } rpmRealDir, *rpmRealDirPtr;
                     89: 
                     90: /*
1.13      veillard   91:  * structure associated with an architecture.
                     92:  */
                     93: 
                     94: typedef struct rpm_arch {
                     95:     struct rpm_arch *next;     /* next in the list */
                     96:     char *os;                  /* the Operating System name */
                     97:     char *arch;                        /* the CPU architecture */
                     98: } rpmArch, *rpmArchPtr;
                     99: 
                    100: /*
1.1       veillard  101:  * structure associated with an rpm
                    102:  */
                    103: 
                    104: typedef struct rpm_data {
1.16      veillard  105:     struct rpm_data *next;     /* next in the full list of RPMs */
                    106:     struct rpm_data *nextSoft; /* next software */
                    107:     struct rpm_data *nextArch; /* RPM for same software on other archs */
                    108:     struct rpm_data *nextHash; /* next in the hash list */
1.37      daniel    109:     /*
                    110:      * These informations need to be kept until the end of the processing
                    111:      * to allow the dump of resources directories.
                    112:      */
1.6       veillard  113:     rpmDirPtr dir;             /* directory infos */
1.37      daniel    114:     char *url;                  /* URL for the software */
1.2       veillard  115:     char *filename;            /* name of the file */
1.40      daniel    116:     const char *name;          /* name of the software */
1.37      daniel    117:     char *summary;             /* 1 line summary */
1.40      daniel    118:     const char *group;         /* type of software */
                    119:     const char *version;       /* version of the software */
                    120:     const char *release;       /* software release */
                    121:     const char *arch;           /* the architecture system */
                    122:     const char *os;             /* the target system */
                    123:     const char *distribution;  /* general OS distribution */
                    124:     const char *vendor;                /* general OS vendor */
1.37      daniel    125:     time_t date;               /* date of packaging */
                    126:     int_32 size;               /* size of the software */
1.40      daniel    127:     const char *subdir;                /* subdirectory holding the rpm */
1.37      daniel    128: 
                    129:     struct rpm_extra_data *extra;/* see below */
                    130: } rpmData, *rpmDataPtr;
                    131: 
                    132: typedef struct rpm_extra_data {
                    133:     /*
                    134:      * These informations are loaded and discarded as soon as the
                    135:      * HTML and RDF pages are built.
                    136:      */
1.8       veillard  137:     char *packager;            /* the packager */
1.2       veillard  138:     char *description;          /* short description */
1.8       veillard  139:     char *copyright;            /* software copyright */
1.20      veillard  140:     char *changelog;            /* changelog */
1.2       veillard  141:     char *srcrpm;              /* source RPM */
1.17      veillard  142:     time_t stamp;              /* modification file of the archive */
1.1       veillard  143:     char *host;                        /* build host */
1.29      veillard  144:     int   nb_resources;                /* #of resources provided */
                    145:     int   max_resources;       /* #of resources slot allocated */
                    146:     struct rpm_resource **resources;/* list of them */
1.19      veillard  147:     int   nb_requires;         /* #of resources required */
1.29      veillard  148:     int   max_requires;                /* #of resources slot allocated */
                    149:     struct rpm_resource **requires;/* list of them */
1.5       veillard  150:     char *filelist;             /* the filelist */
1.51      veillard  151:     int   nb_sigs;             /* #of signatures required */
                    152:     int   max_sigs;            /* #of signatures slot allocated */
                    153:     struct rpm_sig **sigs;     /* list of them */
1.37      daniel    154: } rpmExtraData, *rpmExtraDataPtr;
1.1       veillard  155: 
                    156: /*
                    157:  * structure associated with a resource
                    158:  */
1.19      veillard  159: typedef struct rpm_resource {
                    160:     struct rpm_resource *next; /* next in the list */
1.41      daniel    161:     struct rpm_resource *nextHash;/* next in the hash table list */
1.19      veillard  162:     char *name;                        /* name of the resource */
1.49      veillard  163:     char *version;              /* version of the resource */
                    164:     rpm_dep_flag flag;          /* flag of the resource */
1.19      veillard  165:     int   nb_provider;         /* #of resources provided */
1.29      veillard  166:     int   max_provider;                /* #of resources slot allocated */
1.17      veillard  167:     time_t stamp;              /* max stamp of the provider */
1.29      veillard  168:     struct rpm_data **provider; /* list of them */
1.1       veillard  169: } rpmRess, *rpmRessPtr;
                    170: 
1.51      veillard  171: /*
                    172:  * structure associated with signature
                    173:  */
                    174: typedef struct rpm_sig {
                    175:     int size;                  /* size of signature */
                    176:     int tag;                   /* signature tag */
                    177:     int type;                  /* signature type */
                    178:     int *sig;                  /* signature */
1.52      veillard  179:     #if defined(WITH_GPG)
                    180:     char *resolve;             /* resolved signature */
                    181:     #endif
1.51      veillard  182: } rpmSig, *rpmSigPtr;
1.1       veillard  183: 
1.30      veillard  184: /*
                    185:  * Variables.
                    186:  */
1.33      veillard  187: extern int   rpm2htmlVerbose;
1.30      veillard  188: extern int   force;
1.31      veillard  189: extern time_t currentTime;
1.30      veillard  190: 
1.16      veillard  191: extern const char *archNames[MAX_ARCHS];
                    192: extern int nbArchs;
                    193: 
                    194: extern rpmDataPtr rpmSoftwareList; /* avoid different archs clash */
1.1       veillard  195: extern rpmRessPtr ressList;
1.13      veillard  196: extern rpmArchPtr archList;
1.12      veillard  197: extern rpmRessPtr ressInstalledList;
1.6       veillard  198: extern rpmDirPtr dirList;
1.22      veillard  199: extern rpmSubdirPtr dirTree;
1.23      veillard  200: extern rpmRealDirPtr treeRoot;
1.22      veillard  201: 
1.30      veillard  202: /*
                    203:  * Functions
                    204:  */
1.22      veillard  205: extern rpmSubdirPtr rpmNewSubdir(rpmSubdirPtr dir, const char *name,
1.36      daniel    206:      const char *htmlpath, const char *rpmpath, const char *color, int html);
1.22      veillard  207: extern void rpmRemoveSubdir(rpmSubdirPtr tree);
                    208: extern void rpmFreeSubdir(rpmSubdirPtr tree);
1.54    ! veillard  209: extern void rpmDirFree(rpmDirPtr dir);
1.1       veillard  210: 
1.16      veillard  211: extern void rpmAddSoftware(rpmDataPtr rpm);
1.1       veillard  212: extern void rpmDataPrint(rpmDataPtr rpm);
1.34      daniel    213: extern rpmDataPtr rpmSearchSoftware(const char *name, const char *version,
                    214:                                    const char *release, const char *arch);
1.8       veillard  215: /* extern void rpmDataPrintAll(void); */
1.12      veillard  216: extern rpmRessPtr rpmRessAdd(char *ress, rpmDataPtr rpm, int installed);
1.49      veillard  217: extern rpmRessPtr rpmRequAdd(char *requ, char *requv, rpm_dep_flag requf, rpmDataPtr rpm, int installed);
1.13      veillard  218: extern rpmArchPtr rpmArchAdd(char *os, char *arch);
1.22      veillard  219: extern rpmDataPtr rpmOpen(char *nameRpm, rpmDirPtr dir, rpmSubdirPtr tree);
1.21      veillard  220: extern rpmDataPtr rpmDirScanAll(void);
1.50      veillard  221: extern void rpmDirScanOneDist(const char *dist);
1.8       veillard  222: extern char *extractEMail(char *string);
1.3       veillard  223: 
1.21      veillard  224: extern rpmDataPtr rpmAddList(rpmDataPtr old, rpmDataPtr newlist);
                    225: 
1.47      veillard  226: extern void rpmGroupSort(rpmDataPtr *list, int installed);
                    227: extern void rpmDistribSort(rpmDataPtr *list, int installed);
                    228: extern void rpmVendorSort(rpmDataPtr *list, int installed);
                    229: extern void rpmDateSort(rpmDataPtr *list, int installed);
                    230: extern void rpmNameSort(rpmDataPtr *list, int installed);
1.43      daniel    231: extern void rpmRessSort(rpmRessPtr ress);
1.1       veillard  232: 
1.24      veillard  233: extern rpmRealDirPtr rpmCreateRealRoot(void);
1.25      veillard  234: extern void rpmDestroyRealRoot(rpmRealDirPtr dir);
1.24      veillard  235: extern void rpmAddRealFile(rpmRealDirPtr root, const char *file,
                    236:                            rpmDataPtr rpm);
                    237: extern rpmRealDirPtr rpmMergeRealRoots(rpmRealDirPtr root1,
                    238:                                        rpmRealDirPtr root2);
1.38      daniel    239: extern void rpmFreeExtraData(rpmDataPtr rpm);
1.39      daniel    240: extern void rpmdataCleanup(void);
1.53      veillard  241: extern void rpmlistCleanup(void);
1.39      daniel    242: extern void rpmDataListFree(rpmDataPtr *base);
                    243: extern void rpmRessListFree(rpmRessPtr *base);
                    244: extern void rpmDirListFree(rpmDirPtr *base);
1.1       veillard  245: #endif /* __RPMDATA_H__ */

Webmaster