[SOLUTION] Fwd: automatically modifying scriptlets (included files) at package build time

Ralf Corsepius rc040203 at freenet.de
Tue Mar 18 13:57:17 UTC 2008


On Tue, 2008-03-18 at 15:34 +0200, Eddy Petrișor wrote:
> Hello,
> 
> I just want to let you know I discovered the solution to my problem.
> 
> 
> Is as simple as adding something after the %setup command in the %prep section:
> 
> Index: SPECS/common.spec
> ===================================================================
> --- SPECS/common.spec   (revision 2033)
> +++ SPECS/common.spec   (revision 2034)
> @@ -29,6 +29,9 @@
> 
>  %prep
>  %setup -n common
> +. common.inf && export THISVER="`echo "$VERS.$SUBVERS.$RELEASE" | tr -s '.'`"
> +sed -i "s#^THISVER=.*#THISVER=$THISVER#" %{SOURCE101}
> +sed -i "s#^THISVER=.*#THISVER=$THISVER#" %{SOURCE102}
This way you are modifying your sources-files.

This is bad for 2 closely related reasons:
- Sources should be considered read-only in general.
- This is likely to break on "repeated runs": A previous run modified
your sources in such a way, your next rpmbuild run is not unlikely to
fail.

You will want to work on copies of your SOURCEX's instead of SOURCEX
directly.

Ralf






More information about the fedora-devel-list mailing list