RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Ralf S. Engelschall
Root: /v/rpm/cvs Email: rse@rpm5.org
Module: rpm db Date: 06-Dec-2007 15:47:51
Branch: HEAD Handle: 2007120614474704
Added files:
rpm VENDOR
Modified files:
db/mutex mut_fcntl.c
db/os os_open.c
rpm CHANGES devtool.conf macros.in rpmqv.c
rpm/build build.c files.c pack.c parseBuildInstallClean.c
parsePreamble.c parsePrep.c parseScript.c
parseSpec.c poptBT.c rpmbuild.h rpmspec.h spec.c
rpm/lib fsm.c poptALL.c psm.c query.c rpmevr.h rpmrc.c
transaction.c
rpm/rpmdb db3.c hdrNVR.c hdrfmt.c rpmtag.h
rpm/rpmio macro.c
Log:
Despite my personal preference but following Jeffs repeated request, I
hereby apply all the remaining OpenPKG patches to the rpm5.org code base
in order to allow Jeff to to more easily decide what can be taken over
and to see where the differences are between the stock rpm5.org code
base and the one we need in the OpenPKG bootstrap package.
ALL THOSE CHANGES ARE FULLY DISABLED BY DEFAULT and have to be
explicitly enabled via CPPFLAGS="-DRPM_VENDOR_OPENPKG" or running
"devtool rse". Additionally, the changes are kept as minimal and
non-intrusive as possible and each change is documented in the file
VENDOR.
Feel free to remove the #ifdef/#endif parts where appropriate, but
always notice that for a particular _change_ "foo" (as documented in
VENDOR) _multiple_ "#if defined(RPM_VENDOR_OPENPKG) /* foo */ ...
#endif" blocks might exist.
Summary:
Revision Changes Path
1.9 +22 -0 db/mutex/mut_fcntl.c
1.9 +17 -0 db/os/os_open.c
1.1945 +1 -0 rpm/CHANGES
2.1 +291 -0 rpm/VENDOR
2.121 +78 -0 rpm/build/build.c
1.303 +46 -0 rpm/build/files.c
2.267 +10 -0 rpm/build/pack.c
2.23 +10 -0 rpm/build/parseBuildInstallClean.c
2.154 +33 -0 rpm/build/parsePreamble.c
2.98 +28 -0 rpm/build/parsePrep.c
2.54 +20 -0 rpm/build/parseScript.c
2.121 +21 -0 rpm/build/parseSpec.c
2.16 +14 -0 rpm/build/poptBT.c
2.82 +11 -0 rpm/build/rpmbuild.h
2.63 +14 -0 rpm/build/rpmspec.h
2.165 +21 -0 rpm/build/spec.c
2.141 +4 -2 rpm/devtool.conf
2.140 +20 -0 rpm/lib/fsm.c
2.58 +5 -0 rpm/lib/poptALL.c
2.274 +26 -0 rpm/lib/psm.c
2.197 +21 -0 rpm/lib/query.c
1.4 +4 -0 rpm/lib/rpmevr.h
2.219 +72 -0 rpm/lib/rpmrc.c
1.360 +8 -0 rpm/lib/transaction.c
1.205 +31 -1 rpm/macros.in
1.82 +10 -0 rpm/rpmdb/db3.c
1.40 +7 -0 rpm/rpmdb/hdrNVR.c
1.53 +16 -0 rpm/rpmdb/hdrfmt.c
1.25 +11 -0 rpm/rpmdb/rpmtag.h
2.155 +26 -0 rpm/rpmio/macro.c
1.128 +20 -0 rpm/rpmqv.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: db/mutex/mut_fcntl.c
============================================================================
$ cvs diff -u -r1.8 -r1.9 mut_fcntl.c
--- db/mutex/mut_fcntl.c 29 Jul 2007 13:13:26 -0000 1.8
+++ db/mutex/mut_fcntl.c 6 Dec 2007 14:47:49 -0000 1.9
@@ -63,8 +63,16 @@
/* Initialize the lock. */
k_lock.l_whence = SEEK_SET;
+#if defined(RPM_VENDOR_OPENPKG) /* bdb-no-partial-locking */
+ /* At least Solaris may reject (see fcntl(2) manpage)
+ the (partial) locking, because DB mmap(2)'ed the file (or
+ vice versa). The workaround is to lock the entire(!) file. */
+ k_lock.l_start = 0;
+ k_lock.l_len = 0;
+#else
k_lock.l_start = mutex;
k_lock.l_len = 1;
+#endif
for (locked = 0;;) {
/*
@@ -79,7 +87,17 @@
/* Acquire an exclusive kernel lock. */
k_lock.l_type = F_WRLCK;
+#if defined(RPM_VENDOR_OPENPKG) /* bdb-bugfix-fcntl-usage */
+ /* Bugfix: POSIX/SUSv3 clearly expresses that fcntl(2)
+ returns "value other than -1" on success, so check
+ for equality to -1 instead of non-equality to 0.
+ In practice this does not harm on most platforms,
+ because they fortunately (by conincidence and common
+ practice) return 0. */
+ if (fcntl(dbenv->lockfhp->fd, F_SETLKW, &k_lock) == -1)
+#else
if (fcntl(dbenv->lockfhp->fd, F_SETLKW, &k_lock))
+#endif
goto err;
/* If the resource is still available, it's ours. */
@@ -93,7 +111,11 @@
/* Release the kernel lock. */
k_lock.l_type = F_UNLCK;
+#if defined(RPM_VENDOR_OPENPKG) /* bdb-bugfix-fcntl-usage */
+ if (fcntl(dbenv->lockfhp->fd, F_SETLK, &k_lock) == -1)
+#else
if (fcntl(dbenv->lockfhp->fd, F_SETLK, &k_lock))
+#endif
goto err;
/*
@@ .
patch -p0 <<'@@ .'
Index: db/os/os_open.c
============================================================================
$ cvs diff -u -r1.8 -r1.9 os_open.c
--- db/os/os_open.c 29 Jul 2007 13:13:27 -0000 1.8
+++ db/os/os_open.c 6 Dec 2007 14:47:49 -0000 1.9
@@ -65,10 +65,27 @@
if (LF_ISSET(DB_OSO_EXCL))
oflags |= O_EXCL;
+#if defined(RPM_VENDOR_OPENPKG) /* bdb-use-odirect-on-freebsd-only */
+ /* The O_DIRECT feature is fully broken under at least Linux 2.2 and
+ 2.4. It is sometimes accepted by open(2) without error and later
+ causes a write(2) to fail with EINVAL -- all depending on the
+ underlying filesystem (usually works on tmpfs and fails on ext3).
+ Sometimes it also causes open(2) to fail with EINVAL. In general,
+ it does especially no "graceful degradation" and so is useless for
+ use on mostly all platforms except for those where we know it works
+ (currently FreeBSD only). Interestingly, RPM works on RedHat, just
+ because RedHat's "kernel" package contains a patch which masks out
+ O_DIRECT usage... ;-) */
+#if defined(HAVE_O_DIRECT) && defined(__FreeBSD__)
+ if (LF_ISSET(DB_OSO_DIRECT))
+ oflags |= O_DIRECT;
+#endif
+#else
#ifdef HAVE_O_DIRECT
if (LF_ISSET(DB_OSO_DIRECT))
oflags |= O_DIRECT;
#endif
+#endif
#ifdef O_DSYNC
if (LF_ISSET(DB_OSO_DSYNC))
oflags |= O_DSYNC;
@@ .
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1944 -r1.1945 CHANGES
--- rpm/CHANGES 6 Dec 2007 01:50:48 -0000 1.1944
+++ rpm/CHANGES 6 Dec 2007 14:47:47 -0000 1.1945
@@ -1,4 +1,5 @@
5.0a4 -> 5.0b1:
+ - rse: apply all remaining OpenPKG patches -- fully disabled by default under defined(RPM_VENDOR_OPENPKG)
- jbj: flesh out rpmssl implementation. DSA seems OK, no clue RSA yet.
- jbj: flesh out rpmgc implementation. stil buggy ...
- jbj: stub in rpmgc/rpmssl for gcrypt & openssl signature verification.
@@ .
patch -p0 <<'@@ .'
Index: rpm/VENDOR
============================================================================
$ cvs diff -u -r0 -r2.1 VENDOR
--- /dev/null 2007-12-06 15:44:00 +0100
+++ VENDOR 2007-12-06 15:47:47 +0100
@@ -0,0 +1,291 @@
+
+ VENDOR CHANGES
+ ==============
+
+ APPLICATION RULES
+ -----------------
+
+ The rpm5.org code base to a very restricted and limited scope contains
+ some RPM changes from third-party distribution vendors. A vendor patch
+ *might* be accepted for inclusion into the rpm5.org code base if it at
+ least follows the following rules *and* is accepted after a detailed
+ review by JBJ:
+
+ 1. RULE:
+ at least one representative of a vendor has to be part of the
+ official rpm5.org developer team. Additionally, the vendor and its
+ representative is explicitly listed below.
+
+ 2. RULE:
+ all source code changes have to be really surgically and
+ minimally touching the rpm5.org code base only (no large code
+ block reorderings, no accidential whitespace changes, etc).
+ Additionally, all changes have to be *entirely* wrapped with "#if
+ defined(RPM_VENDOR_<name-id>) /* <change-id> */... #endif" where
+ <name-id> and <change-id> are explicitly listed in this document
+ below under "Name" and "Change".
+
+ VENDOR REGISTRY
+ ---------------
+
+ o Name: OPENPKG
+ Vendor: OpenPKG <http://openpkg.org/>
+ Representative: Ralf S. Engelschall <rse@openpkg.org> <rse@rpm5.org>
+ Application: RPM-based Unix software distribution (> 1100 packages),
+ Characteristic: cross-platform multiple-instance use of RPM
+ ________________________________________________________________________
+
+ Change: splitted-source-directory
+ Purpose: support so-called "splitted source directories", i.e.,
+ source files (listed on SourceX and PatchX headers)
+ can be placed into %{_specdir} in addition to
+ %{_sourcedir}.
+ Reason: OpenPKG ultra-strictly separates sources files into
+ two classes: external ones -- those which are
+ referenced with fully-qualified URLs and can be
+ (re-)fetched from the Internet -- and internal
+ ones -- those which are references as plain files
+ and which are kept in the local version control
+ system (VCS). As in OpenPKG the .spec file is just
+ one of those "internal" files, they are all stored
+ under %{_specdir} while %{_sourcedir} is used
+ for everything which is downloaded from external
+ sources (in OpenPKG even an automated process).
+ Hint: The even better solution would be to introduce
+ %{_sourcedir_external} and %{_sourcedir_internal}
+ and support this throughout RPM.
+ ________________________________________________________________________
+
+ Change: explicit-platform
+ Purpose: Allow the platform identification be set explicitly only.
+ Reason: As OpenPKG is a cross-platform distribution,
+ the "platform" had to be determined by GNU shtool's
+ "shtool platform" script since many years. The
+ result is stored into the "platform" file which
+ RPM internally reads in. This way the platform is
+ explicitly set and no other implicit sets wished.
+ ________________________________________________________________________
+
+ Change: extra-section-track
+ Purpose: Add support for custom section "%track",
+ a package build-time section containing a script
+ which can check whether the current package is
+ still based on the latest upstream vendor version.
+ Reason: In OpenPKG all "external" sources (see above)
+ are automatically and bi-daily tracked for new
+ available versions from the upstream vendor. For
+ this OpenPKG places vcheck(1) based config snippets
+ into its %track sections and lets them be executed
+ through vcheck(1) via "rpm -bt".
+ ________________________________________________________________________
+
+ Change: extra-section-test
+ Purpose: Add support for custom section "%test",
+ a package install-time section containing a script
+ which can check whether the current package is
+ working under run-time, usually by executing some
+ commands of the package.
+ Reason: In OpenPKG we want some form of package regression
+ tests which are directly attached to the packages.
+ Unfortunately, we never got to the point of using
+ %test until now. Shame on us!
+ Hint: This is not tested at all as it is still unused!
+ ________________________________________________________________________
+
+ Change: branding
+ Purpose: Apply some branding for the OpenPKG distribution.
+ Reason: To make sure the users notice that this is not 100%
+ a standard RPM from rpm5.org which is used by OpenPKG.
+ ________________________________________________________________________
+
+ Change: no-deps-on-building-srpms
+ Purpose: Do not perform any dependency checking on building SRPMs.
+ Reason: We never found any reason why this is of any benefit for
+ just rolling a source RPM package.
+ ________________________________________________________________________
+
+ Change: always-remove-tempfiles
+ Purpose: Unconditionally remove temporary files ("rpm-tmp.XXXXX")
+ which were generated for the executed scripts.
+ Reason: In OpenPKG we run the scripts in debug mode ("set -x")
+ anyway, so we never need to see the whole generated
+ script -- not even if it breaks. Instead we would
+ just have temporary files staying around forever.
+ ________________________________________________________________________
+
+ Change: no-default-doc-files
+ Purpose: Do not declare some files as %doc by default.
+ Reason: In OpenPKG we want to be explicit in the declaration
+ of %doc files and do it entirely from a package
+ %files section only. No magic in the code wished.
+ ________________________________________________________________________
+
+ Change: support-srcdefattr
+ Purpose: allow to set SRPM file attributes via %{_srcdefattr} macro
+ Reason: This makes the generated SRPMs look more uniform
+ ________________________________________________________________________
+
+ Change: still-support-section-clean
+ Purpose: allow us to still use %clean section
+ Reason: for temporary backward compatibility only
+ ________________________________________________________________________
+
+ Change: not-fully-arbitrary-tags
+ Purpose: do not allow fully arbitrary tags/headers
+ Reason: we want to allow only those extra tags which are
+ explicitly configured in the macros
+ ________________________________________________________________________
+
+ Change: always-backup-on-patching
+ Purpose: always create backup files on patching files via %patch
+ Reason: In OpenPKG we maintain our patches via "rpm -bp" plus
+ subsequent "svs" commands, so we always want that
+ backup files are created.
+ Hint: We could explicitly specify -b all the time, too.
+ ________________________________________________________________________
+
+ Change: no-require-bin-sh
+ Purpose: do not implicitly add a requirement for /bin/sh
+ Reason: In OpenPKG RPM does not operate on operating system
+ scope. Instead it operates in a fully
+ self-contained multiple-instance environment.
+ There /bin/sh is NEVER provided by an OpenPKG RPM
+ package.
+ ________________________________________________________________________
+
+ Change: bdb-no-partial-locking
+ Purpose: Perform full instead of partial record locking.
+ Reason: At least Solaris may reject (see its fcntl(2) manpage)
+ the (partial) locking, because BDB mmap(2)'ed the file
+ ________________________________________________________________________
+
+ Change: bdb-bugfix-fcntl-usage
+ Purpose: Fix the usage of fcntl(2)
+ Reason: POSIX/SUSv3 clearly expresses that fcntl(2)
+ returns "value other than -1" on success, so check
+ for equality to -1 instead of non-equality to 0.
+ In practice this does not harm on most platforms,
+ because they fortunately (by conincidence and
+ common practice) return 0.
+ ________________________________________________________________________
+
+ Change: bdb-use-odirect-on-freebsd-only
+ Purpose: Use O_DIRECT on FreeBSD only
+ Reason: The O_DIRECT feature is fully broken under at least Linux
+ 2.2 and 2.4. It is sometimes accepted by open(2)
+ without error and later causes a write(2) to fail
+ with EINVAL -- all depending on the underlying
+ filesystem (usually works on tmpfs and fails on
+ ext3). Sometimes it also causes open(2) to fail
+ with EINVAL. In general, it does especially no
+ "graceful degradation" and so is useless for use on
+ mostly all platforms except for those where we know
+ it works (currently FreeBSD only). Interestingly,
+ RPM works on RedHat, just because RedHat's "kernel"
+ package contains a patch which masks out O_DIRECT
+ usage... ;-)
+ ________________________________________________________________________
+
+ Change: no-owner-group-on-srpm-install
+ Purpose: Do not set owner/group on installation/unpacking of SRPM
+ Reason: In OpenPKG it is not wished that file owner/group are
+ set on files during installation of _source_ RPMs.
+ Instead, the current run-time owner/group should
+ be used, because most of the time the owner/group
+ in the source RPM (which is the owner/group of the
+ files as staying on the package author system) is
+ not existing on the target system anyway.
+ ________________________________________________________________________
+
+ Change: switch-from-susr-to-musr-on-srpm-install
+ Purpose: If running as the OpenPKG "susr", do not unpack source
+ RPM packages with "susr" file ownerships. Instead
+ unpack with "musr" file ownerships.
+ Reason: The OpenPKG Set-UID wrapper switches from "musr" to
+ "susr" on "openpkg rpm -Uvh *.src.rpm". As a result
+ the installed files could be never removed again by
+ "musr". It is more consistent to always unpack as
+ "musr" if possible.
+ ________________________________________________________________________
+
+ Change: adjust-verbose-listing
+ Purpose: In verbose file listing output, give the owner and group
+ fields more width and at the same time reduce the
+ fields more nlink and size to typical sizes within
+ fields more OpenPKG.
+ Reason: Just cosmetics to improve output.
+ ________________________________________________________________________
+
+ Change: larger-utsname
+ Purpose: Increase size of "struct utsname"
+ Reason: OpenPKG requires more space for storage
+ ________________________________________________________________________
+
+ Change: platform-major-minor-only
+ Purpose: Reduce the platform version to major and minor version numbers only.
+ Reason: Experience shows that more is never reasonable in practice.
+ ________________________________________________________________________
+
+ Change: allow-excludedocs-default
+ Purpose: Do not override the %{_excludedocs} macro.
+ Reason: The "%_excludedocs" macro is intended to set the
+ _default_ if both --excludedocs and --includedocs
+ are not specified and it is evaluated already
+ before. So, do not override it here again, because
+ it would not allow us to make "%_excludedocs 1" the
+ default.
+ ________________________________________________________________________
+
+ Change: bdb-allow-zero-sized-files
+ Purpose: Make sure RPM passes DB_CREATE to Berkeley-DB also
+ if file exists, but is (still) zero-sized.
+ Reason: In OpenPKG all database files are pre-created
+ to fixate permissions.
+ Hint: This might be obsolete soon as we now create real
+ BDB files instead of empty files.
+ ________________________________________________________________________
+
+ Change: no-architecture-expose
+ Purpose: Do not expose the architecture in outputs.
+ Reason: This is too less information, as in OpenPKG the
+ "platform" is described by the
+ architecture+operating-system combination. But
+ as the whole "platform" information is actually
+ overkill, just revert to the RPM 4 behaviour and do
+ not expose any such information at all
+ Hint: FIXME, not sufficient: still some information exposed during
+ rpm -qa for the case of public keys.
+ ________________________________________________________________________
+
+ Change: fixed-size-macro-buffer
+ Purpose: Use a fixed 16KB buffer for macro expansion.
+ Reason: Don't use the stdio variable BUFSIZ because it is of
+ unknown size. Usually, it is just 1024 on some
+ platforms but on Linux it can be even 8192. Use a
+ fixed 16KB buffer in OpenPKG for now.
+ ________________________________________________________________________
+
+ Change: patch-as-plain-macro
+ Purpose: Use %patch as a plain macro instead of internal implementation.
+ Reason: The macro is more flexible and we especially can introduce
+ some Lua-based substitution magic there more easily.
+ ________________________________________________________________________
+
+ Change: stop-on-error-macro
+ Purpose: Make sure that an %{error:<msg>} macro really stops further
+ processing. Else it would be nothing more than a %{warn:<msg>}.
+ Reason: OpenPKG wants that %error results in a processing stop.
+ ________________________________________________________________________
+
+ Change: auto-remove-source-directories
+ Purpose: Automatically remove source directories if they are empty.
+ Reason: In OpenPKG we use per-package %{_sourcedir} and
+ %{_specdir} definitions (macros have trailing
+ ".../%{name}"). On removal of source(s) and .spec
+ file, this per-package directory would be kept
+ (usually <prefix>/RPM/SRC/<name>/), because RPM
+ does not know about this OpenPKG convention. So,
+ let RPM try(!) to remove the two directories (if
+ they are empty) and just ignore removal failures
+ (if they are still not empty).
+
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/build.c
============================================================================
$ cvs diff -u -r2.120 -r2.121 build.c
--- rpm/build/build.c 3 Dec 2007 21:11:52 -0000 2.120
+++ rpm/build/build.c 6 Dec 2007 14:47:48 -0000 2.121
@@ -16,11 +16,29 @@
/**
*/
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+const char * getSourceDir(rpmfileAttrs attr, const char *filename)
+#else
const char * getSourceDir(rpmfileAttrs attr)
+#endif
/*@globals rpmGlobalMacroContext @*/
{
const char * dir = NULL;
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ const char *fn;
+ /* support splitted source directories, i.e., source files which
+ are alternatively placed into the .spec directory and picked
+ up from there, too. */
+ if (attr & (RPMFILE_SOURCE|RPMFILE_PATCH|RPMFILE_ICON) && filename != NULL) {
+ fn = rpmGetPath("%{_specdir}/", filename, NULL);
+ if (access(fn, F_OK) == 0)
+ dir = "%{_specdir}/";
+ fn = _free(fn);
+ }
+ if (dir != NULL) {
+ } else
+#endif
if (attr & RPMFILE_SOURCE)
dir = "%{_sourcedir}/";
else if (attr & RPMFILE_PATCH)
@@ -52,7 +70,11 @@
const char *dn, *fn;
if (sp->flags & RPMFILE_GHOST)
continue;
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ if (! (dn = getSourceDir(sp->flags, sp->source)))
+#else
if (! (dn = getSourceDir(sp->flags)))
+#endif
continue;
fn = rpmGenPath(NULL, dn, sp->source);
rc = Unlink(fn);
@@ -131,6 +153,16 @@
mPost = "%{__spec_clean_post}";
mCmd = "%{__spec_clean_cmd}";
break;
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ case RPMBUILD_TRACK:
+ name = "%track";
+ sb = spec->track;
+ mTemplate = "%{__spec_track_template}";
+ mPost = "%{__spec_track_post}";
+ mCmd = "%{__spec_track_cmd}";
+ break;
+#endif
case RPMBUILD_STRINGBUF:
default:
mTemplate = "%{___build_template}";
@@ -179,7 +211,12 @@
(void) fputs(buildTemplate, fp);
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir && what != RPMBUILD_TRACK)
+#else
if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir)
+#endif
fprintf(fp, "cd '%s'\n", spec->buildSubdir);
if (what == RPMBUILD_RMBUILD) {
@@ -230,6 +267,10 @@
buildCmd = rpmExpand(mCmd, " ", buildScript, NULL);
(void) poptParseArgvString(buildCmd, &argc, &argv);
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ if (what != RPMBUILD_TRACK)
+#endif
rpmlog(RPMLOG_NOTICE, _("Executing(%s): %s\n"), name, buildCmd);
if (!(child = fork())) {
@@ -257,7 +298,15 @@
exit:
if (scriptName) {
+#if defined(RPM_VENDOR_OPENPKG) /* always-remove-tempfiles */
+ /* Unconditionally remove temporary files ("rpm-tmp.XXXXX") which
+ were generated for the executed scripts. In OpenPKG we run the
+ scripts in debug mode ("set -x") anyway, so we never need to
+ see the whole generated script -- not even if it breaks. Instead
+ we would just have temporary files staying around forever. */
+#else
if (rc == RPMRC_OK)
+#endif
(void) Unlink(scriptName);
scriptName = _free(scriptName);
}
@@ -310,6 +359,13 @@
/*@=boundsread@*/
}
} else {
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ if ((what & RPMBUILD_TRACK) &&
+ (rc = doScript(spec, RPMBUILD_TRACK, NULL, NULL, test)))
+ goto exit;
+#endif
+
if ((what & RPMBUILD_PREP) &&
(rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
goto exit;
@@ -358,6 +414,28 @@
if (what & RPMBUILD_RMSPEC)
(void) Unlink(spec->specFile);
+#if defined(RPM_VENDOR_OPENPKG) /* auto-remove-source-directories */
+ /* In OpenPKG we use per-package %{_sourcedir} and %{_specdir}
+ definitions (macros have trailing ".../%{name}"). On removal of
+ source(s) and .spec file, this per-package directory would be kept
+ (usually <prefix>/RPM/SRC/<name>/), because RPM does not know about
+ this OpenPKG convention. So, let RPM try(!) to remove the two
+ directories (if they are empty) and just ignore removal failures
+ (if they are still not empty). */
+ if (what & RPMBUILD_RMSOURCE) {
+ const char *pn;
+ pn = rpmGetPath("%{_sourcedir}", NULL);
+ Rmdir(pn); /* ignore error, it is ok if it fails (usually with ENOTEMPTY) */
+ pn = _free(pn);
+ }
+ if (what & RPMBUILD_RMSPEC) {
+ const char *pn;
+ pn = rpmGetPath("%{_specdir}", NULL);
+ Rmdir(pn); /* ignore error, it is ok if it fails (usually with ENOTEMPTY) */
+ pn = _free(pn);
+ }
+#endif
+
exit:
if (rc != RPMRC_OK && rpmlogGetNrecs() > 0) {
rpmlog(RPMLOG_NOTICE, _("\n\nRPM build errors:\n"));
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/files.c
============================================================================
$ cvs diff -u -r1.302 -r1.303 files.c
--- rpm/build/files.c 4 Dec 2007 23:49:24 -0000 1.302
+++ rpm/build/files.c 6 Dec 2007 14:47:48 -0000 1.303
@@ -2333,6 +2333,9 @@
fl.defSpecdFlags = 0;
fl.docDirCount = 0;
+#if defined(RPM_VENDOR_OPENPKG) /* no-default-doc-files */
+ /* do not declare any files as %doc files by default. */
+#else
fl.docDirs[fl.docDirCount++] = xstrdup("/usr/doc");
fl.docDirs[fl.docDirCount++] = xstrdup("/usr/man");
fl.docDirs[fl.docDirCount++] = xstrdup("/usr/info");
@@ -2346,6 +2349,7 @@
fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_infodir}", NULL);
fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_javadocdir}", NULL);
fl.docDirs[fl.docDirCount++] = rpmGetPath("%{_examplesdir}", NULL);
+#endif
fl.fileList = NULL;
fl.fileListRecsAlloced = 0;
@@ -2552,6 +2556,16 @@
case RPMTAG_GIF:
case RPMTAG_XPM:
case HEADER_I18NTABLE:
+#if defined(RPM_VENDOR_OPENPKG) /* propagate-provides-to-srpms */
+ /* make sure the "Provides" headers are available for querying from the .src.rpm files. */
+ case RPMTAG_PROVIDENAME:
+ case RPMTAG_PROVIDEVERSION:
+ case RPMTAG_PROVIDEFLAGS:
+#endif
+#if defined(RPM_VENDOR_OPENPKG) /* extra-header-class */
+ /* support "Class" header */
+ case RPMTAG_CLASS:
+#endif
if (he->p.ptr)
xx = headerPut(spec->sourceHeader, he, 0);
/*@switchbreak@*/ break;
@@ -2583,7 +2597,11 @@
for (srcPtr = spec->sources; srcPtr != NULL; srcPtr = srcPtr->next) {
{ const char * sfn;
sfn = rpmGetPath( ((srcPtr->flags & RPMFILE_GHOST) ? "!" : ""),
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ getSourceDir(srcPtr->flags, srcPtr->source), srcPtr->source, NULL);
+#else
getSourceDir(srcPtr->flags), srcPtr->source, NULL);
+#endif
appendLineStringBuf(sourceFiles, sfn);
sfn = _free(sfn);
}
@@ -2644,10 +2662,28 @@
struct FileList_s fl;
char **files, **fp;
int rc;
+#if defined(RPM_VENDOR_OPENPKG) /* support-srcdefattr */
+ /* srcdefattr: needed variables */
+ char _srcdefattr_buf[BUFSIZ];
+ char *_srcdefattr;
+#endif
+
+#if defined(RPM_VENDOR_OPENPKG) /* support-srcdefattr */
+ _srcdefattr = rpmExpand("%{?_srcdefattr}", NULL);
+#endif
*sfp = newStringBuf();
x = initSourceHeader(spec, sfp);
+#if defined(RPM_VENDOR_OPENPKG) /* support-srcdefattr */
+ /* srcdefattr: initialize file list structure */
+ memset(&fl, 0, sizeof(fl));
+ if (_srcdefattr && *_srcdefattr) {
+ snprintf(_srcdefattr_buf, sizeof(_srcdefattr_buf), "%%defattr %s", _srcdefattr);
+ parseForAttr(_srcdefattr_buf, &fl);
+ }
+#endif
+
/* Construct the SRPM file list. */
fl.fileList = xcalloc((spec->numSources + 1), sizeof(*fl.fileList));
rc = fl.processingFailed = 0;
@@ -2698,8 +2734,18 @@
rc = fl.processingFailed = 1;
}
+#if defined(RPM_VENDOR_OPENPKG) /* support-srcdefattr */
+ /* srcdefattr: allow to set SRPM file attributes via %{_srcdefattr} macro */
+ if (fl.def_ar.ar_fmodestr) {
+ flp->fl_mode &= S_IFMT;
+ flp->fl_mode |= fl.def_ar.ar_fmode;
+ }
+ flp->uname = fl.def_ar.ar_user ? getUnameS(fl.def_ar.ar_user) : getUname(flp->fl_uid);
+ flp->gname = fl.def_ar.ar_group ? getGnameS(fl.def_ar.ar_group) : getGname(flp->fl_gid);
+#else
flp->uname = getUname(flp->fl_uid);
flp->gname = getGname(flp->fl_gid);
+#endif
flp->langs = xstrdup("");
fl.totalFileSize += flp->fl_size;
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/pack.c
============================================================================
$ cvs diff -u -r2.266 -r2.267 pack.c
--- rpm/build/pack.c 3 Dec 2007 21:11:52 -0000 2.266
+++ rpm/build/pack.c 6 Dec 2007 14:47:48 -0000 2.267
@@ -287,6 +287,16 @@
}
}
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%test" script/section */
+ if (pkg->testFile) {
+ if (addFileToTag(spec, pkg->testFile, pkg->header, RPMTAG_TEST)) {
+ rpmlog(RPMLOG_ERR, _("Could not open Test file: %s\n"), pkg->testFile);
+ return RPMRC_FAIL;
+ }
+ }
+#endif
+
for (p = pkg->triggerFiles; p != NULL; p = p->next) {
he->tag = RPMTAG_TRIGGERSCRIPTPROG;
he->t = RPM_STRING_ARRAY_TYPE;
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parseBuildInstallClean.c
============================================================================
$ cvs diff -u -r2.22 -r2.23 parseBuildInstallClean.c
--- rpm/build/parseBuildInstallClean.c 11 Oct 2007 13:04:26 -0000 2.22
+++ rpm/build/parseBuildInstallClean.c 6 Dec 2007 14:47:48 -0000 2.23
@@ -31,6 +31,13 @@
sbp = &spec->clean;
name = "%clean";
}
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ else if (parsePart == PART_TRACK) {
+ sbp = &(spec->track);
+ name = "%track";
+ }
+#endif
/*@=branchstate@*/
if (*sbp != NULL) {
@@ -52,7 +59,10 @@
if (s && *s)
appendStringBuf(*sbp, s);
s = _free(s);
+#if !defined(RPM_VENDOR_OPENPKG) /* still-support-section-clean */
+ /* OpenPKG still wishes to use "%clean" script/section */
sbp = NULL; /* XXX skip %clean from spec file. */
+#endif
}
/* There are no options to %build, %install, %check, or %clean */
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parsePreamble.c
============================================================================
$ cvs diff -u -r2.153 -r2.154 parsePreamble.c
--- rpm/build/parsePreamble.c 3 Dec 2007 21:11:52 -0000 2.153
+++ rpm/build/parsePreamble.c 6 Dec 2007 14:47:48 -0000 2.154
@@ -41,6 +41,10 @@
RPMTAG_XMINOR,
RPMTAG_REPOTAG,
RPMTAG_KEYWORDS,
+#if defined(RPM_VENDOR_OPENPKG) /* extra-header-class */
+ /* support "Class" tag/header */
+ RPMTAG_CLASS,
+#endif
0
};
@@ -340,6 +344,10 @@
{ RPMTAG_PACKAGER, "%{packager}" },
{ RPMTAG_DISTRIBUTION, "%{distribution}" },
{ RPMTAG_DISTURL, "%{disturl}" },
+#if defined(RPM_VENDOR_OPENPKG) /* extra-header-class */
+ /* support "Class" tag/header */
+ { RPMTAG_CLASS, "%{class}" },
+#endif
{ -1, NULL }
};
@@ -397,7 +405,18 @@
goto exit;
}
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ /* support splitted source directories, i.e., source files which
+ are alternatively placed into the .spec directory and picked
+ up from there, too. */
+ Lurlfn = rpmGenPath(NULL, "%{_specdir}/", sp->source);
+ if (access(Lurlfn, F_OK) == -1) {
+ Lurlfn = _free(Lurlfn);
+ Lurlfn = rpmGenPath(NULL, "%{_icondir}/", sp->source);
+ }
+#else
Lurlfn = rpmGenPath(NULL, "%{_icondir}/", sp->source);
+#endif
fn = NULL;
urltype = urlPath(Lurlfn, &fn);
@@ -599,6 +618,10 @@
case RPMTAG_VENDOR:
case RPMTAG_LICENSE:
case RPMTAG_PACKAGER:
+#if defined(RPM_VENDOR_OPENPKG) /* extra-header-class */
+ /* support "Class" tag/header */
+ case RPMTAG_CLASS:
+#endif
if (!*lang) {
he->tag = tag;
he->t = RPM_STRING_TYPE;
@@ -782,6 +805,11 @@
break;
default:
+#if defined(RPM_VENDOR_OPENPKG) /* not-fully-arbitrary-tags */
+ /* revert to old behaviour where *arbitrary* tags are *not* allowed */
+ rpmlog(RPMLOG_ERR, _("Internal error: Bogus tag %d\n"), tag);
+ return RPMRC_FAIL;
+#else
macro = 0;
he->tag = tag;
he->t = RPM_STRING_ARRAY_TYPE;
@@ -790,6 +818,7 @@
he->append = 1;
xx = headerPut(pkg->header, he, 0);
he->append = 0;
+#endif
break;
}
@@ -872,6 +901,10 @@
{RPMTAG_KEYWORDS, 0, 0, "keywords"},
{RPMTAG_KEYWORDS, 0, 0, "keyword"},
{RPMTAG_BUILDPLATFORMS, 0, 0, "buildplatforms"},
+#if defined(RPM_VENDOR_OPENPKG) /* extra-header-class */
+ /* support "Class" tag/header */
+ {RPMTAG_CLASS, 0, 0, "class"},
+#endif
/*@-nullassign@*/ /* LCL: can't add null annotation */
{0, 0, 0, 0}
/*@=nullassign@*/
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parsePrep.c
============================================================================
$ cvs diff -u -r2.97 -r2.98 parsePrep.c
--- rpm/build/parsePrep.c 1 Dec 2007 09:36:35 -0000 2.97
+++ rpm/build/parsePrep.c 6 Dec 2007 14:47:48 -0000 2.98
@@ -84,6 +84,11 @@
*t = '\0';
if (db)
t = stpcpy( stpcpy(t, "-b --suffix "), db);
+#if defined(RPM_VENDOR_OPENPKG) /* always-backup-on-patching */
+ /* always create backup files in OpenPKG */
+ else
+ t = stpcpy(t, "-b --suffix .orig ");
+#endif
if (subdir)
t = stpcpy( stpcpy(t, "-d "), subdir);
if (fuzz) {
@@ -216,7 +221,11 @@
taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
/*@=internalglobs@*/
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ Lurlfn = rpmGenPath(NULL, getSourceDir(sp->flags, sp->source), sp->source);
+#else
Lurlfn = rpmGenPath(NULL, getSourceDir(sp->flags), sp->source);
+#endif
/* XXX On non-build parse's, file cannot be stat'd or read */
if (!spec->force && (isCompressed(Lurlfn, &compressed) || checkOwners(Lurlfn))) {
@@ -620,6 +629,9 @@
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
{
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ const char *Smacro;
+#endif
const char *Lmacro, *Lurlfn = NULL;
const char *Rmacro, *Rurlfn = NULL;
struct Source *sp;
@@ -658,7 +670,14 @@
ec = 0;
for (sp = spec->sources; sp != NULL; sp = sp->next) {
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ Smacro = "%{?_specdir}/";
+#endif
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ if (! (Lmacro = getSourceDir(sp->flags, sp->source)))
+#else
if (! (Lmacro = getSourceDir(sp->flags)))
+#endif
continue;
if (sp->flags & RPMFILE_SOURCE) {
Rmacro = "%{?_Rsourcedir}/";
@@ -671,6 +690,15 @@
} else
continue;
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ /* support splitted source directories, i.e., source files which
+ are alternatively placed into the .spec directory and picked
+ up from there, too. */
+ Lurlfn = rpmGenPath(NULL, Smacro, sp->source);
+ rc = Lstat(Lurlfn, &st);
+ if (rc == 0)
+ goto bottom;
+#endif
Lurlfn = rpmGenPath(NULL, Lmacro, sp->source);
rc = Lstat(Lurlfn, &st);
if (rc == 0)
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parseScript.c
============================================================================
$ cvs diff -u -r2.53 -r2.54 parseScript.c
--- rpm/build/parseScript.c 26 Nov 2007 05:16:49 -0000 2.53
+++ rpm/build/parseScript.c 6 Dec 2007 14:47:48 -0000 2.54
@@ -181,6 +181,15 @@
progtag = RPMTAG_TRIGGERSCRIPTPROG;
partname = "%triggerpostun";
break;
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%test" script/section */
+ case PART_TEST:
+ tag = RPMTAG_TEST;
+ tagflags = RPMSENSE_SCRIPT_TEST;
+ progtag = RPMTAG_TESTPROG;
+ partname = "%test";
+ break;
+#endif
}
/*@=branchstate@*/
@@ -313,6 +322,12 @@
spec->lineNum, progArgv[0]);
rc = RPMRC_FAIL;
goto exit;
+#if defined(RPM_VENDOR_OPENPKG) /* no-require-bin-sh */
+ } else if (strcmp(progArgv[0], "/bin/sh") == 0) {
+ /* 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". */
+#endif
} else {
(void) addReqProv(spec, pkg->header, RPMTAG_REQUIRENAME,
progArgv[0], NULL, (tagflags | RPMSENSE_INTERP), 0);
@@ -375,6 +390,11 @@
case PART_VERIFYSCRIPT:
pkg->verifyFile = xstrdup(file);
break;
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ case PART_TEST:
+ pkg->testFile = xstrdup(file);
+ break;
+#endif
}
}
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parseSpec.c
============================================================================
$ cvs diff -u -r2.120 -r2.121 parseSpec.c
--- rpm/build/parseSpec.c 3 Dec 2007 21:11:52 -0000 2.120
+++ rpm/build/parseSpec.c 6 Dec 2007 14:47:48 -0000 2.121
@@ -43,6 +43,14 @@
{ PART_TRIGGERIN, 0, "%triggerin"},
{ PART_TRIGGERIN, 0, "%trigger"},
{ PART_VERIFYSCRIPT, 0, "%verifyscript"},
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ { PART_TRACK, 0, "%track"},
+#endif
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%test" script/section */
+ { PART_TEST, 0, "%test"},
+#endif
{0, 0, 0}
};
@@ -524,6 +532,19 @@
case PART_LAST:
case PART_BUILDARCHITECTURES:
/*@switchbreak@*/ break;
+
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ case PART_TRACK:
+ parsePart = parseBuildInstallClean(spec, parsePart);
+ /*@switchbreak@*/ break;
+#endif
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%test" script/section */
+ case PART_TEST:
+ parsePart = parseScript(spec, parsePart);
+ /*@switchbreak@*/ break;
+#endif
}
if (goterror || parsePart >= PART_LAST) {
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/poptBT.c
============================================================================
$ cvs diff -u -r2.15 -r2.16 poptBT.c
--- rpm/build/poptBT.c 24 Jul 2007 14:36:47 -0000 2.15
+++ rpm/build/poptBT.c 6 Dec 2007 14:47:48 -0000 2.16
@@ -35,6 +35,10 @@
#define POPT_BL 0x626c
#define POPT_BP 0x6270
#define POPT_BS 0x6273
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+/* support "%track" script/section */
+#define POPT_BT 0x6274
+#endif
#define POPT_TA 0x7461
#define POPT_TB 0x7462
#define POPT_TC 0x7463
@@ -80,6 +84,10 @@
case POPT_BL:
case POPT_BP:
case POPT_BS:
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ case POPT_BT:
+#endif
case POPT_TA:
case POPT_TB:
case POPT_TC:
@@ -153,6 +161,12 @@
{ "bs", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BS,
N_("build source package only from <specfile>"),
N_("<specfile>") },
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ { "bt", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BT,
+ N_("track versions of sources from <specfile>"),
+ N_("<specfile>") },
+#endif
{ "tp", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TP,
N_("build through %prep (unpack sources and apply patches) from <tarball>"),
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/rpmbuild.h
============================================================================
$ cvs diff -u -r2.81 -r2.82 rpmbuild.h
--- rpm/build/rpmbuild.h 30 Nov 2007 04:51:30 -0000 2.81
+++ rpm/build/rpmbuild.h 6 Dec 2007 14:47:48 -0000 2.82
@@ -34,6 +34,10 @@
RPMBUILD_RMSOURCE = (1 << 8), /*!< Remove source(s) and patch(s). */
RPMBUILD_RMBUILD = (1 << 9), /*!< Remove build sub-tree. */
RPMBUILD_STRINGBUF = (1 << 10), /*!< only for doScript() */
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ RPMBUILD_TRACK = (1 << 12), /*!< Execute %%track. */
+#endif
RPMBUILD_RMSPEC = (1 << 11) /*!< Remove spec file. */
} rpmBuildFlags;
/*@=typeuse@*/
@@ -72,7 +76,14 @@
PART_BUILDARCHITECTURES= 29+PART_BASE,/*!< */
PART_TRIGGERPOSTUN = 30+PART_BASE, /*!< */
PART_TRIGGERPREIN = 31+PART_BASE, /*!< */
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track extra-section-test */
+ /* support "%track" and "%test" scripts/sections */
+ PART_TRACK = 32+PART_BASE, /*!< */
+ PART_TEST = 33+PART_BASE, /*!< */
+ PART_LAST = 34+PART_BASE /*!< */
+#else
PART_LAST = 32+PART_BASE /*!< */
+#endif
} rpmParseState;
#define STRIP_NOTHING 0
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/rpmspec.h
============================================================================
$ cvs diff -u -r2.62 -r2.63 rpmspec.h
--- rpm/build/rpmspec.h 4 Nov 2007 20:51:26 -0000 2.62
+++ rpm/build/rpmspec.h 6 Dec 2007 14:47:48 -0000 2.63
@@ -177,6 +177,11 @@
StringBuf check; /*!< %check scriptlet. */
/*@only@*/
StringBuf clean; /*!< %clean scriptlet. */
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+/*@only@*/
+ StringBuf track; /*!< %track scriptlet. */
+#endif
/*@owned@*/
Package packages; /*!< Package list. */
@@ -210,6 +215,11 @@
const char * postTransFile; /*!< %posttrans scriptlet. */
/*@only@*/
const char * verifyFile; /*!< %verifyscript scriptlet. */
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%test" script/section */
+/*@only@*/
+ const char * testFile; /*!< %test scriptlet. */
+#endif
/*@only@*/
StringBuf specialDoc;
@@ -348,7 +358,11 @@
* @param attr rpmfileAttrs from source
* @return string containings macros about location, NULL on failure
*/
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+const char * getSourceDir(rpmfileAttrs attr, const char *filename)
+#else
const char * getSourceDir(rpmfileAttrs attr)
+#endif
/*@modifies nothing @*/;
#ifdef __cplusplus
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/spec.c
============================================================================
$ cvs diff -u -r2.164 -r2.165 spec.c
--- rpm/build/spec.c 26 Nov 2007 05:16:49 -0000 2.164
+++ rpm/build/spec.c 6 Dec 2007 14:47:48 -0000 2.165
@@ -145,6 +145,10 @@
p->preUnFile = NULL;
p->postUnFile = NULL;
p->verifyFile = NULL;
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%test" script/section */
+ p->testFile = NULL;
+#endif
p->specialDoc = NULL;
@@ -170,6 +174,10 @@
pkg->preUnFile = _free(pkg->preUnFile);
pkg->postUnFile = _free(pkg->postUnFile);
pkg->verifyFile = _free(pkg->verifyFile);
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%test" script/section */
+ pkg->testFile = _free(pkg->testFile);
+#endif
pkg->header = headerFree(pkg->header);
pkg->ds = rpmdsFree(pkg->ds);
@@ -342,8 +350,10 @@
assert(0);
/*@notreached@*/ break;
}
+#if !defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
mdir = getSourceDir(flag);
assert(mdir != NULL);
+#endif
/*@=branchstate@*/
/* Get the number */
@@ -386,6 +396,9 @@
spec->numSources++;
/* XXX FIXME: need to add ICON* macros. */
+#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
+ mdir = getSourceDir(flag, p->source);
+#endif
if (tag != RPMTAG_ICON) {
const char *body = rpmGenPath(NULL, mdir, p->source);
@@ -496,6 +509,10 @@
spec->install = NULL;
spec->check = NULL;
spec->clean = NULL;
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ spec->track = NULL;
+#endif
spec->sources = NULL;
spec->packages = NULL;
@@ -542,6 +559,10 @@
spec->install = freeStringBuf(spec->install);
spec->check = freeStringBuf(spec->check);
spec->clean = freeStringBuf(spec->clean);
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support "%track" script/section */
+ spec->track = freeStringBuf(spec->track);
+#endif
spec->buildSubdir = _free(spec->buildSubdir);
spec->rootURL = _free(spec->rootURL);
@@ .
patch -p0 <<'@@ .'
Index: rpm/devtool.conf
============================================================================
$ cvs diff -u -r2.140 -r2.141 devtool.conf
--- rpm/devtool.conf 5 Dec 2007 10:51:14 -0000 2.140
+++ rpm/devtool.conf 6 Dec 2007 14:47:47 -0000 2.141
@@ -131,6 +131,8 @@
--with-bugreport=support@windriver.com
%rse
+ RPM_VENDOR_OPENPKG=1
+ export RPM_VENDOR_OPENPKG
%standalone
%standalone
@@ -824,8 +826,8 @@
CPPFLAGS=""
LDFLAGS=""
LIBS=""
- if [ ".`grep 'OpenPKG RPM' ${DEVTOOL_SRCDIR}/rpmqv.c`" != . ]; then
- CPPFLAGS="$CPPFLAGS -DOPENPKG"
+ if [ ".$RPM_VENDOR_OPENPKG" != . ]; then
+ CPPFLAGS="$CPPFLAGS -DRPM_VENDOR_OPENPKG"
fi
LDFLAGS="$LDFLAGS -L$base3rd/bin/$platform/openssl-${v_openssl}" # shameless workaround for Neon/XAR
LDFLAGS="$LDFLAGS -L$base3rd/bin/$platform/libxml2-${v_libxml2}/.libs" # shameless workaround for XAR
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/fsm.c
============================================================================
$ cvs diff -u -r2.139 -r2.140 fsm.c
--- rpm/lib/fsm.c 3 Dec 2007 18:11:09 -0000 2.139
+++ rpm/lib/fsm.c 6 Dec 2007 14:47:49 -0000 2.140
@@ -763,20 +763,40 @@
uid_t uid = fi->uid;
gid_t gid = fi->gid;
+#if defined(RPM_VENDOR_OPENPKG) /* no-owner-group-on-srpm-install */
+ /* Make sure OpenPKG RPM does not try to set file owner/group on files during
+ installation of _source_ RPMs. Instead, let it use the current
+ run-time owner/group, because most of the time the owner/group in
+ the source RPM (which is the owner/group of the files as staying on
+ the package author system) is not existing on the target system, of
+ course. */
+#endif
if (fi->fuser && unameToUid(fi->fuser[i], &uid)) {
+#if defined(RPM_VENDOR_OPENPKG) /* no-owner-group-on-srpm-install */
+ if (!headerIsEntry(fi->h, RPMTAG_SOURCEPACKAGE)) {
+#endif
if (fsm->goal == FSM_PKGINSTALL)
rpmlog(RPMLOG_WARNING,
_("user %s does not exist - using root\n"), fi->fuser[i]);
uid = 0;
finalMode &= ~S_ISUID; /* turn off suid bit */
+#if defined(RPM_VENDOR_OPENPKG) /* no-owner-group-on-srpm-install */
+ }
+#endif
}
if (fi->fgroup && gnameToGid(fi->fgroup[i], &gid)) {
+#if defined(RPM_VENDOR_OPENPKG) /* no-owner-group-on-srpm-install */
+ if (!headerIsEntry(fi->h, RPMTAG_SOURCEPACKAGE)) {
+#endif
if (fsm->goal == FSM_PKGINSTALL)
rpmlog(RPMLOG_WARNING,
_("group %s does not exist - using root\n"), fi->fgroup[i]);
gid = 0;
finalMode &= ~S_ISGID; /* turn off sgid bit */
+#if defined(RPM_VENDOR_OPENPKG) /* no-owner-group-on-srpm-install */
+ }
+#endif
}
if (fsm->mapFlags & CPIO_MAP_MODE)
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/poptALL.c
============================================================================
$ cvs diff -u -r2.57 -r2.58 poptALL.c
--- rpm/lib/poptALL.c 27 Nov 2007 03:29:13 -0000 2.57
+++ rpm/lib/poptALL.c 6 Dec 2007 14:47:49 -0000 2.58
@@ -180,7 +180,12 @@
/*@globals rpmEVR, fileSystem @*/
/*@modifies *fp, fileSystem @*/
{
+#if defined(RPM_VENDOR_OPENPKG) /* branding */
+ /* use OpenPKG branding */
+ fprintf(fp, _("OpenPKG RPM %s\n"), rpmEVR);
+#else
fprintf(fp, _("RPM version %s\n"), rpmEVR);
+#endif
}
void rpmcliConfigured(void)
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/psm.c
============================================================================
$ cvs diff -u -r2.273 -r2.274 psm.c
--- rpm/lib/psm.c 3 Dec 2007 21:11:53 -0000 2.273
+++ rpm/lib/psm.c 6 Dec 2007 14:47:49 -0000 2.274
@@ -274,6 +274,26 @@
fi->uid = getuid();
fi->gid = getgid();
+#if defined(RPM_VENDOR_OPENPKG) /* switch-from-susr-to-musr-on-srpm-install */
+ /* If running as the OpenPKG "susr", do not unpack source RPM
+ packages with "susr" file ownerships as the OpenPKG Set-UID
+ wrapper switches from "musr" to "susr" on "openpkg rpm -Uvh
+ *.src.rpm". As a result the installed files could be never
+ removed again by "musr". It is more consistent to always unpack
+ as "musr" if possible. */
+ if (fi->uid == 0) {
+ char *muid_str;
+ char *mgid_str;
+ uid_t muid;
+ gid_t mgid;
+ if ((muid_str = rpmExpand("%{l_muid}", NULL)) != NULL)
+ if ((muid = (uid_t)strtol(muid_str, (char **)NULL, 10)) > 0)
+ fi->uid = muid;
+ if ((mgid_str = rpmExpand("%{l_mgid}", NULL)) != NULL)
+ if ((mgid = (gid_t)strtol(mgid_str, (char **)NULL, 10)) > 0)
+ fi->gid = mgid;
+ }
+#endif
fi->astriplen = 0;
fi->striplen = 0;
@@ -313,6 +333,9 @@
rpmrc = RPMRC_FAIL;
goto exit;
}
+#if defined(RPM_VENDOR_OPENPKG) /* switch-from-susr-to-musr-on-srpm-install */
+ chown(_sourcedir, fi->uid, fi->gid);
+#endif
_specdir = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", "");
rpmrc = rpmMkdirPath(_specdir, "specdir");
@@ -326,6 +349,9 @@
rpmrc = RPMRC_FAIL;
goto exit;
}
+#if defined(RPM_VENDOR_OPENPKG) /* switch-from-susr-to-musr-on-srpm-install */
+ chown(_specdir, fi->uid, fi->gid);
+#endif
/* Build dnl/dil with {_sourcedir, _specdir} as values. */
if (i < fi->fc) {
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/query.c
============================================================================
$ cvs diff -u -r2.196 -r2.197 query.c
--- rpm/lib/query.c 24 Nov 2007 23:55:01 -0000 2.196
+++ rpm/lib/query.c 6 Dec 2007 14:47:49 -0000 2.197
@@ -40,7 +40,14 @@
/*@modifies *te @*/
{
char sizefield[15];
+#if defined(RPM_VENDOR_OPENPKG) /* adjust-verbose-listing */
+ /* In verbose file listing output, give the owner and group fields
+ more width and at the same time reduce the nlink and size fields
+ more to typical sizes within OpenPKG. */
+ char ownerfield[13+1], groupfield[13+1];
+#else
char ownerfield[8+1], groupfield[8+1];
+#endif
char timefield[100];
time_t when = mtime; /* important if sizeof(uint32_t) ! sizeof(time_t) */
struct tm * tm;
@@ -63,7 +70,14 @@
groupfield[sizeof(groupfield)-1] = '\0';
/* this is normally right */
+#if defined(RPM_VENDOR_OPENPKG) /* adjust-verbose-listing */
+ /* In verbose file listing output, give the owner and group fields
+ more width and at the same time reduce the nlink and size fields
+ more to typical sizes within OpenPKG. */
+ sprintf(sizefield, "%8u", size);
+#else
sprintf(sizefield, "%12u", size);
+#endif
/* this knows too much about dev_t */
@@ -103,7 +117,14 @@
(void)strftime(timefield, sizeof(timefield) - 1, fmt, tm);
}
+#if defined(RPM_VENDOR_OPENPKG) /* adjust-verbose-listing */
+ /* In verbose file listing output, give the owner and group fields
+ more width and at the same time reduce the nlink and size fields
+ more to typical sizes within OpenPKG. */
+ sprintf(te, "%s %d %-13s %-13s %8s %s %s", perms,
+#else
sprintf(te, "%s %4d %-7s %-8s %10s %s %s", perms,
+#endif
(int)nlink, ownerfield, groupfield, sizefield, timefield, namefield);
perms = _free(perms);
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmevr.h
============================================================================
$ cvs diff -u -r1.3 -r1.4 rpmevr.h
--- rpm/lib/rpmevr.h 20 Jun 2007 13:40:45 -0000 1.3
+++ rpm/lib/rpmevr.h 6 Dec 2007 14:47:49 -0000 1.4
@@ -60,6 +60,10 @@
RPMSENSE_SCRIPT_BUILD = (1 << 21), /*!< %build build dependency. */
RPMSENSE_SCRIPT_INSTALL = (1 << 22),/*!< %install build dependency. */
RPMSENSE_SCRIPT_CLEAN = (1 << 23), /*!< %clean build dependency. */
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%test" script/section */
+ RPMSENSE_SCRIPT_TEST = (1 << 31), /*!< %test build dependency. */
+#endif
RPMSENSE_RPMLIB = (1 << 24), /*!< rpmlib(feature) dependency. */
RPMSENSE_TRIGGERPREIN = (1 << 25), /*!< %triggerprein dependency. */
RPMSENSE_KEYRING = (1 << 26),
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmrc.c
============================================================================
$ cvs diff -u -r2.218 -r2.219 rpmrc.c
--- rpm/lib/rpmrc.c 4 Dec 2007 23:49:25 -0000 2.218
+++ rpm/lib/rpmrc.c 6 Dec 2007 14:47:49 -0000 2.219
@@ -482,9 +482,14 @@
addMacro(NULL, "_host_os", NULL, cvog->os, -1);
}
+#if defined(RPM_VENDOR_OPENPKG) /* explicit-platform */
+ /* do not use vendor and GNU attribution */
+ p = rpmExpand("%{_host_cpu}-%{_host_os}", NULL);
+#else
p = rpmExpand("%{_host_cpu}-%{_host_vendor}-%{_host_os}",
(cvog && *cvog->gnu ? "-" : NULL),
(cvog ? cvog->gnu : NULL), NULL);
+#endif
xx = mireAppend(RPMMIRE_STRCMP, 0, p, &mi_re, &mi_nre);
p = _free(p);
@@ -536,16 +541,77 @@
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies *arch, *os, rpmGlobalMacroContext, fileSystem, internalState @*/
{
+#if defined(RPM_VENDOR_OPENPKG) /* larger-utsname */
+ /* utsname fields on some platforms (like HP-UX) are very small
+ (just about 8 characters). This is too small for OpenPKG, so cheat! */
+ static struct utsname un_real;
+ static struct {
+ char sysname[32];
+ char nodename[32];
+ char release[32];
+ char version[32];
+ char machine[32];
+ } un;
+#else
static struct utsname un;
+#endif
static int gotDefaults = 0;
int rc;
while (!gotDefaults) {
CVOG_t cvog = NULL;
+#if defined(RPM_VENDOR_OPENPKG) /* larger-utsname */
+ const char *cp;
+#endif
+#if defined(RPM_VENDOR_OPENPKG) /* larger-utsname */
+ /* utsname fields on some platforms (like HP-UX) are very small
+ (just about 8 characters). This is too small for OpenPKG, so cheat! */
+ rc = uname(&un_real);
+ strncpy(un.sysname, un_real.sysname, sizeof(un.sysname)); un.sysname [sizeof(un.sysname) -1] = '\0';
+ strncpy(un.nodename, un_real.nodename, sizeof(un.nodename)); un.nodename[sizeof(un.nodename)-1] = '\0';
+ strncpy(un.release, un_real.release, sizeof(un.release)); un.release [sizeof(un.release) -1] = '\0';
+ strncpy(un.version, un_real.version, sizeof(un.version)); un.version [sizeof(un.version) -1] = '\0';
+ strncpy(un.machine, un_real.machine, sizeof(un.machine)); un.machine [sizeof(un.machine) -1] = '\0';
+#else
rc = uname(&un);
+#endif
if (rc < 0) return;
+#if defined(RPM_VENDOR_OPENPKG) /* platform-major-minor-only */
+ /* Reduce the platform version to major and minor version numbers */
+ {
+ char *cp;
+ char *cpR;
+ int n;
+ cpR = un.release;
+ if ((n = strcspn(cpR, "0123456789")) > 0)
+ cpR += n;
+ if ((n = strspn(cpR, "0123456789.")) > 0) {
+ /* terminate after "N.N.N...." prefix */
+ cpR[n] = '\0';
+ /* shorten to "N.N" if longer */
+ if ((cp = strchr(cpR, '.')) != NULL) {
+ if ((cp = strchr(cp+1, '.')) != NULL)
+ *cp = '\0';
+ }
+ strcat(un.sysname, cpR);
+ }
+ /* fix up machine hardware name containing white-space as it
+ happens to be on Power Macs running MacOS X */
+ if (!strncmp(un.machine, "Power Macintosh", 15))
+ sprintf(un.machine, "powerpc");
+ }
+#endif
+
+#if defined(RPM_VENDOR_OPENPKG) /* explicit-platform */
+ /* allow the path to the "platforms" file be overridden under run-time */
+ cp = rpmExpand("%{?__platform}", NULL);
+ if (cp == NULL || cp[0] == '\0')
+ cp = platform;
+ if (!rpmPlatform(cp)) {
+#else
if (!rpmPlatform(platform)) {
+#endif
const char * s;
gotDefaults = 1;
s = rpmExpand("%{?_host_cpu}", NULL);
@@ -562,6 +628,12 @@
s = _free(s);
}
+#if defined(RPM_VENDOR_OPENPKG) /* explicit-platform */
+ /* cleanup after above processing */
+ if (cp != NULL && cp != platform)
+ cp = _free(cp);
+#endif
+
if (configTarget && !parseCVOG(configTarget, &cvog) && cvog != NULL) {
gotDefaults = 1;
if (cvog->cpu && cvog->cpu[0] != '\0') {
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/transaction.c
============================================================================
$ cvs diff -u -r1.359 -r1.360 transaction.c
--- rpm/lib/transaction.c 3 Dec 2007 18:11:09 -0000 1.359
+++ rpm/lib/transaction.c 6 Dec 2007 14:47:49 -0000 1.360
@@ -660,8 +660,16 @@
int dc;
int i, j;
+#if defined(RPM_VENDOR_OPENPKG) /* allow-excludedocs-default */
+ /* The "%_excludedocs" macro is intended to set the _default_ if
+ both --excludedocs and --includedocs are not specified and it
+ is evaluated already before. So, do not override it here again,
+ because it would not allow us to make "%_excludedocs 1" the
+ default. */
+#else
if (!noDocs)
noDocs = rpmExpandNumeric("%{_excludedocs}");
+#endif
{ const char *tmpPath = rpmExpand("%{_netsharedpath}", NULL);
if (tmpPath && *tmpPath != '%')
@@ .
patch -p0 <<'@@ .'
Index: rpm/macros.in
============================================================================
$ cvs diff -u -r1.204 -r1.205 macros.in
--- rpm/macros.in 1 Dec 2007 17:54:00 -0000 1.204
+++ rpm/macros.in 6 Dec 2007 14:47:47 -0000 1.205
@@ -1,7 +1,7 @@
#/*! \page config_macros Default configuration: @USRLIBRPM@/macros
# \verbatim
#
-# $Id: macros.in,v 1.204 2007/12/01 17:54:00 afb Exp $
+# $Id: macros.in,v 1.205 2007/12/06 14:47:47 rse Exp $
#
# This is a global RPM configuration file. All changes made here will
# be lost when the rpm package is upgraded. Any per-system configuration
@@ -1182,6 +1182,32 @@
#%{__spec_clean_post}\
#%{nil}
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+# support %track script/section
+%__spec_track_shell %{___build_shell}
+%__spec_track_args %{___build_args}
+%__spec_track_cmd %{___build_cmd}
+%__spec_track_pre %{___build_pre}
+%__spec_track_body %{___build_body}
+%__spec_track_post %{___build_post}
+%__spec_track_template #!%{__spec_track_shell}\
+%{__spec_track_pre}\
+%{nil}
+#endif
+
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+# support %test script/section
+%__spec_test_shell %{___build_shell}
+%__spec_test_args %{___build_args}
+%__spec_test_cmd %{___build_cmd}
+%__spec_test_pre %{___build_pre}
+%__spec_test_body %{___build_body}
+%__spec_test_post %{___build_post}
+%__spec_test_template #!%{__spec_test_shell}\
+%{__spec_test_pre}\
+%{nil}
+#endif
+
%__spec_rmbuild_shell %{___build_shell}
%__spec_rmbuild_args %{___build_args}
%__spec_rmbuild_cmd %{___build_cmd}
@@ -1242,11 +1268,15 @@
%_build_cpu %{_host_cpu}
%_build_vendor %{_host_vendor}
%_build_os %{_host_os}
+#if !defined(RPM_VENDOR_OPENPKG) /* explicit-platform */
+# do not override the "_host*" macros because their value (derived
+# from the "platform" file) is already correctly set internally.
%_host @host@
%_host_alias @host_alias@%{nil}
%_host_cpu @host_cpu@
%_host_vendor @host_vendor@
%_host_os @host_os@
+#endif
%_target %{_host}
%_target_alias %{_host_alias}
%_target_cpu %{_host_cpu}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/db3.c
============================================================================
$ cvs diff -u -r1.81 -r1.82 db3.c
--- rpm/rpmdb/db3.c 19 Nov 2007 18:57:59 -0000 1.81
+++ rpm/rpmdb/db3.c 6 Dec 2007 14:47:50 -0000 1.82
@@ -1216,7 +1216,17 @@
const char * dbf = rpmGetPath(dbhome, "/__db.001", NULL);
/*@=mods@*/
+#if defined(RPM_VENDOR_OPENPKG) /* bdb-allow-zero-sized-files */
+ /* Make sure RPM passes DB_CREATE to Berkeley-DB also
+ if file exists, but is (still) zero-sized. */
+ struct stat sb;
+ long size = -1;
+ if (stat(dbf, &sb) == 0)
+ size = (long)sb.st_size;
+ if (access(dbf, F_OK) == -1 || size == 0) {
+#else
if (access(dbf, F_OK) == -1) {
+#endif
/* ... non-existent (or unwritable) DBENV, will create ... */
dbi->dbi_oeflags |= DB_CREATE;
dbi->dbi_eflags &= ~DB_JOINENV;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/hdrNVR.c
============================================================================
$ cvs diff -u -r1.39 -r1.40 hdrNVR.c
--- rpm/rpmdb/hdrNVR.c 26 Nov 2007 02:03:10 -0000 1.39
+++ rpm/rpmdb/hdrNVR.c 6 Dec 2007 14:47:50 -0000 1.40
@@ -186,6 +186,12 @@
he->p.ptr = _free(he->p.ptr);
}
if (ap) {
+#if !defined(RPM_VENDOR_OPENPKG) /* no-architecture-expose */
+ /* do not expose the architecture as this is too less
+ information, as in OpenPKG the "platform" is described by the
+ architecture+operating-system combination. But as the whole
+ "platform" information is actually overkill, just revert to the
+ RPM 4 behaviour and do not expose any such information at all. */
he->tag = RPMTAG_ARCH;
/*@-observertrans -readonlytrans@*/
if (!headerIsEntry(h, he->tag))
@@ -199,6 +205,7 @@
&& he->t == RPM_STRING_TYPE && he->c == 1)
*ap = xstrdup(he->p.str);
else
+#endif
*ap = NULL;
he->p.ptr = _free(he->p.ptr);
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/hdrfmt.c
============================================================================
$ cvs diff -u -r1.52 -r1.53 hdrfmt.c
--- rpm/rpmdb/hdrfmt.c 4 Dec 2007 17:08:36 -0000 1.52
+++ rpm/rpmdb/hdrfmt.c 6 Dec 2007 14:47:50 -0000 1.53
@@ -1487,14 +1487,30 @@
if (N) nb += strlen(N);
if (V) nb += strlen(V) + 1;
if (R) nb += strlen(R) + 1;
+#if defined(RPM_VENDOR_OPENPKG) /* no-architecture-expose */
+ /* do not expose the architecture as this is too less
+ information, as in OpenPKG the "platform" is described by the
+ architecture+operating-system combination. But as the whole
+ "platform" information is actually overkill, just revert to the
+ RPM 4 behaviour and do not expose any such information at all. */
+#else
if (A) nb += strlen(A) + 1;
+#endif
nb++;
NVRA = t = xmalloc(nb);
*t = '\0';
if (N) t = stpcpy(t, N);
if (V) t = stpcpy( stpcpy(t, "-"), V);
if (R) t = stpcpy( stpcpy(t, "-"), R);
+#if defined(RPM_VENDOR_OPENPKG) /* no-architecture-expose */
+ /* do not expose the architecture as this is too less
+ information, as in OpenPKG the "platform" is described by the
+ architecture+operating-system combination. But as the whole
+ "platform" information is actually overkill, just revert to the
+ RPM 4 behaviour and do not expose any such information at all. */
+#else
if (A) t = stpcpy( stpcpy(t, "."), A);
+#endif
N = _free(N);
V = _free(V);
R = _free(R);
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmtag.h
============================================================================
$ cvs diff -u -r1.24 -r1.25 rpmtag.h
--- rpm/rpmdb/rpmtag.h 5 Dec 2007 11:57:18 -0000 1.24
+++ rpm/rpmdb/rpmtag.h 6 Dec 2007 14:47:50 -0000 1.25
@@ -404,9 +404,20 @@
RPMTAG_RPMLIBVERSION = 1199, /* i */
RPMTAG_RPMLIBTIMESTAMP = 1200, /* i */
RPMTAG_RPMLIBVENDOR = 1201, /* i */
+#if defined(RPM_VENDOR_OPENPKG) /* extra-header-class */
+ /* support "Class" tag/header */
RPMTAG_CLASS = 1202, /* s (OpenPKG Class: placeholder) */
+#endif
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%track" script/section */
RPMTAG_TRACK = 1203, /* s (OpenPKG %track) */
RPMTAG_TRACKPROG = 1204, /* s */
+#endif
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-test */
+ /* support "%test" script/section */
+ RPMTAG_TEST = 1205, /* s */
+ RPMTAG_TESTPROG = 1206, /* s */
+#endif
/*@-enummemuse@*/
RPMTAG_FIRSTFREE_TAG /*!< internal */
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/macro.c
============================================================================
$ cvs diff -u -r2.154 -r2.155 macro.c
--- rpm/rpmio/macro.c 19 Nov 2007 18:57:59 -0000 2.154
+++ rpm/rpmio/macro.c 6 Dec 2007 14:47:51 -0000 2.155
@@ -130,7 +130,14 @@
#define MACRO_CHUNK_SIZE 16
/* Size of expansion buffers. */
+#if defined(RPM_VENDOR_OPENPKG) /* fixed-size-macro-buffer */
+/* Don't use the stdio variable BUFSIZ because it is of unknown size.
+ Usually, it is just 1024 on some platforms but on Linux it can be
+ even 8192. Use a fixed 16KB buffer in OpenPKG for now. */
+static size_t _macro_BUFSIZ = 16 * 1024;
+#else
static size_t _macro_BUFSIZ = 4 * BUFSIZ;
+#endif
/* forward ref */
static int expandMacro(MacroBuf mb)
@@ -1176,6 +1183,9 @@
buf[gn] = '\0';
(void) expandU(mb, buf, bufn);
}
+#if defined(RPM_VENDOR_OPENPKG) /* patch-as-plain-macro */
+#define NOTYET
+#endif
#if defined(NOTYET) /* XXX change needs parsePrep and macros changes too */
if (fn > 5 && STREQ("patch", f, 5) && xisdigit(f[5])) {
/* Skip leading zeros */
@@ -1186,6 +1196,9 @@
*be = '\0';
} else
#endif
+#if defined(RPM_VENDOR_OPENPKG) /* patch-as-plain-macro */
+#undef NOTYET
+#endif
if (STREQ("basename", f, fn)) {
if ((b = strrchr(buf, '/')) == NULL)
b = buf;
@@ -1485,7 +1498,13 @@
STREQ("error", f, fn)) {
int waserror = 0;
if (STREQ("error", f, fn))
+#if defined(RPM_VENDOR_OPENPKG) /* stop-on-error-macro */
+ /* Make sure that an %{error:<msg>} macro really stops further
+ processing. Else it would be nothing more than a %{warn:<msg>}. */
+ waserror = 1, rc = 1;
+#else
waserror = 1;
+#endif
if (g != NULL && g < ge)
doOutput(mb, waserror, g, gn);
else
@@ -1541,7 +1560,11 @@
}
#endif
+#if defined(RPM_VENDOR_OPENPKG) /* patch-as-plain-macro */
+#define NOTYET
+#endif
#if defined(NOTYET) /* XXX change needs parsePrep and macros changes too */
+ /* enable for OpenPKG */
/* Rewrite "%patchNN ..." as "%patch -P NN ..." and expand. */
if (lastc != NULL && fn > 5 && STREQ("patch", f, 5) && xisdigit(f[5])) {
/*@-internalglobs@*/ /* FIX: verbose may be set */
@@ -1551,6 +1574,9 @@
continue;
}
#endif
+#if defined(RPM_VENDOR_OPENPKG) /* patch-as-plain-macro */
+#undef NOTYET
+#endif
/* XXX necessary but clunky */
if (STREQ("basename", f, fn) ||
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmqv.c
============================================================================
$ cvs diff -u -r1.127 -r1.128 rpmqv.c
--- rpm/rpmqv.c 7 Oct 2007 14:00:12 -0000 1.127
+++ rpm/rpmqv.c 6 Dec 2007 14:47:47 -0000 1.128
@@ -149,7 +149,12 @@
/*@globals rpmEVR, fileSystem @*/
/*@modifies *fp, fileSystem @*/
{
+#if defined(RPM_VENDOR_OPENPKG) /* branding */
+ /* use OpenPKG branding */
+ fprintf(fp, _("OpenPKG RPM %s\n"), rpmEVR);
+#else
fprintf(fp, _("RPM version %s\n"), rpmEVR);
+#endif
}
static void printUsage(poptContext con, FILE * fp, int flags)
@@ -639,7 +644,22 @@
/*@innerbreak@*/ break;
case 's':
ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
+#if defined(RPM_VENDOR_OPENPKG) /* no-deps-on-build-srpms */
+ /* enforce no dependency checking when rolling a source RPM */
+ ba->noDeps = 1;
+#endif
/*@innerbreak@*/ break;
+#if defined(RPM_VENDOR_OPENPKG) /* extra-section-track */
+ /* support extracting the "%track" script/section */
+ case 't':
+ ba->buildAmount |= RPMBUILD_TRACK;
+ /* enforce no dependency checking and expansion of %setup, %patch and %prep macros */
+ ba->noDeps = 1;
+ rpmDefineMacro(NULL, "setup #", RMIL_CMDLINE);
+ rpmDefineMacro(NULL, "patch #", RMIL_CMDLINE);
+ rpmDefineMacro(NULL, "prep %%prep", RMIL_CMDLINE);
+ /*@innerbreak@*/ break;
+#endif
}
if (!poptPeekArg(optCon)) {
@@ .
Received on Thu Dec 6 15:47:51 2007