Mandrake Linux Archives: cooker@mandrivalinux.org

Mandrake Linux: cooker@mandrivalinux.org


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

  • From: Olivier Thauvin
  • Subject: [Cooker] from connectiva rpm macros rpm -b? --without SECTION
  • Date: 8 Jun 2005 09:58:59 -0000

Based on an connectiva idea, I will add in next rpm-mandriva-setup these 
macros to allow to build rpm with skipping of arbitrary build section:

%prep %{?_without_prep:%define __spec_prep_cmd /bin/true\
%%prep\
%{warn:Skipping %%prep stage\
}}%{?!_without_prep:%%prep}

%build %{?_without_build:%define __spec_build_cmd /bin/true\
%%build\
%{warn:Skipping %%build stage\
}}%{?!_without_build:%%build}

%install %{?_without_install:%define __spec_install_cmd /bin/true\
%%install\
%{warn:Skipping %%install stage\
}}%{?!_without_install:%%install}

%check %{?_without_check:%define __spec_check_cmd /bin/true\
%%check\
%{warn:Skipping %%check stage\
}}%{?!_without_check:%%check}

You can put this line into your .rpmmacros to test waiting the next 
rpm-mandriva-setup.
Of course this need some explanation :)

At beggining was the spec file:

[...]
%build
%make
[...]

When rpm parse this, it try first to expand macros:
%build => %build (macro don't exist)
%make => make
Result:

%build
make

When the build stage time arrive, it reparse the spec to find the beginning of 
the section (aka %build).

So we can use this behaviour to replace on the fly %SECTION, of course the 
replacement should rewrite %SECTION it self.

My evil macros check is --without section is given as option, if yes, it 
redifined the shell to execute to run the script to /bin/true, in addition I 
add warning.

In a nutshell, --without SECTION will skip the SECTION.

The result is:

$ rpm -bb --without prep --without build emptypackage.spec
Skipping %prep stage
Skipping %build stage
Exécution_de(%prep): /bin/true /home/olivier/rpm/tmp/rpm-tmp.29560
Exécution_de(%build): /bin/true /home/olivier/rpm/tmp/rpm-tmp.29560
Exécution_de(%install): /bin/sh -e /home/olivier/rpm/tmp/rpm-tmp.29560
+ umask 022
+ cd /home/olivier/rpm/BUILD
ect...

Comments and feed back welcome.

I am looking to integrate other macros.

Attachment: pgp00046.pgp
Description: PGP signature



Date Index | Thread Index

Search the archive:



To (un)subscribe from/to the lists:

Sympa mailing lists server.





Fund the Mandriva Linux project

Looking for a job?