4 /** \ingroup rpmfc rpmbuild
6 * Structures and methods for build-time file classification.
11 #include <rpm/rpmtypes.h>
12 #include <rpm/argv.h> /* for ARGV_t */
13 #include <rpm/rpmstring.h> /* for StringBuf */
14 #include <rpm/rpmspec.h> /* for Package */
20 extern int _rpmfc_debug;
24 typedef struct rpmfc_s * rpmfc;
30 RPMFC_ELF32 = (1 << 0),
31 RPMFC_ELF64 = (1 << 1),
32 RPMFC_ELFMIPSN32 = (1 << 2),
33 #define RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32)
34 /* (1 << 3) leaks into package headers, reserved */
37 RPMFC_PKGCONFIG = (1 << 8),
38 RPMFC_LIBTOOL = (1 << 9),
39 RPMFC_BOURNE = (1 << 10),
40 RPMFC_MONO = (1 << 11),
42 RPMFC_SCRIPT = (1 << 12),
43 RPMFC_STATIC = (1 << 13),
44 RPMFC_NOTSTRIPPED = (1 << 14),
47 /* bits 16-19 are enumerated, not bits */
48 RPMFC_DIRECTORY = (1 << 16),
49 RPMFC_SYMLINK = (2 << 16),
50 RPMFC_DEVICE = (3 << 16),
51 RPMFC_LIBRARY = (4 << 16),
52 RPMFC_FONT = (5 << 16),
53 RPMFC_IMAGE = (6 << 16),
54 RPMFC_MANPAGE = (7 << 16),
55 RPMFC_TEXT = (8 << 16),
56 RPMFC_DOCUMENT = (9 << 16),
58 RPMFC_ARCHIVE = (1 << 20),
59 RPMFC_COMPRESSED = (1 << 21),
60 RPMFC_MODULE = (1 << 22),
61 RPMFC_EXECUTABLE = (1 << 23),
63 RPMFC_PERL = (1 << 24),
64 RPMFC_JAVA = (1 << 25),
65 RPMFC_PYTHON = (1 << 26),
66 RPMFC_PHP = (1 << 27),
67 RPMFC_TCL = (1 << 28),
69 RPMFC_WHITE = (1 << 29),
70 RPMFC_INCLUDE = (1 << 30),
71 RPMFC_ERROR = (1 << 31)
76 typedef enum FCOLOR_e FCOLOR_t;
80 typedef const struct rpmfcTokens_s * rpmfcToken;
83 * Return helper output.
84 * @param av helper argv (with possible macros)
85 * @param sb_stdin helper input
86 * @retval *sb_stdoutp helper output
87 * @param failnonzero IS non-zero helper exit status a failure?
89 int rpmfcExec(ARGV_const_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
93 * Return file color given file(1) string.
94 * @param fmstr file(1) string
97 int rpmfcColoring(const char * fmstr);
100 * Print results of file classification.
101 * @todo Remove debugging routine.
102 * @param msg message prefix (NULL for none)
103 * @param fc file classifier
104 * @param fp output file handle (NULL for stderr)
106 void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp);
109 * Destroy a file classifier.
110 * @param fc file classifier
111 * @return NULL always
113 rpmfc rpmfcFree(rpmfc fc);
116 * Create a file classifier.
117 * @return new file classifier
119 rpmfc rpmfcNew(void);
122 * Build file class dictionary and mappings.
123 * @param fc file classifier
124 * @param argv files to classify
125 * @param fmode files mode_t array (or NULL)
126 * @return RPMRC_OK on success
128 rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode);
131 * Build file/package dependency dictionary and mappings.
132 * @param fc file classifier
133 * @return RPMRC_OK on success
135 rpmRC rpmfcApply(rpmfc fc);
138 * Generate package dependencies.
139 * @param spec spec file control
140 * @param pkg package control
141 * @return RPMRC_OK on success
143 rpmRC rpmfcGenerateDepends(const rpmSpec spec, Package pkg);
146 * Retrieve file classification provides
147 * @param fc file classifier
148 * @return rpmds dependency set of fc provides
150 rpmds rpmfcProvides(rpmfc fc);
153 * Retrieve file classification requires
154 * @param fc file classifier
155 * @return rpmds dependency set of fc requires
157 rpmds rpmfcRequires(rpmfc fc);
163 #endif /* _H_RPMFC_ */