summaryrefslogtreecommitdiff
path: root/build/buildio.h
blob: f2ab33fc55fc12a4a5a150bc6ff2b603bd604584 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef	_H_BUILDIO_
#define	_H_BUILDIO_

/** \ingroup rpmbuild
 * \file build/buildio.h
 * Routines to read and write packages.
 * @deprecated this information will move elsewhere eventually.
 * @todo Eliminate, merge into rpmlib.
 */

#include <rpmbuild.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 */
typedef struct cpioSourceArchive_s {
    unsigned int cpioArchiveSize;
    FD_t	cpioFdIn;
    rpmfi	cpioList;
    struct rpmlead * lead;	/* XXX FIXME: exorcize lead/arch/os */
} * CSA_t;

/**
 * Read rpm package components from file.
 * @param fileName	file name of package (or NULL to use stdin)
 * @retval specp	spec structure to carry package header (or NULL)
 * @retval lead		package lead
 * @retval sigs		package signature
 * @param csa
 * @return		0 on success
 */
int readRPM(const char * fileName,
		rpmSpec * specp,
		struct rpmlead * lead,
		Header * sigs,
		CSA_t csa);

/**
 * Write rpm package to file.
 *
 * @warning The first argument (header) is now passed by reference in order to
 * return a reloaded contiguous header to the caller.
 *
 * @retval *hdrp	header to write (final header is returned).
 * @retval *pkgidp	header+payload MD5 of package (NULL to disable).
 * @param fileName	file name of package
 * @param type		RPMLEAD_SOURCE/RPMLEAD_BINARY
 * @param csa
 * @param passPhrase
 * @retval cookie	generated cookie (i.e build host/time)
 * @return		0 on success
 */
int writeRPM(Header * hdrp, unsigned char ** pkgidp,
		const char * fileName,
		int type,
		CSA_t csa,
		char * passPhrase,
		const char ** cookie);

#ifdef __cplusplus
}
#endif

#endif	/* _H_BUILDIO_ */