summaryrefslogtreecommitdiff
path: root/build/rpmbuild.h
blob: 51a735d3dfbf3284e607ee7fa3507656e2bec7e9 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifndef	_H_RPMBUILD_
#define	_H_RPMBUILD_

/** \ingroup rpmbuild
 * \file build/rpmbuild.h
 *  This is the *only* module users of librpmbuild should need to include.
 */

#include <rpm/rpmcli.h>
#include <rpm/rpmds.h>
#include <rpm/rpmspec.h>

#ifdef __cplusplus
extern "C" {
#endif

/** \ingroup rpmbuild
 * Bit(s) to control rpmSpecBuild() operation.
 */
enum rpmBuildFlags_e {
    RPMBUILD_NONE	= 0,
    RPMBUILD_PREP	= (1 <<  0),	/*!< Execute %%prep. */
    RPMBUILD_BUILD	= (1 <<  1),	/*!< Execute %%build. */
    RPMBUILD_INSTALL	= (1 <<  2),	/*!< Execute %%install. */
    RPMBUILD_CHECK	= (1 <<  3),	/*!< Execute %%check. */
    RPMBUILD_CLEAN	= (1 <<  4),	/*!< Execute %%clean. */
    RPMBUILD_FILECHECK	= (1 <<  5),	/*!< Check %%files manifest. */
    RPMBUILD_PACKAGESOURCE = (1 <<  6),	/*!< Create source package. */
    RPMBUILD_PACKAGEBINARY = (1 <<  7),	/*!< Create binary package(s). */
    RPMBUILD_RMSOURCE	= (1 <<  8),	/*!< Remove source(s) and patch(s). */
    RPMBUILD_RMBUILD	= (1 <<  9),	/*!< Remove build sub-tree. */
    RPMBUILD_STRINGBUF	= (1 << 10),	/*!< Internal use only */
    RPMBUILD_RMSPEC	= (1 << 11),	/*!< Remove spec file. */

    RPMBUILD_NOBUILD	= (1 << 31)	/*!< Don't execute or package. */
};

typedef rpmFlags rpmBuildFlags;

/** \ingroup rpmbuild
 * Bit(s) to control package generation
 */
enum rpmBuildPkgFlags_e {
    RPMBUILD_PKG_NONE		= 0,
    RPMBUILD_PKG_NODIRTOKENS	= (1 << 0), /*!< Legacy filename layout */
};

typedef rpmFlags rpmBuildPkgFlags;

/** \ingroup rpmbuild
 * Describe build request.
 */
struct rpmBuildArguments_s {
    rpmBuildPkgFlags pkgFlags;	/*!< Bit(s) to control package generation. */
    rpmBuildFlags buildAmount;	/*!< Bit(s) to control build execution. */
    char * buildRootOverride; 	/*!< from --buildroot */
    char * cookie;		/*!< NULL for binary, ??? for source, rpm's */
    const char * rootdir;
};

/** \ingroup rpmbuild
 */
typedef	struct rpmBuildArguments_s *	BTA_t;

/** \ingroup rpmbuild
 * Parse spec file into spec control structure.
 * @todo Eliminate buildRoot from here, its a build, not spec property
 *
 * @param specFile	path to spec file
 * @param flags		flags to control operation
 * @param buildRoot	buildRoot override or NULL for default
 * @return		new spec control structure
 */
rpmSpec rpmSpecParse(const char *specFile, rpmSpecFlags flags,
		     const char *buildRoot);

/** \ingroup rpmbuild
 * Return the headers of the SRPM that would be built from the spec file
 * @param spec		path to spec file
 * @return		Header
 */
Header rpmSpecSourceHeader(rpmSpec spec);

/** \ingroup rpmbuild
 * Verify build depencies of a spec against.
 * @param ts		(empty) transaction set
 * @param spec		parsed spec control structure
 * @return		rpm problem set or NULL on no problems
 */
rpmps rpmSpecCheckDeps(rpmts ts, rpmSpec spec);

/** \ingroup rpmbuild
 * Retrieve build dependency set from spec.
 * @param spec		parsed spec control structure
 * @param tag		dependency tag
 * @return		dependency set of tag (or NULL)
 */
rpmds rpmSpecDS(rpmSpec spec, rpmTagVal tag);

/** \ingroup rpmbuild
 * Spec build stages state machine driver.
 * @param spec		spec file control structure
 * @param buildArgs	build arguments
 * @return		RPMRC_OK on success
 */
rpmRC rpmSpecBuild(rpmSpec spec, BTA_t buildArgs);

#ifdef __cplusplus
}
#endif

#endif	/* _H_RPMBUILD_ */