1998-07-25 23:10:58 +08:00
|
|
|
#ifndef _H_SPEC_
|
|
|
|
#define _H_SPEC_
|
1996-06-08 02:29:21 +08:00
|
|
|
|
2000-08-28 03:18:25 +08:00
|
|
|
/** \ingroup rpmbuild
|
|
|
|
* \file build/rpmspec.h
|
2007-09-21 20:23:02 +08:00
|
|
|
* The rpmSpec and Package data structures used during build.
|
2000-01-25 04:02:32 +08:00
|
|
|
*/
|
|
|
|
|
2007-12-08 20:02:32 +08:00
|
|
|
#include <rpm/rpmstring.h> /* StringBuf */
|
|
|
|
#include <rpm/rpmcli.h> /* for QVA_t */
|
2007-10-08 19:14:10 +08:00
|
|
|
|
2007-10-08 16:05:06 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
/** \ingroup rpmbuild
|
|
|
|
*/
|
|
|
|
typedef struct Package_s * Package;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
1998-03-21 06:38:00 +08:00
|
|
|
struct TriggerFileEntry {
|
|
|
|
int index;
|
2008-05-05 18:52:19 +08:00
|
|
|
char * fileName;
|
|
|
|
char * script;
|
|
|
|
char * prog;
|
|
|
|
struct TriggerFileEntry * next;
|
1998-03-21 06:38:00 +08:00
|
|
|
};
|
|
|
|
|
2002-01-19 06:51:30 +08:00
|
|
|
#define RPMBUILD_ISSOURCE (1 << 0)
|
|
|
|
#define RPMBUILD_ISPATCH (1 << 1)
|
|
|
|
#define RPMBUILD_ISICON (1 << 2)
|
|
|
|
#define RPMBUILD_ISNO (1 << 3)
|
1998-01-13 05:31:29 +08:00
|
|
|
|
|
|
|
#define RPMBUILD_DEFAULT_LANG "C"
|
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
1998-01-13 05:31:29 +08:00
|
|
|
struct Source {
|
2008-05-05 18:52:19 +08:00
|
|
|
char * fullSource;
|
|
|
|
char * source; /* Pointer into fullSource */
|
1998-01-13 05:31:29 +08:00
|
|
|
int flags;
|
|
|
|
int num;
|
2007-09-12 05:03:27 +08:00
|
|
|
struct Source * next;
|
1998-01-13 05:31:29 +08:00
|
|
|
};
|
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
1999-07-20 02:39:48 +08:00
|
|
|
typedef struct ReadLevelEntry {
|
1998-01-13 05:31:29 +08:00
|
|
|
int reading;
|
2002-01-19 06:51:30 +08:00
|
|
|
struct ReadLevelEntry * next;
|
1999-07-20 02:39:48 +08:00
|
|
|
} RLE_t;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
1999-07-20 02:39:48 +08:00
|
|
|
typedef struct OpenFileInfo {
|
2008-03-25 01:03:00 +08:00
|
|
|
char * fileName;
|
1999-12-08 05:14:51 +08:00
|
|
|
FD_t fd;
|
1998-10-07 01:34:58 +08:00
|
|
|
int lineNum;
|
|
|
|
char readBuf[BUFSIZ];
|
2002-01-19 06:51:30 +08:00
|
|
|
char * readPtr;
|
|
|
|
struct OpenFileInfo * next;
|
1999-07-20 02:39:48 +08:00
|
|
|
} OFI_t;
|
1998-10-07 01:34:58 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2001-05-07 03:17:14 +08:00
|
|
|
typedef struct spectag_s {
|
1999-02-23 01:44:57 +08:00
|
|
|
int t_tag;
|
|
|
|
int t_startx;
|
|
|
|
int t_nlines;
|
2008-03-25 01:03:00 +08:00
|
|
|
char * t_lang;
|
|
|
|
char * t_msgid;
|
2001-05-07 03:17:14 +08:00
|
|
|
} * spectag;
|
1999-02-23 01:44:57 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2001-05-07 03:17:14 +08:00
|
|
|
typedef struct spectags_s {
|
2008-05-05 18:52:19 +08:00
|
|
|
spectag st_t;
|
1999-02-23 01:44:57 +08:00
|
|
|
int st_nalloc;
|
|
|
|
int st_ntags;
|
2001-05-07 03:17:14 +08:00
|
|
|
} * spectags;
|
1999-02-23 01:44:57 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2001-05-07 03:17:14 +08:00
|
|
|
typedef struct speclines_s {
|
2008-05-05 18:52:19 +08:00
|
|
|
char **sl_lines;
|
1999-02-23 01:44:57 +08:00
|
|
|
int sl_nalloc;
|
|
|
|
int sl_nlines;
|
2001-05-07 03:17:14 +08:00
|
|
|
} * speclines;
|
1999-02-23 01:44:57 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
* The structure used to store values parsed from a spec file.
|
|
|
|
*/
|
2007-09-21 20:23:02 +08:00
|
|
|
struct rpmSpec_s {
|
2008-03-25 01:03:20 +08:00
|
|
|
char * specFile; /*!< Name of the spec file. */
|
2008-04-05 01:37:48 +08:00
|
|
|
char * buildRoot;
|
2008-03-25 01:03:20 +08:00
|
|
|
char * buildSubdir;
|
2008-04-05 01:37:48 +08:00
|
|
|
char * rootDir;
|
2002-12-22 04:37:37 +08:00
|
|
|
|
|
|
|
speclines sl;
|
|
|
|
spectags st;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
struct OpenFileInfo * fileStack;
|
2004-04-09 04:27:53 +08:00
|
|
|
char lbuf[10*BUFSIZ];
|
|
|
|
char *lbufPtr;
|
1999-07-20 05:25:53 +08:00
|
|
|
char nextpeekc;
|
2002-12-22 04:37:37 +08:00
|
|
|
char * nextline;
|
|
|
|
char * line;
|
1998-01-13 05:31:29 +08:00
|
|
|
int lineNum;
|
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
struct ReadLevelEntry * readStack;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
Header buildRestrictions;
|
2007-09-21 20:23:02 +08:00
|
|
|
rpmSpec * BASpecs;
|
2002-12-22 04:37:37 +08:00
|
|
|
const char ** BANames;
|
2001-05-07 03:17:14 +08:00
|
|
|
int BACount;
|
2002-12-22 04:37:37 +08:00
|
|
|
int recursing; /*!< parse is recursive? */
|
1998-07-25 23:10:58 +08:00
|
|
|
|
1998-11-20 08:29:46 +08:00
|
|
|
int force;
|
|
|
|
int anyarch;
|
|
|
|
|
2008-04-05 01:37:48 +08:00
|
|
|
int gotBuildRoot;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
char * passPhrase;
|
1998-01-13 05:31:29 +08:00
|
|
|
int timeCheck;
|
2008-03-25 01:03:20 +08:00
|
|
|
char * cookie;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
struct Source * sources;
|
1998-01-13 05:31:29 +08:00
|
|
|
int numSources;
|
|
|
|
int noSource;
|
|
|
|
|
2008-03-25 01:03:20 +08:00
|
|
|
char * sourceRpmName;
|
2002-12-24 10:41:45 +08:00
|
|
|
unsigned char * sourcePkgId;
|
2001-10-29 06:17:47 +08:00
|
|
|
Header sourceHeader;
|
2002-05-20 02:42:25 +08:00
|
|
|
rpmfi sourceCpioList;
|
1998-07-25 23:10:58 +08:00
|
|
|
|
2007-09-20 20:52:03 +08:00
|
|
|
rpmMacroContext macros;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
StringBuf prep; /*!< %prep scriptlet. */
|
|
|
|
StringBuf build; /*!< %build scriptlet. */
|
|
|
|
StringBuf install; /*!< %install scriptlet. */
|
|
|
|
StringBuf check; /*!< %check scriptlet. */
|
|
|
|
StringBuf clean; /*!< %clean scriptlet. */
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
Package packages; /*!< Package list. */
|
1998-01-13 05:31:29 +08:00
|
|
|
};
|
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
* The structure used to store values for a package.
|
|
|
|
*/
|
2002-12-22 04:37:37 +08:00
|
|
|
struct Package_s {
|
2001-10-29 06:17:47 +08:00
|
|
|
Header header;
|
2002-12-24 15:21:04 +08:00
|
|
|
rpmds ds; /*!< Requires: N = EVR */
|
2002-05-20 02:42:25 +08:00
|
|
|
rpmfi cpioList;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
struct Source * icon;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
1999-03-27 04:07:34 +08:00
|
|
|
int autoReq;
|
|
|
|
int autoProv;
|
1998-01-13 05:31:29 +08:00
|
|
|
|
2008-03-25 01:03:20 +08:00
|
|
|
char * preInFile; /*!< %pre scriptlet. */
|
|
|
|
char * postInFile; /*!< %post scriptlet. */
|
|
|
|
char * preUnFile; /*!< %preun scriptlet. */
|
|
|
|
char * postUnFile; /*!< %postun scriptlet. */
|
|
|
|
char * preTransFile; /*!< %pretrans scriptlet. */
|
|
|
|
char * postTransFile; /*!< %posttrans scriptlet. */
|
|
|
|
char * verifyFile; /*!< %verifyscript scriptlet. */
|
1995-11-28 06:31:21 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
StringBuf specialDoc;
|
2008-05-06 17:48:09 +08:00
|
|
|
char *specialDocDir;
|
1998-07-25 23:10:58 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
struct TriggerFileEntry * triggerFiles;
|
1998-07-25 23:10:58 +08:00
|
|
|
|
2008-03-25 01:03:20 +08:00
|
|
|
char * fileFile;
|
2002-12-22 04:37:37 +08:00
|
|
|
StringBuf fileList; /* If NULL, package will not be written */
|
1995-11-28 06:31:21 +08:00
|
|
|
|
2002-12-22 04:37:37 +08:00
|
|
|
Package next;
|
1998-01-13 05:31:29 +08:00
|
|
|
};
|
1995-11-28 06:31:21 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2007-09-21 20:23:02 +08:00
|
|
|
* Create and initialize rpmSpec structure.
|
2001-05-07 03:17:14 +08:00
|
|
|
* @return spec spec file control structure
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2007-09-21 20:23:02 +08:00
|
|
|
rpmSpec newSpec(void);
|
2000-11-16 04:44:57 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
|
|
|
* Destroy Spec structure.
|
|
|
|
* @param spec spec file control structure
|
2001-05-07 03:17:14 +08:00
|
|
|
* @return NULL always
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2007-09-21 20:23:02 +08:00
|
|
|
rpmSpec freeSpec(rpmSpec spec);
|
2000-11-16 04:44:57 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2002-12-22 10:11:05 +08:00
|
|
|
* Function to query spec file(s).
|
|
|
|
* @param ts transaction set
|
|
|
|
* @param qva parsed query/verify options
|
|
|
|
* @param arg query argument
|
|
|
|
* @return 0 on success, else no. of failures
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2007-09-12 05:03:27 +08:00
|
|
|
int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg);
|
1995-12-28 00:39:10 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2007-09-12 05:03:27 +08:00
|
|
|
struct OpenFileInfo * newOpenFileInfo(void);
|
2000-11-16 04:44:57 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2007-10-06 10:42:32 +08:00
|
|
|
* stashSt.
|
2001-01-11 22:13:04 +08:00
|
|
|
* @param spec spec file control structure
|
2007-10-06 10:42:32 +08:00
|
|
|
* @param h header
|
|
|
|
* @param tag tag
|
|
|
|
* @param lang locale
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2008-02-05 23:42:19 +08:00
|
|
|
spectag stashSt(rpmSpec spec, Header h, rpmTag tag, const char * lang);
|
1998-10-07 01:34:58 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2007-10-06 10:42:32 +08:00
|
|
|
* addSource.
|
2001-01-11 22:13:04 +08:00
|
|
|
* @param spec spec file control structure
|
2002-12-03 10:57:02 +08:00
|
|
|
* @param pkg package control
|
2007-10-06 10:42:32 +08:00
|
|
|
* @param field field to parse
|
|
|
|
* @param tag tag
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2008-02-05 23:42:19 +08:00
|
|
|
int addSource(rpmSpec spec, Package pkg, const char * field, rpmTag tag);
|
2000-11-16 04:44:57 +08:00
|
|
|
|
2001-01-11 22:13:04 +08:00
|
|
|
/** \ingroup rpmbuild
|
2007-10-06 10:42:32 +08:00
|
|
|
* parseNoSource.
|
2001-01-11 22:13:04 +08:00
|
|
|
* @param spec spec file control structure
|
2007-10-06 10:42:32 +08:00
|
|
|
* @param field field to parse
|
|
|
|
* @param tag tag
|
2000-11-16 04:44:57 +08:00
|
|
|
*/
|
2008-02-05 23:42:19 +08:00
|
|
|
int parseNoSource(rpmSpec spec, const char * field, rpmTag tag);
|
1996-05-18 02:35:55 +08:00
|
|
|
|
1998-07-25 23:10:58 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _H_SPEC_ */
|