6 #include <rpmlib.h> /* for rpmds, rpmSpec */
7 #include <argv.h> /* for ARGV_t */
8 #include <rpmstring.h> /* for StringBuf */
9 #include <rpmspec.h> /* for Package */
15 extern int _rpmfc_debug;
19 typedef struct rpmfc_s * rpmfc;
25 RPMFC_ELF32 = (1 << 0),
26 RPMFC_ELF64 = (1 << 1),
27 #define RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64)
29 RPMFC_PKGCONFIG = (1 << 5),
30 RPMFC_LIBTOOL = (1 << 6),
31 RPMFC_MODULE = (1 << 7),
32 RPMFC_EXECUTABLE = (1 << 8),
33 RPMFC_SCRIPT = (1 << 9),
34 RPMFC_TEXT = (1 << 10),
35 RPMFC_DATA = (1 << 11), /* XXX unused */
36 RPMFC_DOCUMENT = (1 << 12),
37 RPMFC_STATIC = (1 << 13),
38 RPMFC_NOTSTRIPPED = (1 << 14),
39 RPMFC_COMPRESSED = (1 << 15),
41 RPMFC_DIRECTORY = (1 << 16),
42 RPMFC_SYMLINK = (1 << 17),
43 RPMFC_DEVICE = (1 << 18),
44 RPMFC_LIBRARY = (1 << 19),
45 RPMFC_ARCHIVE = (1 << 20),
46 RPMFC_FONT = (1 << 21),
47 RPMFC_IMAGE = (1 << 22),
48 RPMFC_MANPAGE = (1 << 23),
50 RPMFC_PERL = (1 << 24),
51 RPMFC_JAVA = (1 << 25),
52 RPMFC_PYTHON = (1 << 26),
53 RPMFC_PHP = (1 << 27),
54 RPMFC_TCL = (1 << 28),
55 RPMFC_MONO = (1 << 6),
57 RPMFC_WHITE = (1 << 29),
58 RPMFC_INCLUDE = (1 << 30),
59 RPMFC_ERROR = (1 << 31)
61 typedef enum FCOLOR_e FCOLOR_t;
65 typedef struct rpmfcTokens_s * rpmfcToken;
68 * Return helper output.
69 * @param av helper argv (with possible macros)
70 * @param sb_stdin helper input
71 * @retval *sb_stdoutp helper output
72 * @param failnonzero IS non-zero helper exit status a failure?
74 int rpmfcExec(ARGV_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
78 * Return file color given file(1) string.
79 * @param fmstr file(1) string
82 int rpmfcColoring(const char * fmstr);
85 * Print results of file classification.
86 * @todo Remove debugging routine.
87 * @param msg message prefix (NULL for none)
88 * @param fc file classifier
89 * @param fp output file handle (NULL for stderr)
91 void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp);
94 * Destroy a file classifier.
95 * @param fc file classifier
98 rpmfc rpmfcFree(rpmfc fc);
101 * Create a file classifier.
102 * @return new file classifier
104 rpmfc rpmfcNew(void);
107 * Build file class dictionary and mappings.
108 * @param fc file classifier
109 * @param argv files to classify
110 * @param fmode files mode_t array (or NULL)
111 * @return 0 on success
113 int rpmfcClassify(rpmfc fc, ARGV_t argv, int16_t * fmode);
116 * Build file/package dependency dictionary and mappings.
117 * @param fc file classifier
118 * @return 0 on success
120 int rpmfcApply(rpmfc fc);
123 * Generate package dependencies.
124 * @param spec spec file control
125 * @param pkg package control
126 * @return 0 on success
128 int rpmfcGenerateDepends(const rpmSpec spec, Package pkg);
131 * Retrieve file classification provides
132 * @param fc file classifier
133 * @return rpmds dependency set of fc provides
135 rpmds rpmfcProvides(rpmfc fc);
138 * Retrieve file classification requires
139 * @param fc file classifier
140 * @return rpmds dependency set of fc requires
142 rpmds rpmfcRequires(rpmfc fc);
148 #endif /* _H_RPMFC_ */