Annotation of rpm2html/rpmdata.h, revision 1.39

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

Webmaster