summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-12-07 10:43:53 +0200
committerPanu Matilainen <pmatilai@redhat.com>2007-12-07 10:43:53 +0200
commitd4622b51354ac454f67d30baf9d3b7276672d3b1 (patch)
treeed6a270fc0011f420f53af3a9c74a2eb13fb9035
parent23bba68b56c590f2fdbb955c60e5dff0ceae5bb8 (diff)
downloadlibrpm-tizen-d4622b51354ac454f67d30baf9d3b7276672d3b1.tar.gz
librpm-tizen-d4622b51354ac454f67d30baf9d3b7276672d3b1.tar.bz2
librpm-tizen-d4622b51354ac454f67d30baf9d3b7276672d3b1.zip
Yet more rpmbuild fixups from rpmerr.h removal (partly from rpm5.org)
- additionally use rpmRC return types instead of numbers where appropriate
-rw-r--r--build/files.c138
-rw-r--r--build/pack.c38
-rw-r--r--build/parseBuildInstallClean.c4
-rw-r--r--build/parseChangelog.c20
-rw-r--r--build/parseDescription.c8
-rw-r--r--build/parseFiles.c10
-rw-r--r--build/parsePreamble.c82
-rw-r--r--build/parsePrep.c52
-rw-r--r--build/parseReqs.c10
-rw-r--r--build/parseScript.c22
-rw-r--r--build/rpmbuild.h14
-rw-r--r--build/rpmfc.c22
-rw-r--r--build/rpmfc.h12
-rw-r--r--build/spec.c12
14 files changed, 223 insertions, 221 deletions
diff --git a/build/files.c b/build/files.c
index 4c807a8f4..429fcefe4 100644
--- a/build/files.c
+++ b/build/files.c
@@ -279,9 +279,9 @@ VFA_t verifyAttrs[] = {
* Parse %verify and %defverify from file manifest.
* @param buf current spec file line
* @param fl package file tree walk data
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int parseForVerify(char * buf, FileList fl)
+static rpmRC parseForVerify(char * buf, FileList fl)
{
char *p, *pe, *q;
const char *name;
@@ -297,7 +297,7 @@ static int parseForVerify(char * buf, FileList fl)
resultVerify = &(fl->defVerifyFlags);
specdFlags = &fl->defSpecdFlags;
} else
- return 0;
+ return RPMRC_OK;
for (pe = p; (pe-p) < strlen(name); pe++)
*pe = ' ';
@@ -307,7 +307,7 @@ static int parseForVerify(char * buf, FileList fl)
if (*pe != '(') {
rpmlog(RPMLOG_ERR, _("Missing '(' in %s %s\n"), name, pe);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Bracket %*verify args */
@@ -318,7 +318,7 @@ static int parseForVerify(char * buf, FileList fl)
if (*pe == '\0') {
rpmlog(RPMLOG_ERR, _("Missing ')' in %s(%s\n"), name, p);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Localize. Erase parsed string */
@@ -356,14 +356,14 @@ static int parseForVerify(char * buf, FileList fl)
} else {
rpmlog(RPMLOG_ERR, _("Invalid %s token: %s\n"), name, p);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
*resultVerify = negated ? ~(verifyFlags) : verifyFlags;
*specdFlags |= SPECD_VERIFY;
- return 0;
+ return RPMRC_OK;
}
#define isAttrDefault(_ars) ((_ars)[0] == '-' && (_ars)[1] == '\0')
@@ -372,17 +372,17 @@ static int parseForVerify(char * buf, FileList fl)
* Parse %dev from file manifest.
* @param buf current spec file line
* @param fl package file tree walk data
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int parseForDev(char * buf, FileList fl)
+static rpmRC parseForDev(char * buf, FileList fl)
{
const char * name;
const char * errstr = NULL;
char *p, *pe, *q;
- int rc = RPMLOG_ERR; /* assume error */
+ int rc = RPMRC_FAIL; /* assume error */
if ((p = strstr(buf, (name = "%dev"))) == NULL)
- return 0;
+ return RPMRC_OK;
for (pe = p; (pe-p) < strlen(name); pe++)
*pe = ' ';
@@ -454,7 +454,7 @@ static int parseForDev(char * buf, FileList fl)
fl->noGlob = 1;
- rc = 0;
+ rc = RPMRC_OK;
exit:
if (rc) {
@@ -496,7 +496,7 @@ static int parseForAttr(char * buf, FileList fl)
if (*pe != '(') {
rpmlog(RPMLOG_ERR, _("Missing '(' in %s %s\n"), name, pe);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Bracket %*attr args */
@@ -512,7 +512,7 @@ static int parseForAttr(char * buf, FileList fl)
rpmlog(RPMLOG_ERR,
_("Non-white space follows %s(): %s\n"), name, q);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
@@ -550,7 +550,7 @@ static int parseForAttr(char * buf, FileList fl)
if (!(ar->ar_fmodestr && ar->ar_user && ar->ar_group) || *p != '\0') {
rpmlog(RPMLOG_ERR, _("Bad syntax: %s(%s)\n"), name, q);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Do a quick test on the mode argument and adjust for "-" */
@@ -560,7 +560,7 @@ static int parseForAttr(char * buf, FileList fl)
if ((x == 0) || (ar->ar_fmode & ~MYALLPERMS)) {
rpmlog(RPMLOG_ERR, _("Bad mode spec: %s(%s)\n"), name, q);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
ar->ar_fmode = ui;
} else
@@ -572,7 +572,7 @@ static int parseForAttr(char * buf, FileList fl)
if ((x == 0) || (ar->ar_dmode & ~MYALLPERMS)) {
rpmlog(RPMLOG_ERR, _("Bad dirmode spec: %s(%s)\n"), name, q);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
ar->ar_dmode = ui;
} else
@@ -596,15 +596,15 @@ static int parseForAttr(char * buf, FileList fl)
* Parse %config from file manifest.
* @param buf current spec file line
* @param fl package file tree walk data
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int parseForConfig(char * buf, FileList fl)
+static rpmRC parseForConfig(char * buf, FileList fl)
{
char *p, *pe, *q;
const char *name;
if ((p = strstr(buf, (name = "%config"))) == NULL)
- return 0;
+ return RPMRC_OK;
fl->currentFlags |= RPMFILE_CONFIG;
@@ -613,7 +613,7 @@ static int parseForConfig(char * buf, FileList fl)
*pe = ' ';
SKIPSPACE(pe);
if (*pe != '(')
- return 0;
+ return RPMRC_OK;
/* Bracket %config args */
*pe++ = ' ';
@@ -623,7 +623,7 @@ static int parseForConfig(char * buf, FileList fl)
if (*pe == '\0') {
rpmlog(RPMLOG_ERR, _("Missing ')' in %s(%s\n"), name, p);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Localize. Erase parsed string. */
@@ -648,11 +648,11 @@ static int parseForConfig(char * buf, FileList fl)
} else {
rpmlog(RPMLOG_ERR, _("Invalid %s token: %s\n"), name, p);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
- return 0;
+ return RPMRC_OK;
}
/**
@@ -666,7 +666,7 @@ static int langCmp(const void * ap, const void * bp)
* Parse %lang from file manifest.
* @param buf current spec file line
* @param fl package file tree walk data
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
static int parseForLang(char * buf, FileList fl)
{
@@ -682,7 +682,7 @@ static int parseForLang(char * buf, FileList fl)
if (*pe != '(') {
rpmlog(RPMLOG_ERR, _("Missing '(' in %s %s\n"), name, pe);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Bracket %lang args */
@@ -693,7 +693,7 @@ static int parseForLang(char * buf, FileList fl)
if (*pe == '\0') {
rpmlog(RPMLOG_ERR, _("Missing ')' in %s(%s\n"), name, p);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Localize. Erase parsed string. */
@@ -721,7 +721,7 @@ static int parseForLang(char * buf, FileList fl)
_("Unusual locale length: \"%.*s\" in %%lang(%s)\n"),
(int)np, p, q);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Check for duplicate locales */
@@ -732,7 +732,7 @@ static int parseForLang(char * buf, FileList fl)
rpmlog(RPMLOG_ERR, _("Duplicate locale %.*s in %%lang(%s)\n"),
(int)np, p, q);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Add new locale */
@@ -750,7 +750,7 @@ static int parseForLang(char * buf, FileList fl)
if (fl->currentLangs)
qsort(fl->currentLangs, fl->nLangs, sizeof(*fl->currentLangs), langCmp);
- return 0;
+ return RPMRC_OK;
}
/**
@@ -825,9 +825,9 @@ VFA_t virtualFileAttributes[] = {
* @param buf current spec file line
* @param fl package file tree walk data
* @retval *fileName file name
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
+static rpmRC parseForSimple(rpmSpec spec, Package pkg, char * buf,
FileList fl, const char ** fileName)
{
char *s, *t;
@@ -836,7 +836,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
specialDocBuf[0] = '\0';
*fileName = NULL;
- res = 0;
+ res = RPMRC_OK;
t = buf;
while ((s = strtokWithQuotes(t, " \t\n")) != NULL) {
@@ -846,7 +846,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
if (fl->docDirCount == MAXDOCDIR) {
rpmlog(RPMLOG_ERR, _("Hit limit for %%docdir\n"));
fl->processingFailed = 1;
- res = 1;
+ res = RPMRC_FAIL;
}
if (s != NULL)
@@ -854,7 +854,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
if (s == NULL || strtokWithQuotes(NULL, " \t\n")) {
rpmlog(RPMLOG_ERR, _("Only one arg for %%docdir\n"));
fl->processingFailed = 1;
- res = 1;
+ res = RPMRC_FAIL;
}
break;
}
@@ -886,7 +886,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
rpmlog(RPMLOG_ERR, _("Two files on one line: %s\n"),
*fileName);
fl->processingFailed = 1;
- res = 1;
+ res = RPMRC_FAIL;
}
if (*s != '/') {
@@ -903,7 +903,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
rpmlog(RPMLOG_ERR,
_("File must begin with \"/\": %s\n"), s);
fl->processingFailed = 1;
- res = 1;
+ res = RPMRC_FAIL;
}
} else {
*fileName = s;
@@ -916,7 +916,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
_("Can't mix special %%doc with other forms: %s\n"),
(*fileName ? *fileName : ""));
fl->processingFailed = 1;
- res = 1;
+ res = RPMRC_FAIL;
} else {
/* XXX WATCHOUT: buf is an arg */
{
@@ -933,7 +933,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
if (!fmt) {
rpmlog(RPMLOG_ERR, _("illegal _docdir_fmt: %s\n"), errstr);
fl->processingFailed = 1;
- res = 1;
+ res = RPMRC_FAIL;
}
ddir = rpmGetPath("%{_docdir}/", fmt, NULL);
strcpy(buf, ddir);
@@ -1361,16 +1361,16 @@ static FileListRec freeFileList(FileListRec fileList,
}
/* forward ref */
-static int recurseDir(FileList fl, const char * diskURL);
+static rpmRC recurseDir(FileList fl, const char * diskURL);
/**
* Add a file to the package manifest.
* @param fl package file tree walk data
* @param diskURL path to file
* @param statp file stat (possibly NULL)
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int addFile(FileList fl, const char * diskURL,
+static rpmRC addFile(FileList fl, const char * diskURL,
struct stat * statp)
{
const char *fileURL = diskURL;
@@ -1417,7 +1417,7 @@ static int addFile(FileList fl, const char * diskURL,
rpmlog(RPMLOG_ERR, _("File doesn't match prefix (%s): %s\n"),
fl->prefix, fileURL);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
@@ -1440,7 +1440,7 @@ static int addFile(FileList fl, const char * diskURL,
} else if (lstat(diskURL, statp)) {
rpmlog(RPMLOG_ERR, _("File not found: %s\n"), diskURL);
fl->processingFailed = 1;
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
@@ -1560,15 +1560,15 @@ static int addFile(FileList fl, const char * diskURL,
* Add directory (and all of its files) to the package manifest.
* @param fl package file tree walk data
* @param diskURL path to file
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int recurseDir(FileList fl, const char * diskURL)
+static rpmRC recurseDir(FileList fl, const char * diskURL)
{
char * ftsSet[2];
FTS * ftsp;
FTSENT * fts;
int myFtsOpts = (FTS_COMFOLLOW | FTS_NOCHDIR | FTS_PHYSICAL);
- int rc = RPMLOG_ERR;
+ int rc = RPMRC_FAIL;
fl->inFtw = 1; /* Flag to indicate file has buildRootURL prefixed */
fl->isDir = 1; /* Keep it from following myftw() again */
@@ -1597,7 +1597,7 @@ static int recurseDir(FileList fl, const char * diskURL)
case FTS_INIT: /* initialized only */
case FTS_W: /* whiteout object */
default:
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
break;
}
if (rc)
@@ -1617,9 +1617,9 @@ static int recurseDir(FileList fl, const char * diskURL)
* @param fl package file tree walk data
* @param fileURL path to file, relative is builddir, absolute buildroot.
* @param tag tag to add
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int processMetadataFile(Package pkg, FileList fl, const char * fileURL,
+static rpmRC processMetadataFile(Package pkg, FileList fl, const char * fileURL,
rpmTag tag)
{
const char * buildURL = "%{_builddir}/%{?buildsubdir}/";
@@ -1628,7 +1628,7 @@ static int processMetadataFile(Package pkg, FileList fl, const char * fileURL,
uint8_t * pkt = NULL;
ssize_t pktlen = 0;
int absolute = 0;
- int rc = 1;
+ int rc = RPMRC_FAIL;
int xx;
(void) urlPath(fileURL, &fn);
@@ -1644,19 +1644,23 @@ static int processMetadataFile(Package pkg, FileList fl, const char * fileURL,
fn, tag);
goto exit;
break;
- case RPMTAG_PUBKEYS:
- if ((rc = pgpReadPkts(fn, (const uint8_t **)&pkt, (size_t *)&pktlen)) <= 0) {
+ case RPMTAG_PUBKEYS: {
+ if ((xx = pgpReadPkts(fn, (const uint8_t **)&pkt, (size_t *)&pktlen)) <= 0) {
+ rc = RPMRC_FAIL;
rpmlog(RPMLOG_ERR, _("%s: public key read failed.\n"), fn);
goto exit;
}
- if (rc != PGPARMOR_PUBKEY) {
+ if (xx != PGPARMOR_PUBKEY) {
+ rc = RPMRC_FAIL;
rpmlog(RPMLOG_ERR, _("%s: not an armored public key.\n"), fn);
goto exit;
}
apkt = pgpArmorWrap(PGPARMOR_PUBKEY, pkt, pktlen);
break;
+ }
case RPMTAG_POLICIES:
- if ((rc = rpmioSlurp(fn, &pkt, &pktlen)) != 0) {
+ if ((xx = rpmioSlurp(fn, &pkt, &pktlen)) != 0) {
+ rc = RPMRC_FAIL;
rpmlog(RPMLOG_ERR, _("%s: *.te policy read failed.\n"), fn);
goto exit;
}
@@ -1668,7 +1672,7 @@ static int processMetadataFile(Package pkg, FileList fl, const char * fileURL,
xx = headerAddOrAppendEntry(pkg->header, tag,
RPM_STRING_ARRAY_TYPE, &apkt, 1);
- rc = 0;
+ rc = RPMRC_OK;
if (absolute)
rc = addFile(fl, fn, NULL);
@@ -1678,7 +1682,7 @@ exit:
fn = _free(fn);
if (rc) {
fl->processingFailed = 1;
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
}
return rc;
}
@@ -1688,15 +1692,15 @@ exit:
* @param pkg
* @param fl package file tree walk data
* @param fileURL
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int processBinaryFile(Package pkg, FileList fl,
+static rpmRC processBinaryFile(Package pkg, FileList fl,
const char * fileURL)
{
int quote = 1; /* XXX permit quoted glob characters. */
int doGlob;
const char *diskURL = NULL;
- int rc = 0;
+ int rc = RPMRC_OK;
doGlob = glob_pattern_p(fileURL, quote);
@@ -1706,7 +1710,7 @@ static int processBinaryFile(Package pkg, FileList fl,
if (*fileName != '/') {
rpmlog(RPMLOG_ERR, _("File needs leading \"/\": %s\n"),
fileName);
- rc = 1;
+ rc = RPMRC_FAIL;
goto exit;
}
}
@@ -1730,7 +1734,7 @@ static int processBinaryFile(Package pkg, FileList fl,
if (fl->noGlob) {
rpmlog(RPMLOG_ERR, _("Glob not permitted: %s\n"),
diskURL);
- rc = 1;
+ rc = RPMRC_FAIL;
goto exit;
}
@@ -1744,7 +1748,7 @@ static int processBinaryFile(Package pkg, FileList fl,
} else {
rpmlog(RPMLOG_ERR, _("File not found by glob: %s\n"),
diskURL);
- rc = 1;
+ rc = RPMRC_FAIL;
goto exit;
}
} else {
@@ -1755,14 +1759,14 @@ exit:
diskURL = _free(diskURL);
if (rc) {
fl->processingFailed = 1;
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
}
return rc;
}
/**
*/
-static int processPackageFiles(rpmSpec spec, Package pkg,
+static rpmRC processPackageFiles(rpmSpec spec, Package pkg,
int installSpecialDoc, int test)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
@@ -1797,7 +1801,7 @@ static int processPackageFiles(rpmSpec spec, Package pkg,
rpmlog(RPMLOG_ERR,
_("Could not open %%files file %s: %s\n"),
ffn, Fstrerror(fd));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
ffn = _free(ffn);
@@ -1807,7 +1811,7 @@ static int processPackageFiles(rpmSpec spec, Package pkg,
handleComments(buf);
if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
rpmlog(RPMLOG_ERR, _("line: %s\n"), buf);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
appendStringBuf(pkg->fileList, buf);
}
diff --git a/build/pack.c b/build/pack.c
index 075aec4bd..4d121ec90 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -184,7 +184,7 @@ static int addFileToArrayTag(rpmSpec spec, const char *file, Header h, int tag)
/**
*/
-static int processScriptFiles(rpmSpec spec, Package pkg)
+static rpmRC processScriptFiles(rpmSpec spec, Package pkg)
{
struct TriggerFileEntry *p;
@@ -192,42 +192,42 @@ static int processScriptFiles(rpmSpec spec, Package pkg)
if (addFileToTag(spec, pkg->preInFile, pkg->header, RPMTAG_PREIN)) {
rpmlog(RPMLOG_ERR,
_("Could not open PreIn file: %s\n"), pkg->preInFile);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
if (pkg->preUnFile) {
if (addFileToTag(spec, pkg->preUnFile, pkg->header, RPMTAG_PREUN)) {
rpmlog(RPMLOG_ERR,
_("Could not open PreUn file: %s\n"), pkg->preUnFile);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
if (pkg->preTransFile) {
if (addFileToTag(spec, pkg->preTransFile, pkg->header, RPMTAG_PRETRANS)) {
rpmlog(RPMLOG_ERR,
_("Could not open PreIn file: %s\n"), pkg->preTransFile);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
if (pkg->postInFile) {
if (addFileToTag(spec, pkg->postInFile, pkg->header, RPMTAG_POSTIN)) {
rpmlog(RPMLOG_ERR,
_("Could not open PostIn file: %s\n"), pkg->postInFile);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
if (pkg->postUnFile) {
if (addFileToTag(spec, pkg->postUnFile, pkg->header, RPMTAG_POSTUN)) {
rpmlog(RPMLOG_ERR,
_("Could not open PostUn file: %s\n"), pkg->postUnFile);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
if (pkg->postTransFile) {
if (addFileToTag(spec, pkg->postTransFile, pkg->header, RPMTAG_POSTTRANS)) {
rpmlog(RPMLOG_ERR,
_("Could not open PostUn file: %s\n"), pkg->postTransFile);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
if (pkg->verifyFile) {
@@ -235,7 +235,7 @@ static int processScriptFiles(rpmSpec spec, Package pkg)
RPMTAG_VERIFYSCRIPT)) {
rpmlog(RPMLOG_ERR,
_("Could not open VerifyScript file: %s\n"), pkg->verifyFile);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
@@ -251,7 +251,7 @@ static int processScriptFiles(rpmSpec spec, Package pkg)
rpmlog(RPMLOG_ERR,
_("Could not open Trigger script file: %s\n"),
p->fileName);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
} else {
/* This is dumb. When the header supports NULL string */
@@ -262,7 +262,7 @@ static int processScriptFiles(rpmSpec spec, Package pkg)
}
}
- return 0;
+ return RPMRC_OK;
}
rpmRC readRPM(const char *fileName, rpmSpec *specp,
@@ -319,12 +319,12 @@ rpmRC readRPM(const char *fileName, rpmSpec *specp,
case RPMRC_NOTFOUND:
rpmlog(RPMLOG_ERR, _("readRPM: %s is not an RPM package\n"),
(fileName ? fileName : "<stdin>"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
case RPMRC_FAIL:
default:
rpmlog(RPMLOG_ERR, _("readRPM: reading header from %s\n"),
(fileName ? fileName : "<stdin>"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
break;
}
@@ -601,11 +601,11 @@ static int32_t copyTags[] = {
0
};
-int packageBinaries(rpmSpec spec)
+rpmRC packageBinaries(rpmSpec spec)
{
struct cpioSourceArchive_s csabuf;
CSA_t csa = &csabuf;
- int rc;
+ rpmRC rc;
const char *errorString;
Package pkg;
@@ -659,7 +659,7 @@ int packageBinaries(rpmSpec spec)
(void) headerNVR(pkg->header, &name, NULL, NULL);
rpmlog(RPMLOG_ERR, _("Could not generate output "
"filename for package %s: %s\n"), name, errorString);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
fn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
if ((binDir = strchr(binRpm, '/')) != NULL) {
@@ -695,18 +695,18 @@ int packageBinaries(rpmSpec spec)
csa->cpioFdIn = fdFree(csa->cpioFdIn,
RPMDBG_M("init (packageBinaries)"));
fn = _free(fn);
- if (rc)
+ if (rc != RPMRC_OK)
return rc;
}
- return 0;
+ return RPMRC_OK;
}
-int packageSources(rpmSpec spec)
+rpmRC packageSources(rpmSpec spec)
{
struct cpioSourceArchive_s csabuf;
CSA_t csa = &csabuf;
- int rc;
+ rpmRC rc;
/* Add some cruft */
(void) headerAddEntry(spec->sourceHeader, RPMTAG_RPMVERSION,
diff --git a/build/parseBuildInstallClean.c b/build/parseBuildInstallClean.c
index f4c8ad5fc..f16127be6 100644
--- a/build/parseBuildInstallClean.c
+++ b/build/parseBuildInstallClean.c
@@ -32,7 +32,7 @@ int parseBuildInstallClean(rpmSpec spec, rpmParseState parsePart)
if (*sbp != NULL) {
rpmlog(RPMLOG_ERR, _("line %d: second %s\n"),
spec->lineNum, name);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
*sbp = newStringBuf();
@@ -40,7 +40,7 @@ int parseBuildInstallClean(rpmSpec spec, rpmParseState parsePart)
/* There are no options to %build, %install, %check, or %clean */
if ((rc = readLine(spec, STRIP_NOTHING)) > 0)
return PART_NONE;
- if (rc)
+ if (rc != RPMRC_OK)
return rc;
while (! (nextPart = isPart(spec->line))) {
diff --git a/build/parseChangelog.c b/build/parseChangelog.c
index b8bcd1c4f..a39a74f49 100644
--- a/build/parseChangelog.c
+++ b/build/parseChangelog.c
@@ -106,9 +106,9 @@ static char lengths[] =
* Add %changelog section to header.
* @param h header
* @param sb changelog strings
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int addChangelog(Header h, StringBuf sb)
+static rpmRC addChangelog(Header h, StringBuf sb)
{
char *s;
int i;
@@ -125,7 +125,7 @@ static int addChangelog(Header h, StringBuf sb)
if (*s != '*') {
rpmlog(RPMLOG_ERR,
_("%%changelog entries must start with *\n"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* find end of line */
@@ -133,7 +133,7 @@ static int addChangelog(Header h, StringBuf sb)
while(*s && *s != '\n') s++;
if (! *s) {
rpmlog(RPMLOG_ERR, _("incomplete %%changelog entry\n"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
*s = '\0';
text = s + 1;
@@ -148,12 +148,12 @@ static int addChangelog(Header h, StringBuf sb)
SKIPSPACE(date);
if (dateToTimet(date, &time)) {
rpmlog(RPMLOG_ERR, _("bad date in %%changelog: %s\n"), date);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (lastTime && lastTime < time) {
rpmlog(RPMLOG_ERR,
_("%%changelog not in descending chronological order\n"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
lastTime = time;
@@ -161,7 +161,7 @@ static int addChangelog(Header h, StringBuf sb)
SKIPSPACE(s);
if (! *s) {
rpmlog(RPMLOG_ERR, _("missing name in %%changelog\n"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* name */
@@ -172,14 +172,14 @@ static int addChangelog(Header h, StringBuf sb)
}
if (s == name) {
rpmlog(RPMLOG_ERR, _("missing name in %%changelog\n"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* text */
SKIPSPACE(text);
if (! *text) {
rpmlog(RPMLOG_ERR, _("no description in %%changelog\n"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* find the next leading '*' (or eos) */
@@ -199,7 +199,7 @@ static int addChangelog(Header h, StringBuf sb)
s = next;
}
- return 0;
+ return RPMRC_OK;
}
int parseChangelog(rpmSpec spec)
diff --git a/build/parseDescription.c b/build/parseDescription.c
index 6d598b8fe..b1190287f 100644
--- a/build/parseDescription.c
+++ b/build/parseDescription.c
@@ -23,7 +23,7 @@ extern int noLang;
int parseDescription(rpmSpec spec)
{
- int nextPart = RPMLOG_ERR; /* assume error */
+ int nextPart = RPMRC_FAIL; /* assume error */
StringBuf sb;
int flag = PART_SUBNAME;
Package pkg;
@@ -39,7 +39,7 @@ int parseDescription(rpmSpec spec)
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmlog(RPMLOG_ERR, _("line %d: Error parsing %%description: %s\n"),
spec->lineNum, poptStrerror(rc));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
@@ -93,7 +93,7 @@ int parseDescription(rpmSpec spec)
nextPart = PART_NONE;
} else {
if (rc) {
- nextPart = RPMLOG_ERR;
+ nextPart = RPMRC_FAIL;
goto exit;
}
while (! (nextPart = isPart(spec->line))) {
@@ -105,7 +105,7 @@ int parseDescription(rpmSpec spec)
break;
}
if (rc) {
- nextPart = RPMLOG_ERR;
+ nextPart = RPMRC_FAIL;
goto exit;
}
}
diff --git a/build/parseFiles.c b/build/parseFiles.c
index bd12c05d0..2b3e1a3ea 100644
--- a/build/parseFiles.c
+++ b/build/parseFiles.c
@@ -35,7 +35,7 @@ int parseFiles(rpmSpec spec)
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmlog(RPMLOG_ERR, _("line %d: Error parsing %%files: %s\n"),
spec->lineNum, poptStrerror(rc));
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
@@ -51,7 +51,7 @@ int parseFiles(rpmSpec spec)
spec->lineNum,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
spec->line);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
@@ -62,7 +62,7 @@ int parseFiles(rpmSpec spec)
rpmlog(RPMLOG_ERR, _("line %d: Too many names: %s\n"),
spec->lineNum,
spec->line);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
}
@@ -70,14 +70,14 @@ int parseFiles(rpmSpec spec)
if (lookupPackage(spec, name, flag, &pkg)) {
rpmlog(RPMLOG_ERR, _("line %d: Package does not exist: %s\n"),
spec->lineNum, spec->line);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
if (pkg->fileList != NULL) {
rpmlog(RPMLOG_ERR, _("line %d: Second %%files list\n"),
spec->lineNum);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 2593313db..b8982d223 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -166,7 +166,7 @@ static int parseBits(const char * s, const tokenBits tokbits,
}
}
if (c == 0 && bp) *bp = bits;
- return (c ? RPMLOG_ERR : 0);
+ return (c ? RPMRC_FAIL : RPMRC_OK);
}
/**
@@ -214,40 +214,40 @@ static int checkForValidArchitectures(rpmSpec spec)
if (isMemberInEntry(spec->buildRestrictions,
arch, RPMTAG_EXCLUDEARCH) == 1) {
rpmlog(RPMLOG_ERR, _("Architecture is excluded: %s\n"), arch);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (isMemberInEntry(spec->buildRestrictions,
arch, RPMTAG_EXCLUSIVEARCH) == 0) {
rpmlog(RPMLOG_ERR, _("Architecture is not included: %s\n"), arch);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (isMemberInEntry(spec->buildRestrictions,
os, RPMTAG_EXCLUDEOS) == 1) {
rpmlog(RPMLOG_ERR, _("OS is excluded: %s\n"), os);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (isMemberInEntry(spec->buildRestrictions,
os, RPMTAG_EXCLUSIVEOS) == 0) {
rpmlog(RPMLOG_ERR, _("OS is not included: %s\n"), os);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
arch = _free(arch);
os = _free(os);
- return 0;
+ return RPMRC_OK;
}
/**
* Check that required tags are present in header.
* @param h header
* @param NVR package name-version-release
- * @return 0 if OK
+ * @return RPMRC_OK if OK
*/
static int checkForRequired(Header h, const char * NVR)
/* LCL: parse error here with modifies */
{
- int res = 0;
+ int res = RPMRC_OK;
rpmTag * p;
for (p = requiredTags; *p != 0; p++) {
@@ -255,7 +255,7 @@ static int checkForRequired(Header h, const char * NVR)
rpmlog(RPMLOG_ERR,
_("%s field must be present in package: %s\n"),
rpmTagGetName(*p), NVR);
- res = 1;
+ res = RPMRC_FAIL;
}
}
@@ -266,11 +266,11 @@ static int checkForRequired(Header h, const char * NVR)
* Check that no duplicate tags are present in header.
* @param h header
* @param NVR package name-version-release
- * @return 0 if OK
+ * @return RPMRC_OK if OK
*/
static int checkForDuplicates(Header h, const char * NVR)
{
- int res = 0;
+ int res = RPMRC_OK;
int lastTag, tag;
HeaderIterator hi;
@@ -282,7 +282,7 @@ static int checkForDuplicates(Header h, const char * NVR)
continue;
rpmlog(RPMLOG_ERR, _("Duplicate %s entries in package: %s\n"),
rpmTagGetName(tag), NVR);
- res = 1;
+ res = RPMRC_FAIL;
}
hi = headerFreeIterator(hi);
@@ -320,12 +320,12 @@ static void fillOutMainPackage(Header h)
/**
*/
-static int readIcon(Header h, const char * file)
+static rpmRC readIcon(Header h, const char * file)
{
const char *fn = NULL;
char *icon;
FD_t fd;
- int rc = 0;
+ rpmRC rc = RPMRC_OK;
off_t size;
size_t nb, iconsize;
@@ -336,14 +336,14 @@ static int readIcon(Header h, const char * file)
if (fd == NULL || Ferror(fd)) {
rpmlog(RPMLOG_ERR, _("Unable to open icon %s: %s\n"),
fn, Fstrerror(fd));
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
size = fdSize(fd);
iconsize = (size >= 0 ? size : (8 * BUFSIZ));
if (iconsize == 0) {
(void) Fclose(fd);
- rc = 0;
+ rc = RPMRC_OK;
goto exit;
}
@@ -354,10 +354,10 @@ static int readIcon(Header h, const char * file)
if (Ferror(fd) || (size >= 0 && nb != size)) {
rpmlog(RPMLOG_ERR, _("Unable to read icon %s: %s\n"),
fn, Fstrerror(fd));
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
}
(void) Fclose(fd);
- if (rc)
+ if (rc != RPMRC_OK)
goto exit;
if (! strncmp(icon, "GIF", sizeof("GIF")-1)) {
@@ -366,7 +366,7 @@ static int readIcon(Header h, const char * file)
(void) headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, iconsize);
} else {
rpmlog(RPMLOG_ERR, _("Unknown icon type: %s\n"), file);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
icon = _free(icon);
@@ -409,7 +409,7 @@ spectag stashSt(rpmSpec spec, Header h, int tag, const char * lang)
if (multiToken) { \
rpmlog(RPMLOG_ERR, _("line %d: Tag takes single token only: %s\n"), \
spec->lineNum, spec->line); \
- return RPMLOG_ERR; \
+ return RPMRC_FAIL; \
}
extern int noLang;
@@ -432,14 +432,14 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
int rc;
int xx;
- if (field == NULL) return RPMLOG_ERR; /* XXX can't happen */
+ if (field == NULL) return RPMRC_FAIL; /* XXX can't happen */
/* Find the start of the "field" and strip trailing space */
while ((*field) && (*field != ':'))
field++;
if (*field != ':') {
rpmlog(RPMLOG_ERR, _("line %d: Malformed tag: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
field++;
SKIPSPACE(field);
@@ -447,7 +447,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
/* Empty field */
rpmlog(RPMLOG_ERR, _("line %d: Empty tag: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
end = findLastChar(field);
*(end+1) = '\0';
@@ -472,14 +472,14 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
if (strchr(field, '-') != NULL) {
rpmlog(RPMLOG_ERR, _("line %d: Illegal char '-' in %s: %s\n"),
spec->lineNum, "version", spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
addMacro(spec->macros, "PACKAGE_VERSION", NULL, field, RMIL_OLDSPEC);
} else if (tag == RPMTAG_RELEASE) {
if (strchr(field, '-') != NULL) {
rpmlog(RPMLOG_ERR, _("line %d: Illegal char '-' in %s: %s\n"),
spec->lineNum, "release", spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
addMacro(spec->macros, "PACKAGE_RELEASE", NULL, field, RMIL_OLDSPEC-1);
}
@@ -535,7 +535,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
rpmlog(RPMLOG_ERR,
_("BuildRoot can not be \"/\": %s\n"), spec->buildRootURL);
buildRootURL = _free(buildRootURL);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
buildRootURL = _free(buildRootURL);
} break;
@@ -549,7 +549,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
_("line %d: Prefixes must not end with \"/\": %s\n"),
spec->lineNum, spec->line);
array = hfd(array, type);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
array = hfd(array, type);
@@ -560,7 +560,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
rpmlog(RPMLOG_ERR,
_("line %d: Docdir must begin with '/': %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
macro = NULL;
delMacro(NULL, "_docdir");
@@ -572,7 +572,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
rpmlog(RPMLOG_ERR,
_("line %d: Epoch/Serial field must be a number: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
xx = headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1);
break;
@@ -598,7 +598,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
if ((rc = addSource(spec, pkg, field, tag)))
return rc;
if ((rc = readIcon(pkg->header, field)))
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
break;
case RPMTAG_NOSOURCE:
case RPMTAG_NOPATCH:
@@ -649,7 +649,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
rpmlog(RPMLOG_ERR,
_("line %d: Bad BuildArchitecture format: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (!spec->BACount)
spec->BANames = _free(spec->BANames);
@@ -657,13 +657,13 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
default:
rpmlog(RPMLOG_ERR, _("Internal error: Bogus tag %d\n"), tag);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (macro)
addMacro(spec->macros, macro, NULL, field, RMIL_SPEC);
- return 0;
+ return RPMRC_OK;
}
/* This table has to be in a peculiar order. If one tag is the */
@@ -817,13 +817,13 @@ int parsePreamble(rpmSpec spec, int initialPackage)
if (parseSimplePart(spec->line, &name, &flag)) {
rpmlog(RPMLOG_ERR, _("Bad package specification: %s\n"),
spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (!lookupPackage(spec, name, flag, NULL)) {
rpmlog(RPMLOG_ERR, _("Package already exists: %s\n"),
spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* Construct the package */
@@ -852,10 +852,10 @@ int parsePreamble(rpmSpec spec, int initialPackage)
if (findPreambleTag(spec, &tag, &macro, lang)) {
rpmlog(RPMLOG_ERR, _("line %d: Unknown tag: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (handlePreambleTag(spec, pkg, tag, macro, lang))
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
if (spec->BANames && !spec->recursing)
return PART_BUILDARCHITECTURES;
}
@@ -873,25 +873,25 @@ int parsePreamble(rpmSpec spec, int initialPackage)
if (!spec->gotBuildRootURL && spec->buildRootURL) {
rpmlog(RPMLOG_ERR, _("Spec file can't use BuildRoot\n"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
/* XXX Skip valid arch check if not building binary package */
if (!spec->anyarch && checkForValidArchitectures(spec))
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
if (pkg == spec->packages)
fillOutMainPackage(pkg->header);
if (checkForDuplicates(pkg->header, NVR))
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
if (pkg != spec->packages)
headerCopyTags(spec->packages->header, pkg->header,
(int32_t *)copyTagsDuringParse);
if (checkForRequired(pkg->header, NVR))
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
return nextPart;
}
diff --git a/build/parsePrep.c b/build/parsePrep.c
index 06e7ce72f..35cd95471 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -28,23 +28,23 @@ static struct poptOption optionsTable[] = {
/**
* Check that file owner and group are known.
* @param urlfn file url
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int checkOwners(const char * urlfn)
+static rpmRC checkOwners(const char * urlfn)
{
struct stat sb;
if (lstat(urlfn, &sb)) {
rpmlog(RPMLOG_ERR, _("Bad source: %s: %s\n"),
urlfn, strerror(errno));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (!getUname(sb.st_uid) || !getGname(sb.st_gid)) {
rpmlog(RPMLOG_ERR, _("Bad owner/group: %s\n"), urlfn);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
- return 0;
+ return RPMRC_OK;
}
/**
@@ -275,7 +275,7 @@ static const char *doUntar(rpmSpec spec, int c, int quietly)
* @todo FIXME: Option -q broken when not immediately after %setup.
* @param spec build info
* @param line current line from spec file
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
static int doSetupMacro(rpmSpec spec, char *line)
{
@@ -297,7 +297,7 @@ static int doSetupMacro(rpmSpec spec, char *line)
if ((rc = poptParseArgvString(line, &argc, &argv))) {
rpmlog(RPMLOG_ERR, _("Error parsing %%setup: %s\n"),
poptStrerror(rc));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
before = newStringBuf();
@@ -316,12 +316,12 @@ static int doSetupMacro(rpmSpec spec, char *line)
after = freeStringBuf(after);
optCon = poptFreeContext(optCon);
argv = _free(argv);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
{ const char *chptr = doUntar(spec, num, quietly);
if (chptr == NULL)
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
appendLineStringBuf((arg == 'a' ? after : before), chptr);
}
@@ -336,7 +336,7 @@ static int doSetupMacro(rpmSpec spec, char *line)
after = freeStringBuf(after);
optCon = poptFreeContext(optCon);
argv = _free(argv);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (dirName) {
@@ -379,7 +379,7 @@ static int doSetupMacro(rpmSpec spec, char *line)
if (!createDir && !skipDefaultAction) {
const char *chptr = doUntar(spec, 0, quietly);
if (!chptr)
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
appendLineStringBuf(spec->prep, chptr);
}
@@ -394,7 +394,7 @@ static int doSetupMacro(rpmSpec spec, char *line)
if (createDir && !skipDefaultAction) {
const char * chptr = doUntar(spec, 0, quietly);
if (chptr == NULL)
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
appendLineStringBuf(spec->prep, chptr);
}
@@ -416,16 +416,16 @@ static int doSetupMacro(rpmSpec spec, char *line)
}
}
- return 0;
+ return RPMRC_OK;
}
/**
* Parse %patch line.
* @param spec build info
* @param line current line from spec file
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-static int doPatchMacro(rpmSpec spec, char *line)
+static rpmRC doPatchMacro(rpmSpec spec, char *line)
{
char *opt_b;
int opt_P, opt_p, opt_R, opt_E, opt_F;
@@ -465,7 +465,7 @@ static int doPatchMacro(rpmSpec spec, char *line)
rpmlog(RPMLOG_ERR,
_("line %d: Need arg to %%patch -b: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
} else if (!strcmp(s, "-z")) {
/* orig suffix */
@@ -474,7 +474,7 @@ static int doPatchMacro(rpmSpec spec, char *line)
rpmlog(RPMLOG_ERR,
_("line %d: Need arg to %%patch -z: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
} else if (!strncmp(s, "-F", strlen("-F"))) {
/* fuzz factor */
@@ -491,7 +491,7 @@ static int doPatchMacro(rpmSpec spec, char *line)
rpmlog(RPMLOG_ERR,
_("line %d: Bad arg to %%patch -F: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
} else if (!strncmp(s, "-p", sizeof("-p")-1)) {
/* unfortunately, we must support -pX */
@@ -503,25 +503,25 @@ static int doPatchMacro(rpmSpec spec, char *line)
rpmlog(RPMLOG_ERR,
_("line %d: Need arg to %%patch -p: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
if (parseNum(s, &opt_p)) {
rpmlog(RPMLOG_ERR,
_("line %d: Bad arg to %%patch -p: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
} else {
/* Must be a patch num */
if (patch_index == 1024) {
rpmlog(RPMLOG_ERR, _("Too many patches!\n"));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (parseNum(s, &(patch_nums[patch_index]))) {
rpmlog(RPMLOG_ERR, _("line %d: Bad arg to %%patch: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
patch_index++;
}
@@ -532,18 +532,18 @@ static int doPatchMacro(rpmSpec spec, char *line)
if (! opt_P) {
s = doPatch(spec, 0, opt_p, opt_b, opt_R, opt_E, opt_F);
if (s == NULL)
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
appendLineStringBuf(spec->prep, s);
}
for (x = 0; x < patch_index; x++) {
s = doPatch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E, opt_F);
if (s == NULL)
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
appendLineStringBuf(spec->prep, s);
}
- return 0;
+ return RPMRC_OK;
}
int parsePrep(rpmSpec spec)
@@ -554,7 +554,7 @@ int parsePrep(rpmSpec spec)
if (spec->prep != NULL) {
rpmlog(RPMLOG_ERR, _("line %d: second %%prep\n"), spec->lineNum);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
spec->prep = newStringBuf();
diff --git a/build/parseReqs.c b/build/parseReqs.c
index 1f9bf86b1..4e0dc6cfb 100644
--- a/build/parseReqs.c
+++ b/build/parseReqs.c
@@ -32,7 +32,7 @@ const char * token;
#define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}
-int parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
+rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
int index, rpmsenseFlags tagflags)
{
const char *r, *re, *v, *ve;
@@ -100,7 +100,7 @@ int parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
rpmlog(RPMLOG_ERR,
_("line %d: Dependency tokens must begin with alpha-numeric, '_' or '/': %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
re = r;
@@ -128,7 +128,7 @@ int parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
rpmlog(RPMLOG_ERR,
_("line %d: Versioned file name not permitted: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
switch(tagN) {
@@ -158,7 +158,7 @@ int parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
if (*v == '\0' || ve == v) {
rpmlog(RPMLOG_ERR, _("line %d: Version required: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
EVR = xmalloc((ve-v) + 1);
strncpy(EVR, v, (ve-v));
@@ -174,5 +174,5 @@ int parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
}
- return 0;
+ return RPMRC_OK;
}
diff --git a/build/parseScript.c b/build/parseScript.c
index 7a5fb1c27..9c613e333 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -167,7 +167,7 @@ int parseScript(rpmSpec spec, int parsePart)
if (!p) {
rpmlog(RPMLOG_ERR, _("line %d: triggers must have --: %s\n"),
spec->lineNum, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
*p = '\0';
@@ -177,7 +177,7 @@ int parseScript(rpmSpec spec, int parsePart)
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmlog(RPMLOG_ERR, _("line %d: Error parsing %s: %s\n"),
spec->lineNum, partname, poptStrerror(rc));
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
@@ -189,14 +189,14 @@ int parseScript(rpmSpec spec, int parsePart)
rpmlog(RPMLOG_ERR,
_("line %d: internal script must end "
"with \'>\': %s\n"), spec->lineNum, prog);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
} else if (prog[0] != '/') {
rpmlog(RPMLOG_ERR,
_("line %d: script program must begin "
"with \'/\': %s\n"), spec->lineNum, prog);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
break;
@@ -211,7 +211,7 @@ int parseScript(rpmSpec spec, int parsePart)
spec->lineNum,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
spec->line);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
@@ -222,7 +222,7 @@ int parseScript(rpmSpec spec, int parsePart)
rpmlog(RPMLOG_ERR, _("line %d: Too many names: %s\n"),
spec->lineNum,
spec->line);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
}
@@ -230,7 +230,7 @@ int parseScript(rpmSpec spec, int parsePart)
if (lookupPackage(spec, name, flag, &pkg)) {
rpmlog(RPMLOG_ERR, _("line %d: Package does not exist: %s\n"),
spec->lineNum, spec->line);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
@@ -238,7 +238,7 @@ int parseScript(rpmSpec spec, int parsePart)
if (headerIsEntry(pkg->header, progtag)) {
rpmlog(RPMLOG_ERR, _("line %d: Second %s\n"),
spec->lineNum, partname);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
}
@@ -246,7 +246,7 @@ int parseScript(rpmSpec spec, int parsePart)
if ((rc = poptParseArgvString(prog, &progArgc, &progArgv))) {
rpmlog(RPMLOG_ERR, _("line %d: Error parsing %s: %s\n"),
spec->lineNum, partname, poptStrerror(rc));
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
@@ -273,7 +273,7 @@ int parseScript(rpmSpec spec, int parsePart)
if (!strcmp(progArgv[0], "<lua>")) {
rpmlua lua = NULL; /* Global state. */
if (rpmluaCheckScript(lua, p, partname) != RPMRC_OK) {
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
}
(void) rpmlibNeedsFeature(pkg->header,
@@ -284,7 +284,7 @@ int parseScript(rpmSpec spec, int parsePart)
rpmlog(RPMLOG_ERR,
_("line %d: unsupported internal script: %s\n"),
spec->lineNum, progArgv[0]);
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
goto exit;
} else {
(void) addReqProv(spec, pkg->header, RPMTAG_REQUIRENAME,
diff --git a/build/rpmbuild.h b/build/rpmbuild.h
index 06f36e1c5..6b8e222e2 100644
--- a/build/rpmbuild.h
+++ b/build/rpmbuild.h
@@ -242,9 +242,9 @@ int parsePrep(rpmSpec spec);
* @param tagN tag, identifies type of dependency
* @param index (0 always)
* @param tagflags dependency flags already known from context
- * @return 0 on success, RPMERR_BADSPEC on failure
+ * @return RPMRC_OK on success, RPMRC_FAIL on failure
*/
-int parseRCPOT(rpmSpec spec, Package pkg, const char * field, rpmTag tagN,
+rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char * field, rpmTag tagN,
int index, rpmsenseFlags tagflags);
/** \ingroup rpmbuild
@@ -292,7 +292,7 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char * name,
* @retval pkg package control structure
* @return 0 on success, 1 on failure
*/
-int lookupPackage(rpmSpec spec, const char * name, int flag,
+rpmRC lookupPackage(rpmSpec spec, const char * name, int flag,
Package * pkg);
/** \ingroup rpmbuild
@@ -396,16 +396,16 @@ rpmRC buildSpec(rpmts ts, rpmSpec spec, int what, int test);
/** \ingroup rpmbuild
* Generate binary package(s).
* @param spec spec file control structure
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-int packageBinaries(rpmSpec spec);
+rpmRC packageBinaries(rpmSpec spec);
/** \ingroup rpmbuild
* Generate source package.
* @param spec spec file control structure
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-int packageSources(rpmSpec spec);
+rpmRC packageSources(rpmSpec spec);
#ifdef __cplusplus
}
diff --git a/build/rpmfc.c b/build/rpmfc.c
index 6408ac316..73137749a 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -127,7 +127,7 @@ static StringBuf getOutputFrom(const char * dir, ARGV_t argv,
/* XXX this error message is probably not seen. */
rpmlog(RPMLOG_ERR, _("Couldn't exec %s: %s\n"),
argv[0], strerror(errno));
- _exit(RPMLOG_ERR);
+ _exit(EXIT_FAILURE);
}
if (child < 0) {
rpmlog(RPMLOG_ERR, _("Couldn't fork %s: %s\n"),
@@ -1112,7 +1112,7 @@ static struct rpmfcApplyTbl_s rpmfcApplyTable[] = {
{ NULL, 0 }
};
-int rpmfcApply(rpmfc fc)
+rpmRC rpmfcApply(rpmfc fc)
{
rpmfcApplyTbl fcat;
const char * s;
@@ -1212,7 +1212,7 @@ assert(dix >= 0);
return 0;
}
-int rpmfcClassify(rpmfc fc, ARGV_t argv, int16_t * fmode)
+rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, int16_t * fmode)
{
ARGV_t fcav = NULL;
ARGV_t dav;
@@ -1238,16 +1238,14 @@ int rpmfcClassify(rpmfc fc, ARGV_t argv, int16_t * fmode)
ms = magic_open(msflags);
if (ms == NULL) {
- xx = RPMLOG_ERR;
- rpmlog(xx, _("magic_open(0x%x) failed: %s\n"),
+ rpmlog(RPMLOG_ERR, _("magic_open(0x%x) failed: %s\n"),
msflags, strerror(errno));
assert(ms != NULL); /* XXX figger a proper return path. */
}
xx = magic_load(ms, NULL);
if (xx == -1) {
- xx = RPMLOG_ERR;
- rpmlog(xx, _("magic_load failed: %s\n"), magic_error(ms));
+ rpmlog(RPMLOG_ERR, _("magic_load failed: %s\n"), magic_error(ms));
assert(xx != -1); /* XXX figger a proper return path. */
}
@@ -1290,9 +1288,9 @@ assert(s != NULL);
ftype = magic_file(ms, s);
if (ftype == NULL) {
- xx = RPMLOG_ERR;
- rpmlog(xx, _("magic_file(ms, \"%s\") failed: mode %06o %s\n"),
- s, mode, magic_error(ms));
+ rpmlog(RPMLOG_ERR,
+ _("magic_file(ms, \"%s\") failed: mode %06o %s\n"),
+ s, mode, magic_error(ms));
assert(ftype != NULL); /* XXX figger a proper return path. */
}
}
@@ -1495,7 +1493,7 @@ static int rpmfcGenerateDependsHelper(const rpmSpec spec, Package pkg, rpmfi fi)
s = _free(s);
if (sb_stdout == NULL) {
- rc = RPMLOG_ERR;
+ rc = RPMRC_FAIL;
rpmlog(rc, _("Failed to find %s:\n"), dm->msg);
break;
}
@@ -1515,7 +1513,7 @@ static int rpmfcGenerateDependsHelper(const rpmSpec spec, Package pkg, rpmfi fi)
return rc;
}
-int rpmfcGenerateDepends(const rpmSpec spec, Package pkg)
+rpmRC rpmfcGenerateDepends(const rpmSpec spec, Package pkg)
{
rpmfi fi = pkg->cpioList;
rpmfc fc = NULL;
diff --git a/build/rpmfc.h b/build/rpmfc.h
index c4f958b1c..87034941d 100644
--- a/build/rpmfc.h
+++ b/build/rpmfc.h
@@ -115,24 +115,24 @@ rpmfc rpmfcNew(void);
* @param fc file classifier
* @param argv files to classify
* @param fmode files mode_t array (or NULL)
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-int rpmfcClassify(rpmfc fc, ARGV_t argv, int16_t * fmode);
+rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, int16_t * fmode);
/** \ingroup rpmfc
* Build file/package dependency dictionary and mappings.
* @param fc file classifier
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-int rpmfcApply(rpmfc fc);
+rpmRC rpmfcApply(rpmfc fc);
/** \ingroup rpmfc
* Generate package dependencies.
* @param spec spec file control
* @param pkg package control
- * @return 0 on success
+ * @return RPMRC_OK on success
*/
-int rpmfcGenerateDepends(const rpmSpec spec, Package pkg);
+rpmRC rpmfcGenerateDepends(const rpmSpec spec, Package pkg);
/** \ingroup rpmfc
* Retrieve file classification provides
diff --git a/build/spec.c b/build/spec.c
index a75bda818..d9e4bea35 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -59,7 +59,7 @@ struct Source * freeSources(struct Source * s)
return NULL;
}
-int lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg)
+rpmRC lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg)
{
const char *pname;
const char *fullName;
@@ -69,7 +69,7 @@ int lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg)
if (name == NULL) {
if (pkg)
*pkg = spec->packages;
- return 0;
+ return RPMRC_OK;
}
/* Construct package name */
@@ -95,7 +95,7 @@ int lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg)
if (pkg)
*pkg = p;
- return ((p == NULL) ? 1 : 0);
+ return ((p == NULL) ? RPMRC_FAIL : RPMRC_OK);
}
Package newPackage(rpmSpec spec)
@@ -226,13 +226,13 @@ int parseNoSource(rpmSpec spec, const char * field, int tag)
if (parseNum(f, &num)) {
rpmlog(RPMLOG_ERR, _("line %d: Bad number: %s\n"),
spec->lineNum, f);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
if (! (p = findSource(spec, num, flag))) {
rpmlog(RPMLOG_ERR, _("line %d: Bad no%s number: %d\n"),
spec->lineNum, name, num);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
p->flags |= RPMBUILD_ISNO;
@@ -291,7 +291,7 @@ int addSource(rpmSpec spec, Package pkg, const char *field, int tag)
if (parseNum(buf, &num)) {
rpmlog(RPMLOG_ERR, _("line %d: Bad %s number: %s\n"),
spec->lineNum, name, spec->line);
- return RPMLOG_ERR;
+ return RPMRC_FAIL;
}
}
}