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

Generated at Thu Apr 19 15:29:43 2001 for rpm by doxygen1.2.6-20010408 written by Dimitri van Heesch, © 1997-2001