4 /** \ingroup rpmcli rpmrc rpmdep rpmtrans rpmdb lead signature header payload dbi
7 * In Memoriam: Steve Taylor <staylor@redhat.com> was here, now he's not.
13 #include <rpm/rpmio.h>
14 #include <rpm/header.h>
15 #include <rpm/rpmtag.h>
16 #include <rpm/rpmds.h> /* XXX move rpmlib provides to rpmds instead */
17 #include <rpm/rpmpgp.h>
18 #ifdef _RPM_4_4_COMPAT
19 #include <rpm/rpmlegacy.h> /* legacy compat definitions if enabled */
26 extern struct rpmMacroContext_s * rpmGlobalMacroContext;
28 extern struct rpmMacroContext_s * rpmCLIMacroContext;
30 extern const char * const RPMVERSION;
32 extern const char * const rpmNAME;
34 extern const char * const rpmEVR;
36 extern const int rpmFLAGS;
38 /* ==================================================================== */
42 * Build and install arch/os table identifiers.
43 * @todo Eliminate from API.
45 enum rpm_machtable_e {
46 RPM_MACHTABLE_INSTARCH = 0, /*!< Install platform architecture. */
47 RPM_MACHTABLE_INSTOS = 1, /*!< Install platform operating system. */
48 RPM_MACHTABLE_BUILDARCH = 2, /*!< Build platform architecture. */
49 RPM_MACHTABLE_BUILDOS = 3 /*!< Build platform operating system. */
51 #define RPM_MACHTABLE_COUNT 4 /*!< No. of arch/os tables. */
54 * Read macro configuration file(s) for a target.
55 * @param file colon separated files to read (NULL uses default)
56 * @param target target platform (NULL uses default)
57 * @return 0 on success, -1 on error
59 int rpmReadConfigFiles(const char * file,
63 * Return current arch name and/or number.
64 * @todo Generalize to extract arch component from target_platform macro.
65 * @retval name address of arch name (or NULL)
66 * @retval num address of arch number (or NULL)
68 void rpmGetArchInfo( const char ** name,
72 * Return color for an arch
73 * @param arch name of an architecture
74 * @return color color of arch, -1 if the arch couldn't be determined
76 int rpmGetArchColor(const char *arch);
79 * Return current os name and/or number.
80 * @todo Generalize to extract os component from target_platform macro.
81 * @retval name address of os name (or NULL)
82 * @retval num address of os number (or NULL)
84 void rpmGetOsInfo( const char ** name,
88 * Return arch/os score of a name.
89 * An arch/os score measures the "nearness" of a name to the currently
90 * running (or defined) platform arch/os. For example, the score of arch
91 * "i586" on an i686 platform is (usually) 2. The arch/os score is used
92 * to select one of several otherwise identical packages using the arch/os
93 * tags from the header as hints of the intended platform for the package.
94 * @todo Rewrite to use RE's against config.guess target platform output.
96 * @param type any of the RPM_MACHTABLE_* constants
98 * @return arch score (0 is no match, lower is preferred)
100 int rpmMachineScore(int type, const char * name);
103 * Display current rpmrc (and macro) configuration.
104 * @param fp output file handle
107 int rpmShowRC(FILE * fp);
110 * Destroy rpmrc arch/os compatibility tables.
111 * @todo Eliminate from API.
113 void rpmFreeRpmrc(void);
116 * Compare headers to determine which header is "newer".
117 * @param first 1st header
118 * @param second 2nd header
119 * @return result of comparison
121 int rpmVersionCompare(Header first, Header second);
124 * Check header consistency, performing headerGetEntry() the hard way.
126 * Sanity checks on the header are performed while looking for a
127 * header-only digest or signature to verify the blob. If found,
128 * the digest or signature is verified.
130 * @param ts transaction set
131 * @param uh unloaded header blob
132 * @param uc no. of bytes in blob (or 0 to disable)
133 * @retval *msg verification error message (or NULL)
134 * @return RPMRC_OK on success
136 rpmRC headerCheck(rpmts ts, const void * uh, size_t uc, char ** msg);
139 * Return checked and loaded header.
140 * @param ts transaction set
141 * @param fd file handle
142 * @retval hdrp address of header (or NULL)
143 * @retval *msg verification error message (or NULL)
144 * @return RPMRC_OK on success
146 rpmRC rpmReadHeader(rpmts ts, FD_t fd, Header *hdrp, char ** msg);
149 * Return package header from file handle, verifying digests/signatures.
150 * @param ts transaction set
151 * @param fd file handle
152 * @param fn file name
153 * @retval hdrp address of header (or NULL)
154 * @return RPMRC_OK on success
156 rpmRC rpmReadPackageFile(rpmts ts, FD_t fd,
157 const char * fn, Header * hdrp);
159 /** \ingroup rpmtrans
160 * Install source package.
161 * @param ts transaction set
162 * @param fd file handle
163 * @retval specFilePtr address of spec file name (or NULL)
164 * @retval cookie address of cookie pointer (or NULL)
165 * @return rpmRC return code
167 rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
171 /** \ingroup rpmtrans
172 * Segmented string compare for version or release strings.
174 * @param a 1st string
175 * @param b 2nd string
176 * @return +1 if a is "newer", 0 if equal, -1 if b is "newer"
178 int rpmvercmp(const char * a, const char * b);
184 #endif /* H_RPMLIB */