2.5.3 -> 2.9
+ - consolidated includes for librpmbuild.
- fixed lib/rpmrc.c to accept include: tags (AdV)
- fixed the CHANGES file to reflect that this is 2.9, not 3.0 (AdV)
- aggregate system includes into system.h.
#include "system.h"
+#include "build/rpmbuild.h"
+
#include "build.h"
#include "intl.h"
-#include "lib/rpmlib.h"
-#include "build/build.h"
-#include "build/parse.h"
-#include "build/spec.h"
int build(char *arg, int buildAmount, char *passPhrase,
char *buildRoot, int fromTarball, int test, char *cookie) {
VPATH = @srcdir@
LIBOBJECTS = \
-misc.o parsePreamble.o part.o \
-package.o parseDescription.o parsePrep.o read.o \
-parseFiles.o parseReqs.o reqprov.o \
-parseChangelog.o parseSpec.o spec.o \
-parseScript.o parseBuildInstallClean.o build.o \
-files.o myftw.o names.o pack.o macro.o
+ build.o files.o macro.o misc.o myftw.o names.o pack.o \
+ parseBuildInstallClean.o parseChangelog.o parseDescription.o \
+ parseFiles.o parsePreamble.o parsePrep.o parseReqs.o \
+ parseScript.o parseSpec.o reqprov.o spec.o
LIBBUILD = librpmbuild.a
LOADLIBES = -lrpm -lz ../popt/libpopt.a $(LIBEFENCE)
#include "system.h"
-#include "misc.h"
-#include "spec.h"
-#include "build.h"
-#include "lib/misc.h"
-#include "lib/messages.h"
-#include "rpmlib.h"
-#include "pack.h"
+#include "rpmbuild.h"
+
#include "files.h"
#ifdef DYING
+++ /dev/null
-#ifndef _H_BUILD_
-#define _H_BUILD_
-
-#include "spec.h"
-
-#define RPMBUILD_PREP (1 << 0)
-#define RPMBUILD_BUILD (1 << 1)
-#define RPMBUILD_INSTALL (1 << 2)
-#define RPMBUILD_CLEAN (1 << 3)
-#define RPMBUILD_FILECHECK (1 << 4)
-#define RPMBUILD_PACKAGESOURCE (1 << 5)
-#define RPMBUILD_PACKAGEBINARY (1 << 6)
-#define RPMBUILD_RMSOURCE (1 << 7)
-#define RPMBUILD_RMBUILD (1 << 8)
-#define RPMBUILD_STRINGBUF (1 << 9) /* only for doScript() */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int buildSpec(Spec spec, int what, int test);
-int doScript(Spec spec, int what, char *name, StringBuf sb, int test);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H_BUILD_ */
#include <regex.h>
#include <signal.h> /* getOutputFrom() */
-#include <time.h>
-#include "spec.h"
-#include "package.h"
-#include "rpmlib.h"
-#include "misc.h"
-#include "lib/misc.h"
+#include "rpmbuild.h"
+
#include "myftw.h"
#include "lib/cpio.h"
-#include "header.h"
#include "md5.h"
-#include "names.h"
-#include "messages.h"
#include "macro.h"
-#include "build.h"
-#include "read.h"
-#include "reqprov.h"
#define MAXDOCDIR 1024
return fl.processingFailed;
}
-void freeCpioList(struct cpioFileMapping *cpioList, int cpioCount)
-{
- struct cpioFileMapping *p = cpioList;
-
- while (cpioCount--) {
- rpmMessage(RPMMESS_DEBUG, "archive = %s, fs = %s\n",
- p->archivePath, p->fsPath);
- FREE(p->archivePath);
- FREE(p->fsPath);
- p++;
- }
- FREE(cpioList);
-}
-
int processSourceFiles(Spec spec)
{
struct Source *srcPtr;
#define _H_FILES_
#include "spec.h"
-#include "package.h"
#include "lib/cpio.h"
#ifdef __cplusplus
#define RPMERR_BADSPEC stderr
#define FREE(_x) { if (_x) free(_x); ((void *)(_x)) = NULL; }
#else
-#include "spec.h"
-#include "miscfn.h"
-#include "misc.h"
-#include "lib/rpmlib.h"
+
+#include "rpmbuild.h"
+
#endif
#include "macro.h"
#include "system.h"
-#include "misc.h"
-#include "spec.h"
-#include "rpmlib.h"
-#include "header.h"
+#include "rpmbuild.h"
+
#include "popt/popt.h"
int parseNum(char *line, int *res)
+++ /dev/null
-#ifndef _H_MISC_
-#define _H_MISC_
-
-#include "spec.h"
-#include "ctype.h"
-
-#define FREE(x) { if (x) free(x); x = NULL; }
-
-#define SKIPSPACE(s) { while (*(s) && isspace(*(s))) (s)++; }
-
-#define SKIPNONSPACE(s) { while (*(s) && !isspace(*(s))) (s)++; }
-
-#define SKIPTONEWLINE(s) { while (*s && *s != '\n') s++; }
-
-#define PART_SUBNAME 0
-#define PART_NAME 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef DYING
-void addOrAppendListEntry(Header h, int_32 tag, char *line);
-int parseSimplePart(char *line, char **name, int *flag);
-char *findLastChar(char *s);
-int parseYesNo(char *s);
-StringBuf getOutputFrom(char *dir, char *argv[],
- char *writePtr, int writeBytesLeft,
- int failNonZero);
-#endif /* DYING */
-
-int parseNum(char *line, int *res);
-char *cleanFileName(char *name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H_MISC_ */
#include "system.h"
-#include <pwd.h>
-#include <grp.h>
-#include <time.h>
-#include <netdb.h>
-
-#include "names.h"
-#include "rpmlib.h"
-#include "messages.h"
+#include "rpmbuild.h"
static uid_t uids[1024];
static char *unames[1024];
+++ /dev/null
-/* names.h -- user/group name/id cache plus hostname and buildtime */
-
-#ifndef _H_NAMES_
-#define _H_NAMES_
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-char *getUname(uid_t uid);
-char *getUnameS(char *uname);
-char *getGname(gid_t gid);
-char *getGnameS(char *gname);
-
-char *buildHost(void);
-time_t *getBuildTime(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H_NAMES_ */
#include "system.h"
#include <signal.h>
-#include <time.h>
-#include "spec.h"
-#include "header.h"
-#include "misc.h"
-#include "reqprov.h"
-#include "names.h"
-#include "macro.h"
+#include "rpmbuild.h"
-#include "rpmlib.h"
#include "files.h"
+
#include "lib/cpio.h"
-#include "lib/misc.h"
#include "lib/signature.h"
#include "lib/rpmlead.h"
-#include "lib/messages.h"
#define RPM_MAJOR_NUMBER 3
+++ /dev/null
-#ifndef _H_PACK_
-#define _H_PACK_
-
-#include "spec.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int packageBinaries(Spec spec);
-int packageSources(Spec spec);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H_PACK_ */
+++ /dev/null
-#include "system.h"
-
-#include "spec.h"
-#include "package.h"
-#include "misc.h"
-#include "rpmlib.h"
-#include "files.h"
-
-static void freeTriggerFiles(struct TriggerFileEntry *p);
-
-int lookupPackage(Spec spec, char *name, int flag, Package *pkg)
-{
- char buf[BUFSIZ];
- char *n, *fullName;
- Package p;
-
- /* "main" package */
- if (! name) {
- if (pkg) {
- *pkg = spec->packages;
- }
- return 0;
- }
-
- /* Construct package name */
- if (flag == PART_SUBNAME) {
- headerGetEntry(spec->packages->header, RPMTAG_NAME,
- NULL, (void *) &n, NULL);
- sprintf(buf, "%s-%s", n, name);
- fullName = buf;
- } else {
- fullName = name;
- }
-
- p = spec->packages;
- while (p) {
- headerGetEntry(p->header, RPMTAG_NAME, NULL, (void *) &n, NULL);
- if (n && (! strcmp(fullName, n))) {
- if (pkg) {
- *pkg = p;
- }
- return 0;
- }
- p = p->next;
- }
-
- if (pkg) {
- *pkg = NULL;
- }
- return 1;
-}
-
-Package newPackage(Spec spec)
-{
- Package p;
- Package pp;
-
- p = malloc(sizeof(*p));
-
- p->header = headerNew();
- p->icon = NULL;
- p->autoReqProv = 1;
-
-#if 0
- p->reqProv = NULL;
- p->triggers = NULL;
- p->triggerScripts = NULL;
-#endif
-
- p->triggerFiles = NULL;
-
- p->fileFile = NULL;
- p->fileList = NULL;
- p->next = NULL;
-
- p->cpioList = NULL;
- p->cpioCount = 0;
-
- p->preInFile = NULL;
- p->postInFile = NULL;
- p->preUnFile = NULL;
- p->postUnFile = NULL;
- p->verifyFile = NULL;
-
- p->specialDoc = NULL;
-
- if (! spec->packages) {
- spec->packages = p;
- } else {
- /* Always add package to end of list */
- pp = spec->packages;
- while (pp->next) {
- pp = pp->next;
- }
- pp->next = p;
- }
-
- return p;
-}
-
-void freePackages(Spec spec)
-{
- Package p;
-
- while (spec->packages) {
- p = spec->packages;
- spec->packages = p->next;
- freePackage(p);
- }
-}
-
-void freePackage(Package p)
-{
- if (! p) {
- return;
- }
-
- FREE(p->preInFile);
- FREE(p->postInFile);
- FREE(p->preUnFile);
- FREE(p->postUnFile);
- FREE(p->verifyFile);
-
- headerFree(p->header);
- freeStringBuf(p->fileList);
- FREE(p->fileFile);
- freeCpioList(p->cpioList, p->cpioCount);
-
- freeStringBuf(p->specialDoc);
-
- freeTriggerFiles(p->triggerFiles);
-
- free(p);
-}
-
-static void freeTriggerFiles(struct TriggerFileEntry *p)
-{
- struct TriggerFileEntry *o;
-
- while (p) {
- FREE(p->fileName);
- FREE(p->script);
- FREE(p->prog);
- o = p;
- p = p->next;
- free(o);
- }
-}
+++ /dev/null
-#ifndef _H_PACKAGE_
-#define _H_PACKAGE_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int lookupPackage(Spec spec, char *name, int flag, Package *pkg);
-Package newPackage(Spec spec);
-void freePackages(Spec spec);
-void freePackage(Package p);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H_PACKAGE_ */
+++ /dev/null
-#ifndef _H_PARSE_
-#define _H_PARSE_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int parseChangelog(Spec spec);
-int parseDescription(Spec spec);
-int parseFiles(Spec spec);
-int parsePreamble(Spec spec, int initialPackage);
-int parsePrep(Spec spec);
-int parseRequiresConflicts(Spec spec, Package pkg, char *field,
- int tag, int index);
-int parseProvidesObsoletes(Spec spec, Package pkg, char *field, int tag);
-int parseTrigger(Spec spec, Package pkg, char *field, int tag);
-int parseScript(Spec spec, int parsePart);
-int parseBuildInstallClean(Spec spec, int parsePart);
-
-int parseSpec(Spec *specp, char *specFile, char *buildRoot,
- int inBuildArch, char *passPhrase, char *cookie);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H_PARSE_ */
#include "system.h"
-#include "read.h"
-#include "part.h"
-#include "rpmlib.h"
+#include "rpmbuild.h"
int parseBuildInstallClean(Spec spec, int parsePart)
{
#include "system.h"
-#include <time.h>
-
-#include "read.h"
-#include "part.h"
-#include "stringbuf.h"
-#include "misc.h"
-#include "header.h"
-#include "rpmlib.h"
+#include "rpmbuild.h"
+#ifdef DYING
static void addChangelogEntry(Header h, int time, char *name, char *text);
static int addChangelog(Header h, StringBuf sb);
static int dateToTimet(const char * datestr, time_t * secs);
-
-int parseChangelog(Spec spec)
-{
- int nextPart, res, rc;
- StringBuf sb;
+#endif
- sb = newStringBuf();
-
- /* There are no options to %changelog */
- if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
- freeStringBuf(sb);
- return PART_NONE;
- }
- if (rc) {
- return rc;
+static void addChangelogEntry(Header h, int time, char *name, char *text)
+{
+ if (headerIsEntry(h, RPMTAG_CHANGELOGTIME)) {
+ headerAppendEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
+ &time, 1);
+ headerAppendEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
+ &name, 1);
+ headerAppendEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
+ &text, 1);
+ } else {
+ headerAddEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
+ &time, 1);
+ headerAddEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
+ &name, 1);
+ headerAddEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
+ &text, 1);
}
+}
+
+/* datestr is of the form 'Wed Jan 1 1997' */
+static int dateToTimet(const char * datestr, time_t * secs)
+{
+ struct tm time;
+ char * chptr, * end, ** idx;
+ char * date = strcpy(alloca(strlen(datestr) + 1), datestr);
+ static char * days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
+ NULL };
+ static char * months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL };
+ static char lengths[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- while (! (nextPart = isPart(spec->line))) {
- appendStringBuf(sb, spec->line);
- if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
- nextPart = PART_NONE;
- break;
- }
- if (rc) {
- return rc;
- }
- }
+ memset(&time, 0, sizeof(time));
- res = addChangelog(spec->packages->header, sb);
- freeStringBuf(sb);
+ end = chptr = date;
- return (res) ? res : nextPart;
+ /* day of week */
+ if ((chptr = strtok(date, " \t\n")) == NULL) return -1;
+ idx = days;
+ while (*idx && strcmp(*idx, chptr)) idx++;
+ if (!*idx) return -1;
+
+ /* month */
+ if ((chptr = strtok(NULL, " \t\n")) == NULL) return -1;
+ idx = months;
+ while (*idx && strcmp(*idx, chptr)) idx++;
+ if (!*idx) return -1;
+
+ time.tm_mon = idx - months;
+
+ /* day */
+ if ((chptr = strtok(NULL, " \t\n")) == NULL) return -1;
+
+ /* make this noon so the day is always right (as we make this UTC) */
+ time.tm_hour = 12;
+
+ time.tm_mday = strtol(chptr, &chptr, 10);
+ if (*chptr) return -1;
+ if (time.tm_mday < 0 || time.tm_mday > lengths[time.tm_mon]) return -1;
+
+ /* year */
+ if ((chptr = strtok(NULL, " \t\n")) == NULL) return -1;
+
+ time.tm_year = strtol(chptr, &chptr, 10);
+ if (*chptr) return -1;
+ if (time.tm_year < 1997 || time.tm_year >= 3000) return -1;
+ time.tm_year -= 1900;
+
+ *secs = mktime(&time);
+ if (*secs == -1) return -1;
+
+ /* adjust to GMT */
+ *secs += timezone;
+
+ return 0;
}
static int addChangelog(Header h, StringBuf sb)
return 0;
}
-static void addChangelogEntry(Header h, int time, char *name, char *text)
+int parseChangelog(Spec spec)
{
- if (headerIsEntry(h, RPMTAG_CHANGELOGTIME)) {
- headerAppendEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
- &time, 1);
- headerAppendEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
- &name, 1);
- headerAppendEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
- &text, 1);
- } else {
- headerAddEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
- &time, 1);
- headerAddEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
- &name, 1);
- headerAddEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
- &text, 1);
- }
-}
+ int nextPart, res, rc;
+ StringBuf sb;
-/* datestr is of the form 'Wed Jan 1 1997' */
-static int dateToTimet(const char * datestr, time_t * secs)
-{
- struct tm time;
- char * chptr, * end, ** idx;
- char * date = strcpy(alloca(strlen(datestr) + 1), datestr);
- static char * days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
- NULL };
- static char * months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL };
- static char lengths[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ sb = newStringBuf();
- memset(&time, 0, sizeof(time));
-
- end = chptr = date;
-
- /* day of week */
- if ((chptr = strtok(date, " \t\n")) == NULL) return -1;
- idx = days;
- while (*idx && strcmp(*idx, chptr)) idx++;
- if (!*idx) return -1;
-
- /* month */
- if ((chptr = strtok(NULL, " \t\n")) == NULL) return -1;
- idx = months;
- while (*idx && strcmp(*idx, chptr)) idx++;
- if (!*idx) return -1;
-
- time.tm_mon = idx - months;
-
- /* day */
- if ((chptr = strtok(NULL, " \t\n")) == NULL) return -1;
-
- /* make this noon so the day is always right (as we make this UTC) */
- time.tm_hour = 12;
-
- time.tm_mday = strtol(chptr, &chptr, 10);
- if (*chptr) return -1;
- if (time.tm_mday < 0 || time.tm_mday > lengths[time.tm_mon]) return -1;
-
- /* year */
- if ((chptr = strtok(NULL, " \t\n")) == NULL) return -1;
-
- time.tm_year = strtol(chptr, &chptr, 10);
- if (*chptr) return -1;
- if (time.tm_year < 1997 || time.tm_year >= 3000) return -1;
- time.tm_year -= 1900;
-
- *secs = mktime(&time);
- if (*secs == -1) return -1;
+ /* There are no options to %changelog */
+ if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
+ freeStringBuf(sb);
+ return PART_NONE;
+ }
+ if (rc) {
+ return rc;
+ }
+
+ while (! (nextPart = isPart(spec->line))) {
+ appendStringBuf(sb, spec->line);
+ if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
+ nextPart = PART_NONE;
+ break;
+ }
+ if (rc) {
+ return rc;
+ }
+ }
- /* adjust to GMT */
- *secs += timezone;
+ res = addChangelog(spec->packages->header, sb);
+ freeStringBuf(sb);
- return 0;
+ return (res) ? res : nextPart;
}
#include "system.h"
-#include "spec.h"
-#include "header.h"
-#include "read.h"
-#include "part.h"
-#include "misc.h"
-#include "rpmlib.h"
-#include "package.h"
+#include "rpmbuild.h"
+
#include "popt/popt.h"
/* These have to be global scope to make up for *stupid* compilers */
#include "system.h"
-#include "header.h"
-#include "read.h"
-#include "part.h"
-#include "misc.h"
-#include "rpmlib.h"
-#include "package.h"
-#include "stringbuf.h"
+#include "rpmbuild.h"
+
#include "popt/popt.h"
/* These have to be global scope to make up for *stupid* compilers */
#include "system.h"
-#include "read.h"
-#include "part.h"
-#include "rpmlib.h"
-#include "spec.h"
-#include "package.h"
-#include "misc.h"
-#include "reqprov.h"
-#include "parse.h"
+#include "rpmbuild.h"
+
#include "popt/popt.h"
static int copyTags[] = {
#include "system.h"
-#include "spec.h"
-#include "read.h"
-#include "part.h"
-#include "rpmlib.h"
-#include "lib/misc.h"
+#include "rpmbuild.h"
+
#include "popt/popt.h"
-#include "names.h"
-#include "misc.h"
-#include "config.h"
/* These have to be global to make up for stupid compilers */
static int leaveDirs, skipDefaultAction;
#include "system.h"
-#include "spec.h"
-#include "rpmlib.h"
-#include "reqprov.h"
+#include "rpmbuild.h"
static struct ReqComp {
char *token;
#include "system.h"
-#include "header.h"
-#include "read.h"
-#include "part.h"
-#include "misc.h"
-#include "rpmlib.h"
+#include "rpmbuild.h"
+
#include "popt/popt.h"
-#include "reqprov.h"
-#include "package.h"
-#include "parse.h"
static int addTriggerIndex(Package pkg, char *file, char *script, char *prog);
#include "system.h"
-#include "header.h"
-#include "rpmlib.h"
-#include "part.h"
-#include "spec.h"
-#include "parse.h"
-#include "read.h"
-#include "misc.h"
+#include "rpmbuild.h"
+#ifdef DYING
static void setStandardMacros(Spec spec, char *arch, char *os);
+#endif
+
+static void setStandardMacros(Spec spec, char *arch, char *os)
+{
+ char buf[BUFSIZ];
+ int x;
+
+ addMacro(&spec->macros, "sourcedir", NULL, rpmGetVar(RPMVAR_SOURCEDIR), -1);
+ addMacro(&spec->macros, "builddir", NULL, rpmGetVar(RPMVAR_BUILDDIR), -1);
+ addMacro(&spec->macros, "optflags", NULL, rpmGetVar(RPMVAR_OPTFLAGS), -1);
+ addMacro(&spec->macros, "buildarch", NULL, arch, -1);
+ addMacro(&spec->macros, "buildos", NULL, os, -1);
+
+ x = 0;
+ while (arch[x]) {
+ buf[x] = tolower(arch[x]);
+ x++;
+ }
+ buf[x] = '\0';
+ addMacro(&spec->macros, "buildarch_lc", NULL, buf, -1);
+ x = 0;
+ while (os[x]) {
+ buf[x] = tolower(os[x]);
+ x++;
+ }
+ buf[x] = '\0';
+ addMacro(&spec->macros, "buildos_lc", NULL, buf, -1);
+}
+
+static struct PartRec {
+ int part;
+ int len;
+ char *token;
+} partList[] = {
+ {PART_PREAMBLE, 0, "%package"},
+ {PART_PREP, 0, "%prep"},
+ {PART_BUILD, 0, "%build"},
+ {PART_INSTALL, 0, "%install"},
+ {PART_CLEAN, 0, "%clean"},
+ {PART_PREUN, 0, "%preun"},
+ {PART_POSTUN, 0, "%postun"},
+ {PART_PRE, 0, "%pre"},
+ {PART_POST, 0, "%post"},
+ {PART_FILES, 0, "%files"},
+ {PART_CHANGELOG, 0, "%changelog"},
+ {PART_DESCRIPTION, 0, "%description"},
+ {PART_TRIGGERPOSTUN, 0, "%triggerpostun"},
+ {PART_TRIGGERUN, 0, "%triggerun"},
+ {PART_TRIGGERIN, 0, "%triggerin"},
+ {PART_TRIGGERIN, 0, "%trigger"},
+ {PART_VERIFYSCRIPT, 0, "%verifyscript"},
+ {0, 0, 0}
+};
+
+static void initParts(void)
+{
+ struct PartRec *p = partList;
+
+ while (p->token) {
+ p->len = strlen(p->token);
+ p++;
+ }
+}
+
+int isPart(char *line)
+{
+ char c;
+ struct PartRec *p = partList;
+
+ if (p->len == 0) {
+ initParts();
+ }
+
+ while (p->token) {
+ if (! strncmp(line, p->token, p->len)) {
+ c = *(line + p->len);
+ if (c == '\0' || isspace(c)) {
+ break;
+ }
+ }
+ p++;
+ }
+
+ if (p->token) {
+ return p->part;
+ } else {
+ return PART_NONE;
+ }
+}
+
+#ifdef DYING
+static int matchTok(char *token, char *line);
+#endif
+
+static int matchTok(char *token, char *line)
+{
+ char buf[BUFSIZ], *tok;
+
+ strcpy(buf, line);
+ strtok(buf, " \n\t");
+ while ((tok = strtok(NULL, " \n\t"))) {
+ if (! strcmp(tok, token)) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+void handleComments(char *s)
+{
+ SKIPSPACE(s);
+ if (*s == '#') {
+ *s = '\0';
+ }
+}
+
+/* returns 0 - success */
+/* 1 - EOF */
+/* <0 - error */
+
+int readLine(Spec spec, int strip)
+{
+ char *from, *to, *last, *s, *arch, *os;
+ int match;
+ char ch;
+ struct ReadLevelEntry *rl;
+
+ /* Make sure the spec file is open */
+ if (!spec->file) {
+ if (!(spec->file = fopen(spec->specFile, "r"))) {
+ rpmError(RPMERR_BADSPEC, "Unable to open: %s\n", spec->specFile);
+ return RPMERR_BADSPEC;
+ }
+ spec->lineNum = 0;
+ }
+
+ /* Make sure we have something in the read buffer */
+ if (!spec->readPtr || ! *(spec->readPtr)) {
+ if (!fgets(spec->readBuf, BUFSIZ, spec->file)) {
+ /* EOF */
+ if (spec->readStack->next) {
+ rpmError(RPMERR_UNMATCHEDIF, "Unclosed %%if");
+ return RPMERR_UNMATCHEDIF;
+ }
+ return 1;
+ }
+ spec->readPtr = spec->readBuf;
+ spec->lineNum++;
+ /*rpmMessage(RPMMESS_DEBUG, "LINE: %s", spec->readBuf);*/
+ }
+
+ /* Copy a single line to the line buffer */
+ from = spec->readPtr;
+ to = last = spec->line;
+ ch = ' ';
+ while (*from && ch != '\n') {
+ ch = *to++ = *from++;
+ if (!isspace(ch)) {
+ last = to;
+ }
+ }
+ *to = '\0';
+ spec->readPtr = from;
+
+ if (strip & STRIP_COMMENTS) {
+ handleComments(spec->line);
+ }
+
+ if (strip & STRIP_TRAILINGSPACE) {
+ *last = '\0';
+ }
+
+ if (spec->readStack->reading) {
+ if (expandMacros(spec, &spec->macros, spec->line, sizeof(spec->line))) {
+ rpmError(RPMERR_BADSPEC, "line %d: %s", spec->lineNum, spec->line);
+ return RPMERR_BADSPEC;
+ }
+ }
+
+ rpmGetArchInfo(&arch, NULL);
+ rpmGetOsInfo(&os, NULL);
+ s = spec->line;
+ SKIPSPACE(s);
+ match = -1;
+ if (! strncmp("%ifarch", s, 7)) {
+ match = matchTok(arch, s);
+ } else if (! strncmp("%ifnarch", s, 8)) {
+ match = !matchTok(arch, s);
+ } else if (! strncmp("%ifos", s, 5)) {
+ match = matchTok(os, s);
+ } else if (! strncmp("%ifnos", s, 6)) {
+ match = !matchTok(os, s);
+ } else if (! strncmp("%else", s, 5)) {
+ if (! spec->readStack->next) {
+ /* Got an else with no %if ! */
+ rpmError(RPMERR_UNMATCHEDIF, "line %d: Got a %%else with no if",
+ spec->lineNum);
+ return RPMERR_UNMATCHEDIF;
+ }
+ spec->readStack->reading =
+ spec->readStack->next->reading && ! spec->readStack->reading;
+ spec->line[0] = '\0';
+ } else if (! strncmp("%endif", s, 6)) {
+ if (! spec->readStack->next) {
+ /* Got an end with no %if ! */
+ rpmError(RPMERR_UNMATCHEDIF, "line %d: Got a %%endif with no if",
+ spec->lineNum);
+ return RPMERR_UNMATCHEDIF;
+ }
+ rl = spec->readStack;
+ spec->readStack = spec->readStack->next;
+ free(rl);
+ spec->line[0] = '\0';
+ }
+ if (match != -1) {
+ rl = malloc(sizeof(struct ReadLevelEntry));
+ rl->reading = spec->readStack->reading && match;
+ rl->next = spec->readStack;
+ spec->readStack = rl;
+ spec->line[0] = '\0';
+ }
+
+ if (! spec->readStack->reading) {
+ spec->line[0] = '\0';
+ }
+
+ return 0;
+}
+
+void closeSpec(Spec spec)
+{
+ if (spec->file) {
+ fclose(spec->file);
+ }
+ spec->file = NULL;
+}
int parseSpec(Spec *specp, char *specFile, char *buildRoot,
int inBuildArch, char *passPhrase, char *cookie)
return 0;
}
-
-static void setStandardMacros(Spec spec, char *arch, char *os)
-{
- char buf[BUFSIZ];
- int x;
-
- addMacro(&spec->macros, "sourcedir", NULL, rpmGetVar(RPMVAR_SOURCEDIR), -1);
- addMacro(&spec->macros, "builddir", NULL, rpmGetVar(RPMVAR_BUILDDIR), -1);
- addMacro(&spec->macros, "optflags", NULL, rpmGetVar(RPMVAR_OPTFLAGS), -1);
- addMacro(&spec->macros, "buildarch", NULL, arch, -1);
- addMacro(&spec->macros, "buildos", NULL, os, -1);
-
- x = 0;
- while (arch[x]) {
- buf[x] = tolower(arch[x]);
- x++;
- }
- buf[x] = '\0';
- addMacro(&spec->macros, "buildarch_lc", NULL, buf, -1);
- x = 0;
- while (os[x]) {
- buf[x] = tolower(os[x]);
- x++;
- }
- buf[x] = '\0';
- addMacro(&spec->macros, "buildos_lc", NULL, buf, -1);
-}
+++ /dev/null
-#include "system.h"
-
-#include "part.h"
-
-static struct PartRec {
- int part;
- int len;
- char *token;
-} partList[] = {
- {PART_PREAMBLE, 0, "%package"},
- {PART_PREP, 0, "%prep"},
- {PART_BUILD, 0, "%build"},
- {PART_INSTALL, 0, "%install"},
- {PART_CLEAN, 0, "%clean"},
- {PART_PREUN, 0, "%preun"},
- {PART_POSTUN, 0, "%postun"},
- {PART_PRE, 0, "%pre"},
- {PART_POST, 0, "%post"},
- {PART_FILES, 0, "%files"},
- {PART_CHANGELOG, 0, "%changelog"},
- {PART_DESCRIPTION, 0, "%description"},
- {PART_TRIGGERPOSTUN, 0, "%triggerpostun"},
- {PART_TRIGGERUN, 0, "%triggerun"},
- {PART_TRIGGERIN, 0, "%triggerin"},
- {PART_TRIGGERIN, 0, "%trigger"},
- {PART_VERIFYSCRIPT, 0, "%verifyscript"},
- {0, 0, 0}
-};
-
-static void initParts(void)
-{
- struct PartRec *p = partList;
-
- while (p->token) {
- p->len = strlen(p->token);
- p++;
- }
-}
-
-int isPart(char *line)
-{
- char c;
- struct PartRec *p = partList;
-
- if (p->len == 0) {
- initParts();
- }
-
- while (p->token) {
- if (! strncmp(line, p->token, p->len)) {
- c = *(line + p->len);
- if (c == '\0' || isspace(c)) {
- break;
- }
- }
- p++;
- }
-
- if (p->token) {
- return p->part;
- } else {
- return PART_NONE;
- }
-}
-
+++ /dev/null
-#ifndef _H_PART_
-#define _H_PART_
-
-#define PART_NONE 0
-#define PART_PREAMBLE 1
-#define PART_PREP 2
-#define PART_BUILD 3
-#define PART_INSTALL 4
-#define PART_CLEAN 5
-#define PART_FILES 6
-#define PART_PRE 7
-#define PART_POST 8
-#define PART_PREUN 9
-#define PART_POSTUN 10
-#define PART_DESCRIPTION 11
-#define PART_CHANGELOG 12
-#define PART_TRIGGERIN 13
-#define PART_TRIGGERUN 14
-#define PART_VERIFYSCRIPT 15
-#define PART_BUILDARCHITECTURES 16
-#define PART_TRIGGERPOSTUN 17
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int isPart(char *line);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H_PART_ */
+++ /dev/null
-#include "system.h"
-
-#include "spec.h"
-#include "rpmlib.h"
-#include "messages.h"
-#include "macro.h"
-#include "misc.h"
-#include "read.h"
-
-#ifdef DYING
-static int matchTok(char *token, char *line);
-#endif
-
-static int matchTok(char *token, char *line)
-{
- char buf[BUFSIZ], *tok;
-
- strcpy(buf, line);
- strtok(buf, " \n\t");
- while ((tok = strtok(NULL, " \n\t"))) {
- if (! strcmp(tok, token)) {
- return 1;
- }
- }
-
- return 0;
-}
-
-void handleComments(char *s)
-{
- SKIPSPACE(s);
- if (*s == '#') {
- *s = '\0';
- }
-}
-
-/* returns 0 - success */
-/* 1 - EOF */
-/* <0 - error */
-
-int readLine(Spec spec, int strip)
-{
- char *from, *to, *last, *s, *arch, *os;
- int match;
- char ch;
- struct ReadLevelEntry *rl;
-
- /* Make sure the spec file is open */
- if (!spec->file) {
- if (!(spec->file = fopen(spec->specFile, "r"))) {
- rpmError(RPMERR_BADSPEC, "Unable to open: %s\n", spec->specFile);
- return RPMERR_BADSPEC;
- }
- spec->lineNum = 0;
- }
-
- /* Make sure we have something in the read buffer */
- if (!spec->readPtr || ! *(spec->readPtr)) {
- if (!fgets(spec->readBuf, BUFSIZ, spec->file)) {
- /* EOF */
- if (spec->readStack->next) {
- rpmError(RPMERR_UNMATCHEDIF, "Unclosed %%if");
- return RPMERR_UNMATCHEDIF;
- }
- return 1;
- }
- spec->readPtr = spec->readBuf;
- spec->lineNum++;
- /*rpmMessage(RPMMESS_DEBUG, "LINE: %s", spec->readBuf);*/
- }
-
- /* Copy a single line to the line buffer */
- from = spec->readPtr;
- to = last = spec->line;
- ch = ' ';
- while (*from && ch != '\n') {
- ch = *to++ = *from++;
- if (!isspace(ch)) {
- last = to;
- }
- }
- *to = '\0';
- spec->readPtr = from;
-
- if (strip & STRIP_COMMENTS) {
- handleComments(spec->line);
- }
-
- if (strip & STRIP_TRAILINGSPACE) {
- *last = '\0';
- }
-
- if (spec->readStack->reading) {
- if (expandMacros(spec, &spec->macros, spec->line, sizeof(spec->line))) {
- rpmError(RPMERR_BADSPEC, "line %d: %s", spec->lineNum, spec->line);
- return RPMERR_BADSPEC;
- }
- }
-
- rpmGetArchInfo(&arch, NULL);
- rpmGetOsInfo(&os, NULL);
- s = spec->line;
- SKIPSPACE(s);
- match = -1;
- if (! strncmp("%ifarch", s, 7)) {
- match = matchTok(arch, s);
- } else if (! strncmp("%ifnarch", s, 8)) {
- match = !matchTok(arch, s);
- } else if (! strncmp("%ifos", s, 5)) {
- match = matchTok(os, s);
- } else if (! strncmp("%ifnos", s, 6)) {
- match = !matchTok(os, s);
- } else if (! strncmp("%else", s, 5)) {
- if (! spec->readStack->next) {
- /* Got an else with no %if ! */
- rpmError(RPMERR_UNMATCHEDIF, "line %d: Got a %%else with no if",
- spec->lineNum);
- return RPMERR_UNMATCHEDIF;
- }
- spec->readStack->reading =
- spec->readStack->next->reading && ! spec->readStack->reading;
- spec->line[0] = '\0';
- } else if (! strncmp("%endif", s, 6)) {
- if (! spec->readStack->next) {
- /* Got an end with no %if ! */
- rpmError(RPMERR_UNMATCHEDIF, "line %d: Got a %%endif with no if",
- spec->lineNum);
- return RPMERR_UNMATCHEDIF;
- }
- rl = spec->readStack;
- spec->readStack = spec->readStack->next;
- free(rl);
- spec->line[0] = '\0';
- }
- if (match != -1) {
- rl = malloc(sizeof(struct ReadLevelEntry));
- rl->reading = spec->readStack->reading && match;
- rl->next = spec->readStack;
- spec->readStack = rl;
- spec->line[0] = '\0';
- }
-
- if (! spec->readStack->reading) {
- spec->line[0] = '\0';
- }
-
- return 0;
-}
-
-void closeSpec(Spec spec)
-{
- if (spec->file) {
- fclose(spec->file);
- }
- spec->file = NULL;
-}
+++ /dev/null
-#ifndef _H_READ_
-#define _H_READ_
-
-#include "spec.h"
-
-#define STRIP_NOTHING 0
-#define STRIP_TRAILINGSPACE (1 << 0)
-#define STRIP_COMMENTS (1 << 1)
-
-/* returns 0 - success */
-/* 1 - EOF */
-/* <0 - error */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int readLine(Spec spec, int strip);
-void closeSpec(Spec spec);
-void handleComments(char *s);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H_READ_ */
#include "system.h"
-#include "spec.h"
-#include "reqprov.h"
-#include "messages.h"
-#include "rpmlib.h"
-#include "misc.h"
-#include "lib/misc.h"
+#include "rpmbuild.h"
int addReqProv(Spec spec, Package pkg,
int flag, char *name, char *version, int index)
+++ /dev/null
-#ifndef _H_REQPROV_
-#define _H_REQPROV_
-
-#include "spec.h"
-#include "package.h"
-#include "lib/cpio.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int addReqProv(Spec spec, Package pkg,
- int flag, char *name, char *version, int index);
-
-#ifdef DYING
-int generateAutoReqProv(Spec spec, Package pkg,
- struct cpioFileMapping *cpioList, int cpioCount);
-void printReqs(Spec spec, Package pkg);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H_REQPROV_ */
--- /dev/null
+#ifndef _H_RPMBUILD_
+#define _H_RPMBUILD_
+
+/* This is the *only* module users of librpmbuild should need to include */
+#include "rpmlib.h"
+
+/* and it shouldn't need these :-( */
+#include "stringbuf.h"
+#include "messages.h"
+#include "misc.h"
+
+/* but this will be needed */
+#include "spec.h"
+
+/* from build/build.h */
+
+#define RPMBUILD_PREP (1 << 0)
+#define RPMBUILD_BUILD (1 << 1)
+#define RPMBUILD_INSTALL (1 << 2)
+#define RPMBUILD_CLEAN (1 << 3)
+#define RPMBUILD_FILECHECK (1 << 4)
+#define RPMBUILD_PACKAGESOURCE (1 << 5)
+#define RPMBUILD_PACKAGEBINARY (1 << 6)
+#define RPMBUILD_RMSOURCE (1 << 7)
+#define RPMBUILD_RMBUILD (1 << 8)
+#define RPMBUILD_STRINGBUF (1 << 9) /* only for doScript() */
+
+/* from build/misc.h */
+
+#include <ctype.h>
+
+#define FREE(x) { if (x) free(x); x = NULL; }
+#define SKIPSPACE(s) { while (*(s) && isspace(*(s))) (s)++; }
+#define SKIPNONSPACE(s) { while (*(s) && !isspace(*(s))) (s)++; }
+#define SKIPTONEWLINE(s) { while (*s && *s != '\n') s++; }
+
+#define PART_SUBNAME 0
+#define PART_NAME 1
+
+/* from build/part.h */
+
+#define PART_NONE 0
+#define PART_PREAMBLE 1
+#define PART_PREP 2
+#define PART_BUILD 3
+#define PART_INSTALL 4
+#define PART_CLEAN 5
+#define PART_FILES 6
+#define PART_PRE 7
+#define PART_POST 8
+#define PART_PREUN 9
+#define PART_POSTUN 10
+#define PART_DESCRIPTION 11
+#define PART_CHANGELOG 12
+#define PART_TRIGGERIN 13
+#define PART_TRIGGERUN 14
+#define PART_VERIFYSCRIPT 15
+#define PART_BUILDARCHITECTURES 16
+#define PART_TRIGGERPOSTUN 17
+
+/* from build/read.h */
+
+#define STRIP_NOTHING 0
+#define STRIP_TRAILINGSPACE (1 << 0)
+#define STRIP_COMMENTS (1 << 1)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int isCompressed(char *file, int *compressed);
+
+/* from build/names.h */
+
+char *getUname(uid_t uid);
+char *getUnameS(char *uname);
+char *getGname(gid_t gid);
+char *getGnameS(char *gname);
+
+char *buildHost(void);
+time_t *getBuildTime(void);
+
+/* from build/read.h */
+
+/* returns 0 - success */
+/* 1 - EOF */
+/* <0 - error */
+int readLine(Spec spec, int strip);
+
+void closeSpec(Spec spec);
+void handleComments(char *s);
+
+/* from build/part.h */
+
+int isPart(char *line);
+
+/* from build/misc.h */
+
+int parseNum(char *line, int *res);
+char *cleanFileName(char *name);
+
+/* from build/parse.h */
+
+int parseChangelog(Spec spec);
+int parseDescription(Spec spec);
+int parseFiles(Spec spec);
+int parsePreamble(Spec spec, int initialPackage);
+int parsePrep(Spec spec);
+int parseRequiresConflicts(Spec spec, Package pkg, char *field,
+ int tag, int index);
+int parseProvidesObsoletes(Spec spec, Package pkg, char *field, int tag);
+int parseTrigger(Spec spec, Package pkg, char *field, int tag);
+int parseScript(Spec spec, int parsePart);
+int parseBuildInstallClean(Spec spec, int parsePart);
+
+/* from build/build.h */
+
+int doScript(Spec spec, int what, char *name, StringBuf sb, int test);
+
+/* from build/package.h */
+
+int lookupPackage(Spec spec, char *name, int flag, Package *pkg);
+Package newPackage(Spec spec);
+void freePackages(Spec spec);
+void freePackage(Package p);
+
+/* from build/reqprov.h */
+
+int addReqProv(Spec spec, Package pkg,
+ int flag, char *name, char *version, int index);
+
+/* from build/files.h */
+
+int processBinaryFiles(Spec spec, int installSpecialDoc, int test);
+int processSourceFiles(Spec spec);
+
+/* global entry points */
+
+int parseSpec(Spec *specp, char *specFile, char *buildRoot,
+ int inBuildArch, char *passPhrase, char *cookie);
+int buildSpec(Spec spec, int what, int test);
+
+int packageBinaries(Spec spec);
+int packageSources(Spec spec);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H_RPMBUILD_ */
#include "system.h"
-#include "spec.h"
-#include "misc.h"
-#include "rpmlib.h"
-#include "package.h"
-#include "read.h"
-#include "files.h"
-#include "macro.h"
+#include "rpmbuild.h"
+
+#include "lib/cpio.h"
+
+#ifdef DYING
+static void freeTriggerFiles(struct TriggerFileEntry *p);
+#endif
+
+static void freeTriggerFiles(struct TriggerFileEntry *p)
+{
+ struct TriggerFileEntry *o;
+
+ while (p) {
+ FREE(p->fileName);
+ FREE(p->script);
+ FREE(p->prog);
+ o = p;
+ p = p->next;
+ free(o);
+ }
+}
+
+void freeCpioList(struct cpioFileMapping *cpioList, int cpioCount)
+{
+ struct cpioFileMapping *p = cpioList;
+
+ while (cpioCount--) {
+ rpmMessage(RPMMESS_DEBUG, "archive = %s, fs = %s\n",
+ p->archivePath, p->fsPath);
+ FREE(p->archivePath);
+ FREE(p->fsPath);
+ p++;
+ }
+ FREE(cpioList);
+}
+
+int lookupPackage(Spec spec, char *name, int flag, Package *pkg)
+{
+ char buf[BUFSIZ];
+ char *n, *fullName;
+ Package p;
+
+ /* "main" package */
+ if (! name) {
+ if (pkg) {
+ *pkg = spec->packages;
+ }
+ return 0;
+ }
+
+ /* Construct package name */
+ if (flag == PART_SUBNAME) {
+ headerGetEntry(spec->packages->header, RPMTAG_NAME,
+ NULL, (void *) &n, NULL);
+ sprintf(buf, "%s-%s", n, name);
+ fullName = buf;
+ } else {
+ fullName = name;
+ }
+
+ p = spec->packages;
+ while (p) {
+ headerGetEntry(p->header, RPMTAG_NAME, NULL, (void *) &n, NULL);
+ if (n && (! strcmp(fullName, n))) {
+ if (pkg) {
+ *pkg = p;
+ }
+ return 0;
+ }
+ p = p->next;
+ }
+
+ if (pkg) {
+ *pkg = NULL;
+ }
+ return 1;
+}
+
+Package newPackage(Spec spec)
+{
+ Package p;
+ Package pp;
+
+ p = malloc(sizeof(*p));
+
+ p->header = headerNew();
+ p->icon = NULL;
+ p->autoReqProv = 1;
+
+#if 0
+ p->reqProv = NULL;
+ p->triggers = NULL;
+ p->triggerScripts = NULL;
+#endif
+
+ p->triggerFiles = NULL;
+
+ p->fileFile = NULL;
+ p->fileList = NULL;
+ p->next = NULL;
+
+ p->cpioList = NULL;
+ p->cpioCount = 0;
+
+ p->preInFile = NULL;
+ p->postInFile = NULL;
+ p->preUnFile = NULL;
+ p->postUnFile = NULL;
+ p->verifyFile = NULL;
+
+ p->specialDoc = NULL;
+
+ if (! spec->packages) {
+ spec->packages = p;
+ } else {
+ /* Always add package to end of list */
+ pp = spec->packages;
+ while (pp->next) {
+ pp = pp->next;
+ }
+ pp->next = p;
+ }
+
+ return p;
+}
+
+void freePackage(Package p)
+{
+ if (! p) {
+ return;
+ }
+
+ FREE(p->preInFile);
+ FREE(p->postInFile);
+ FREE(p->preUnFile);
+ FREE(p->postUnFile);
+ FREE(p->verifyFile);
+
+ headerFree(p->header);
+ freeStringBuf(p->fileList);
+ FREE(p->fileFile);
+ freeCpioList(p->cpioList, p->cpioCount);
+
+ freeStringBuf(p->specialDoc);
+
+ freeTriggerFiles(p->triggerFiles);
+
+ free(p);
+}
+
+void freePackages(Spec spec)
+{
+ Package p;
+
+ while (spec->packages) {
+ p = spec->packages;
+ spec->packages = p->next;
+ freePackage(p);
+ }
+}
#ifdef DYING
static char *getSourceAux(Spec spec, int num, int flag, int full);
#ifndef _H_SPEC_
#define _H_SPEC_
-#include "header.h"
-#include "stringbuf.h"
-
typedef struct SpecStruct *Spec;
#include "macro.h"
#include "system.h"
+#include "build/rpmbuild.h"
+
#include "checksig.h"
#include "intl.h"
-#include "rpmlib.h"
#include "rpmlead.h"
#include "signature.h"
-#include "messages.h"
-#include "lib/misc.h"
int doReSign(int add, char *passPhrase, char **argv)
{
AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/vmount.h)
AC_CHECK_HEADERS(glob.h,,MISCOBJS="$MISCOBJS glob.o")
AC_CHECK_HEADERS(fnmatch.h,,MISCOBJS="$MISCOBJS fnmatch.o")
-AC_CHECK_HEADERS(fcntl.h malloc.h memory.h sys/wait.h)
+AC_CHECK_HEADERS(fcntl.h grp.h malloc.h memory.h netdb.h pwd.h utime.h)
+AC_CHECK_HEADERS(sys/mman.h sys/param.h sys/resource.h sys/utsname.h sys/wait.h)
AC_CHECK_HEADERS(db_185.h)
if test "$PO" = po; then
AC_CHECK_HEADERS(libintl.h)
fi
+AC_HEADER_TIME
AC_C_BIGENDIAN
AC_C_INLINE
#include "system.h"
-#include "dbindex.h"
+#include "build/rpmbuild.h"
+
#include "falloc.h"
-#include "header.h"
-#include "misc.h"
#include "oldrpmdb.h"
#include "oldheader.h"
-#include "rpmlib.h"
int convertDB(void);
#include "system.h"
-#if HAVE_CONFIG_H
-# include "miscfn.h"
-#else
+#if !defined(HAVE_CONFIG_H)
#define HAVE_MACHINE_TYPES_H 1
#define HAVE_ALLOCA_H 1
#define HAVE_NETINET_IN_SYSTM_H 1
extern int h_errno;
#endif
-#include <netdb.h>
-#include <pwd.h>
#include <stdarg.h>
-#include <sys/time.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include "system.h"
-#include "miscfn.h"
+#include "build/rpmbuild.h"
+
#include "install.h"
#include "intl.h"
-#include "lib/rpmlib.h"
-#include "messages.h"
#include "query.h"
#include "url.h"
#include "system.h"
-#include "miscfn.h"
-
-#include <utime.h>
#include "cpio.h"
#include "system.h"
-#include "miscfn.h"
-#ifdef HAVE_DB_185_H
-#include <db_185.h>
-#else
-#include <db.h>
-#endif
+#include "rpmlib.h"
-#include "dbindex.h"
#include "intl.h"
-#include "rpmlib.h"
dbiIndex * dbiOpenIndex(char * filename, int flags, int perms) {
dbiIndex * db;
#ifndef H_DBINDEX
#define H_DBINDEX
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* this will break if sizeof(int) != 4 */
-
#ifdef HAVE_DB_185_H
#include <db_185.h>
#else
#include <db.h>
#endif
+/* this will break if sizeof(int) != 4 */
+
typedef struct {
unsigned int recOffset;
unsigned int fileNumber;
char * indexname;
} dbiIndex;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
dbiIndex * dbiOpenIndex(char * filename, int flags, int perms);
void dbiCloseIndex(dbiIndex * dbi);
void dbiSyncIndex(dbiIndex * dbi);
#include "system.h"
-#include "miscfn.h"
+
+#include "rpmlib.h"
#include "depends.h"
#include "intl.h"
#include "misc.h"
-#include "rpmlib.h"
#include "messages.h"
struct availablePackage {
#include "system.h"
-#include "miscfn.h"
-#include "header.h"
-#include "intl.h"
#include "rpmlib.h"
+#include "intl.h"
+
static char * permsFormat(int_32 type, const void * data,
char * formatPrefix, int padding, int element);
static char * depflagsFormat(int_32 type, const void * data,
#include "system.h"
-#include "miscfn.h"
-#include "header.h"
-#include "intl.h"
#include "rpmlib.h"
+#include "intl.h"
+
struct fsinfo {
char * mntPoint;
dev_t dev;
/* network byte order and is converted on the fly to host order. */
#include "system.h"
-#include "miscfn.h"
-#include <zlib.h>
-
-#include <sys/time.h>
#include <netinet/in.h>
#include "header.h"
+
#include "intl.h"
#include "tread.h"
#include "system.h"
-#include "miscfn.h"
-#include <pwd.h>
#include <signal.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <time.h>
-#include <utime.h>
-#include <zlib.h>
+
+#include "rpmlib.h"
#include "cpio.h"
-#include "header.h"
#include "install.h"
#include "md5.h"
#include "messages.h"
#include "misc.h"
#include "rpmdb.h"
-#include "rpmlib.h"
enum instActions { UNKNOWN, CREATE, BACKUP, KEEP, SAVE, SKIP, ALTNAME };
enum fileTypes { XDIR, BDEV, CDEV, SOCK, PIPE, REG, LINK } ;
#include "system.h"
-#include "miscfn.h"
-#include "intl.h"
#include "rpmlib.h"
+#include "intl.h"
+
static int findMatches(rpmdb db, char * name, char * version, char * release,
dbiIndexSet * matches);
#include <stdarg.h>
-#include "intl.h"
-#include "messages.h"
#include "rpmlib.h"
+
+#include "messages.h"
#include "intl.h"
static int minLevel = RPMMESS_NORMAL;
#include "system.h"
-#include "miscfn.h"
-#include <grp.h>
-#include <pwd.h>
-#include <sys/time.h>
+#include "rpmlib.h"
#include "intl.h"
#include "misc.h"
-#include "rpmlib.h"
#include "messages.h"
char * RPMVERSION = VERSION; /* just to put a marker in librpm.a */
#include "system.h"
-#include "miscfn.h"
#include <netinet/in.h>
+#include "rpmlib.h"
+
#include "misc.h"
#include "oldheader.h"
-#include "rpmlib.h"
#include "tread.h"
/* This *can't* read 1.0 headers -- it needs 1.1 (w/ group and icon fields)
#include "system.h"
-#include "miscfn.h"
#include <netinet/in.h>
-#include "header.h"
+#include "rpmlib.h"
+
#include "intl.h"
#include "misc.h"
#include "oldheader.h"
#include "rpmlead.h"
-#include "rpmlib.h"
#include "signature.h"
#include "messages.h"
#include "system.h"
+#include "rpmlib.h"
+
#include "intl.h"
#include "messages.h"
#include "rpmdb.h"
-#include "rpmlib.h"
int rpmdbRebuild(char * rootdir) {
rpmdb olddb, newdb;
#include <signal.h>
#include <sys/signal.h>
+#include "rpmlib.h"
+
#include "dbindex.h"
#include "falloc.h"
-#include "header.h"
#include "intl.h"
#include "misc.h"
#include "rpmdb.h"
-#include "rpmlib.h"
#include "messages.h"
/* XXX the signal handling in here is not thread safe */
#include "system.h"
-#include "miscfn.h"
#if HAVE_MACHINE_TYPES_H
# include <machine/types.h>
#include <netinet/in.h>
#include "rpmlib.h"
+
#include "rpmlead.h"
#include "tread.h"
#include "intl.h"
/* This is the *only* module users of rpmlib should need to include */
-#ifdef HAVE_DB_185_H
-#include <db_185.h>
-#else
-#include <db.h>
-#endif
+/* and it shouldn't need these :-( */
-/* it shouldn't need these :-( */
#include "dbindex.h"
#include "header.h"
#include "system.h"
-#include "miscfn.h"
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/utsname.h>
+#include "rpmlib.h"
#include "intl.h"
#include "messages.h"
#include "misc.h"
-#include "rpmlib.h"
#include "intl.h"
#if HAVE_SYS_SYSTEMCFG_H
*/
#include "system.h"
-#include "miscfn.h"
#if HAVE_ASM_BYTEORDER_H
#include <asm/byteorder.h>
#endif
-#include <sys/time.h>
-#include <sys/resource.h>
+#include "rpmlib.h"
#include "intl.h"
#include "md5.h"
#include "misc.h"
-#include "rpmlib.h"
#include "rpmlead.h"
#include "signature.h"
#include "tread.h"
#include "system.h"
-#include "miscfn.h"
#include "stringbuf.h"
#include "system.h"
-#include "header.h"
#include "rpmlib.h"
void main(int argc, char **argv)
#include "system.h"
-#include "miscfn.h"
-
-#include <sys/time.h>
#include "tread.h"
#include "system.h"
-#include "miscfn.h"
-#include <sys/time.h>
-#include <sys/resource.h>
+#include "rpmlib.h"
-#include "dbindex.h"
#include "depends.h"
#include "install.h"
#include "intl.h"
#include "md5.h"
#include "misc.h"
#include "rpmdb.h"
-#include "rpmlib.h"
static char * SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:"
"/usr/X11R6/bin";
#include "system.h"
-#include "miscfn.h"
-#include <sys/time.h>
-#include <sys/resource.h>
+#include "rpmlib.h"
#include "md5.h"
#include "misc.h"
#include "messages.h"
-#include "rpmlib.h"
#include "install.h"
#define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
#include <errno.h>
#include <ctype.h>
-#include "miscfn.h"
-
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
-#include "miscfn.h"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "system.h"
#ifdef __aix__
#define COMMENTCHAR '*'
#pragma alloca
#endif
-#include <errno.h>
-#include <sys/types.h>
-
-#include "config.h"
+#include "system.h"
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
#undef GLOB_APPEND
#undef GLOB_NOESCAPE
#undef GLOB_PERIOD
-#include "miscfn.h"
\f
__ptr_t (*__glob_opendir_hook) __P ((const char *directory));
const char *(*__glob_readdir_hook) __P ((__ptr_t stream));
#include "system.h"
-#include "miscfn.h"
#ifdef HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
+++ /dev/null
-#ifndef H_MISCFN
-#define H_MISCFN
-
-#if HAVE_SYS_STDTYPES_H
-# include <sys/stdtypes.h>
-#endif
-
-#if NEED_TIMEZONE
-extern time_t timezone;
-#endif
-
-#endif
#include "system.h"
-#include "miscfn.h"
-#include "rpmlib.h"
+#include "build/rpmbuild.h"
+
#include "rpm_malloc.h"
-#include "messages.h"
-#include "misc.h"
-#include "miscfn.h"
#include "oldrpmdb.h"
static int labelstrlistToLabelList(char * str, int length,
#include "system.h"
-#include <time.h>
-#include <sys/param.h>
-
#ifndef PATH_MAX
# define PATH_MAX 255
#endif
+#include "build/rpmbuild.h"
+
#include "intl.h"
-#include "lib/messages.h"
-#include "miscfn.h"
-#include "rpmlib.h"
#include "query.h"
#include "url.h"
#include <getopt.h>
#include <locale.h>
+#include "build/rpmbuild.h"
+
#include "install.h"
#include <intl.h>
-#include "lib/messages.h"
#include "lib/signature.h"
#include "query.h"
#include "verify.h"
#include "checksig.h"
-#include "rpmlib.h"
-#include "build/build.h"
#define GETOPT_QUERYFORMAT 1000
#define GETOPT_WHATREQUIRES 1001
#include "system.h"
-#include "miscfn.h"
#include <locale.h>
-#include <sys/time.h>
-#include <sys/resource.h>
+
+#include "build/rpmbuild.h"
#include "build.h"
-#include "build/build.h"
#include "checksig.h"
#include "install.h"
#include "intl.h"
-#include "lib/messages.h"
#include "lib/signature.h"
#include "popt/popt.h"
-#include "miscfn.h"
#include "query.h"
-#include "rpmlib.h"
#include "verify.h"
#define GETOPT_QUERYFORMAT 1000
#include "system.h"
-#include <zlib.h>
-
#include "rpmlib.h"
char *zlib_err [] = {
#include <stdarg.h>
-#include "intl.h"
-#include "messages.h"
#include "rpmlib.h"
+
+#include "messages.h"
#include "intl.h"
static int minLevel = RPMMESS_NORMAL;
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
/* <unistd.h> should be included before any preprocessor test
of _POSIX_VERSION. */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if NEED_TIMEZONE
+extern time_t timezone;
+#endif
+
+
/* Since major is a function on SVR4, we can't use `ifndef major'. */
#if MAJOR_IN_MKDEV
#include <sys/mkdev.h>
#endif
#undef HAVE_MAJOR
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#include <ctype.h>
+#if HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+/* XXX FIXME: popt on sunos4.1.3: <sys/resource.h> requires <sys/time.h> */
+#if HAVE_SYS_RESOURCE_H && HAVE_SYS_TIME_H
+#include <sys/resource.h>
+#endif
+
+#if HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
+#if HAVE_GRP_H
+#include <grp.h>
+#endif
+
#if HAVE_LIMITS_H
#include <limits.h>
#endif
#include <malloc.h>
#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#if HAVE_PWD_H
+#include <pwd.h>
+#endif
+
/* ============== from misc/miscfn.h */
#if HAVE_FNMATCH_H
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
+#include "system.h"
-#include "header.h"
#include "rpmlib.h"
+
#include "intl.h"
int main(int argc, char ** argv)
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "header.h"
+#include "system.h"
+
#include "rpmlib.h"
#include "intl.h"
/* rpmarchive: spit out the main archive portion of a package */
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include "system.h"
#include "rpmlead.h"
#include "signature.h"
/* rpmchecksig: verify the signature of an RPM */
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include "system.h"
#include "rpmlib.h"
+
#include "rpmlead.h"
#include "signature.h"
#include "intl.h"
/* rpmheader: spit out the header portion of a package */
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include "system.h"
#include "rpmlead.h"
#include "signature.h"
/* rpmlead: spit out the lead portion of a package */
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include "system.h"
#include "rpmlead.h"
#include "intl.h"
/* rpmsignature: spit out the signature portion of a package */
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include "system.h"
#include "rpmlead.h"
#include "signature.h"
#include "system.h"
-#include "miscfn.h"
-#include <pwd.h>
+#include "build/rpmbuild.h"
#include "ftp.h"
#include "intl.h"
-#include "messages.h"
-#include "miscfn.h"
-#include "rpmlib.h"
#include "url.h"
struct pwcacheEntry {
#include "system.h"
-#include "lib/messages.h"
+#include "build/rpmbuild.h"
+
#include "install.h"
#include "intl.h"
#include "query.h"
-#include "rpmlib.h"
#include "url.h"
#include "verify.h"