[Rpm-maint] Conditional creation of subpackages

Jacek Bukarewicz j.bukarewicz at samsung.com
Tue Sep 24 16:31:51 UTC 2013


Hi,

In our project we maintain lots of rpm packages. In order to make 
maintenance easier we intend to automate generation of subpackages 
(containing translation files for instance). We try to do it by having 
slightly modified version of rpm which "puts" relevant sections in spec 
files of all used projects (by adding and modifying rpm macros - spec 
files of individual packages contain no information about autogenerated 
subpackages).
Basically what these modifications do is:
  - for every package find-lang.sh script is implicitly invoked
  - every package contains implicit %package locale section with -f 
parameter pointing to generated language file list

One problem we encountered is that not every package has translation 
files so language subpackage shouldn't always be created. Currently, 
empty subpackage is generated when there are no translations.
In other words we'd like to create packages conditionally depending on 
whether suitable files exist in given package. We cannot do it by using 
rpm conditionals as decision whether such package should be created can 
only be done after processing %build section.
Problem could be solved by introduction of a new option to %package 
section which would tell rpm to create subpackage only if it's not 
empty. I'm attaching proposed implementation. Please take a look and 
tell if it's acceptable.

I would also be grateful for alternatives to proposed solution that 
would solve our problem (automatic generation of subpackages based on 
some file patterns), especially if you dislike the idea of having a new 
option in %package section :)

Thanks

-- 
Jacek Bukarewicz
Samsung R&D Institute Poland
Samsung Electronics
j.bukarewicz at samsung.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rpm-optional.diff
Type: text/x-patch
Size: 5473 bytes
Desc: not available
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20130924/fbcc7a73/attachment.bin>


More information about the Rpm-maint mailing list