Create /usr/lib/rpm directory and move rpmrc et al there.
CVS patchset: 2168
CVS date: 1998/07/08 17:30:37
+2.5.3 -> 3.0
+ - add {init,add,expand}Macro args everywhere (new macro.c compatibility)
+ - create /usr/lib/rpm directory and move rpmrc et al there
+
2.5.2 -> 2.5.3:
- allow %define with leading whitespace
[ -d $(installprefix)/$(LIBDIR) ] || mkdir -p $(installprefix)/$(LIBDIR)
[ -d $(installprefix)/$(INCDIR) ] || mkdir -p $(installprefix)/$(INCDIR)
[ -d $(installprefix)/$(RPMCONFIGDIR) ] || \
- mkdir -p $(installprefix)/$(INCDIR)
+ mkdir -p $(installprefix)/$(RPMCONFIGDIR)
if [ -x ./rpm ]; then \
$(INSTALL_PROGRAM) -s -m 755 rpm $(installprefix)/$(RPMBINDIR); \
else \
$(INSTALL_PROGRAM) -s -m 755 rpm.shared $(installprefix)/$(RPMBINDIR)/rpm; \
fi
- $(INSTALL_PROGRAM) -m 755 $(srcdir)/gendiff $(installprefix)/$(BINDIR)
+ $(INSTALL_PROGRAM) -m 755 $(srcdir)/gendiff $(installprefix)/$(RPMCONFIGDIR)
+ ln -sf $(RPMCONFIGDIR)/gendiff $(installprefix)/$(BINDIR)/gendiff
$(INSTALL_PROGRAM) -m 755 $(topdir)/find-provides.sh $(installprefix)/$(BINDIR)/find-provides
- $(INSTALL_PROGRAM) -m 755 $(topdir)/find-requires.sh $(installprefix)/$(BINDIR)/find-requires
+ ln -sf $(RPMCONFIGDIR)/find-provides $(installprefix)/$(BINDIR)/find-provides
+ $(INSTALL_PROGRAM) -m 755 $(topdir)/find-requires.sh $(installprefix)/$(RPMCONFIGDIR)/find-requires
+ ln -sf $(RPMCONFIGDIR)/find-requires $(installprefix)/$(BINDIR)/find-requires
$(INSTALL_PROGRAM) -s -m 755 rpm2cpio $(installprefix)/$(BINDIR)
$(INSTALL_DATA) -m 644 $(srcdir)/rpm.8 $(installprefix)/$(MANDIR)
$(INSTALL_DATA) -m 644 $(srcdir)/rpm2cpio.8 $(installprefix)/$(MANDIR)
- $(INSTALL_DATA) -m 644 $(topdir)/lib-rpmrc $(installprefix)/$(LIBDIR)/rpmrc
- $(INSTALL_DATA) -m 644 $(srcdir)/rpmpopt $(installprefix)/$(LIBDIR)/rpmpopt
+ $(INSTALL_DATA) -m 644 $(topdir)/lib-rpmrc $(installprefix)/$(RPMCONFIGDIR)/rpmrc
+ ln -sf $(RPMCONFIGDIR)/rpmrc $(installprefix)/$(LIBDIR)/rpmrc
+ $(INSTALL_DATA) -m 644 $(srcdir)/rpmpopt $(installprefix)/$(RPMCONFIGDIR)/rpmpopt
+ ln -sf $(RPMCONFIGDIR)/rpmpopt $(installprefix)/$(LIBDIR)/rpmpopt
(cd lib; $(MAKE) LIBDIR=$(installprefix)/$(LIBDIR) INCDIR=$(installprefix)/$(INCDIR) install)
for d in $(INSTSUBDIRS); do \
(cd $$d; $(MAKE) installprefix=$(installprefix) LIBDIR=$(installprefix)/$(LIBDIR) INCDIR=$(installprefix)/$(INCDIR) install) ;\
@sleep 5
@cvs -Q tag -F $(CVSTAG) .
@rm -rf /tmp/rpm-$(VERSION) /tmp/rpm
- @cd /tmp; cvs -Q -d $(CVSROOT) export -r$(CVSTAG) rpm || echo GRRRrrrrr -- ignore [export aborted]
+ @cd /tmp; cvs -Q -d $(CVSROOT) export -r$(CVSTAG) rpm
@mv /tmp/rpm /tmp/rpm-$(VERSION)
@rm /tmp/rpm-$(VERSION)/popt/popt.spec
@cd /tmp/rpm-$(VERSION); ./autogen.sh ; make depend; make distclean
RANLIB = @RANLIB@
OPTS = @DEFS@
RPMCONFIGDIR=@RPMCONFIGDIR@
+FINDPROVIDES=$(RPMCONFIGDIR)/find-provides
+FINDREQUIRES=$(RPMCONFIGDIR)/find-requires
LIBRPMRC_FILENAME=$(RPMCONFIGDIR)/rpmrc
LIBRPMALIAS_FILENAME=$(RPMCONFIGDIR)/rpmpopt
+MACROFILE=$(RPMCONFIGDIR)/macros
RPMNLSDIR=@datadir@/locale
RPMNLSPACKAGE=rpm
CFLAGS = -I$(topdir) -I$(topsrcdir) @CFLAGS@ @INCPATH@ $(OPTS) \
exit 0;
fi
-if [ -z "$@" ]; then
+if [ X"$@" = X ]; then
./configure --prefix=/usr
else
./configure "$@"
pack.o: pack.c
$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -o $@ -c $<
+reqprov.o: reqprov.c
+ $(CC) $(CFLAGS) -DFINDPROVIDES=\"$(FINDPROVIDES)\" -DFINDREQUIRES=\"$(FINDREQUIRES)\" -o $@ -c $<
+
+spec.o: spec.c
+ $(CC) $(CFLAGS) -DMACROFILE=\"$(MACROFILE)\" -o $@ -c $<
+
clean:
rm -f *.a *.o *~ $(PROGS)
}
while (fgets(buf, sizeof(buf), f)) {
handleComments(buf);
- if (expandMacros(&spec->macros, buf)) {
+ if (expandMacros(spec, &spec->macros, buf, sizeof(buf))) {
rpmError(RPMERR_BADSPEC, "line: %s", buf);
return RPMERR_BADSPEC;
}
#include <ctype.h>
#include <stdio.h>
+#include "spec.h"
#include "macro.h"
#include "misc.h"
static void dumpTable(struct MacroContext *mc);
static void expandMacroTable(struct MacroContext *mc);
static int compareMacros(const void *ap, const void *bp);
-static struct MacroEntry *findEntry(struct MacroContext *mc, char *name);
+static struct MacroEntry *findEntry(struct MacroContext *mc, const char *name);
static int handleDefine(struct MacroContext *mc, char *buf);
static int parseMacro(char *p, char **macro, char **next);
/* */
/*************************************************************************/
-int expandMacros(struct MacroContext *mc, char *buf)
+int expandMacros(Spec spec, struct MacroContext *mc, char *buf, size_t buflen)
{
char bufA[1024];
char *copyTo, *copyFrom;
}
}
- if (expandMacros(mc, expansion)) {
+ /* XXX HACK: 1st and last args for compatibility, currently unused*/
+ if (expandMacros(NULL, mc, expansion, 0)) {
+
return 1;
}
- addMacro(mc, name, expansion);
+ addMacro(mc, name, NULL, expansion, -1);
return 0;
}
/* */
/*************************************************************************/
-void initMacros(struct MacroContext *mc)
+void initMacros(struct MacroContext *mc, const char *macrofile)
{
mc->macrosAllocated = 0;
mc->firstFree = 0;
FREE(mc->macroTable);
}
-void addMacro(struct MacroContext *mc, char *name, char *expansion)
+void addMacro(struct MacroContext *mc, const char *name, const char *o, const char *expansion, int depth)
{
struct MacroEntry *p;
compareMacros);
}
-static struct MacroEntry *findEntry(struct MacroContext *mc, char *name)
+static struct MacroEntry *findEntry(struct MacroContext *mc, const char *name)
{
struct MacroEntry key;
int firstFree;
};
-void initMacros(struct MacroContext *mc);
+void initMacros(struct MacroContext *mc, const char *macrofile);
void freeMacros(struct MacroContext *mc);
-void addMacro(struct MacroContext *mc, char *name, char *expansion);
+void addMacro(struct MacroContext *mc, const char *n, const char *o, const char *b, int depth);
/* Expand all macros in buf, in place */
-int expandMacros(struct MacroContext *mc, char *buf);
+int expandMacros(Spec spec, struct MacroContext *mc, char *sbuf, size_t sbuflen);
#endif
return NULL;
}
while (fgets(buf, sizeof(buf), f)) {
- if (expandMacros(&spec->macros, buf)) {
+ if (expandMacros(spec, &spec->macros, buf, sizeof(buf))) {
rpmError(RPMERR_BADSPEC, "line: %s", buf);
return NULL;
}
SINGLE_TOKEN_ONLY;
/* These are for backward compatibility */
if (tag == RPMTAG_VERSION) {
- addMacro(&spec->macros, "PACKAGE_VERSION", field);
+ addMacro(&spec->macros, "PACKAGE_VERSION", NULL, field, -1);
} else if (tag == RPMTAG_RELEASE) {
- addMacro(&spec->macros, "PACKAGE_RELEASE", field);
+ addMacro(&spec->macros, "PACKAGE_RELEASE", NULL, field, -1);
}
/* fall through */
case RPMTAG_GROUP:
}
if (macro) {
- addMacro(&spec->macros, macro, field);
+ addMacro(&spec->macros, macro, NULL, field, -1);
}
return 0;
static int doPatchMacro(Spec spec, char *line);
static char *doPatch(Spec spec, int c, int strip, char *db,
int reverse, int removeEmpties);
-static int isCompressed(char *file, int *compressed);
+ int isCompressed(char *file, int *compressed);
static int checkOwners(char *file);
static char *doUntar(Spec spec, int c, int quietly);
return 0;
}
-static int isCompressed(char *file, int *compressed)
+int isCompressed(char *file, int *compressed)
{
int fd;
unsigned char magic[4];
char buf[BUFSIZ];
int x;
- addMacro(&spec->macros, "sourcedir", rpmGetVar(RPMVAR_SOURCEDIR));
- addMacro(&spec->macros, "builddir", rpmGetVar(RPMVAR_BUILDDIR));
- addMacro(&spec->macros, "optflags", rpmGetVar(RPMVAR_OPTFLAGS));
- addMacro(&spec->macros, "buildarch", arch);
- addMacro(&spec->macros, "buildos", os);
+ 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]) {
x++;
}
buf[x] = '\0';
- addMacro(&spec->macros, "buildarch_lc", buf);
+ 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", buf);
+ addMacro(&spec->macros, "buildos_lc", NULL, buf, -1);
}
}
if (spec->readStack->reading) {
- if (expandMacros(&spec->macros, spec->line)) {
+ if (expandMacros(spec, &spec->macros, spec->line, sizeof(spec->line))) {
rpmError(RPMERR_BADSPEC, "line %d: %s", spec->lineNum, spec->line);
return RPMERR_BADSPEC;
}
if (spec->autoProv) {
rpmMessage(RPMMESS_NORMAL, "Finding provides...\n");
- argv[0] = "find-provides";
+ argv[0] = FINDPROVIDES;
argv[1] = NULL;
readBuf = getOutputFrom(NULL, argv,
getStringBuf(writeBuf), writeBytes, 1);
if (spec->autoReq) {
rpmMessage(RPMMESS_NORMAL, "Finding requires...\n");
- argv[0] = "find-requires";
+ argv[0] = FINDREQUIRES;
argv[1] = NULL;
readBuf = getOutputFrom(NULL, argv,
getStringBuf(writeBuf), writeBytes, 0);
spec->inBuildArchitectures = 0;
spec->buildArchitectureSpecs = NULL;
- initMacros(&spec->macros);
+ initMacros(&spec->macros, MACROFILE);
spec->autoReq = 1;
spec->autoProv = 1;
char *name = NULL;
char *nump, *fieldp = NULL;
char buf[BUFSIZ];
- char expansion[BUFSIZ];
+ char body[BUFSIZ];
int num = 0;
switch (tag) {
spec->numSources++;
if (tag != RPMTAG_ICON) {
- sprintf(expansion, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), p->source);
+ sprintf(body, "%s/%s", rpmGetVar(RPMVAR_SOURCEDIR), p->source);
sprintf(buf, "%s%d",
(flag & RPMBUILD_ISPATCH) ? "PATCH" : "SOURCE", num);
- addMacro(&spec->macros, buf, expansion);
+ addMacro(&spec->macros, buf, NULL, body, -1);
sprintf(buf, "%sURL%d",
(flag & RPMBUILD_ISPATCH) ? "PATCH" : "SOURCE", num);
- addMacro(&spec->macros, buf, p->fullSource);
+ addMacro(&spec->macros, buf, NULL, p->fullSource, -1);
}
return 0;
#include "header.h"
#include "stringbuf.h"
+
+typedef struct SpecStruct *Spec;
#include "macro.h"
#if 0
struct PackageStruct *next;
};
-typedef struct SpecStruct *Spec;
typedef struct PackageStruct *Package;
Spec newSpec(void);
AC_CANONICAL_SYSTEM
-RPMCONFIGDIR='$(libdir)'
+RPMCONFIGDIR='$(libdir)/rpm'
dnl Checks for programs.
AC_PROG_CC
RPM=rpm.shared
fi
-AC_MSG_CHECKING(POSIX chmod...)
+AC_MSG_CHECKING(POSIX chmod)
touch foo.chmodtest
chmod 744 foo.chmodtest
chmod +X foo.chmodtest 2>/dev/null
AC_CHECK_TOOL(AR, ar, :)
if test "$cross_compiling" != "yes"; then
- AC_MSG_CHECKING(GNU gzip...)
+ AC_MSG_CHECKING(GNU gzip)
if test -z "$GZIPBIN"; then
oldifs="$IFS"
IFS=:
esac
}
-if test $prefix != "/usr" -a $prefix != "/usr/local"; then
- AC_MSG_CHECKING("$prefix/lib... $ac_c")
- if test -d $prefix/lib ; then
- addlib $prefix/lib
+localdone=
+for dir in $prefix /usr/local
+do
+ case $dir in
+ NONE|/usr) continue;;
+ /usr/local)
+ if test X$localdone != X ; then continue; fi
+ localdone="$dir"
+ ;;
+ esac
+
+ AC_MSG_CHECKING(for $dir/lib in LIBS)
+ if test -d $dir/lib ; then
+ addlib $dir/lib
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
- echo $ac_n "checking for $prefix/include... $ac_c"
- if test -d $prefix/include ; then
- INCPATH="$INCPATH -I$prefix/include"
+ AC_MSG_CHECKING(for $dir/include in INCPATH)
+ if test -d $dir/include ; then
+ INCPATH="$INCPATH -I$dir/include"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
-fi
-
-AC_MSG_CHECKING(/usr/local/lib...)
-if test -d /usr/local/lib ; then
- addlib /usr/local/lib
-
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(/usr/local/include...)
-if test -d /usr/local/include ; then
- INCPATH="$INCPATH -I/usr/local/include"
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
+done
-AC_MSG_CHECKING(/usr/ucblib...)
+AC_MSG_CHECKING(for /usr/ucblib in LIBS)
if test -d /usr/ucblib ; then
if test "$build" = "mips-sni-sysv4" ; then
addlib /usr/ccs/lib -lc
dnl look for libc features
PROVIDES_ERRNO=no
-AC_MSG_CHECKING(if <netdb.h> defines h_errno...)
+AC_MSG_CHECKING(if <netdb.h> defines h_errno)
AC_TRY_LINK([#include <netdb.h>],printf("%d",h_errno),PROVIDES_ERRNO=yes)
AC_MSG_RESULT($PROVIDES_ERRNO)
if test $PROVIDES_ERRNO = yes; then
dnl If a system doesn't have S_IFSOCK, define it as 0 which will
dnl make S_ISSOCK always return false (nice, eh?)
-AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK...)
+AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_IFSOCK),
HAS_S_IFSOCK=yes,HAS_S_IFSOCK=no)
AC_MSG_RESULT($HAS_S_IFSOCK)
fi
dnl Some Unix's are missing S_ISLNK, S_ISSOCK
-AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK...)
+AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISLNK(0755)),
HAS_S_ISLNK=yes,HAS_S_ISLNK=no)
AC_MSG_RESULT($HAS_S_ISLNK)
AC_DEFINE(HAVE_S_ISLNK)
fi
-AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK...)
+AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISSOCK(0755)),
HAS_S_ISSOCK=yes,HAS_S_ISSOCK=no)
AC_MSG_RESULT($HAS_S_ISSOCK)
AC_DEFINE(HAVE_S_ISSOCK)
fi
-AC_MSG_CHECKING(if timezone is defined...)
+AC_MSG_CHECKING(if timezone is defined)
AC_TRY_LINK([#include <time.h>],printf("%ld", timezone),
HAS_TIMEZONE=yes,HAS_TIMEZONE=no)
AC_MSG_RESULT($HAS_TIMEZONE)
if test "$LCHOWN" = no; then
dnl Does chown() follow symlinks? This should be a good enough test.
- AC_MSG_CHECKING(whether chown() follows symlinks...)
+ AC_MSG_CHECKING(whether chown() follows symlinks)
AC_ARG_ENABLE([broken-chown],
[ --enable-broken-chown this system's chown follows symbolic links],
result=$enableval, result=unknown)
Group: Utilities/System
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-2.5.x/rpm-%{version}.tar.gz
Copyright: GPL
-BuildRoot: /var/tmp/rpm-%{version}
+BuildRoot: /var/tmp/rpm-%{version}-root
Conflicts: patch < 2.5
%package devel
/usr/bin/find-requires
/usr/man/man8/rpm.8
/usr/man/man8/rpm2cpio.8
+/usr/lib/rpm
/usr/lib/rpmrc
/usr/lib/rpmpopt
%dir /usr/src/redhat