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>
19 #ifdef _RPM_4_4_COMPAT
20 #warning RPM 4.4.x compatibility layer has been removed in RPM >= 4.14
27 extern struct rpmMacroContext_s * rpmGlobalMacroContext;
29 extern struct rpmMacroContext_s * rpmCLIMacroContext;
31 extern const char * const RPMVERSION;
33 extern const char * const rpmNAME;
35 extern const char * const rpmEVR;
37 extern const int rpmFLAGS;
39 /* ==================================================================== */
43 * Build and install arch/os table identifiers.
44 * @todo Eliminate from API.
46 enum rpm_machtable_e {
47 RPM_MACHTABLE_INSTARCH = 0, /*!< Install platform architecture. */
48 RPM_MACHTABLE_INSTOS = 1, /*!< Install platform operating system. */
49 RPM_MACHTABLE_BUILDARCH = 2, /*!< Build platform architecture. */
50 RPM_MACHTABLE_BUILDOS = 3 /*!< Build platform operating system. */
52 #define RPM_MACHTABLE_COUNT 4 /*!< No. of arch/os tables. */
55 * Read macro configuration file(s) for a target.
56 * @param file colon separated files to read (NULL uses default)
57 * @param target target platform (NULL uses default)
58 * @return 0 on success, -1 on error
60 int rpmReadConfigFiles(const char * file,
64 * Return current arch name and/or number.
65 * @todo Generalize to extract arch component from target_platform macro.
66 * @retval name address of arch name (or NULL)
67 * @retval num address of arch number (or NULL)
69 void rpmGetArchInfo( const char ** name,
73 * Return color for an arch
74 * @param arch name of an architecture
75 * @return color color of arch, -1 if the arch couldn't be determined
77 int rpmGetArchColor(const char *arch);
80 * Return current os name and/or number.
81 * @todo Generalize to extract os component from target_platform macro.
82 * @retval name address of os name (or NULL)
83 * @retval num address of os number (or NULL)
85 void rpmGetOsInfo( const char ** name,
89 * Return arch/os score of a name.
90 * An arch/os score measures the "nearness" of a name to the currently
91 * running (or defined) platform arch/os. For example, the score of arch
92 * "i586" on an i686 platform is (usually) 2. The arch/os score is used
93 * to select one of several otherwise identical packages using the arch/os
94 * tags from the header as hints of the intended platform for the package.
95 * @todo Rewrite to use RE's against config.guess target platform output.
97 * @param type any of the RPM_MACHTABLE_* constants
99 * @return arch score (0 is no match, lower is preferred)
101 int rpmMachineScore(int type, const char * name);
104 * Display current rpmrc (and macro) configuration.
105 * @param fp output file handle
108 int rpmShowRC(FILE * fp);
111 * Destroy rpmrc arch/os compatibility tables.
112 * @todo Eliminate from API.
114 void rpmFreeRpmrc(void);
117 * Compare headers to determine which header is "newer".
118 * @param first 1st header
119 * @param second 2nd header
120 * @return result of comparison
122 int rpmVersionCompare(Header first, Header second);
125 * Check header consistency, performing headerGetEntry() the hard way.
127 * Sanity checks on the header are performed while looking for a
128 * header-only digest or signature to verify the blob. If found,
129 * the digest or signature is verified.
131 * @param ts transaction set
132 * @param uh unloaded header blob
133 * @param uc no. of bytes in blob (or 0 to disable)
134 * @retval *msg verification error message (or NULL)
135 * @return RPMRC_OK on success
137 rpmRC headerCheck(rpmts ts, const void * uh, size_t uc, char ** msg);
140 * Return checked and loaded header.
142 * @param fd file handle
143 * @retval hdrp address of header (or NULL)
144 * @retval *msg verification error message (or NULL)
145 * @return RPMRC_OK on success
147 rpmRC rpmReadHeader(rpmts ts, FD_t fd, Header *hdrp, char ** msg);
150 * Return package header from file handle, verifying digests/signatures.
151 * @param ts transaction set
152 * @param fd file handle
153 * @param fn file name
154 * @retval hdrp address of header (or NULL)
155 * @return RPMRC_OK on success
157 rpmRC rpmReadPackageFile(rpmts ts, FD_t fd,
158 const char * fn, Header * hdrp);
160 /** \ingroup rpmtrans
161 * Install source package.
162 * @param ts transaction set
163 * @param fd file handle
164 * @retval specFilePtr address of spec file name (or NULL)
165 * @retval cookie address of cookie pointer (or NULL)
166 * @return rpmRC return code
168 rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
172 /** \ingroup rpmtrans
173 * Segmented string compare for version or release strings.
175 * @param a 1st string
176 * @param b 2nd string
177 * @return +1 if a is "newer", 0 if equal, -1 if b is "newer"
179 int rpmvercmp(const char * a, const char * b);
185 #endif /* H_RPMLIB */