Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

lib/rpmlibprov.c

Go to the documentation of this file.
00001 
00005 #include "system.h"
00006 
00007 #include <rpmlib.h>
00008 #include "debug.h"
00009 
00010 static struct rpmlibProvides {
00011     const char * featureName;
00012     const char * featureEVR;
00013     int featureFlags;
00014     const char * featureDescription;
00015 } rpmlibProvides[] = {
00016     { "rpmlib(VersionedDependencies)",  "3.0.3-1",
00017         (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
00018         "PreReq:, Provides:, and Obsoletes: dependencies support versions." },
00019     { "rpmlib(CompressedFileNames)",    "3.0.4-1",
00020         (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
00021         "file names stored as (dirName,BaseName,dirIndex) tuple, not as path."},
00022     { "rpmlib(PayloadIsBzip2)",         "3.0.5-1",
00023         (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
00024         "package payload compressed using bzip2." },
00025     { "rpmlib(PayloadFilesHavePrefix)", "4.0-1",
00026         (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
00027         "package payload files have \"./\" prefix." },
00028     { "rpmlib(ExplicitPackageProvide)", "4.0-1",
00029         (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
00030         "package name-version-release not implicitly provided." },
00031     { "rpmlib(HeaderLoadSortsTags)",    "4.0.1-1",      RPMSENSE_EQUAL,
00032         "header tags are always sorted after being loaded." },
00033     { NULL,                             NULL,   0 }
00034 };
00035 
00036 void rpmShowRpmlibProvides(FILE * fp)
00037 {
00038     const struct rpmlibProvides * rlp;
00039 
00040     for (rlp = rpmlibProvides; rlp->featureName != NULL; rlp++) {
00041         fprintf(fp, "    %s", rlp->featureName);
00042         if (rlp->featureFlags)
00043             printDepFlags(fp, rlp->featureEVR, rlp->featureFlags);
00044         fprintf(fp, "\n");
00045         fprintf(fp, "\t%s\n", rlp->featureDescription);
00046     }
00047 }
00048 
00049 int rpmCheckRpmlibProvides(const char * keyName, const char * keyEVR,
00050         int keyFlags)
00051 {
00052     const struct rpmlibProvides * rlp;
00053     int rc = 0;
00054 
00055     for (rlp = rpmlibProvides; rlp->featureName != NULL; rlp++) {
00056         rc = rpmRangesOverlap(keyName, keyEVR, keyFlags,
00057                 rlp->featureName, rlp->featureEVR, rlp->featureFlags);
00058         if (rc)
00059             break;
00060     }
00061     return rc;
00062 }
00063 
00064 int rpmGetRpmlibProvides(const char *** provNames, int ** provFlags,
00065                          const char *** provVersions)
00066 {
00067     const char ** names, ** versions;
00068     int * flags;
00069     int n = 0;
00070     
00071     while (rpmlibProvides[n].featureName != NULL)
00072         n++;
00073 
00074     names = xmalloc(sizeof(*names) * (n+1));
00075     versions = xmalloc(sizeof(*versions) * (n+1));
00076     flags = xmalloc(sizeof(*flags) * (n+1));
00077     
00078     for (n = 0; rpmlibProvides[n].featureName != NULL; n++) {
00079         names[n] = rpmlibProvides[n].featureName;
00080         flags[n] = rpmlibProvides[n].featureFlags;
00081         versions[n] = rpmlibProvides[n].featureEVR;
00082     }
00083     
00084     names[n] = NULL;
00085     versions[n] = NULL;
00086     flags[n] = -1;
00087     
00088     *provNames = names;
00089     *provFlags = flags;
00090     *provVersions = versions;
00091     return n;
00092 }

Generated at Mon May 21 08:53:40 2001 for rpm by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001