rpm  5.4.10
Functions | Variables
parsePrep.c File Reference

Parse prep section from spec file. More...

#include "system.h"
#include <rpmio.h>
#include <rpmiotypes.h>
#include <argv.h>
#include <rpmcb.h>
#include <rpmurl.h>
#include <rpmbuild.h>
#include "misc.h"
#include "debug.h"
Include dependency graph for parsePrep.c:

Go to the source code of this file.

Functions

static rpmRC checkOwners (const char *urlfn)
 Check that file owner and group are known. More...
 
static char * doPatch (Spec spec, rpmuint32_t c, int strip, const char *db, int reverse, int removeEmpties, int fuzz, const char *subdir)
 Expand patchN macro into prep scriptlet. More...
 
static const char * doUntar (Spec spec, rpmuint32_t c, int quietly)
 Expand setup macro into prep scriptlet. More...
 
static int doSetupMacro (Spec spec, const char *line)
 Parse setup macro. More...
 
static rpmRC doPatchMacro (Spec spec, const char *line)
 Parse patch line. More...
 
static void prepFetchVerbose (struct Source *sp, struct stat *st)
 
static int prepFetch (Spec spec)
 Check that all sources/patches/icons exist locally, fetching if necessary. More...
 
int parsePrep (Spec spec, int verify)
 Parse %prep section of a spec file. More...
 

Variables

static int leaveDirs
 
static int skipDefaultAction
 
static int createDir
 
static int quietly
 
static const char * dirName = NULL
 
static struct poptOption optionsTable []
 

Detailed Description

Parse prep section from spec file.

Definition in file parsePrep.c.

Function Documentation

§ checkOwners()

static rpmRC checkOwners ( const char *  urlfn)
static

Check that file owner and group are known.

Parameters
urlfnfile url
Returns
RPMRC_OK on success

Definition at line 46 of file parsePrep.c.

References _, errno, getGname(), getUname(), Lstat(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, and RPMRC_OK.

Referenced by doPatch(), and doUntar().

§ doPatch()

static char* doPatch ( Spec  spec,
rpmuint32_t  c,
int  strip,
const char *  db,
int  reverse,
int  removeEmpties,
int  fuzz,
const char *  subdir 
)
static

Expand patchN macro into prep scriptlet.

Parameters
specbuild info
cpatch index
strippatch level (i.e. patch -p argument)
dbsaved file suffix (i.e. patch –suffix argument)
reverseinclude -R?
removeEmptiesinclude -E?
fuzzinclude -F? (fuzz<0 means no)
subdirsub-directory (i.e patch -d argument);
Returns
expanded patch macro (NULL on error)

Definition at line 79 of file parsePrep.c.

References _, _free(), checkOwners(), COMPRESSED_BZIP2, COMPRESSED_LZMA, COMPRESSED_LZOP, COMPRESSED_NOT, COMPRESSED_OTHER, COMPRESSED_XZ, COMPRESSED_ZIP, Source::flags, Spec_s::force, isCompressed(), Source::next, Source::num, rpmExpand(), RPMFILE_PATCH, rpmGenPath(), rpmGetPath(), rpmlog(), RPMLOG_ERR, Source::source, Spec_s::sources, stpcpy(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and xstrdup().

Referenced by doPatchMacro().

§ doPatchMacro()

static rpmRC doPatchMacro ( Spec  spec,
const char *  line 
)
static

Parse patch line.

Parameters
specbuild info
linecurrent line from spec file
Returns
RPMRC_OK on success

Definition at line 577 of file parsePrep.c.

References _, doPatch(), Spec_s::line, Spec_s::lineNum, parseNum(), Spec_s::prep, rpmExpandNumeric(), rpmiobAppend(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, and RPMRC_OK.

Referenced by parsePrep().

§ doSetupMacro()

static int doSetupMacro ( Spec  spec,
const char *  line 
)
static

§ doUntar()

static const char* doUntar ( Spec  spec,
rpmuint32_t  c,
int  quietly 
)
static

§ parsePrep()

int parsePrep ( Spec  spec,
int  verify 
)

Parse %prep section of a spec file.

Parameters
specspec file control structure
verifyverify existence of sources/patches?
Returns
>= 0 next rpmParseState, < 0 on error

Definition at line 887 of file parsePrep.c.

References _, argvFree(), argvSplit(), doPatchMacro(), doSetupMacro(), Spec_s::force, isPart(), Spec_s::line, Spec_s::lineNum, PART_NONE, Spec_s::prep, prepFetch(), readLine(), rpmiobAppend(), rpmiobFree(), rpmiobNew(), rpmiobStr(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, and STRIP_NOTHING.

Referenced by parseSpec().

§ prepFetch()

static int prepFetch ( Spec  spec)
static

§ prepFetchVerbose()

static void prepFetchVerbose ( struct Source sp,
struct stat *  st 
)
static

Variable Documentation

§ createDir

int createDir
static

Definition at line 26 of file parsePrep.c.

Referenced by doSetupMacro().

§ dirName

const char* dirName = NULL
static

§ leaveDirs

int leaveDirs
static

Definition at line 24 of file parsePrep.c.

Referenced by doSetupMacro().

§ optionsTable

struct poptOption optionsTable[]
static
Initial value:
= {
{ NULL, 'a', POPT_ARG_STRING, NULL, 'a', NULL, NULL},
{ NULL, 'b', POPT_ARG_STRING, NULL, 'b', NULL, NULL},
{ NULL, 'c', 0, &createDir, 0, NULL, NULL},
{ NULL, 'D', 0, &leaveDirs, 0, NULL, NULL},
{ NULL, 'n', POPT_ARG_STRING, &dirName, 0, NULL, NULL},
{ NULL, 'T', 0, &skipDefaultAction, 0, NULL, NULL},
{ NULL, 'q', 0, &quietly, 0, NULL, NULL},
{ 0, 0, 0, 0, 0, NULL, NULL}
}
static int quietly
Definition: parsePrep.c:26
static int createDir
Definition: parsePrep.c:26
static int leaveDirs
Definition: parsePrep.c:24
static int skipDefaultAction
Definition: parsePrep.c:24
static const char * dirName
Definition: parsePrep.c:28

Definition at line 30 of file parsePrep.c.

Referenced by doSetupMacro().

§ quietly

int quietly
static

Definition at line 26 of file parsePrep.c.

Referenced by doSetupMacro(), prepFetch(), and prepFetchVerbose().

§ skipDefaultAction

int skipDefaultAction
static

Definition at line 24 of file parsePrep.c.

Referenced by doSetupMacro().