diff options
author | root <devnull@localhost> | 1996-11-18 18:02:36 +0000 |
---|---|---|
committer | root <devnull@localhost> | 1996-11-18 18:02:36 +0000 |
commit | d382745d17ae859c0ad43d691648da576bd70907 (patch) | |
tree | 1c62239339a9bcba0f2f3f3d9d9b90b479ae2d3e /build | |
parent | 5c46c799f264c30b6414f4a64e27b42ca829bb51 (diff) | |
download | librpm-tizen-d382745d17ae859c0ad43d691648da576bd70907.tar.gz librpm-tizen-d382745d17ae859c0ad43d691648da576bd70907.tar.bz2 librpm-tizen-d382745d17ae859c0ad43d691648da576bd70907.zip |
The Great Renaming
CVS patchset: 1171
CVS date: 1996/11/18 18:02:36
Diffstat (limited to 'build')
-rw-r--r-- | build/build.c | 91 | ||||
-rw-r--r-- | build/files.c | 115 | ||||
-rw-r--r-- | build/names.c | 4 | ||||
-rw-r--r-- | build/pack.c | 216 | ||||
-rw-r--r-- | build/reqprov.c | 83 | ||||
-rw-r--r-- | build/spec.c | 165 | ||||
-rw-r--r-- | build/trigger.c | 21 | ||||
-rw-r--r-- | build/vspec.c | 23 |
8 files changed, 356 insertions, 362 deletions
diff --git a/build/build.c b/build/build.c index a60233c2b..f63ac3f67 100644 --- a/build/build.c +++ b/build/build.c @@ -16,7 +16,6 @@ #include "header.h" #include "spec.h" #include "specP.h" -#include "rpmerr.h" #include "rpmlib.h" #include "messages.h" #include "stringbuf.h" @@ -54,11 +53,11 @@ struct Script *openScript(Spec spec, int builddir, char *name) int_32 foo; if (! main_package) { - error(RPMERR_INTERNAL, "Empty main package"); + rpmError(RPMERR_INTERNAL, "Empty main package"); exit(RPMERR_INTERNAL); } - script->name = tempnam(getVar(RPMVAR_TMPPATH), "rpmbuild"); + script->name = tempnam(rpmGetVar(RPMVAR_TMPPATH), "rpmbuild"); script->file = fopen(script->name, "w"); /* Prepare the script */ @@ -66,31 +65,31 @@ struct Script *openScript(Spec spec, int builddir, char *name) "#!/bin/sh -e\n" "# Script generated by rpm\n\n"); - fprintf(script->file, "RPM_SOURCE_DIR=\"%s\"\n", getVar(RPMVAR_SOURCEDIR)); - fprintf(script->file, "RPM_BUILD_DIR=\"%s\"\n", getVar(RPMVAR_BUILDDIR)); - fprintf(script->file, "RPM_DOC_DIR=\"%s\"\n", getVar(RPMVAR_DEFAULTDOCDIR)); - fprintf(script->file, "RPM_OPT_FLAGS=\"%s\"\n", getVar(RPMVAR_OPTFLAGS)); - fprintf(script->file, "RPM_ARCH=\"%s\"\n", getArchName()); - fprintf(script->file, "RPM_OS=\"%s\"\n", getOsName()); - if (getVar(RPMVAR_ROOT)) { - fprintf(script->file, "RPM_ROOT_DIR=\"%s\"\n", getVar(RPMVAR_ROOT)); + fprintf(script->file, "RPM_SOURCE_DIR=\"%s\"\n", rpmGetVar(RPMVAR_SOURCEDIR)); + fprintf(script->file, "RPM_BUILD_DIR=\"%s\"\n", rpmGetVar(RPMVAR_BUILDDIR)); + fprintf(script->file, "RPM_DOC_DIR=\"%s\"\n", rpmGetVar(RPMVAR_DEFAULTDOCDIR)); + fprintf(script->file, "RPM_OPT_FLAGS=\"%s\"\n", rpmGetVar(RPMVAR_OPTFLAGS)); + fprintf(script->file, "RPM_ARCH=\"%s\"\n", rpmGetArchName()); + fprintf(script->file, "RPM_OS=\"%s\"\n", rpmGetOsName()); + if (rpmGetVar(RPMVAR_ROOT)) { + fprintf(script->file, "RPM_ROOT_DIR=\"%s\"\n", rpmGetVar(RPMVAR_ROOT)); } else { fprintf(script->file, "RPM_ROOT_DIR=\"\"\n"); } - if (getVar(RPMVAR_BUILDROOT)) { + if (rpmGetVar(RPMVAR_BUILDROOT)) { fprintf(script->file, "RPM_BUILD_ROOT=\"%s\"\n", - getVar(RPMVAR_BUILDROOT)); + rpmGetVar(RPMVAR_BUILDROOT)); } else { fprintf(script->file, "RPM_BUILD_ROOT=\"\"\n"); } fprintf(script->file, "RPM_PACKAGE_NAME=\"%s\"\n", spec->name); - getEntry(main_package->header, RPMTAG_VERSION, &foo, (void **)&s, &foo); + headerGetEntry(main_package->header, RPMTAG_VERSION, &foo, (void **)&s, &foo); fprintf(script->file, "RPM_PACKAGE_VERSION=\"%s\"\n", s); - getEntry(main_package->header, RPMTAG_RELEASE, &foo, (void **)&s, &foo); + headerGetEntry(main_package->header, RPMTAG_RELEASE, &foo, (void **)&s, &foo); fprintf(script->file, "RPM_PACKAGE_RELEASE=\"%s\"\n", s); - if (isVerbose()) { + if (rpmIsVerbose()) { fprintf(script->file, "set -x\n\n"); } else { fprintf(script->file, "exec > /dev/null\n\n"); @@ -100,7 +99,7 @@ struct Script *openScript(Spec spec, int builddir, char *name) fprintf(script->file, "umask 022\n"); fprintf(script->file, "\necho Executing: %s\n", name); - fprintf(script->file, "cd %s\n\n", getVar(RPMVAR_BUILDDIR)); + fprintf(script->file, "cd %s\n\n", rpmGetVar(RPMVAR_BUILDDIR)); if (builddir) { /* Need to cd to the actual build directory. */ /* Note that this means we have to parse the */ @@ -128,12 +127,12 @@ int execScript(struct Script *script) if (!(pid = fork())) { execl(script->name, script->name, NULL); - error(RPMERR_SCRIPT, "Exec failed"); + rpmError(RPMERR_SCRIPT, "Exec failed"); exit(RPMERR_SCRIPT); } wait(&status); if (! WIFEXITED(status) || WEXITSTATUS(status)) { - error(RPMERR_SCRIPT, "Bad exit status"); + rpmError(RPMERR_SCRIPT, "Bad exit status"); exit(RPMERR_SCRIPT); } return 0; @@ -153,7 +152,7 @@ int execPart(Spec s, char *sb, char *name, int builddir, int test) { struct Script *script; - message(MESS_DEBUG, "RUNNING: %s\n", name); + rpmMessage(RPMMESS_DEBUG, "RUNNING: %s\n", name); script = openScript(s, builddir, name); writeScript(script, sb); if (!test) { @@ -184,14 +183,14 @@ static int doRmSource(Spec s) struct PackageRec *package; /* spec file */ - sprintf(filename, "%s%s", getVar(RPMVAR_SPECDIR), + sprintf(filename, "%s%s", rpmGetVar(RPMVAR_SPECDIR), strrchr(s->specfile, '/')); unlink(filename); /* sources and patches */ source = s->sources; while (source) { - sprintf(filename, "%s/%s", getVar(RPMVAR_SOURCEDIR), source->source); + sprintf(filename, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), source->source); unlink(filename); source = source->next; } @@ -200,7 +199,7 @@ static int doRmSource(Spec s) package = s->packages; while (package) { if (package->icon) { - sprintf(filename, "%s/%s", getVar(RPMVAR_SOURCEDIR), + sprintf(filename, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), package->icon); unlink(filename); } @@ -233,35 +232,35 @@ static int doSetupMacro(Spec spec, StringBuf sb, char *line) /* dir name */ opt_n = strtok(NULL, " \t\n"); if (! opt_n) { - error(RPMERR_BADSPEC, "Need arg to %%setup -n"); + rpmError(RPMERR_BADSPEC, "Need arg to %%setup -n"); return(RPMERR_BADSPEC); } } else if (!strcmp(s, "-a")) { s = strtok(NULL, " \t\n"); if (! s) { - error(RPMERR_BADSPEC, "Need arg to %%setup -a"); + rpmError(RPMERR_BADSPEC, "Need arg to %%setup -a"); return(RPMERR_BADSPEC); } s1 = NULL; opt_a = strtoul(s, &s1, 10); if ((*s1) || (s1 == s) || (opt_a == ULONG_MAX)) { - error(RPMERR_BADSPEC, "Bad arg to %%setup -a: %s", s); + rpmError(RPMERR_BADSPEC, "Bad arg to %%setup -a: %s", s); return(RPMERR_BADSPEC); } } else if (!strcmp(s, "-b")) { s = strtok(NULL, " \t\n"); if (! s) { - error(RPMERR_BADSPEC, "Need arg to %%setup -b"); + rpmError(RPMERR_BADSPEC, "Need arg to %%setup -b"); return(RPMERR_BADSPEC); } s1 = NULL; opt_b = strtoul(s, &s1, 10); if ((*s1) || (s1 == s) || (opt_b == ULONG_MAX)) { - error(RPMERR_BADSPEC, "Bad arg to %%setup -b: %s", s); + rpmError(RPMERR_BADSPEC, "Bad arg to %%setup -b: %s", s); return(RPMERR_BADSPEC); } } else { - error(RPMERR_BADSPEC, "Bad arg to %%setup: %s", s); + rpmError(RPMERR_BADSPEC, "Bad arg to %%setup: %s", s); return(RPMERR_BADSPEC); } } @@ -282,13 +281,13 @@ static int doSetupMacro(Spec spec, StringBuf sb, char *line) strcpy(build_subdir, spec->name); strcat(build_subdir, "-"); /* We should already have a version field */ - getEntry(spec->packages->header, RPMTAG_VERSION, NULL, + headerGetEntry(spec->packages->header, RPMTAG_VERSION, NULL, (void *) &version, NULL); strcat(build_subdir, version); } /* cd to the build dir */ - sprintf(buf, "cd %s", getVar(RPMVAR_BUILDDIR)); + sprintf(buf, "cd %s", rpmGetVar(RPMVAR_BUILDDIR)); appendLineStringBuf(sb, buf); /* delete any old sources */ @@ -345,7 +344,7 @@ static int doSetupMacro(Spec spec, StringBuf sb, char *line) } /* clean up permissions etc */ - sprintf(buf, "cd %s/%s", getVar(RPMVAR_BUILDDIR), build_subdir); + sprintf(buf, "cd %s/%s", rpmGetVar(RPMVAR_BUILDDIR), build_subdir); appendLineStringBuf(sb, buf); if (! geteuid()) { appendLineStringBuf(sb, "chown -R root ."); @@ -396,12 +395,12 @@ static char *do_untar(Spec spec, int c) sp = sp->next; } if (! s) { - error(RPMERR_BADSPEC, "No source number %d", c); + rpmError(RPMERR_BADSPEC, "No source number %d", c); return NULL; } - sprintf(file, "%s/%s", getVar(RPMVAR_SOURCEDIR), s); - taropts = (isVerbose() ? "-xvvf" : "-xf"); + sprintf(file, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), s); + taropts = (rpmIsVerbose() ? "-xvvf" : "-xf"); if (isCompressed(file)) { sprintf(buf, @@ -436,11 +435,11 @@ static char *do_patch(Spec spec, int c, int strip, char *db, sp = sp->next; } if (! s) { - error(RPMERR_BADSPEC, "No patch number %d", c); + rpmError(RPMERR_BADSPEC, "No patch number %d", c); return NULL; } - sprintf(file, "%s/%s", getVar(RPMVAR_SOURCEDIR), s); + sprintf(file, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), s); args[0] = '\0'; if (db) { @@ -503,7 +502,7 @@ static int doPatchMacro(Spec spec, StringBuf sb, char *line) /* orig suffix */ opt_b = strtok(NULL, " \t\n"); if (! opt_b) { - error(RPMERR_BADSPEC, "Need arg to %%patch -b"); + rpmError(RPMERR_BADSPEC, "Need arg to %%patch -b"); return(RPMERR_BADSPEC); } } else if (!strncmp(s, "-p", 2)) { @@ -513,26 +512,26 @@ static int doPatchMacro(Spec spec, StringBuf sb, char *line) } else { s = strtok(NULL, " \t\n"); if (! s) { - error(RPMERR_BADSPEC, "Need arg to %%patch -p"); + rpmError(RPMERR_BADSPEC, "Need arg to %%patch -p"); return(RPMERR_BADSPEC); } } s1 = NULL; opt_p = strtoul(s, &s1, 10); if ((*s1) || (s1 == s) || (opt_p == ULONG_MAX)) { - error(RPMERR_BADSPEC, "Bad arg to %%patch -p: %s", s); + rpmError(RPMERR_BADSPEC, "Bad arg to %%patch -p: %s", s); return(RPMERR_BADSPEC); } } else { /* Must be a patch num */ if (patch_index == 1024) { - error(RPMERR_BADSPEC, "Too many patches!"); + rpmError(RPMERR_BADSPEC, "Too many patches!"); return(RPMERR_BADSPEC); } s1 = NULL; patch_nums[patch_index] = strtoul(s, &s1, 10); if ((*s1) || (s1 == s) || (patch_nums[patch_index] == ULONG_MAX)) { - error(RPMERR_BADSPEC, "Bad arg to %%patch: %s", s); + rpmError(RPMERR_BADSPEC, "Bad arg to %%patch: %s", s); return(RPMERR_BADSPEC); } patch_index++; @@ -571,9 +570,9 @@ static int checkSources(Spec s) /* Check that we can access all the sources */ source = s->sources; while (source) { - sprintf(buf, "%s/%s", getVar(RPMVAR_SOURCEDIR), source->source); + sprintf(buf, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), source->source); if (access(buf, R_OK)) { - error(RPMERR_BADSPEC, "missing source or patch: %s", buf); + rpmError(RPMERR_BADSPEC, "missing source or patch: %s", buf); return RPMERR_BADSPEC; } source = source->next; @@ -583,9 +582,9 @@ static int checkSources(Spec s) package = s->packages; while (package) { if (package->icon) { - sprintf(buf, "%s/%s", getVar(RPMVAR_SOURCEDIR), package->icon); + sprintf(buf, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), package->icon); if (access(buf, R_OK)) { - error(RPMERR_BADSPEC, "missing icon: %s", buf); + rpmError(RPMERR_BADSPEC, "missing icon: %s", buf); return RPMERR_BADSPEC; } } diff --git a/build/files.c b/build/files.c index 04a74ca85..5fbf4a591 100644 --- a/build/files.c +++ b/build/files.c @@ -20,7 +20,6 @@ #include "header.h" #include "files.h" #include "names.h" -#include "rpmerr.h" #include "rpmlead.h" #include "rpmlib.h" #include "misc.h" @@ -86,9 +85,9 @@ int process_filelist(Header header, struct PackageRec *pr, resetDocdir(); if (type == RPMLEAD_BINARY && pr->fileFile) { - sprintf(buf, "%s/%s/%s", getVar(RPMVAR_BUILDDIR), + sprintf(buf, "%s/%s/%s", rpmGetVar(RPMVAR_BUILDDIR), build_subdir, pr->fileFile); - message(MESS_DEBUG, "Reading file names from: %sXX\n", buf); + rpmMessage(RPMMESS_DEBUG, "Reading file names from: %sXX\n", buf); if ((file = fopen(buf, "r")) == NULL) { perror("open fileFile"); exit(1); @@ -121,7 +120,7 @@ int process_filelist(Header header, struct PackageRec *pr, free (currGname); currGname = NULL; } - verify_flags = VERIFY_ALL; + verify_flags = RPMVERIFY_ALL; filename = NULL; /* First preparse buf for %verify() */ @@ -149,7 +148,7 @@ int process_filelist(Header header, struct PackageRec *pr, } else { if (filename) { /* We already got a file -- error */ - error(RPMERR_BADSPEC, + rpmError(RPMERR_BADSPEC, "Two files on one line: %s", filename); return(RPMERR_BADSPEC); } @@ -158,7 +157,7 @@ int process_filelist(Header header, struct PackageRec *pr, special_doc = 1; } else { /* not in %doc, does not begin with / -- error */ - error(RPMERR_BADSPEC, + rpmError(RPMERR_BADSPEC, "File must begin with \"/\": %s", s); return(RPMERR_BADSPEC); } @@ -174,11 +173,11 @@ int process_filelist(Header header, struct PackageRec *pr, continue; } else { if (filename || isconf || isdir) { - error(RPMERR_BADSPEC, + rpmError(RPMERR_BADSPEC, "Can't mix special %%doc with other forms: %s", fp); return(RPMERR_BADSPEC); } - sprintf(buf, "%s/%s-%s-%s", getVar(RPMVAR_DEFAULTDOCDIR), + sprintf(buf, "%s/%s-%s-%s", rpmGetVar(RPMVAR_DEFAULTDOCDIR), name, version, release); filename = buf; passed_special_doc = 1; @@ -192,7 +191,7 @@ int process_filelist(Header header, struct PackageRec *pr, if (type == RPMLEAD_BINARY) { /* check that file starts with leading "/" */ if (*filename != '/') { - error(RPMERR_BADSPEC, + rpmError(RPMERR_BADSPEC, "File needs leading \"/\": %s", filename); return(RPMERR_BADSPEC); } @@ -200,24 +199,24 @@ int process_filelist(Header header, struct PackageRec *pr, if (glob_pattern_p(filename)) { char fullname[1024]; - if (getVar(RPMVAR_ROOT)) { - sprintf(fullname, "%s%s", getVar(RPMVAR_ROOT), filename); + if (rpmGetVar(RPMVAR_ROOT)) { + sprintf(fullname, "%s%s", rpmGetVar(RPMVAR_ROOT), filename); } else { strcpy(fullname, filename); } if (glob(fullname, 0, glob_error, &glob_result)) { - error(RPMERR_BADSPEC, "No matches: %s", fullname); + rpmError(RPMERR_BADSPEC, "No matches: %s", fullname); return(RPMERR_BADSPEC); } if (glob_result.gl_pathc < 1) { - error(RPMERR_BADSPEC, "No matches: %s", fullname); + rpmError(RPMERR_BADSPEC, "No matches: %s", fullname); return(RPMERR_BADSPEC); } x = 0; c = 0; while (x < glob_result.gl_pathc) { - int offset = strlen(getVar(RPMVAR_ROOT) ? : ""); + int offset = strlen(rpmGetVar(RPMVAR_ROOT) ? : ""); c += add_file(&fes, &(glob_result.gl_pathv[x][offset]), isdoc, isconf, isdir, verify_flags, currPmode, currUname, currGname, prefix); @@ -248,7 +247,7 @@ int process_filelist(Header header, struct PackageRec *pr, } if (! c) { - error(RPMERR_BADSPEC, "File not found: %s", filename); + rpmError(RPMERR_BADSPEC, "File not found: %s", filename); return(RPMERR_BADSPEC); } count += c; @@ -301,7 +300,7 @@ int process_filelist(Header header, struct PackageRec *pr, /* Do timecheck */ tc = 0; currentTime = time(NULL); - if ((tcs = getVar(RPMVAR_TIMECHECK))) { + if ((tcs = rpmGetVar(RPMVAR_TIMECHECK))) { tc = strtoul(tcs, NULL, 10); } @@ -314,7 +313,7 @@ int process_filelist(Header header, struct PackageRec *pr, fileList[c] = strrchr(fest->file, '/') + 1; } if ((c > 0) && !strcmp(fileList[c], fileList[c-1])) { - error(RPMERR_BADSPEC, "File listed twice: %s", fileList[c]); + rpmError(RPMERR_BADSPEC, "File listed twice: %s", fileList[c]); return(RPMERR_BADSPEC); } @@ -322,14 +321,14 @@ int process_filelist(Header header, struct PackageRec *pr, fileGnameList[c] = fest->gname; *size += fest->statbuf.st_size; if (S_ISREG(fest->statbuf.st_mode)) { - if (getVar(RPMVAR_ROOT)) { - sprintf(buf, "%s%s", getVar(RPMVAR_ROOT), fest->file); + if (rpmGetVar(RPMVAR_ROOT)) { + sprintf(buf, "%s%s", rpmGetVar(RPMVAR_ROOT), fest->file); } else { strcpy(buf, fest->file); } mdfile(buf, buf); fileMD5List[c] = strdup(buf); - message(MESS_DEBUG, "md5(%s) = %s\n", fest->file, buf); + rpmMessage(RPMMESS_DEBUG, "md5(%s) = %s\n", fest->file, buf); } else { /* This is stupid */ fileMD5List[c] = strdup(""); @@ -342,7 +341,7 @@ int process_filelist(Header header, struct PackageRec *pr, /* Do timecheck */ if (tc && (type == RPMLEAD_BINARY)) { if (currentTime - fest->statbuf.st_mtime > tc) { - message(MESS_WARNING, "TIMECHECK failure: %s\n", + rpmMessage(RPMMESS_WARNING, "TIMECHECK failure: %s\n", fest->file); } } @@ -362,8 +361,8 @@ int process_filelist(Header header, struct PackageRec *pr, fileVerifyFlagsList[c] = fest->verify_flags; if (S_ISLNK(fest->statbuf.st_mode)) { - if (getVar(RPMVAR_ROOT)) { - sprintf(buf, "%s%s", getVar(RPMVAR_ROOT), fest->file); + if (rpmGetVar(RPMVAR_ROOT)) { + sprintf(buf, "%s%s", rpmGetVar(RPMVAR_ROOT), fest->file); } else { strcpy(buf, fest->file); } @@ -378,22 +377,22 @@ int process_filelist(Header header, struct PackageRec *pr, /* Add the header entries */ c = count; - addEntry(header, RPMTAG_FILENAMES, STRING_ARRAY_TYPE, fileList, c); - addEntry(header, RPMTAG_FILELINKTOS, STRING_ARRAY_TYPE, + headerAddEntry(header, RPMTAG_FILENAMES, RPM_STRING_ARRAY_TYPE, fileList, c); + headerAddEntry(header, RPMTAG_FILELINKTOS, RPM_STRING_ARRAY_TYPE, fileLinktoList, c); - addEntry(header, RPMTAG_FILEMD5S, STRING_ARRAY_TYPE, fileMD5List, c); - addEntry(header, RPMTAG_FILESIZES, INT32_TYPE, fileSizeList, c); - addEntry(header, RPMTAG_FILEUIDS, INT32_TYPE, fileUIDList, c); - addEntry(header, RPMTAG_FILEGIDS, INT32_TYPE, fileGIDList, c); - addEntry(header, RPMTAG_FILEUSERNAME, STRING_ARRAY_TYPE, + headerAddEntry(header, RPMTAG_FILEMD5S, RPM_STRING_ARRAY_TYPE, fileMD5List, c); + headerAddEntry(header, RPMTAG_FILESIZES, RPM_INT32_TYPE, fileSizeList, c); + headerAddEntry(header, RPMTAG_FILEUIDS, RPM_INT32_TYPE, fileUIDList, c); + headerAddEntry(header, RPMTAG_FILEGIDS, RPM_INT32_TYPE, fileGIDList, c); + headerAddEntry(header, RPMTAG_FILEUSERNAME, RPM_STRING_ARRAY_TYPE, fileUnameList, c); - addEntry(header, RPMTAG_FILEGROUPNAME, STRING_ARRAY_TYPE, + headerAddEntry(header, RPMTAG_FILEGROUPNAME, RPM_STRING_ARRAY_TYPE, fileGnameList, c); - addEntry(header, RPMTAG_FILEMTIMES, INT32_TYPE, fileMtimesList, c); - addEntry(header, RPMTAG_FILEFLAGS, INT32_TYPE, fileFlagsList, c); - addEntry(header, RPMTAG_FILEMODES, INT16_TYPE, fileModesList, c); - addEntry(header, RPMTAG_FILERDEVS, INT16_TYPE, fileRDevsList, c); - addEntry(header, RPMTAG_FILEVERIFYFLAGS, INT32_TYPE, + headerAddEntry(header, RPMTAG_FILEMTIMES, RPM_INT32_TYPE, fileMtimesList, c); + headerAddEntry(header, RPMTAG_FILEFLAGS, RPM_INT32_TYPE, fileFlagsList, c); + headerAddEntry(header, RPMTAG_FILEMODES, RPM_INT16_TYPE, fileModesList, c); + headerAddEntry(header, RPMTAG_FILERDEVS, RPM_INT16_TYPE, fileRDevsList, c); + headerAddEntry(header, RPMTAG_FILEVERIFYFLAGS, RPM_INT32_TYPE, fileVerifyFlagsList, c); /* Free the allocated strings */ @@ -548,8 +547,8 @@ static int add_file(struct file_entry **festack, const char *name, p->isconf = isconf; p->isspecfile = 0; /* source packages are done by hand */ p->verify_flags = verify_flags; - if (getVar(RPMVAR_ROOT)) { - sprintf(fullname, "%s%s", getVar(RPMVAR_ROOT), name); + if (rpmGetVar(RPMVAR_ROOT)) { + sprintf(fullname, "%s%s", rpmGetVar(RPMVAR_ROOT), name); } else { strcpy(fullname, name); } @@ -566,7 +565,7 @@ static int add_file(struct file_entry **festack, const char *name, prefixTest++; } if (*prefixPtr) { - error(RPMERR_BADSPEC, "File doesn't match prefix (%s): %s", + rpmError(RPMERR_BADSPEC, "File doesn't match prefix (%s): %s", prefix, name); return 0; } @@ -615,7 +614,7 @@ static int add_file(struct file_entry **festack, const char *name, p->next = *festack; *festack = p; - message(MESS_DEBUG, "ADDING: %s\n", name); + rpmMessage(RPMMESS_DEBUG, "ADDING: %s\n", name); /* return number of entries added */ return 1; @@ -626,8 +625,8 @@ static int add_file_aux(const char *file, struct stat *sb, int flag) { const char *name = file; - if (getVar(RPMVAR_ROOT)) { - name += strlen(getVar(RPMVAR_ROOT)); + if (rpmGetVar(RPMVAR_ROOT)) { + name += strlen(rpmGetVar(RPMVAR_ROOT)); } /* The 1 will cause add_file() to *not* descend */ @@ -705,7 +704,7 @@ static int parseForAttr(char *buf, char **currPmode, } if (*p != '(') { - error(RPMERR_BADSPEC, "Bad %%attr() syntax: %s", buf); + rpmError(RPMERR_BADSPEC, "Bad %%attr() syntax: %s", buf); return 0; } p++; @@ -716,7 +715,7 @@ static int parseForAttr(char *buf, char **currPmode, } if (! *end) { - error(RPMERR_BADSPEC, "Bad %%attr() syntax: %s", buf); + rpmError(RPMERR_BADSPEC, "Bad %%attr() syntax: %s", buf); return 0; } @@ -728,7 +727,7 @@ static int parseForAttr(char *buf, char **currPmode, *currGname = strtok(NULL, ", \n\t"); if (! (*currPmode && *currUname && *currGname)) { - error(RPMERR_BADSPEC, "Bad %%attr() syntax: %s", buf); + rpmError(RPMERR_BADSPEC, "Bad %%attr() syntax: %s", buf); *currPmode = *currUname = *currGname = NULL; return 0; } @@ -737,7 +736,7 @@ static int parseForAttr(char *buf, char **currPmode, if (strcmp(*currPmode, "-")) { x = sscanf(*currPmode, "%o", &mode); if ((x == 0) || (mode >> 12)) { - error(RPMERR_BADSPEC, "Bad %%attr() mode spec: %s", buf); + rpmError(RPMERR_BADSPEC, "Bad %%attr() mode spec: %s", buf); *currPmode = *currUname = *currGname = NULL; return 0; } @@ -777,7 +776,7 @@ static int parseForVerify(char *buf, int *verify_flags) } if (*p != '(') { - error(RPMERR_BADSPEC, "Bad %%verify() syntax: %s", buf); + rpmError(RPMERR_BADSPEC, "Bad %%verify() syntax: %s", buf); return 0; } p++; @@ -788,7 +787,7 @@ static int parseForVerify(char *buf, int *verify_flags) } if (! *end) { - error(RPMERR_BADSPEC, "Bad %%verify() syntax: %s", buf); + rpmError(RPMERR_BADSPEC, "Bad %%verify() syntax: %s", buf); return 0; } @@ -800,28 +799,28 @@ static int parseForVerify(char *buf, int *verify_flags) p = strtok(ourbuf, ", \n\t"); not = 0; - *verify_flags = VERIFY_NONE; + *verify_flags = RPMVERIFY_NONE; while (p) { if (!strcmp(p, "not")) { not = 1; } else if (!strcmp(p, "md5")) { - *verify_flags |= VERIFY_MD5; + *verify_flags |= RPMVERIFY_MD5; } else if (!strcmp(p, "size")) { - *verify_flags |= VERIFY_FILESIZE; + *verify_flags |= RPMVERIFY_FILESIZE; } else if (!strcmp(p, "link")) { - *verify_flags |= VERIFY_LINKTO; + *verify_flags |= RPMVERIFY_LINKTO; } else if (!strcmp(p, "user")) { - *verify_flags |= VERIFY_USER; + *verify_flags |= RPMVERIFY_USER; } else if (!strcmp(p, "group")) { - *verify_flags |= VERIFY_GROUP; + *verify_flags |= RPMVERIFY_GROUP; } else if (!strcmp(p, "mtime")) { - *verify_flags |= VERIFY_MTIME; + *verify_flags |= RPMVERIFY_MTIME; } else if (!strcmp(p, "mode")) { - *verify_flags |= VERIFY_MODE; + *verify_flags |= RPMVERIFY_MODE; } else if (!strcmp(p, "rdev")) { - *verify_flags |= VERIFY_RDEV; + *verify_flags |= RPMVERIFY_RDEV; } else { - error(RPMERR_BADSPEC, "Invalid %%verify token: %s", p); + rpmError(RPMERR_BADSPEC, "Invalid %%verify token: %s", p); return 0; } p = strtok(NULL, ", \n\t"); diff --git a/build/names.c b/build/names.c index 65562283d..f64a1f49d 100644 --- a/build/names.c +++ b/build/names.c @@ -12,7 +12,7 @@ #include "names.h" #include "rpmlib.h" -#include "rpmerr.h" +#include "messages.h" static uid_t uids[1024]; static char *unames[1024]; @@ -183,7 +183,7 @@ char *buildHost(void) if ((hbn = gethostbyname(hostname))) { strcpy(hostname, hbn->h_name); } else { - message(MESS_WARNING, "Could not canonicalize hostname: %s\n", + rpmMessage(RPMMESS_WARNING, "Could not canonicalize hostname: %s\n", hostname); } gotit = 1; diff --git a/build/pack.c b/build/pack.c index c2ec3c8e4..bdfe7e077 100644 --- a/build/pack.c +++ b/build/pack.c @@ -16,7 +16,6 @@ #include "spec.h" #include "specP.h" #include "signature.h" -#include "rpmerr.h" #include "rpmlead.h" #include "rpmlib.h" #include "misc.h" @@ -25,6 +24,7 @@ #include "files.h" #include "reqprov.h" #include "trigger.h" +#include "messages.h" static int writeMagic(int fd, char *name, unsigned short type); static int cpio_gzip(int fd, char *tempdir, char *writePtr, @@ -55,7 +55,7 @@ static int generateRPM(char *name, /* name-version-release */ Header sig; /* Write the archive to a temp file so we can get the size */ - archiveTemp = tempnam(getVar(RPMVAR_TMPPATH), "rpmbuild"); + archiveTemp = tempnam(rpmGetVar(RPMVAR_TMPPATH), "rpmbuild"); if ((fd = open(archiveTemp, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) { fprintf(stderr, "Could not open %s\n", archiveTemp); return 1; @@ -68,16 +68,16 @@ static int generateRPM(char *name, /* name-version-release */ close(fd); /* Add the archive size to the Header */ - addEntry(header, RPMTAG_ARCHIVESIZE, INT32_TYPE, &archiveSize, 1); + headerAddEntry(header, RPMTAG_ARCHIVESIZE, RPM_INT32_TYPE, &archiveSize, 1); /* Now write the header and append the archive */ - sigtarget = tempnam(getVar(RPMVAR_TMPPATH), "rpmbuild"); + sigtarget = tempnam(rpmGetVar(RPMVAR_TMPPATH), "rpmbuild"); if ((fd = open(sigtarget, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) { fprintf(stderr, "Could not open %s\n", sigtarget); unlink(archiveTemp); return 1; } - writeHeader(fd, header, HEADER_MAGIC); + headerWrite(fd, header, HEADER_MAGIC_YES); ifd = open(archiveTemp, O_RDONLY, 0644); while ((count = read(ifd, buffer, sizeof(buffer))) > 0) { if (count == -1) { @@ -116,23 +116,23 @@ static int generateRPM(char *name, /* name-version-release */ } /* Generate the signature */ - sigtype = sigLookupType(); - message(MESS_VERBOSE, "Generating signature: %d\n", sigtype); + sigtype = rpmLookupSignatureType(); + rpmMessage(RPMMESS_VERBOSE, "Generating signature: %d\n", sigtype); fflush(stdout); - sig = newSignature(); - addSignature(sig, sigtarget, SIGTAG_SIZE, passPhrase); - addSignature(sig, sigtarget, SIGTAG_MD5, passPhrase); + sig = rpmNewSignature(); + rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase); + rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase); if (sigtype>0) { - addSignature(sig, sigtarget, sigtype, passPhrase); + rpmAddSignature(sig, sigtarget, sigtype, passPhrase); } - if (writeSignature(fd, sig)) { + if (rpmWriteSignature(fd, sig)) { close(fd); unlink(sigtarget); unlink(filename); - freeSignature(sig); + rpmFreeSignature(sig); return 1; } - freeSignature(sig); + rpmFreeSignature(sig); /* Append the header and archive */ ifd = open(sigtarget, O_RDONLY); @@ -158,7 +158,7 @@ static int generateRPM(char *name, /* name-version-release */ close(fd); unlink(sigtarget); - message(MESS_VERBOSE, "Wrote: %s\n", filename); + rpmMessage(RPMMESS_VERBOSE, "Wrote: %s\n", filename); return 0; } @@ -172,8 +172,8 @@ static int writeMagic(int fd, char *name, lead.major = 3; lead.minor = 0; lead.type = type; - lead.archnum = getArchNum(); - lead.osnum = getOsNum(); + lead.archnum = rpmGetArchNum(); + lead.osnum = rpmGetOsNum(); lead.signature_type = RPMSIG_HEADERSIG; /* New-style signature */ strncpy(lead.name, name, sizeof(lead.name)); @@ -200,7 +200,7 @@ static int cpio_gzip(int fd, char *tempdir, char *writePtr, int status; void *oldhandler; - cpiobin = getVar(RPMVAR_CPIOBIN); + cpiobin = rpmGetVar(RPMVAR_CPIOBIN); if (!cpiobin) cpiobin = "cpio"; *archiveSize = 0; @@ -223,10 +223,10 @@ static int cpio_gzip(int fd, char *tempdir, char *writePtr, if (tempdir) { chdir(tempdir); - } else if (getVar(RPMVAR_ROOT)) { - if (chdir(getVar(RPMVAR_ROOT))) { - error(RPMERR_EXEC, "Couldn't chdir to %s", - getVar(RPMVAR_ROOT)); + } else if (rpmGetVar(RPMVAR_ROOT)) { + if (chdir(rpmGetVar(RPMVAR_ROOT))) { + rpmError(RPMERR_EXEC, "Couldn't chdir to %s", + rpmGetVar(RPMVAR_ROOT)); exit(RPMERR_EXEC); } } else { @@ -235,20 +235,20 @@ static int cpio_gzip(int fd, char *tempdir, char *writePtr, } if (prefix) { if (chdir(prefix)) { - error(RPMERR_EXEC, "Couldn't chdir to %s", prefix); + rpmError(RPMERR_EXEC, "Couldn't chdir to %s", prefix); exit(RPMERR_EXEC); } } execlp(cpiobin, cpiobin, - (isVerbose()) ? "-ov" : "-o", + (rpmIsVerbose()) ? "-ov" : "-o", (tempdir) ? "-LH" : "-H", "crc", NULL); - error(RPMERR_EXEC, "Couldn't exec cpio"); + rpmError(RPMERR_EXEC, "Couldn't exec cpio"); exit(RPMERR_EXEC); } if (cpioPID < 0) { - error(RPMERR_FORK, "Couldn't fork cpio"); + rpmError(RPMERR_FORK, "Couldn't fork cpio"); return RPMERR_FORK; } @@ -268,11 +268,11 @@ static int cpio_gzip(int fd, char *tempdir, char *writePtr, dup2(fd, 1); /* Make stdout the passed-in fd */ execlp("gzip", "gzip", "-c9fn", NULL); - error(RPMERR_EXEC, "Couldn't exec gzip"); + rpmError(RPMERR_EXEC, "Couldn't exec gzip"); exit(RPMERR_EXEC); } if (gzipPID < 0) { - error(RPMERR_FORK, "Couldn't fork gzip"); + rpmError(RPMERR_FORK, "Couldn't fork gzip"); return RPMERR_FORK; } @@ -327,7 +327,7 @@ static int cpio_gzip(int fd, char *tempdir, char *writePtr, } while (((!cpioDead) || bytes) && (!gzipDead)); if (gzipDead) { - error(RPMERR_GZIP, "gzip died"); + rpmError(RPMERR_GZIP, "gzip died"); return 1; } @@ -338,17 +338,17 @@ static int cpio_gzip(int fd, char *tempdir, char *writePtr, signal(SIGPIPE, oldhandler); if (writeBytesLeft) { - error(RPMERR_CPIO, "failed to write all data to cpio"); + rpmError(RPMERR_CPIO, "failed to write all data to cpio"); return 1; } waitpid(cpioPID, &status, 0); if (!WIFEXITED(status) || WEXITSTATUS(status)) { - error(RPMERR_CPIO, "cpio failed"); + rpmError(RPMERR_CPIO, "cpio failed"); return 1; } waitpid(gzipPID, &status, 0); if (!WIFEXITED(status) || WEXITSTATUS(status)) { - error(RPMERR_GZIP, "gzip failed"); + rpmError(RPMERR_GZIP, "gzip failed"); return 1; } @@ -383,18 +383,18 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) char **farray, *file; int count; - if (!getEntry(s->packages->header, RPMTAG_VERSION, NULL, + if (!headerGetEntry(s->packages->header, RPMTAG_VERSION, NULL, (void *) &version, NULL)) { - error(RPMERR_BADSPEC, "No version field"); + rpmError(RPMERR_BADSPEC, "No version field"); return RPMERR_BADSPEC; } - if (!getEntry(s->packages->header, RPMTAG_RELEASE, NULL, + if (!headerGetEntry(s->packages->header, RPMTAG_RELEASE, NULL, (void *) &release, NULL)) { - error(RPMERR_BADSPEC, "No release field"); + rpmError(RPMERR_BADSPEC, "No release field"); return RPMERR_BADSPEC; } - /* after the getEntry() these are just pointers into the */ - /* header structure, which can be moved around by addEntry */ + /* after the headerGetEntry() these are just pointers into the */ + /* header structure, which can be moved around by headerAddEntry */ version = strdup(version); release = strdup(release); @@ -402,16 +402,16 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) (s->numNoPatch + s->numNoSource) ? "no" : ""); vendor = NULL; - if (!isEntry(s->packages->header, RPMTAG_VENDOR)) { - vendor = getVar(RPMVAR_VENDOR); + if (!headerIsEntry(s->packages->header, RPMTAG_VENDOR)) { + vendor = rpmGetVar(RPMVAR_VENDOR); } dist = NULL; - if (!isEntry(s->packages->header, RPMTAG_DISTRIBUTION)) { - dist = getVar(RPMVAR_DISTRIBUTION); + if (!headerIsEntry(s->packages->header, RPMTAG_DISTRIBUTION)) { + dist = rpmGetVar(RPMVAR_DISTRIBUTION); } packager = NULL; - if (!isEntry(s->packages->header, RPMTAG_PACKAGER)) { - packager = getVar(RPMVAR_PACKAGER); + if (!headerIsEntry(s->packages->header, RPMTAG_PACKAGER)) { + packager = rpmGetVar(RPMVAR_PACKAGER); } /* Look through for each package */ @@ -424,30 +424,30 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) } /* Handle subpackage version/release overrides */ - if (!getEntry(pr->header, RPMTAG_VERSION, NULL, + if (!headerGetEntry(pr->header, RPMTAG_VERSION, NULL, (void *) &packageVersion, NULL)) { packageVersion = version; } - if (!getEntry(pr->header, RPMTAG_RELEASE, NULL, + if (!headerGetEntry(pr->header, RPMTAG_RELEASE, NULL, (void *) &packageRelease, NULL)) { packageRelease = release; } - /* after the getEntry() these are just pointers into the */ - /* header structure, which can be moved around by addEntry */ + /* after the headerGetEntry() these are just pointers into the */ + /* header structure, which can be moved around by headerAddEntry */ packageVersion = strdup(packageVersion); packageRelease = strdup(packageRelease); /* Figure out the name of this package */ - if (!getEntry(pr->header, RPMTAG_NAME, NULL, (void *)&nametmp, NULL)) { - error(RPMERR_INTERNAL, "Package has no name!"); + if (!headerGetEntry(pr->header, RPMTAG_NAME, NULL, (void *)&nametmp, NULL)) { + rpmError(RPMERR_INTERNAL, "Package has no name!"); return RPMERR_INTERNAL; } sprintf(name, "%s-%s-%s", nametmp, packageVersion, packageRelease); if (doPackage == PACK_PACKAGE) { - message(MESS_VERBOSE, "Binary Packaging: %s\n", name); + rpmMessage(RPMMESS_VERBOSE, "Binary Packaging: %s\n", name); } else { - message(MESS_VERBOSE, "File List Check: %s\n", name); + rpmMessage(RPMMESS_VERBOSE, "File List Check: %s\n", name); } /**** Generate the Header ****/ @@ -455,9 +455,9 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) /* Here's the plan: copy the package's header, */ /* then add entries from the primary header */ /* that don't already exist. */ - outHeader = copyHeader(pr->header); - headerIter = initIterator(s->packages->header); - while (nextIterator(headerIter, &tag, &type, &ptr, &c)) { + outHeader = headerCopy(pr->header); + headerIter = headerInitIterator(s->packages->header); + while (headerNextIterator(headerIter, &tag, &type, &ptr, &c)) { /* Some tags we don't copy */ switch (tag) { case RPMTAG_PREIN: @@ -468,57 +468,57 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) continue; break; /* Shouldn't need this */ default: - if (! isEntry(outHeader, tag)) { - addEntry(outHeader, tag, type, ptr, c); + if (! headerIsEntry(outHeader, tag)) { + headerAddEntry(outHeader, tag, type, ptr, c); } } } - freeIterator(headerIter); + headerFreeIterator(headerIter); /* Add some final entries to the header */ - addEntry(outHeader, RPMTAG_OS, STRING_TYPE, getOsName(), 1); - addEntry(outHeader, RPMTAG_ARCH, STRING_TYPE, getArchName(), 1); - addEntry(outHeader, RPMTAG_BUILDTIME, INT32_TYPE, getBuildTime(), 1); - addEntry(outHeader, RPMTAG_BUILDHOST, STRING_TYPE, buildHost(), 1); - addEntry(outHeader, RPMTAG_SOURCERPM, STRING_TYPE, sourcerpm, 1); - addEntry(outHeader, RPMTAG_RPMVERSION, STRING_TYPE, VERSION, 1); + headerAddEntry(outHeader, RPMTAG_OS, RPM_STRING_TYPE, rpmGetOsName(), 1); + headerAddEntry(outHeader, RPMTAG_ARCH, RPM_STRING_TYPE, rpmGetArchName(), 1); + headerAddEntry(outHeader, RPMTAG_BUILDTIME, RPM_INT32_TYPE, getBuildTime(), 1); + headerAddEntry(outHeader, RPMTAG_BUILDHOST, RPM_STRING_TYPE, buildHost(), 1); + headerAddEntry(outHeader, RPMTAG_SOURCERPM, RPM_STRING_TYPE, sourcerpm, 1); + headerAddEntry(outHeader, RPMTAG_RPMVERSION, RPM_STRING_TYPE, VERSION, 1); if (pr->icon) { - sprintf(filename, "%s/%s", getVar(RPMVAR_SOURCEDIR), pr->icon); + sprintf(filename, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), pr->icon); stat(filename, &statbuf); icon = malloc(statbuf.st_size); iconFD = open(filename, O_RDONLY, 0644); read(iconFD, icon, statbuf.st_size); close(iconFD); if (! strncmp(icon, "GIF", 3)) { - addEntry(outHeader, RPMTAG_GIF, BIN_TYPE, + headerAddEntry(outHeader, RPMTAG_GIF, RPM_BIN_TYPE, icon, statbuf.st_size); } else if (! strncmp(icon, "/* XPM", 6)) { - addEntry(outHeader, RPMTAG_XPM, BIN_TYPE, + headerAddEntry(outHeader, RPMTAG_XPM, RPM_BIN_TYPE, icon, statbuf.st_size); } else { - error(RPMERR_BADSPEC, "Unknown icon type"); + rpmError(RPMERR_BADSPEC, "Unknown icon type"); return 1; } free(icon); } if (vendor) { - addEntry(outHeader, RPMTAG_VENDOR, STRING_TYPE, vendor, 1); + headerAddEntry(outHeader, RPMTAG_VENDOR, RPM_STRING_TYPE, vendor, 1); } if (dist) { - addEntry(outHeader, RPMTAG_DISTRIBUTION, STRING_TYPE, dist, 1); + headerAddEntry(outHeader, RPMTAG_DISTRIBUTION, RPM_STRING_TYPE, dist, 1); } if (packager) { - addEntry(outHeader, RPMTAG_PACKAGER, STRING_TYPE, packager, 1); + headerAddEntry(outHeader, RPMTAG_PACKAGER, RPM_STRING_TYPE, packager, 1); } /**** Process the file list ****/ prefixSave = prefix = NULL; prefixLen = 0; - if (getEntry(outHeader, RPMTAG_DEFAULTPREFIX, + if (headerGetEntry(outHeader, RPMTAG_DEFAULTPREFIX, NULL, (void **)&prefix, NULL)) { - /* after the getEntry() this is just pointers into the */ - /* header structure, which can be moved around by addEntry */ + /* after the headerGetEntry() this is just pointers into the */ + /* header structure, which can be moved around by headerAddEntry */ prefixSave = prefix = strdup(prefix); while (*prefix && (*prefix == '/')) { prefix++; @@ -528,7 +528,7 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) prefixLen = 0; } else { prefixLen = strlen(prefix); - message(MESS_VERBOSE, "Package Prefix = %s\n", prefix); + rpmMessage(RPMMESS_VERBOSE, "Package Prefix = %s\n", prefix); } } @@ -538,7 +538,7 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) return 1; } - if (!getEntry(outHeader, RPMTAG_FILENAMES, NULL, (void **) &farray, + if (!headerGetEntry(outHeader, RPMTAG_FILENAMES, NULL, (void **) &farray, &count)) { /* count may already be 0, but this is safer */ count = 0; @@ -552,7 +552,7 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) } if (prefix) { if (strncmp(prefix, file, prefixLen)) { - error(RPMERR_BADSPEC, "File doesn't match prefix (%s): %s", + rpmError(RPMERR_BADSPEC, "File doesn't match prefix (%s): %s", prefix, file); return 1; } @@ -572,14 +572,14 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) generateTriggerEntries(outHeader, pr); /* And add the final Header entry */ - addEntry(outHeader, RPMTAG_SIZE, INT32_TYPE, &size, 1); + headerAddEntry(outHeader, RPMTAG_SIZE, RPM_INT32_TYPE, &size, 1); /**** Make the RPM ****/ /* Make the output RPM filename */ if (doPackage == PACK_PACKAGE) { - sprintf(filename, "%s/%s/%s.%s.rpm", getVar(RPMVAR_RPMDIR), - getArchName(), name, getArchName()); + sprintf(filename, "%s/%s/%s.%s.rpm", rpmGetVar(RPMVAR_RPMDIR), + rpmGetArchName(), name, rpmGetArchName()); if (generateRPM(name, filename, RPMLEAD_BINARY, outHeader, NULL, getStringBuf(cpioFileList), passPhrase, prefix)) { @@ -589,7 +589,7 @@ int packageBinaries(Spec s, char *passPhrase, int doPackage) } freeStringBuf(cpioFileList); - freeHeader(outHeader); + headerFree(outHeader); if (prefixSave) free(prefixSave); @@ -631,7 +631,7 @@ int packageSource(Spec s, char *passPhrase) /**** Create links for all the sources ****/ - tempdir = tempnam(getVar(RPMVAR_TMPPATH), "rpmbuild"); + tempdir = tempnam(rpmGetVar(RPMVAR_TMPPATH), "rpmbuild"); mkdir(tempdir, 0700); filelist = newStringBuf(); /* List in the header */ @@ -664,13 +664,13 @@ int packageSource(Spec s, char *passPhrase) } skipi--; } - sprintf(src, "%s/%s", getVar(RPMVAR_SOURCEDIR), source->source); + sprintf(src, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), source->source); sprintf(dest, "%s/%s", tempdir, source->source); if (skipi < 0) { symlink(src, dest); appendLineStringBuf(cpioFileList, source->source); } else { - message(MESS_VERBOSE, "Skipping source/patch (%d): %s\n", + rpmMessage(RPMMESS_VERBOSE, "Skipping source/patch (%d): %s\n", source->num, source->source); } appendLineStringBuf(filelist, src); @@ -685,7 +685,7 @@ int packageSource(Spec s, char *passPhrase) package = s->packages; while (package) { if (package->icon) { - sprintf(src, "%s/%s", getVar(RPMVAR_SOURCEDIR), package->icon); + sprintf(src, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), package->icon); sprintf(dest, "%s/%s", tempdir, package->icon); appendLineStringBuf(filelist, dest); appendLineStringBuf(cpioFileList, package->icon); @@ -696,43 +696,43 @@ int packageSource(Spec s, char *passPhrase) /**** Generate the Header ****/ - if (!getEntry(s->packages->header, RPMTAG_VERSION, NULL, + if (!headerGetEntry(s->packages->header, RPMTAG_VERSION, NULL, (void *) &version, NULL)) { - error(RPMERR_BADSPEC, "No version field"); + rpmError(RPMERR_BADSPEC, "No version field"); return RPMERR_BADSPEC; } - if (!getEntry(s->packages->header, RPMTAG_RELEASE, NULL, + if (!headerGetEntry(s->packages->header, RPMTAG_RELEASE, NULL, (void *) &release, NULL)) { - error(RPMERR_BADSPEC, "No release field"); + rpmError(RPMERR_BADSPEC, "No release field"); return RPMERR_BADSPEC; } - outHeader = copyHeader(s->packages->header); - addEntry(outHeader, RPMTAG_OS, STRING_TYPE, getOsName(), 1); - addEntry(outHeader, RPMTAG_ARCH, STRING_TYPE, getArchName(), 1); - addEntry(outHeader, RPMTAG_BUILDTIME, INT32_TYPE, getBuildTime(), 1); - addEntry(outHeader, RPMTAG_BUILDHOST, STRING_TYPE, buildHost(), 1); - addEntry(outHeader, RPMTAG_RPMVERSION, STRING_TYPE, VERSION, 1); + outHeader = headerCopy(s->packages->header); + headerAddEntry(outHeader, RPMTAG_OS, RPM_STRING_TYPE, rpmGetOsName(), 1); + headerAddEntry(outHeader, RPMTAG_ARCH, RPM_STRING_TYPE, rpmGetArchName(), 1); + headerAddEntry(outHeader, RPMTAG_BUILDTIME, RPM_INT32_TYPE, getBuildTime(), 1); + headerAddEntry(outHeader, RPMTAG_BUILDHOST, RPM_STRING_TYPE, buildHost(), 1); + headerAddEntry(outHeader, RPMTAG_RPMVERSION, RPM_STRING_TYPE, VERSION, 1); if (scount) - addEntry(outHeader, RPMTAG_SOURCE, STRING_ARRAY_TYPE, sources, scount); + headerAddEntry(outHeader, RPMTAG_SOURCE, RPM_STRING_ARRAY_TYPE, sources, scount); if (pcount) - addEntry(outHeader, RPMTAG_PATCH, STRING_ARRAY_TYPE, patches, pcount); + headerAddEntry(outHeader, RPMTAG_PATCH, RPM_STRING_ARRAY_TYPE, patches, pcount); if (s->numNoSource) { - addEntry(outHeader, RPMTAG_NOSOURCE, INT32_TYPE, s->noSource, + headerAddEntry(outHeader, RPMTAG_NOSOURCE, RPM_INT32_TYPE, s->noSource, s->numNoSource); } if (s->numNoPatch) { - addEntry(outHeader, RPMTAG_NOPATCH, INT32_TYPE, s->noPatch, + headerAddEntry(outHeader, RPMTAG_NOPATCH, RPM_INT32_TYPE, s->noPatch, s->numNoPatch); } - if (!isEntry(s->packages->header, RPMTAG_VENDOR)) { - if ((vendor = getVar(RPMVAR_VENDOR))) { - addEntry(outHeader, RPMTAG_VENDOR, STRING_TYPE, vendor, 1); + if (!headerIsEntry(s->packages->header, RPMTAG_VENDOR)) { + if ((vendor = rpmGetVar(RPMVAR_VENDOR))) { + headerAddEntry(outHeader, RPMTAG_VENDOR, RPM_STRING_TYPE, vendor, 1); } } - if (!isEntry(s->packages->header, RPMTAG_DISTRIBUTION)) { - if ((dist = getVar(RPMVAR_DISTRIBUTION))) { - addEntry(outHeader, RPMTAG_DISTRIBUTION, STRING_TYPE, dist, 1); + if (!headerIsEntry(s->packages->header, RPMTAG_DISTRIBUTION)) { + if ((dist = rpmGetVar(RPMVAR_DISTRIBUTION))) { + headerAddEntry(outHeader, RPMTAG_DISTRIBUTION, RPM_STRING_TYPE, dist, 1); } } @@ -744,14 +744,14 @@ int packageSource(Spec s, char *passPhrase) } /* And add the final Header entry */ - addEntry(outHeader, RPMTAG_SIZE, INT32_TYPE, &size, 1); + headerAddEntry(outHeader, RPMTAG_SIZE, RPM_INT32_TYPE, &size, 1); /**** Make the RPM ****/ sprintf(fullname, "%s-%s-%s", s->name, version, release); - sprintf(filename, "%s/%s.%ssrc.rpm", getVar(RPMVAR_SRPMDIR), fullname, + sprintf(filename, "%s/%s.%ssrc.rpm", rpmGetVar(RPMVAR_SRPMDIR), fullname, (s->numNoPatch + s->numNoSource) ? "no" : ""); - message(MESS_VERBOSE, "Source Packaging: %s\n", fullname); + rpmMessage(RPMMESS_VERBOSE, "Source Packaging: %s\n", fullname); if (generateRPM(fullname, filename, RPMLEAD_SOURCE, outHeader, tempdir, getStringBuf(cpioFileList), passPhrase, NULL)) { diff --git a/build/reqprov.c b/build/reqprov.c index 9b0091ef0..ff9fc0f80 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -15,7 +15,6 @@ #include "reqprov.h" #include "messages.h" #include "rpmlib.h" -#include "rpmerr.h" #include "misc.h" static StringBuf getOutputFrom(char *dir, char *argv[], @@ -57,7 +56,7 @@ int addReqProv(struct PackageRec *p, int flags, } if (rd) { /* already there */ - message(MESS_DEBUG, "Already Got: %s\n", name); + rpmMessage(RPMMESS_DEBUG, "Already Got: %s\n", name); return 0; } @@ -68,14 +67,14 @@ int addReqProv(struct PackageRec *p, int flags, rd->next = p->reqprov; p->reqprov = rd; - if (flags & REQUIRE_PROVIDES) { - message(MESS_DEBUG, "Adding provide: %s\n", name); + if (flags & RPMSENSE_PROVIDES) { + rpmMessage(RPMMESS_DEBUG, "Adding provide: %s\n", name); p->numProv++; - } else if (flags & REQUIRE_CONFLICTS) { - message(MESS_DEBUG, "Adding conflict: %s\n", name); + } else if (flags & RPMSENSE_CONFLICTS) { + rpmMessage(RPMMESS_DEBUG, "Adding conflict: %s\n", name); p->numConflict++; } else { - message(MESS_DEBUG, "Adding require: %s\n", name); + rpmMessage(RPMMESS_DEBUG, "Adding require: %s\n", name); p->numReq++; } @@ -121,11 +120,11 @@ static StringBuf getOutputFrom(char *dir, char *argv[], chdir(dir); execvp(argv[0], argv); - error(RPMERR_EXEC, "Couldn't exec %s", argv[0]); + rpmError(RPMERR_EXEC, "Couldn't exec %s", argv[0]); exit(RPMERR_EXEC); } if (progPID < 0) { - error(RPMERR_FORK, "Couldn't fork %s", argv[0]); + rpmError(RPMERR_FORK, "Couldn't fork %s", argv[0]); return NULL; } @@ -177,12 +176,12 @@ static StringBuf getOutputFrom(char *dir, char *argv[], signal(SIGPIPE, oldhandler); if (writeBytesLeft) { - error(RPMERR_EXEC, "failed to write all data to %s", argv[0]); + rpmError(RPMERR_EXEC, "failed to write all data to %s", argv[0]); return NULL; } waitpid(progPID, &status, 0); if (!WIFEXITED(status) || WEXITSTATUS(status)) { - error(RPMERR_EXEC, "%s failed", argv[0]); + rpmError(RPMERR_EXEC, "%s failed", argv[0]); return NULL; } @@ -202,26 +201,26 @@ int generateAutoReqProv(Header header, struct PackageRec *p) char dir[1024]; char *argv[8]; - message(MESS_VERBOSE, "Finding dependencies...\n"); + rpmMessage(RPMMESS_VERBOSE, "Finding dependencies...\n"); /*** Get root directory ***/ - if (getVar(RPMVAR_ROOT)) { - strcpy(dir, getVar(RPMVAR_ROOT)); + if (rpmGetVar(RPMVAR_ROOT)) { + strcpy(dir, rpmGetVar(RPMVAR_ROOT)); } else { strcpy(dir, "/"); } /*** Generate File List ***/ - if (!getEntry(header, RPMTAG_FILENAMES, NULL, (void **) &f, &count)) { + if (!headerGetEntry(header, RPMTAG_FILENAMES, NULL, (void **) &f, &count)) { return 0; } if (!count) { return 0; } fsave = f; - getEntry(header, RPMTAG_FILEMODES, NULL, (void **) &modes, NULL); + headerGetEntry(header, RPMTAG_FILEMODES, NULL, (void **) &modes, NULL); writeBuff = newStringBuf(); writeBytes = 0; @@ -244,7 +243,7 @@ int generateAutoReqProv(Header header, struct PackageRec *p) argv[1] = NULL; readBuff = getOutputFrom(dir, argv, writePtr, writeBytes); if (!readBuff) { - error(RPMERR_EXEC, "Failed to find provides"); + rpmError(RPMERR_EXEC, "Failed to find provides"); exit(1); } @@ -253,7 +252,7 @@ int generateAutoReqProv(Header header, struct PackageRec *p) freeStringBuf(readBuff); while (*f) { if (**f) { - addReqProv(p, REQUIRE_PROVIDES, *f, NULL); + addReqProv(p, RPMSENSE_PROVIDES, *f, NULL); } f++; } @@ -276,7 +275,7 @@ int generateAutoReqProv(Header header, struct PackageRec *p) argv[3] = NULL; readBuff = getOutputFrom(dir, argv, writePtr, writeBytes); if (!readBuff) { - error(RPMERR_EXEC, "Failed to find requires"); + rpmError(RPMERR_EXEC, "Failed to find requires"); exit(1); } @@ -297,7 +296,7 @@ int generateAutoReqProv(Header header, struct PackageRec *p) if ((s = strrchr(tok, '/'))) { tok = s + 1; } - addReqProv(p, REQUIRE_ANY, tok, NULL); + addReqProv(p, RPMSENSE_ANY, tok, NULL); } f++; @@ -328,17 +327,17 @@ int processReqProv(Header h, struct PackageRec *p) if (p->numProv) { rd = p->reqprov; nameArray = namePtr = malloc(p->numProv * sizeof(*nameArray)); - message(MESS_VERBOSE, "Provides (%d):", p->numProv); + rpmMessage(RPMMESS_VERBOSE, "Provides (%d):", p->numProv); while (rd) { - if (rd->flags & REQUIRE_PROVIDES) { - message(MESS_VERBOSE, " %s", rd->name); + if (rd->flags & RPMSENSE_PROVIDES) { + rpmMessage(RPMMESS_VERBOSE, " %s", rd->name); *namePtr++ = rd->name; } rd = rd->next; } - message(MESS_VERBOSE, "\n"); + rpmMessage(RPMMESS_VERBOSE, "\n"); - addEntry(h, RPMTAG_PROVIDES, STRING_ARRAY_TYPE, nameArray, p->numProv); + headerAddEntry(h, RPMTAG_PROVIDES, RPM_STRING_ARRAY_TYPE, nameArray, p->numProv); free(nameArray); } @@ -348,23 +347,23 @@ int processReqProv(Header h, struct PackageRec *p) versionArray = versionPtr = malloc(p->numConflict * sizeof(*versionArray)); flagArray = flagPtr = malloc(p->numConflict * sizeof(*flagArray)); - message(MESS_VERBOSE, "Conflicts (%d):", p->numConflict); + rpmMessage(RPMMESS_VERBOSE, "Conflicts (%d):", p->numConflict); while (rd) { - if (rd->flags & REQUIRE_CONFLICTS) { - message(MESS_VERBOSE, " %s", rd->name); + if (rd->flags & RPMSENSE_CONFLICTS) { + rpmMessage(RPMMESS_VERBOSE, " %s", rd->name); *namePtr++ = rd->name; *versionPtr++ = rd->version ? rd->version : ""; - *flagPtr++ = rd->flags & REQUIRE_SENSEMASK; + *flagPtr++ = rd->flags & RPMSENSE_SENSEMASK; } rd = rd->next; } - message(MESS_VERBOSE, "\n"); + rpmMessage(RPMMESS_VERBOSE, "\n"); - addEntry(h, RPMTAG_CONFLICTNAME, STRING_ARRAY_TYPE, + headerAddEntry(h, RPMTAG_CONFLICTNAME, RPM_STRING_ARRAY_TYPE, nameArray, p->numConflict); - addEntry(h, RPMTAG_CONFLICTVERSION, STRING_ARRAY_TYPE, + headerAddEntry(h, RPMTAG_CONFLICTVERSION, RPM_STRING_ARRAY_TYPE, versionArray, p->numConflict); - addEntry(h, RPMTAG_CONFLICTFLAGS, INT32_TYPE, + headerAddEntry(h, RPMTAG_CONFLICTFLAGS, RPM_INT32_TYPE, flagArray, p->numConflict); free(nameArray); @@ -377,24 +376,24 @@ int processReqProv(Header h, struct PackageRec *p) nameArray = namePtr = malloc(p->numReq * sizeof(*nameArray)); versionArray = versionPtr = malloc(p->numReq * sizeof(*versionArray)); flagArray = flagPtr = malloc(p->numReq * sizeof(*flagArray)); - message(MESS_VERBOSE, "Requires (%d):", p->numReq); + rpmMessage(RPMMESS_VERBOSE, "Requires (%d):", p->numReq); while (rd) { - if (! ((rd->flags & REQUIRE_PROVIDES) || - (rd->flags & REQUIRE_CONFLICTS))) { - message(MESS_VERBOSE, " %s", rd->name); + if (! ((rd->flags & RPMSENSE_PROVIDES) || + (rd->flags & RPMSENSE_CONFLICTS))) { + rpmMessage(RPMMESS_VERBOSE, " %s", rd->name); *namePtr++ = rd->name; *versionPtr++ = rd->version ? rd->version : ""; - *flagPtr++ = rd->flags & REQUIRE_SENSEMASK; + *flagPtr++ = rd->flags & RPMSENSE_SENSEMASK; } rd = rd->next; } - message(MESS_VERBOSE, "\n"); + rpmMessage(RPMMESS_VERBOSE, "\n"); - addEntry(h, RPMTAG_REQUIRENAME, STRING_ARRAY_TYPE, + headerAddEntry(h, RPMTAG_REQUIRENAME, RPM_STRING_ARRAY_TYPE, nameArray, p->numReq); - addEntry(h, RPMTAG_REQUIREVERSION, STRING_ARRAY_TYPE, + headerAddEntry(h, RPMTAG_REQUIREVERSION, RPM_STRING_ARRAY_TYPE, versionArray, p->numReq); - addEntry(h, RPMTAG_REQUIREFLAGS, INT32_TYPE, + headerAddEntry(h, RPMTAG_REQUIREFLAGS, RPM_INT32_TYPE, flagArray, p->numReq); free(nameArray); diff --git a/build/spec.c b/build/spec.c index 90851f54b..623bd891a 100644 --- a/build/spec.c +++ b/build/spec.c @@ -21,7 +21,6 @@ TODO: #include "header.h" #include "spec.h" #include "specP.h" -#include "rpmerr.h" #include "messages.h" #include "rpmlib.h" #include "stringbuf.h" @@ -81,7 +80,7 @@ static int addSource(Spec spec, char *line) p->ispatch = 1; s = line + 5; } else { - error(RPMERR_BADSPEC, "Not a source/patch line: %s\n", line); + rpmError(RPMERR_BADSPEC, "Not a source/patch line: %s\n", line); return(RPMERR_BADSPEC); } @@ -90,7 +89,7 @@ static int addSource(Spec spec, char *line) if (*s != ':') { x = strspn(s, "0123456789"); if (! x) { - error(RPMERR_BADSPEC, "Bad source/patch line: %s\n", line); + rpmError(RPMERR_BADSPEC, "Bad source/patch line: %s\n", line); return(RPMERR_BADSPEC); } c = s[x]; @@ -99,7 +98,7 @@ static int addSource(Spec spec, char *line) p->num = strtoul(s, &s1, 10); if ((*s1) || (s1 == s) || (p->num == ULONG_MAX)) { s[x] = c; - error(RPMERR_BADSPEC, "Bad source/patch number: %s\n", s); + rpmError(RPMERR_BADSPEC, "Bad source/patch number: %s\n", s); return(RPMERR_BADSPEC); } s[x] = c; @@ -109,7 +108,7 @@ static int addSource(Spec spec, char *line) } if (*s != ':') { - error(RPMERR_BADSPEC, "Bad source/patch line: %s\n", line); + rpmError(RPMERR_BADSPEC, "Bad source/patch line: %s\n", line); return(RPMERR_BADSPEC); } @@ -119,7 +118,7 @@ static int addSource(Spec spec, char *line) file = strtok(s, " \t\n"); if (! file) { - error(RPMERR_BADSPEC, "Bad source/patch line: %s\n", line); + rpmError(RPMERR_BADSPEC, "Bad source/patch line: %s\n", line); return(RPMERR_BADSPEC); } p->fullSource = strdup(file); @@ -131,9 +130,9 @@ static int addSource(Spec spec, char *line) } if (p->ispatch) { - message(MESS_DEBUG, "Patch(%d) = %s\n", p->num, p->fullSource); + rpmMessage(RPMMESS_DEBUG, "Patch(%d) = %s\n", p->num, p->fullSource); } else { - message(MESS_DEBUG, "Source(%d) = %s\n", p->num, p->fullSource); + rpmMessage(RPMMESS_DEBUG, "Source(%d) = %s\n", p->num, p->fullSource); } return 0; @@ -201,7 +200,7 @@ int noSourcePatch(Spec s, char *line, int_32 tag) if (((tag == RPMTAG_NOSOURCE) && s->numNoSource) || ((tag == RPMTAG_NOPATCH) && s->numNoPatch)) { - error(RPMERR_BADSPEC, "Only one nosource/nopatch line allowed\n"); + rpmError(RPMERR_BADSPEC, "Only one nosource/nopatch line allowed\n"); return(RPMERR_BADSPEC); } @@ -209,11 +208,11 @@ int noSourcePatch(Spec s, char *line, int_32 tag) while ((t = strtok(line, ", \t"))) { num = strtoul(t, &te, 10); if ((*te) || (te == t) || (num == ULONG_MAX)) { - error(RPMERR_BADSPEC, "Bad source/patch number: %s\n", t); + rpmError(RPMERR_BADSPEC, "Bad source/patch number: %s\n", t); return(RPMERR_BADSPEC); } array[count++] = num; - message(MESS_DEBUG, "Skipping source/patch number: %d\n", num); + rpmMessage(RPMMESS_DEBUG, "Skipping source/patch number: %d\n", num); line = NULL; } @@ -252,22 +251,22 @@ static void free_reqprov(struct ReqProv *p) } struct ReqComp ReqComparisons[] = { - { "<=", REQUIRE_LESS | REQUIRE_EQUAL}, - { "<=S", REQUIRE_LESS | REQUIRE_EQUAL | REQUIRE_SERIAL}, - { "=<", REQUIRE_LESS | REQUIRE_EQUAL}, - { "=<S", REQUIRE_LESS | REQUIRE_EQUAL | REQUIRE_SERIAL}, - { "<", REQUIRE_LESS}, - { "<S", REQUIRE_LESS | REQUIRE_SERIAL}, - - { "=", REQUIRE_EQUAL}, - { "=S", REQUIRE_EQUAL | REQUIRE_SERIAL}, + { "<=", RPMSENSE_LESS | RPMSENSE_EQUAL}, + { "<=S", RPMSENSE_LESS | RPMSENSE_EQUAL | RPMSENSE_SERIAL}, + { "=<", RPMSENSE_LESS | RPMSENSE_EQUAL}, + { "=<S", RPMSENSE_LESS | RPMSENSE_EQUAL | RPMSENSE_SERIAL}, + { "<", RPMSENSE_LESS}, + { "<S", RPMSENSE_LESS | RPMSENSE_SERIAL}, + + { "=", RPMSENSE_EQUAL}, + { "=S", RPMSENSE_EQUAL | RPMSENSE_SERIAL}, - { ">=", REQUIRE_GREATER | REQUIRE_EQUAL}, - { ">=S", REQUIRE_GREATER | REQUIRE_EQUAL | REQUIRE_SERIAL}, - { "=>", REQUIRE_GREATER | REQUIRE_EQUAL}, - { "=>S", REQUIRE_GREATER | REQUIRE_EQUAL | REQUIRE_SERIAL}, - { ">", REQUIRE_GREATER}, - { ">S", REQUIRE_GREATER | REQUIRE_SERIAL}, + { ">=", RPMSENSE_GREATER | RPMSENSE_EQUAL}, + { ">=S", RPMSENSE_GREATER | RPMSENSE_EQUAL | RPMSENSE_SERIAL}, + { "=>", RPMSENSE_GREATER | RPMSENSE_EQUAL}, + { "=>S", RPMSENSE_GREATER | RPMSENSE_EQUAL | RPMSENSE_SERIAL}, + { ">", RPMSENSE_GREATER}, + { ">S", RPMSENSE_GREATER | RPMSENSE_SERIAL}, { NULL, 0 }, }; @@ -281,7 +280,7 @@ static int parseRequiresConflicts(struct PackageRec *p, char *line, while (req || (req = strtok(line, " ,\t\n"))) { flags = (flag == RPMTAG_CONFLICTFLAGS) ? - REQUIRE_CONFLICTS : REQUIRE_ANY; + RPMSENSE_CONFLICTS : RPMSENSE_ANY; if ((version = strtok(NULL, " ,\t\n"))) { rc = ReqComparisons; while (rc->token && strcmp(version, rc->token)) { @@ -293,8 +292,8 @@ static int parseRequiresConflicts(struct PackageRec *p, char *line, version = strtok(NULL, " ,\t\n"); } } - if ((flags & REQUIRE_SENSEMASK) && !version) { - error(RPMERR_BADSPEC, "Version required in require/conflict"); + if ((flags & RPMSENSE_SENSEMASK) && !version) { + rpmError(RPMERR_BADSPEC, "Version required in require/conflict"); return RPMERR_BADSPEC; } @@ -314,7 +313,7 @@ static int parseRequiresConflicts(struct PackageRec *p, char *line, static int parseProvides(struct PackageRec *p, char *line) { char *prov; - int flags = REQUIRE_PROVIDES; + int flags = RPMSENSE_PROVIDES; while ((prov = strtok(line, " ,\t\n"))) { addReqProv(p, flags, prov, NULL); @@ -336,7 +335,7 @@ static struct PackageRec *new_packagerec(void) p->subname = NULL; p->newname = NULL; p->icon = NULL; - p->header = newHeader(); + p->header = headerNew(); p->filelist = newStringBuf(); p->files = -1; /* -1 means no %files, thus no package */ p->fileFile = NULL; @@ -357,7 +356,7 @@ static struct PackageRec *new_packagerec(void) void free_packagerec(struct PackageRec *p) { - freeHeader(p->header); + headerFree(p->header); freeStringBuf(p->filelist); freeStringBuf(p->doc); FREE(p->subname); @@ -469,9 +468,9 @@ static void generateNamesAndDocScript(Spec s) char fullname[1024]; char *name, *version, *release, *packageVersion, *packageRelease, *docs; - getEntry(s->packages->header, RPMTAG_VERSION, NULL, + headerGetEntry(s->packages->header, RPMTAG_VERSION, NULL, (void *) &version, NULL); - getEntry(s->packages->header, RPMTAG_RELEASE, NULL, + headerGetEntry(s->packages->header, RPMTAG_RELEASE, NULL, (void *) &release, NULL); package = s->packages; @@ -485,14 +484,14 @@ static void generateNamesAndDocScript(Spec s) /* Must be the main package */ name = s->name; } - addEntry(package->header, RPMTAG_NAME, STRING_TYPE, name, 1); + headerAddEntry(package->header, RPMTAG_NAME, RPM_STRING_TYPE, name, 1); /* Handle subpackage version/release overrides */ - if (!getEntry(package->header, RPMTAG_VERSION, NULL, + if (!headerGetEntry(package->header, RPMTAG_VERSION, NULL, (void *) &packageVersion, NULL)) { packageVersion = version; } - if (!getEntry(package->header, RPMTAG_RELEASE, NULL, + if (!headerGetEntry(package->header, RPMTAG_RELEASE, NULL, (void *) &packageRelease, NULL)) { packageRelease = release; } @@ -522,7 +521,7 @@ static int match_arch(char *s) char *tok, *arch; int sense, match; - arch = getArchName(); + arch = rpmGetArchName(); match = 0; tok = strtok(s, " \n\t"); @@ -542,7 +541,7 @@ static int match_os(char *s) char *tok, *os; int sense, match; - os = getOsName(); + os = rpmGetOsName(); match = 0; tok = strtok(s, " \n\t"); @@ -573,7 +572,7 @@ static int read_line(FILE *f, char *line) if (! fgets(line, LINE_BUF_SIZE, f)) { /* the end */ if (read_level->next) { - error(RPMERR_UNMATCHEDIF, "Unclosed %%if"); + rpmError(RPMERR_UNMATCHEDIF, "Unclosed %%if"); return RPMERR_UNMATCHEDIF; } else { return 0; @@ -594,14 +593,14 @@ static int read_line(FILE *f, char *line) } else if (! strncmp("%else", line, 5)) { if (! read_level->next) { /* Got an else with no %if ! */ - error(RPMERR_UNMATCHEDIF, "Got a %%else with no if"); + rpmError(RPMERR_UNMATCHEDIF, "Got a %%else with no if"); return RPMERR_UNMATCHEDIF; } read_level->reading = read_level->next->reading && ! read_level->reading; } else if (! strncmp("%endif", line, 6)) { if (! read_level->next) { - error(RPMERR_UNMATCHEDIF, "Got a %%endif with no if"); + rpmError(RPMERR_UNMATCHEDIF, "Got a %%endif with no if"); return RPMERR_UNMATCHEDIF; } rl = read_level; @@ -775,7 +774,7 @@ static void addListEntry(Header h, int_32 tag, char *line) line = NULL; } if (argc) { - addEntry(h, tag, STRING_ARRAY_TYPE, argvs, argc); + headerAddEntry(h, tag, RPM_STRING_ARRAY_TYPE, argvs, argc); } free(argvs); } @@ -852,7 +851,7 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) line = buf; s = NULL; if ((tag = check_part(line, &s))) { - message(MESS_DEBUG, "Switching to part: %d\n", tag); + rpmMessage(RPMMESS_DEBUG, "Switching to part: %d\n", tag); t1 = 0; switch (cur_part) { case PREIN_PART: @@ -880,25 +879,25 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) /* %changelog is a little special. It goes in the */ /* "main" package no matter where it appears, and it */ /* ends up in all the packages. */ - addEntry(spec->packages->header, RPMTAG_CHANGELOG, STRING_TYPE, + headerAddEntry(spec->packages->header, RPMTAG_CHANGELOG, RPM_STRING_TYPE, getStringBuf(sb), 1); break; case TRIGGERON_PART: - if (addTrigger(cur_package, TRIGGER_ON, + if (addTrigger(cur_package, RPMSENSE_TRIGGER_ON, getStringBuf(sb), triggerArgs)) { return NULL; } break; case TRIGGEROFF_PART: - if (addTrigger(cur_package, TRIGGER_OFF, + if (addTrigger(cur_package, RPMSENSE_TRIGGER_OFF, getStringBuf(sb), triggerArgs)) { return NULL; } break; } if (t1) { - addEntry(cur_package->header, t1, - STRING_TYPE, getStringBuf(sb), 1); + headerAddEntry(cur_package->header, t1, + RPM_STRING_TYPE, getStringBuf(sb), 1); } cur_part = tag; truncStringBuf(sb); @@ -911,7 +910,7 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) case INSTALL_PART: case CLEAN_PART: case CHANGELOG_PART: - error(RPMERR_BADARG, "Tag takes no arguments: %s", s); + rpmError(RPMERR_BADARG, "Tag takes no arguments: %s", s); return NULL; } } @@ -950,7 +949,7 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) } } - message(MESS_DEBUG, "fileFile = %s\n", + rpmMessage(RPMMESS_DEBUG, "fileFile = %s\n", fileFile[0] ? fileFile : "(null)"); /* If trigger, pull off the args */ @@ -973,7 +972,7 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) s += 2; s += strspn(s, ": \t"); if (*s == '\0') { - error(RPMERR_BADARG, "-n takes argument"); + rpmError(RPMERR_BADARG, "-n takes argument"); return NULL; } lookupopts = LP_NEWNAME; @@ -1003,10 +1002,10 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) default: /* XXX - should be able to drop the -n in non-%package parts */ if (! lookup_package(spec, &cur_package, s, lookupopts)) { - error(RPMERR_INTERNAL, "Package lookup failed: %s", s); + rpmError(RPMERR_INTERNAL, "Package lookup failed: %s", s); return NULL; } - message(MESS_DEBUG, "Switched to package: %s\n", + rpmMessage(RPMMESS_DEBUG, "Switched to package: %s\n", s ? s : "(main)"); } @@ -1030,10 +1029,10 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) lookupopts = LP_CREATE | LP_FAIL_EXISTS; } if (! lookup_package(spec, &cur_package, NULL, lookupopts)) { - error(RPMERR_INTERNAL, "Base package lookup failed!"); + rpmError(RPMERR_INTERNAL, "Base package lookup failed!"); return NULL; } - message(MESS_DEBUG, "Switched to BASE package\n"); + rpmMessage(RPMMESS_DEBUG, "Switched to BASE package\n"); } switch (cur_part) { @@ -1042,14 +1041,14 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) switch (tag) { case RPMTAG_EXCLUDE: case RPMTAG_EXCLUSIVE: - message(MESS_WARNING, + rpmMessage(RPMMESS_WARNING, "Exclude/Exclusive are depricated.\n" "Use ExcludeArch/ExclusiveArch instead.\n"); sprintf(buf2, "%s %s", (tag == RPMTAG_EXCLUDE) ? "%ifarch" : "%ifnarch", s); if (match_arch(buf2)) { - error(RPMERR_BADARCH, "Arch mismatch!"); + rpmError(RPMERR_BADARCH, "Arch mismatch!"); return NULL; } addListEntry(cur_package->header, @@ -1062,7 +1061,7 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) sprintf(buf2, "%s %s", (tag == RPMTAG_EXCLUDEARCH) ? "%ifarch" : "%ifnarch", s); if (match_arch(buf2)) { - error(RPMERR_BADARCH, "Arch mismatch!"); + rpmError(RPMERR_BADARCH, "Arch mismatch!"); return NULL; } addListEntry(cur_package->header, tag, s); @@ -1072,7 +1071,7 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) sprintf(buf2, "%s %s", (tag == RPMTAG_EXCLUDEOS) ? "%ifos" : "%ifnos", s); if (match_os(buf2)) { - error(RPMERR_BADOS, "OS mismatch!"); + rpmError(RPMERR_BADOS, "OS mismatch!"); return NULL; } addListEntry(cur_package->header, tag, s); @@ -1099,18 +1098,18 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) case RPMTAG_PACKAGER: case RPMTAG_GROUP: case RPMTAG_URL: - addEntry(cur_package->header, tag, STRING_TYPE, s, 1); + headerAddEntry(cur_package->header, tag, RPM_STRING_TYPE, s, 1); break; case RPMTAG_BUILDROOT: gotBuildroot = 1; spec->buildroot = strdup(s); break; case RPMTAG_DEFAULTPREFIX: - addEntry(cur_package->header, tag, STRING_TYPE, s, 1); + headerAddEntry(cur_package->header, tag, RPM_STRING_TYPE, s, 1); break; case RPMTAG_SERIAL: serial = atoi(s); - addEntry(cur_package->header, tag, INT32_TYPE, &serial, 1); + headerAddEntry(cur_package->header, tag, RPM_INT32_TYPE, &serial, 1); break; case RPMTAG_DESCRIPTION: /* Special case -- need to handle backslash */ @@ -1126,15 +1125,15 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) s = buf; } appendStringBuf(sb, s); - addEntry(cur_package->header, RPMTAG_DESCRIPTION, - STRING_TYPE, getStringBuf(sb), 1); + headerAddEntry(cur_package->header, RPMTAG_DESCRIPTION, + RPM_STRING_TYPE, getStringBuf(sb), 1); break; case RPMTAG_ROOT: /* special case */ gotRoot = 1; - message(MESS_DEBUG, "Got root: %s\n", s); - message(MESS_WARNING, "The Root: tag is depricated. Use Buildroot: instead\n"); - setVar(RPMVAR_ROOT, s); + rpmMessage(RPMMESS_DEBUG, "Got root: %s\n", s); + rpmMessage(RPMMESS_WARNING, "The Root: tag is depricated. Use Buildroot: instead\n"); + rpmSetVar(RPMVAR_ROOT, s); break; case RPMTAG_ICON: cur_package->icon = strdup(s); @@ -1177,9 +1176,9 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) } break; default: - /* message(MESS_DEBUG, "Skipping: %s\n", line); */ + /* rpmMessage(RPMMESS_DEBUG, "Skipping: %s\n", line); */ /* This shouldn't happen? */ - error(RPMERR_INTERNAL, "Bogus token"); + rpmError(RPMERR_INTERNAL, "Bogus token"); return NULL; } } else { @@ -1188,8 +1187,8 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) while (*s1 && (*s1 == ' ' || *s1 == '\t')) s1++; /* Handle blanks lines and comments */ if (*s1 && (*s1 != '#')) { - /*message(MESS_WARNING, "Unknown Field: %s\n", line);*/ - error(RPMERR_BADSPEC, "Unknown Field: %s\n", line); + /*rpmMessage(RPMMESS_WARNING, "Unknown Field: %s\n", line);*/ + rpmError(RPMERR_BADSPEC, "Unknown Field: %s\n", line); return NULL; } } @@ -1230,7 +1229,7 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) } break; default: - error(RPMERR_INTERNAL, "Bad part"); + rpmError(RPMERR_INTERNAL, "Bad part"); return NULL; } /* switch */ } @@ -1240,30 +1239,30 @@ Spec parseSpec(FILE *f, char *specfile, char *buildRootOverride) if (gotRoot && gotBuildroot) { freeSpec(spec); - error(RPMERR_BADSPEC, + rpmError(RPMERR_BADSPEC, "Spec file can not have both Root: and Buildroot:"); return NULL; } if (spec->buildroot) { /* This package can do build roots */ if (buildRootOverride) { - setVar(RPMVAR_ROOT, buildRootOverride); - setVar(RPMVAR_BUILDROOT, buildRootOverride); + rpmSetVar(RPMVAR_ROOT, buildRootOverride); + rpmSetVar(RPMVAR_BUILDROOT, buildRootOverride); } else { - if ((s = getVar(RPMVAR_BUILDROOT))) { + if ((s = rpmGetVar(RPMVAR_BUILDROOT))) { /* Take build prefix from rpmrc */ - setVar(RPMVAR_ROOT, s); + rpmSetVar(RPMVAR_ROOT, s); } else { /* Use default */ - setVar(RPMVAR_ROOT, spec->buildroot); - setVar(RPMVAR_BUILDROOT, spec->buildroot); + rpmSetVar(RPMVAR_ROOT, spec->buildroot); + rpmSetVar(RPMVAR_BUILDROOT, spec->buildroot); } } } else { /* Package can not do build prefixes */ if (buildRootOverride) { freeSpec(spec); - error(RPMERR_BADARG, "Package can not do build prefixes"); + rpmError(RPMERR_BADARG, "Package can not do build prefixes"); return NULL; } } @@ -1285,7 +1284,7 @@ static void reset_spec() struct preamble_line *p = preamble_spec; struct part_rec *p1 = part_list; - setVar(RPMVAR_ROOT, NULL); + rpmSetVar(RPMVAR_ROOT, NULL); while (read_level) { rl = read_level; @@ -1353,7 +1352,7 @@ static void dumpPackage(struct PackageRec *p, FILE *f) fprintf(f, "%s", getStringBuf(p->filelist)); fprintf(f, "FILES =^\n"); fprintf(f, "HEADER =v\n"); - dumpHeader(p->header, f, 1); + headerDump(p->header, f, 1); fprintf(f, "HEADER =^\n"); } diff --git a/build/trigger.c b/build/trigger.c index 5f9242c4c..a2c117ff0 100644 --- a/build/trigger.c +++ b/build/trigger.c @@ -7,7 +7,6 @@ #include "header.h" #include "spec.h" #include "specP.h" -#include "rpmerr.h" #include "messages.h" #include "rpmlib.h" #include "stringbuf.h" @@ -36,7 +35,7 @@ int addTrigger(struct PackageRec *package, sizeof(*(package->trigger.triggerScripts))); } package->trigger.triggerScripts[i] = strdup(script); - message(MESS_DEBUG, "TRIGGER %d:\n%s", i, script); + rpmMessage(RPMMESS_DEBUG, "TRIGGER %d:\n%s", i, script); /* create the entry (or entries) */ te = NULL; @@ -56,16 +55,16 @@ int addTrigger(struct PackageRec *package, version = strtok(NULL, " ,\t\n"); } } - if ((te->flags & REQUIRE_SENSEMASK) && !version) { - error(RPMERR_BADSPEC, "Version required in trigger"); + if ((te->flags & RPMSENSE_SENSEMASK) && !version) { + rpmError(RPMERR_BADSPEC, "Version required in trigger"); return RPMERR_BADSPEC; } te->name = strdup(arg); te->version = (rc && rc->token && version) ? strdup(version) : NULL; te->index = i; - message(MESS_DEBUG, "TRIGGER(%s): %s %s %s %d\n", - (sense == TRIGGER_ON) ? "on" : "off", + rpmMessage(RPMMESS_DEBUG, "TRIGGER(%s): %s %s %s %d\n", + (sense == RPMSENSE_TRIGGER_ON) ? "on" : "off", te->name, (rc && rc->token) ? rc->token : "NONE", te->version, te->index); @@ -100,7 +99,7 @@ void generateTriggerEntries(Header h, struct PackageRec *p) /* Add the scripts */ if (p->trigger.used) { - addEntry(h, RPMTAG_TRIGGERSCRIPTS, STRING_ARRAY_TYPE, + headerAddEntry(h, RPMTAG_TRIGGERSCRIPTS, RPM_STRING_ARRAY_TYPE, p->trigger.triggerScripts, p->trigger.used); } @@ -122,10 +121,10 @@ void generateTriggerEntries(Header h, struct PackageRec *p) te = te->next; } - addEntry(h, RPMTAG_TRIGGERNAME, STRING_ARRAY_TYPE, nameArray, i); - addEntry(h, RPMTAG_TRIGGERVERSION, STRING_ARRAY_TYPE, versionArray, i); - addEntry(h, RPMTAG_TRIGGERFLAGS, INT32_TYPE, flagArray, i); - addEntry(h, RPMTAG_TRIGGERINDEX, INT32_TYPE, indexArray, i); + headerAddEntry(h, RPMTAG_TRIGGERNAME, RPM_STRING_ARRAY_TYPE, nameArray, i); + headerAddEntry(h, RPMTAG_TRIGGERVERSION, RPM_STRING_ARRAY_TYPE, versionArray, i); + headerAddEntry(h, RPMTAG_TRIGGERFLAGS, RPM_INT32_TYPE, flagArray, i); + headerAddEntry(h, RPMTAG_TRIGGERINDEX, RPM_INT32_TYPE, indexArray, i); } void freeTriggers(struct TriggerStruct t) diff --git a/build/vspec.c b/build/vspec.c index 08b50db7c..68cb5e241 100644 --- a/build/vspec.c +++ b/build/vspec.c @@ -22,7 +22,6 @@ Here's what we do #include "header.h" #include "spec.h" #include "specP.h" -#include "rpmerr.h" #include "messages.h" #include "rpmlib.h" #include "stringbuf.h" @@ -121,13 +120,13 @@ static int checkHeaderTags(Header inh, struct packageFieldsRec *pfr) struct packageFieldsRec *p; /* This actually sorts the index, so it'll be easy to catch dups */ - h = copyHeader(inh); + h = headerCopy(inh); - headerIter = initIterator(h); + headerIter = headerInitIterator(h); lastTag = 0; - while (nextIterator(headerIter, &tag, &type, &ptr, &c)) { + while (headerNextIterator(headerIter, &tag, &type, &ptr, &c)) { if (tag == lastTag) { - error(RPMERR_BADSPEC, "Duplicate fields for : %s", + rpmError(RPMERR_BADSPEC, "Duplicate fields for : %s", tagName(tag)); res = 1; } @@ -136,13 +135,13 @@ static int checkHeaderTags(Header inh, struct packageFieldsRec *pfr) p->present = 1; lastTag = tag; } - freeIterator(headerIter); - freeHeader(h); + headerFreeIterator(headerIter); + headerFree(h); p = pfr; while (p->tag) { if (p->shouldBePresent != p->present) { - error(RPMERR_BADSPEC, "Field must%s be present%s: %s", + rpmError(RPMERR_BADSPEC, "Field must%s be present%s: %s", p->present ? " NOT" : "", p->present ? "" : " ", tagName(p->tag)); res = 1; @@ -186,15 +185,15 @@ int verifySpec(Spec s) } val = NULL; - getEntry(pr->header, RPMTAG_VERSION, NULL, (void *) &val, NULL); + headerGetEntry(pr->header, RPMTAG_VERSION, NULL, (void *) &val, NULL); if (val && strchr(val, '-')) { - error(RPMERR_BADSPEC, "Illegal '-' char in version: %s\n", val); + rpmError(RPMERR_BADSPEC, "Illegal '-' char in version: %s\n", val); res = 1; } val = NULL; - getEntry(pr->header, RPMTAG_RELEASE, NULL, (void *) &val, NULL); + headerGetEntry(pr->header, RPMTAG_RELEASE, NULL, (void *) &val, NULL); if (val && strchr(val, '-')) { - error(RPMERR_BADSPEC, "Illegal '-' char in release: %s\n", val); + rpmError(RPMERR_BADSPEC, "Illegal '-' char in release: %s\n", val); res = 1; } |