This patch likely needs a warning ...
I've added a lazy "mkdir -p %{buildroot}" to
the automagic inserted at the beginning of %install.
Here's what happens building my typical test case, the "time" package:
Executing(%install): /bin/sh -e /X/tmp/rpm-tmp.49918
+ umask 022
+ cd /X/time
+ /bin/rm -rf /X/tmp/time-root
+ /bin/mkdir -p /X/tmp/time-root
+ cd time-1.7
+ rm -rf /X/tmp/time-root
+ make install DESTDIR=/X/tmp/time-root
Note that %{buildroot} is cleaned twiice.
(aside) Which means everything is in place to remove the "standard"
packaging boilerplate at the beginning of the %install build scriptlet
that tries to trash-and-burn any pre-existing %{buildroot}. Not
that anyone is going to be brave enough to permit rpm to
automate %{buildroot} handling, judging from past experience, it
will be another decade or more before any vendor deviates
from what they have always done. That ain't my rpm problem any more ...
OTOH, the change is highly likely to break odd-ball packaging
like what is usually found in vendor kernel packages, which typically
are working at cross-purposes with rpmbuild anyways, attempting to loop
over multiple builds for arches (and xen and ...) with some weird
%buildroot trickery.
Note that %_spec_install_pre is just a macro, you can redefine
to %{nil} and do whatever you please, in kernel.spec.
Or just blame me for introducing "incompatibilities" and "useless
features"
in rpm-5.0, that works just fine too.
73 de Jeff
On Dec 17, 2007, at 12:44 PM, Jeff Johnson wrote:
> RPM Package Manager, CVS Repository
> http://rpm5.org/cvs/
>
> ______________________________________________________________________
> ______
>
> Server: rpm5.org Name: Jeff Johnson
> Root: /v/rpm/cvs Email: jbj@rpm5.org
> Module: rpm Date: 17-Dec-2007
> 18:44:53
> Branch: HEAD Handle: 2007121717445200
>
> Modified files:
> rpm CHANGES TODO macros.in
> rpm/build parseBuildInstallClean.c parseChangelog.c
> parseDescription.c parseFiles.c
> parsePrep.c
> parseScript.c
>
> Log:
> - start using rpmParseState typedef rather than int.
> - fix: explicitly add mkdir -p to spec_install_pre.
>
> Summary:
> Revision Changes Path
> 1.1995 +2 -0 rpm/CHANGES
> 1.88 +0 -2 rpm/TODO
> 2.29 +2 -2 rpm/build/parseBuildInstallClean.c
> 2.42 +1 -1 rpm/build/parseChangelog.c
> 2.35 +1 -1 rpm/build/parseDescription.c
> 2.32 +1 -1 rpm/build/parseFiles.c
> 2.106 +2 -1 rpm/build/parsePrep.c
> 2.60 +1 -1 rpm/build/parseScript.c
> 1.213 +2 -2 rpm/macros.in
>
> ______________________________________________________________________
> ______
>
> patch -p0 <<'@@ .'
> Index: rpm/CHANGES
>
> ======================================================================
> ======
> $ cvs diff -u -r1.1994 -r1.1995 CHANGES
> --- rpm/CHANGES 17 Dec 2007 17:13:52 -0000 1.1994
> +++ rpm/CHANGES 17 Dec 2007 17:44:52 -0000 1.1995
> @@ -1,4 +1,6 @@
> 5.0b2 -> 5.0b3:
> + - jbj: start using rpmParseState typedef rather than int.
> + - jbj: fix: explicitly add mkdir -p to spec_install_pre.
> - jbj: explicitly compare against PART_NONE, avoid RPMRC_FOO
> collisions.
> - jbj: fold in patch-as-plain-macro changes.
> - jbj: fix some minor memory leaks.
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/TODO
>
> ======================================================================
> ======
> $ cvs diff -u -r1.87 -r1.88 TODO
> --- rpm/TODO 16 Dec 2007 21:58:54 -0000 1.87
> +++ rpm/TODO 17 Dec 2007 17:44:52 -0000 1.88
> @@ -62,8 +62,6 @@
> - jbj: finish --trust with --import (or punt to 5.1).
> - jbj: add build script templates for install scriptlets (or
> punt to 5.1).
> - jbj: change RPM_I18NSTRING_TYPE wiring to use arbitrary tag.
> - - jbj: add lazy mkdir -p to handle packaging pathologies
> like in
> - devtool-test.spec (no mkdir -p in %install).
> - jbj: Mandriva perl-URPM "make test" indicates a problem
> querying binary
> package headers that would be produced by a spec file.
> Dvalin has found that reverting this patch
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/build/parseBuildInstallClean.c
>
> ======================================================================
> ======
> $ cvs diff -u -r2.28 -r2.29 parseBuildInstallClean.c
> --- rpm/build/parseBuildInstallClean.c 17 Dec 2007 17:13:52 -0000
> 2.28
> +++ rpm/build/parseBuildInstallClean.c 17 Dec 2007 17:44:52 -0000
> 2.29
> @@ -12,7 +12,7 @@
>
> int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
> {
> - int nextPart;
> + rpmParseState nextPart;
> StringBuf *sbp = NULL;
> const char *name = NULL;
> rpmRC rc;
> @@ -44,7 +44,7 @@
>
> /* Make sure the buildroot is removed where needed. */
> if (parsePart == PART_INSTALL) {
> - const char * s = rpmExpand("%{!?__spec_install_pre:%{?
> buildroot:rm -rf '%{buildroot}'\n}}\n", NULL);
> + const char * s = rpmExpand("%{!?__spec_install_pre:%{?buildroot:
> %{__rm} -rf '%{buildroot}'\n%{__mkdir_p} '%{buildroot}'\n}}\n", NULL);
> if (s && *s)
> appendStringBuf(*sbp, s);
> s = _free(s);
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/build/parseChangelog.c
>
> ======================================================================
> ======
> $ cvs diff -u -r2.41 -r2.42 parseChangelog.c
> --- rpm/build/parseChangelog.c 17 Dec 2007 17:13:52 -0000 2.41
> +++ rpm/build/parseChangelog.c 17 Dec 2007 17:44:52 -0000 2.42
> @@ -260,7 +260,7 @@
>
> int parseChangelog(Spec spec)
> {
> - int nextPart;
> + rpmParseState nextPart;
> StringBuf sb = newStringBuf();
> rpmRC rc;
>
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/build/parseDescription.c
>
> ======================================================================
> ======
> $ cvs diff -u -r2.34 -r2.35 parseDescription.c
> --- rpm/build/parseDescription.c 17 Dec 2007 17:13:52 -0000 2.34
> +++ rpm/build/parseDescription.c 17 Dec 2007 17:44:52 -0000 2.35
> @@ -31,7 +31,7 @@
> /*@globals name, lang @*/
> /*@modifies name, lang @*/
> {
> - int nextPart = RPMRC_FAIL; /* assume error */
> + rpmParseState nextPart = RPMRC_FAIL; /* assume error */
> StringBuf sb;
> int flag = PART_SUBNAME;
> Package pkg;
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/build/parseFiles.c
>
> ======================================================================
> ======
> $ cvs diff -u -r2.31 -r2.32 parseFiles.c
> --- rpm/build/parseFiles.c 17 Dec 2007 17:13:52 -0000 2.31
> +++ rpm/build/parseFiles.c 17 Dec 2007 17:44:52 -0000 2.32
> @@ -26,7 +26,7 @@
>
> int parseFiles(Spec spec)
> {
> - int nextPart;
> + rpmParseState nextPart;
> Package pkg;
> int rc, argc;
> int arg;
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/build/parsePrep.c
>
> ======================================================================
> ======
> $ cvs diff -u -r2.105 -r2.106 parsePrep.c
> --- rpm/build/parsePrep.c 17 Dec 2007 17:13:52 -0000 2.105
> +++ rpm/build/parsePrep.c 17 Dec 2007 17:44:52 -0000 2.106
> @@ -750,7 +750,8 @@
>
> int parsePrep(Spec spec, int verify)
> {
> - int nextPart, res, rc;
> + rpmParseState nextPart;
> + int res, rc;
> StringBuf sb;
> char **lines, **saveLines;
> char *cp;
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/build/parseScript.c
>
> ======================================================================
> ======
> $ cvs diff -u -r2.59 -r2.60 parseScript.c
> --- rpm/build/parseScript.c 17 Dec 2007 17:13:52 -0000 2.59
> +++ rpm/build/parseScript.c 17 Dec 2007 17:44:52 -0000 2.60
> @@ -93,7 +93,7 @@
> int flag = PART_SUBNAME;
> Package pkg;
> StringBuf sb = NULL;
> - int nextPart;
> + rpmParseState nextPart;
> char reqargs[BUFSIZ];
>
> int argc;
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/macros.in
>
> ======================================================================
> ======
> $ cvs diff -u -r1.212 -r1.213 macros.in
> --- rpm/macros.in 16 Dec 2007 21:48:22 -0000 1.212
> +++ rpm/macros.in 17 Dec 2007 17:44:52 -0000 1.213
> @@ -1,7 +1,7 @@
> #/*! \page config_macros Default configuration: @USRLIBRPM@/macros
> # \verbatim
> #
> -# $Id: macros.in,v 1.212 2007/12/16 21:48:22 jbj Exp $
> +# $Id: macros.in,v 1.213 2007/12/17 17:44:52 jbj 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
> @@ -1128,7 +1128,7 @@
> %__spec_install_args %{___build_args}
> %__spec_install_cmd %{___build_cmd}
> %__spec_install_pre %{___build_pre}\
> -%{?buildroot:%{__rm} -rf '%{buildroot}'}
> +%{?buildroot:%{__rm} -rf '%{buildroot}'; %{__mkdir_p} '%
> {buildroot}'}
> %__spec_install_body %{___build_body}
> %__spec_install_post\
> %{?__debug_package:%{__debug_install_post}}\
> @@ .
> ______________________________________________________________________
> RPM Package Manager http://rpm5.org
> CVS Sources Repository rpm-cvs@rpm5.org
Received on Mon Dec 17 18:56:31 2007