Browse Source

Fix "%{SOURCE xxx}" constructs under Linux: We have to set the value of optind to 0 instead of 1, because internally GNU libc increases it to 1 implicitly, but additionally performs the necessary full initialization. Without this the option parsing will horribly break under Linux.

master
parent
commit
ebcc9d9c37
  1. 2
      openpkg/openpkg.spec
  2. 110
      openpkg/rpm-4.0.2.patch.bugfix
  3. 354
      openpkg/rpm-4.0.2.patch.feature
  4. 279
      openpkg/rpm-4.0.2.patch.porting
  5. 227
      openpkg/rpm-4.0.2.patch.regen

2
openpkg/openpkg.spec

@ -39,7 +39,7 @@
# the package version and release
%define V_openpkg 0.9
%define R_openpkg 32
%define R_openpkg 33
# the used software versions
%define V_rpm 4.0.2

110
openpkg/rpm-4.0.2.patch.bugfix

@ -0,0 +1,110 @@
##
## rpm-4.0.2.patch.bugfix -- Annotated patch file
## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
## Copyright (c) 2000-2001 Ralf S. Engelschall <rse.com>
##
## This file assembles changes to existing RPM source files between
## the original RedHat RPM and the OpenPKG RPM variant. It can be
## automatically applied to a vanilla RedHat RPM source tree with the
## 'patch' tool to upgrade those files. Each patch snippet is annotated
## with a short description.
##
## Created on: 20-Sep-2001
##
+---------------------------------------------------------------------------
| First, remove incorrectly introduced buffer assignment. Second, fix
| second and subsequent "%{foo -x}" constructs. Without resetting
| the option index only the first construct works. Third, bugfix
| the handling of macros inside macro arguments as in "%{foo
| bar%{quux}baz}". RPM correctly determined the pointer to the
| terminating second(1) closing brace, but instead of passing
| this pointer to the subroutine which handles the macro argument
| construction, it passed the underlying character. This in turn
| obviously leaded to an incorrect determination of the argument end
| (it then though the first closing brace is the end). We fix this by
| passing the pointer and not the underlying character.
+---------------------------------------------------------------------------
Index: rpmio/macro.c
--- rpmio/macro.c 2001/01/19 01:47:25 1.1.1.2
+++ rpmio/macro.c 2001/09/20 09:58:20 1.6
@@ -746,7 +746,7 @@
* @return address to continue parsing
*/
/*@dependent@*/ static const char *
-grabArgs(MacroBuf *mb, const MacroEntry *me, const char *se, char lastc)
+grabArgs(MacroBuf *mb, const MacroEntry *me, const char *se, char *lastc)
{
char buf[BUFSIZ], *b, *be;
char aname[16];
@@ -764,7 +764,7 @@
/* Copy args into buf until lastc */
*be++ = ' ';
- while ((c = *se++) != '\0' && c != lastc) {
+ while ((c = *se++) != '\0' && (se-1) != lastc) {
if (!isblank(c)) {
*be++ = c;
continue;
@@ -801,7 +801,7 @@
/* Build argv array */
argv = (const char **) alloca((argc + 1) * sizeof(char *));
be[-1] = ' '; /* be - 1 == b + strlen(b) == buf + strlen(buf) */
- buf[0] = '\0';
+ be[0] = '\0';
b = buf;
for (c = 0; c < argc; c++) {
argv[c] = b;
@@ -814,6 +814,15 @@
opts = me->opts;
/* Define option macros. */
+#ifdef __GLIBC__
+ /* set to value of 0 instead of 1, because internally GNU libc
+ increases it to 1 implicitly, but additionally performs the
+ necessary full initialization. Without this the option parsing
+ will horribly break under Linux and various circumstances. */
+ optind = 0;
+#else
+ optind = 1;
+#endif
while((c = getopt(argc, (char **)argv, opts)) != -1) {
if (c == '?' || (o = strchr(opts, c)) == NULL) {
rpmError(RPMERR_BADSPEC, _("Unknown option %c in %s(%s)\n"),
@@ -991,7 +1000,7 @@
int c;
int rc = 0;
int negate;
- char grab;
+ char *grab;
int chkexist;
if (++mb->depth > max_macro_depth) {
@@ -1024,7 +1033,7 @@
if (mb->depth > 1) /* XXX full expansion for outermost level */
t = mb->t; /* save expansion pointer for printExpand */
negate = 0;
- grab = '\0';
+ grab = NULL;
chkexist = 0;
switch ((c = *s)) {
default: /* %name substitution */
@@ -1058,7 +1067,8 @@
fe = se;
/* For "%name " macros ... */
if ((c = *fe) && isblank(c))
- grab = '\n';
+ if ((grab = strchr(fe, '\n')) == NULL)
+ grab = strchr(fe, '\0');
break;
case '(': /* %(...) shell escape */
if ((se = matchchar(s, c, ')')) == NULL) {
@@ -1104,7 +1114,7 @@
ge = se - 1;
break;
case ' ':
- grab = se[-1];
+ grab = se-1;
break;
default:
break;

354
openpkg/rpm-4.0.2.patch.feature

@ -0,0 +1,354 @@
##
## rpm-4.0.2.patch.feature -- Annotated patch file
## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
## Copyright (c) 2000-2001 Ralf S. Engelschall <rse.com>
##
## This file assembles changes to existing RPM source files between
## the original RedHat RPM and the OpenPKG RPM variant. It can be
## automatically applied to a vanilla RedHat RPM source tree with the
## 'patch' tool to upgrade those files. Each patch snippet is annotated
## with a short description.
##
## Created on: 20-Sep-2001
##
+---------------------------------------------------------------------------
| In OpenPKG, the RPM package contains own local versions of the
| "patch" and "tar" tools, so we cannot accept hard-coded names here.
| Instead we expand a variable to allow us to direct RPM to our tools.
| Also we allow %setup and %patch macros whitespace-indented in %prep,
| because both in OpenPKG we both have all scripts indented and this
| way it is more flexible and clean.
| Additionally add support for splitted source directories, i.e.,
| source files alternatively can be placed into the spec directory and
| are picked up there, too.
+---------------------------------------------------------------------------
Index: build/parsePrep.c
--- build/parsePrep.c 2001/01/15 23:10:04 1.1.1.7
+++ build/parsePrep.c 2001/09/17 11:09:23 1.3
@@ -65,6 +65,7 @@
struct Source *sp;
rpmCompressedMagic compressed = COMPRESSED_NOT;
int urltype;
+ const char *patcher;
for (sp = spec->sources; sp != NULL; sp = sp->next) {
if ((sp->flags & RPMBUILD_ISPATCH) && (sp->num == c)) {
@@ -76,7 +77,15 @@
return NULL;
}
+#ifndef OPENPKG
fn = urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
+#else
+ fn = urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL);
+ if (access(fn, F_OK) == -1) {
+ free(fn);
+ fn = urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
+ }
+#endif
args[0] = '\0';
if (db) {
@@ -112,6 +121,9 @@
/*@notreached@*/ break;
}
+ patcher = rpmGetPath("%{_patchbin}", NULL);
+ if (strcmp(patcher, "%{_patchbin}") == 0)
+ patcher = "patch";
if (compressed) {
const char *zipper = rpmGetPath(
(compressed == COMPRESSED_BZIP2 ? "%{_bzip2bin}" : "%{_gzipbin}"),
@@ -119,20 +131,20 @@
sprintf(buf,
"echo \"Patch #%d (%s):\"\n"
- "%s -d < %s | patch -p%d %s -s\n"
+ "%s -d < %s | %s -p%d %s -s\n"
"STATUS=$?\n"
"if [ $STATUS -ne 0 ]; then\n"
" exit $STATUS\n"
"fi",
c, (const char *) basename(fn),
zipper,
- fn, strip, args);
+ fn, patcher, strip, args);
free((void *)zipper);
} else {
sprintf(buf,
"echo \"Patch #%d (%s):\"\n"
- "patch -p%d %s -s < %s", c, (const char *) basename(fn),
- strip, args, fn);
+ "%s -p%d %s -s < %s", c, (const char *) basename(fn),
+ patcher, strip, args, fn);
}
free((void *)urlfn);
@@ -155,6 +167,7 @@
struct Source *sp;
rpmCompressedMagic compressed = COMPRESSED_NOT;
int urltype;
+ const char *tar;
for (sp = spec->sources; sp != NULL; sp = sp->next) {
if ((sp->flags & RPMBUILD_ISSOURCE) && (sp->num == c)) {
@@ -166,7 +179,19 @@
return NULL;
}
+#ifndef OPENPKG
fn = urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
+#else
+ fn = urlfn = rpmGetPath("%{_specdir}/", sp->source, NULL);
+ if (access(fn, F_OK) == -1) {
+ free(fn);
+ fn = urlfn = rpmGetPath("%{_sourcedir}/", sp->source, NULL);
+ }
+#endif
+
+ tar = rpmGetPath("%{_tarbin}", NULL);
+ if (strcmp(tar, "%{_tarbin}") == 0)
+ tar = "tar";
taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
@@ -232,8 +257,13 @@
free((void *)zipper);
*t++ = ' ';
t = stpcpy(t, fn);
- if (needtar)
- t = stpcpy( stpcpy( stpcpy(t, " | tar "), taropts), " -");
+ if (needtar) {
+ t = stpcpy(t, " | ");
+ t = stpcpy(t, tar);
+ t = stpcpy(t, " ");
+ t = stpcpy(t, taropts);
+ t = stpcpy(t, " -");
+ }
t = stpcpy(t,
"\n"
"STATUS=$?\n"
@@ -549,11 +579,14 @@
saveLines = splitString(getStringBuf(buf), strlen(getStringBuf(buf)), '\n');
for (lines = saveLines; *lines; lines++) {
+ char *cp;
+ for (cp = *lines; *cp == ' ' || *cp == '\t'; cp++)
+ ;
res = 0;
- if (! strncmp(*lines, "%setup", sizeof("%setup")-1)) {
- res = doSetupMacro(spec, *lines);
- } else if (! strncmp(*lines, "%patch", sizeof("%patch")-1)) {
- res = doPatchMacro(spec, *lines);
+ if (! strncmp(cp, "%setup", sizeof("%setup")-1)) {
+ res = doSetupMacro(spec, cp);
+ } else if (! strncmp(cp, "%patch", sizeof("%patch")-1)) {
+ res = doPatchMacro(spec, cp);
} else {
appendLineStringBuf(spec->prep, *lines);
}
+---------------------------------------------------------------------------
| Not everything on a system is RPM based (for instance OpenPKG is
| just an add-on to the system), so do not assume we can just require
| a package to provide "/bin/sh".
+---------------------------------------------------------------------------
Index: build/parseScript.c
--- build/parseScript.c 2001/01/15 23:10:04 1.1.1.9
+++ build/parseScript.c 2001/06/25 19:31:13 1.2
@@ -246,6 +246,7 @@
stripTrailingBlanksStringBuf(sb);
p = getStringBuf(sb);
+ if (progArgv[0] != NULL && strcmp(progArgv[0], "/bin/sh") != 0)
addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
/* Trigger script insertion is always delayed in order to */
+---------------------------------------------------------------------------
| RPM has two platform id canonicalizations: hard-coded ones in the
| "rpm" program and defined ones in the rpmrc files. The hard-coded
| ones make the defined ones inconsistent. Additionally in OpenPKG we
| know exactly what we do. So disable the hard-coded canonicalizations
| and use only the defined ones. The only thing we do inside "rpm" is
| to reduce the platform version to major and minor version numbers in
| order to simplify the "rpmrc" files.
+---------------------------------------------------------------------------
Index: lib/rpmrc.c
--- lib/rpmrc.c 2001/03/13 12:55:25 1.1.1.20
+++ lib/rpmrc.c 2001/06/25 19:35:42 1.2
@@ -931,6 +931,23 @@
if (!gotDefaults) {
uname(&un);
+#ifdef OPENPKG
+ {
+ char *cp;
+ int n;
+ if ((n = strspn(un.release, "0123456789.")) > 0) {
+ /* terminate after "N.N.N...." prefix */
+ un.release[n] = '\0';
+ /* shorten to "N.N" if longer */
+ if ((cp = strchr(un.release, '.')) != NULL) {
+ if ((cp = strchr(cp+1, '.')) != NULL) {
+ *cp = '\0';
+ }
+ }
+ strcat(un.sysname, un.release);
+ }
+ }
+#else /* OPENPKG */
#if !defined(__linux__)
#ifdef SNI
/* USUALLY un.sysname on sinix does start with the word "SINIX"
@@ -1114,6 +1131,7 @@
un.machine[1] = class;
}
# endif
+#endif /* OPENPKG */
/* the uname() result goes through the arch_canon table */
canon = lookupInCanonTable(un.machine,
+---------------------------------------------------------------------------
| Add support for splitted source directories, i.e., source files
| alternatively can be placed into the spec directory and are picked
| up there, too.
+---------------------------------------------------------------------------
Index: build/build.c
--- build/build.c 2001/01/15 23:10:04 1.1.1.16
+++ build/build.c 2001/09/17 11:09:23 1.2
@@ -25,7 +25,15 @@
for (p = spec->sources; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
+#ifndef OPENPKG
const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
+#else
+ const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL);
+ if (access(fn, F_OK) == -1) {
+ free(fn);
+ fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
+ }
+#endif
unlink(fn);
free((void *)fn);
}
@@ -34,7 +42,15 @@
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
for (p = pkg->icon; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
+#ifndef OPENPKG
const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
+#else
+ const char *fn = rpmGetPath("%{_specdir}/", p->source, NULL);
+ if (access(fn, F_OK) == -1) {
+ free(fn);
+ fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
+ }
+#endif
unlink(fn);
free((void *)fn);
}
+---------------------------------------------------------------------------
| Add support for splitted source directories, i.e., source files
| alternatively can be placed into the spec directory and are picked
| up there, too.
+---------------------------------------------------------------------------
Index: build/files.c
--- build/files.c 2001/01/19 01:47:25 1.1.1.15
+++ build/files.c 2001/09/17 11:09:23 1.2
@@ -1655,8 +1655,20 @@
}
{ const char *s;
+#ifndef OPENPKG
s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
"%{_sourcedir}/", srcPtr->source, NULL);
+#else
+ const char *s2;
+ s2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL);
+ if (access(s2, F_OK) == 0)
+ s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
+ "%{_specdir}/", srcPtr->source, NULL);
+ else
+ s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
+ "%{_sourcedir}/", srcPtr->source, NULL);
+ free(s2);
+#endif
appendLineStringBuf(sourceFiles, s);
free((void *)s);
}
@@ -1665,8 +1677,20 @@
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
for (srcPtr = pkg->icon; srcPtr != NULL; srcPtr = srcPtr->next) {
const char *s;
+#ifndef OPENPKG
s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
"%{_sourcedir}/", srcPtr->source, NULL);
+#else
+ const char *s2;
+ s2 = rpmGetPath("%{_specdir}/", srcPtr->source, NULL);
+ if (access(s2, F_OK) == 0)
+ s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
+ "%{_specdir}/", srcPtr->source, NULL);
+ else
+ s = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
+ "%{_sourcedir}/", srcPtr->source, NULL);
+ free(s2);
+#endif
appendLineStringBuf(sourceFiles, s);
free((void *)s);
}
+---------------------------------------------------------------------------
| Add support for splitted source directories, i.e., source files
| alternatively can be placed into the spec directory and are picked
| up there, too.
+---------------------------------------------------------------------------
Index: build/parsePreamble.c
--- build/parsePreamble.c 2001/01/15 23:10:04 1.1.1.9
+++ build/parsePreamble.c 2001/09/17 11:09:23 1.2
@@ -317,7 +317,15 @@
size_t nb, iconsize;
/* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */
+#ifndef OPENPKG
fn = rpmGetPath("%{_sourcedir}/", file, NULL);
+#else
+ fn = rpmGetPath("%{_specdir}/", file, NULL);
+ if (access(fn, F_OK) == -1) {
+ free(fn);
+ fn = rpmGetPath("%{_sourcedir}/", file, NULL);
+ }
+#endif
fd = Fopen(fn, "r.ufdio");
if (fd == NULL || Ferror(fd)) {
+---------------------------------------------------------------------------
| Add support for splitted source directories, i.e., source files
| alternatively can be placed into the spec directory and are picked
| up there, too.
+---------------------------------------------------------------------------
Index: build/spec.c
--- build/spec.c 2001/01/15 23:10:04 1.1.1.16
+++ build/spec.c 2001/09/17 11:09:23 1.2
@@ -319,7 +319,15 @@
spec->numSources++;
if (tag != RPMTAG_ICON) {
+#ifndef OPENPKG
const char *body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
+#else
+ const char *body = rpmGetPath("%{_specdir}/", p->source, NULL);
+ if (access(body, F_OK) == -1) {
+ free(body);
+ body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
+ }
+#endif
sprintf(buf, "%s%d",
(flag & RPMBUILD_ISPATCH) ? "PATCH" : "SOURCE", num);

279
openpkg/rpm-4.0.2.patch.porting

@ -0,0 +1,279 @@
##
## rpm-4.0.2.patch.porting -- Annotated patch file
## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
## Copyright (c) 2000-2001 Ralf S. Engelschall <rse.com>
##
## This file assembles changes to existing RPM source files between
## the original RedHat RPM and the OpenPKG RPM variant. It can be
## automatically applied to a vanilla RedHat RPM source tree with the
## 'patch' tool to upgrade those files. Each patch snippet is annotated
## with a short description.
##
## Created on: 20-Sep-2001
##
+---------------------------------------------------------------------------
| Replace RedHat-specific #include with general one.
| Add support for Berkeley-DB 3.2.x.
+---------------------------------------------------------------------------
Index: lib/db3.c
--- lib/db3.c 2001/02/15 00:16:09 1.1.1.3
+++ lib/db3.c 2001/06/25 14:49:03 1.2
@@ -13,7 +13,7 @@
#include "system.h"
-#include <db3/db.h>
+#include <db.h>
#include <rpmlib.h>
#include <rpmmacro.h>
@@ -135,7 +135,7 @@
xx = db_env_create(&dbenv, 0);
xx = cvtdberr(dbi, "db_env_create", rc, _debug);
-#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 1
+#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR >= 1
xx = dbenv->remove(dbenv, dbhome, 0);
#else
xx = dbenv->remove(dbenv, dbhome, NULL, 0);
@@ -213,7 +213,7 @@
/* dbenv->set_tx_max(???) */
/* dbenv->set_tx_recover(???) */
if (dbi->dbi_no_fsync) {
-#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 1
+#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR >= 1
xx = db_env_set_func_fsync(db3_fsync_disable);
#else
xx = dbenv->set_func_fsync(dbenv, db3_fsync_disable);
@@ -231,7 +231,7 @@
#endif /* __USE_DB3 */
#if defined(__USE_DB3)
-#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 1
+#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR >= 1
rc = dbenv->open(dbenv, dbhome, eflags, dbi->dbi_perms);
#else
rc = dbenv->open(dbenv, dbhome, NULL, eflags, dbi->dbi_perms);
+---------------------------------------------------------------------------
| Replace RedHat-specific #include with general one.
+---------------------------------------------------------------------------
Index: lib/dbconfig.c
--- lib/dbconfig.c 2001/02/14 19:49:14 1.1.1.1
+++ lib/dbconfig.c 2001/06/25 14:49:03 1.2
@@ -4,7 +4,7 @@
#include "system.h"
-#include <db3/db.h>
+#include <db.h>
#include <rpmlib.h>
#include <rpmmacro.h>
+---------------------------------------------------------------------------
| Avoid non-portable construct: a self-referencing structure
| declaration cannot be combined with the corresponding typedef.
| Although GCC supports this (and does the correct thing), most
| other stricter compilers complain and fail.
+---------------------------------------------------------------------------
Index: rpmio/rpmmacro.h
--- rpmio/rpmmacro.h 2000/12/11 18:41:27 1.1.1.2
+++ rpmio/rpmmacro.h 2001/06/25 19:26:59 1.2
@@ -6,14 +6,15 @@
*/
/*! The structure used to store a macro. */
-typedef /*@abstract@*/ struct MacroEntry {
+struct MacroEntry {
struct MacroEntry *prev;/*!< Macro entry stack. */
const char *name; /*!< Macro name. */
const char *opts; /*!< Macro parameters (a la getopt) */
const char *body; /*!< Macro body. */
int used; /*!< No. of expansions. */
int level; /*!< Scoping level. */
-} MacroEntry;
+};
+typedef /*@abstract@*/ struct MacroEntry MacroEntry;
/*! The structure used to store the set of macros in a context. */
typedef /*@abstract@*/ struct MacroContext {
+---------------------------------------------------------------------------
| Add support for OSF1/Tru64.
+---------------------------------------------------------------------------
Index: misc/fnmatch.h
--- misc/fnmatch.h 2000/03/10 22:02:29 1.1.1.2
+++ misc/fnmatch.h 2001/06/25 19:43:38 1.2
@@ -55,7 +55,7 @@
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
-#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
+#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE || defined __osf__
# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
+---------------------------------------------------------------------------
| Add support for OSF1/Tru64.
+---------------------------------------------------------------------------
Index: misc/glob.h
--- misc/glob.h 2000/03/11 20:59:30 1.1.1.3
+++ misc/glob.h 2001/06/25 19:43:38 1.2
@@ -74,7 +74,7 @@
#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
#if (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _BSD_SOURCE \
- || defined _GNU_SOURCE)
+ || defined _GNU_SOURCE || defined __osf__ )
# define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
# define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
# define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
+---------------------------------------------------------------------------
| Make sure db1xxx() function references are only used if Berkeley-DB
| 1.x was really found.
+---------------------------------------------------------------------------
Index: lib/rpmdb.c
--- lib/rpmdb.c 2001/02/23 21:43:20 1.1.1.17
+++ lib/rpmdb.c 2001/06/25 19:45:29 1.2
@@ -2124,6 +2124,7 @@
case 2:
case 1:
case 0:
+#if USE_DB1
for (i = 0; i < dbiTagsMax; i++) {
const char * base = db1basename(dbiTags[i]);
sprintf(filename, "%s/%s/%s", rootdir, dbpath, base);
@@ -2131,6 +2132,7 @@
xx = unlink(filename);
free((void *)base);
}
+#endif
break;
}
@@ -2213,6 +2215,7 @@
case 2:
case 1:
case 0:
+#if USE_DB1
for (i = 0; i < dbiTagsMax; i++) {
const char * base;
int rpmtag;
@@ -2240,6 +2243,7 @@
rc = 1;
free((void *)base);
}
+#endif
break;
}
if (rc || _olddbapi == _newdbapi)
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
+---------------------------------------------------------------------------
Index: acconfig.h
--- acconfig.h 2000/12/11 18:40:56 1.1.1.7
+++ acconfig.h 2001/07/05 11:44:10 1.2
@@ -65,6 +65,9 @@
/* Define as 1 if you have getmntinfo_r() (only osf?) */
#undef HAVE_GETMNTINFO_R
+/* Define as 1 if you have getmntinfo() */
+#undef HAVE_GETMNTINFO
+
/* Define as 1 if you have "struct mnttab" (only sco?) */
#undef HAVE_STRUCT_MNTTAB
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
+---------------------------------------------------------------------------
Index: config.h.in
--- config.h.in 2001/02/21 20:47:08 1.1.1.12
+++ config.h.in 2001/07/05 11:44:10 1.11
@@ -123,6 +123,9 @@
/* Define as 1 if you have getmntinfo_r() (only osf?) */
#undef HAVE_GETMNTINFO_R
+/* Define as 1 if you have getmntinfo() */
+#undef HAVE_GETMNTINFO
+
/* Define as 1 if you have "struct mnttab" (only sco?) */
#undef HAVE_STRUCT_MNTTAB
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
+---------------------------------------------------------------------------
Index: configure.in
--- configure.in 2001/02/25 17:13:26 1.1.1.17
+++ configure.in 2001/07/05 11:44:11 1.2
@@ -815,12 +815,13 @@
AC_CHECK_FUNCS(getpassphrase)
AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT), [
+ AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO), [
AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL),[
AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R), [
AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
AC_DEFINE(HAVE_GETMNTINFO_R)], [
AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
- LIBOBJS="$LIBOBJS getmntent.o"])])])])
+ LIBOBJS="$LIBOBJS getmntent.o"])])])])])
AC_CHECK_FUNC(lchown,
[__CHOWN_RHF="%{__chown} -Rhf"
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
+---------------------------------------------------------------------------
Index: system.h
--- system.h 2000/12/11 18:40:56 1.1.1.5
+++ system.h 2001/07/05 11:44:11 1.2
@@ -325,7 +325,7 @@
#define lchown chown
#endif
-#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
+#if HAVE_GETMNTINFO_R || HAVE_GETMNTINFO || HAVE_MNTCTL
# define GETMNTENT_ONE 0
# define GETMNTENT_TWO 0
# if HAVE_SYS_MNTCTL_H
+---------------------------------------------------------------------------
| Add support for BSD getmntinfo(3).
+---------------------------------------------------------------------------
Index: lib/fs.c
--- lib/fs.c 2001/01/15 23:10:04 1.1.1.8
+++ lib/fs.c 2001/07/05 11:44:14 1.2
@@ -138,7 +138,7 @@
# if GETMNTENT_ONE || GETMNTENT_TWO
our_mntent item;
FILE * mtab;
-# elif HAVE_GETMNTINFO_R
+# elif HAVE_GETMNTINFO_R || HAVE_GETMNTINFO
struct statfs * mounts = NULL;
int mntCount = 0, bufSize = 0, flags = MNT_NOWAIT;
int nextMount = 0;
@@ -155,6 +155,8 @@
}
# elif HAVE_GETMNTINFO_R
getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
+# elif HAVE_GETMNTINFO
+ mntCount = getmntinfo(&mounts, flags);
# endif
filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems)); /* XXX memory leak */
@@ -175,7 +177,7 @@
/* Solaris, maybe others */
if (getmntent(mtab, &item)) break;
mntdir = item.our_mntdir;
-# elif HAVE_GETMNTINFO_R
+# elif HAVE_GETMNTINFO_R || HAVE_GETMNTINFO
if (nextMount == mntCount) break;
mntdir = mounts[nextMount++].f_mntonname;
# endif

227
openpkg/rpm-4.0.2.patch.regen

@ -0,0 +1,227 @@
##
## rpm-4.0.2.patch.regen -- Annotated patch file
## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
## Copyright (c) 2000-2001 Ralf S. Engelschall <rse.com>
##
## This file assembles changes to existing RPM source files between
## the original RedHat RPM and the OpenPKG RPM variant. It can be
## automatically applied to a vanilla RedHat RPM source tree with the
## 'patch' tool to upgrade those files. Each patch snippet is annotated
## with a short description.
##
## Created on: 20-Sep-2001
##
+---------------------------------------------------------------------------
| Regenerated configure script from GNU autoconf run after
| the patches for configure.in were applied.
+---------------------------------------------------------------------------
Index: configure
--- configure 2001/02/26 21:52:29 1.1.1.16
+++ configure 2001/07/05 11:44:33 1.13
@@ -1879,7 +1879,7 @@
fi
-for ac_prog in gawk mawk nawk awk
+for ac_prog in mawk gawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -9055,13 +9055,63 @@
else
echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for getmntinfo""... $ac_c" 1>&6
+echo "configure:9060: checking for getmntinfo" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getmntinfo'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 9065 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getmntinfo(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char getmntinfo();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_getmntinfo) || defined (__stub___getmntinfo)
+choke me
+#else
+getmntinfo();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getmntinfo=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_getmntinfo=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getmntinfo`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_GETMNTINFO 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+
echo $ac_n "checking for mntctl""... $ac_c" 1>&6
-echo "configure:9060: checking for mntctl" >&5
+echo "configure:9110: checking for mntctl" >&5
if eval "test \"`echo '$''{'ac_cv_func_mntctl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9065 "configure"
+#line 9115 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char mntctl(); below. */
@@ -9084,7 +9134,7 @@
; return 0; }
EOF
-if { (eval echo configure:9088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_mntctl=yes"
else
@@ -9106,12 +9156,12 @@
echo "$ac_t""no" 1>&6
echo $ac_n "checking for getmntinfo_r""... $ac_c" 1>&6
-echo "configure:9110: checking for getmntinfo_r" >&5
+echo "configure:9160: checking for getmntinfo_r" >&5
if eval "test \"`echo '$''{'ac_cv_func_getmntinfo_r'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9115 "configure"
+#line 9165 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char getmntinfo_r(); below. */
@@ -9134,7 +9184,7 @@
; return 0; }
EOF
-if { (eval echo configure:9138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_getmntinfo_r=yes"
else
@@ -9156,7 +9206,7 @@
echo "$ac_t""no" 1>&6
echo $ac_n "checking for getmntinfo_r in -lc_r""... $ac_c" 1>&6
-echo "configure:9160: checking for getmntinfo_r in -lc_r" >&5
+echo "configure:9210: checking for getmntinfo_r in -lc_r" >&5
ac_lib_var=`echo c_r'_'getmntinfo_r | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -9164,7 +9214,7 @@
ac_save_LIBS="$LIBS"
LIBS="-lc_r $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9168 "configure"
+#line 9218 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -9175,7 +9225,7 @@
getmntinfo_r()
; return 0; }
EOF
-if { (eval echo configure:9179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -9211,14 +9261,16 @@
fi
+fi
+
echo $ac_n "checking for lchown""... $ac_c" 1>&6
-echo "configure:9217: checking for lchown" >&5
+echo "configure:9269: checking for lchown" >&5
if eval "test \"`echo '$''{'ac_cv_func_lchown'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9222 "configure"
+#line 9274 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char lchown(); below. */
@@ -9241,7 +9293,7 @@
; return 0; }
EOF
-if { (eval echo configure:9245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_lchown=yes"
else
@@ -9266,7 +9318,7 @@
__CHOWN_RHF="%{__chown} -Rf"
__CHGRP_RHF="%{__chgrp} -Rf"
echo $ac_n "checking whether chown() follows symlinks""... $ac_c" 1>&6
-echo "configure:9270: checking whether chown() follows symlinks" >&5
+echo "configure:9322: checking whether chown() follows symlinks" >&5
# Check whether --enable-broken-chown or --disable-broken-chown was given.
if test "${enable_broken_chown+set}" = set; then
enableval="$enable_broken_chown"
@@ -9294,7 +9346,7 @@
${__RM} -f foo bar
else
echo $ac_n "checking (cannot check by non-root user)""... $ac_c" 1>&6
-echo "configure:9298: checking (cannot check by non-root user)" >&5
+echo "configure:9350: checking (cannot check by non-root user)" >&5
result=no
fi
fi
@@ -9312,13 +9364,13 @@
echo $ac_n "checking root's primary group""... $ac_c" 1>&6
-echo "configure:9316: checking root's primary group" >&5
+echo "configure:9368: checking root's primary group" >&5
if test "$cross_compiling" = yes; then
ROOT_GROUP="root"
else
cat > conftest.$ac_ext <<EOF
-#line 9322 "configure"
+#line 9374 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/types.h>
@@ -9347,7 +9399,7 @@
exit(1);
}
EOF
-if { (eval echo configure:9351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ROOT_GROUP=`cat conftest_rootg`
else
Loading…
Cancel
Save