rpm-spec

Can I use rpm to expand the macros in a specfile?

穿精又带淫゛_ 提交于 2019-12-03 05:49:18
问题 The concrete example being I have lots of specfiles with Source0 : or other Source lines containing macros. How can I have these macros expanded without actually starting a build on the specfile or writing my own parser? 回答1: You could grep to get the Source lines, sed to extract the string containing the macro and then rpm --eval 'string' to evaluate it. Note that this will only expand the global macros, not the ones defined in this spec. To expand those as well you'd probably need to grep

How do I get rpmbuild to download all of the sources for a particular .spec?

三世轮回 提交于 2019-12-03 01:14:47
I am adding some sources to an existing rpm .spec file by URL and don't have them downloaded yet. Is there a way to get rpmbuild to download the sources rather than doing it manually? joeforker The spectool utility from the rpmdevtools package can do this. Just install rpmdevtools and point spectools at the .spec like so: spectool -g -R SPECS/nginx.spec It will download any missing sources into rpm's %{_sourcedir} (usually SOURCES ) directory. For posterity, there is another way to do it, which does not need any additional tools or downloads: rpmbuild --undefine=_disable_source_fetch -ba /path

Build RPM to just install files

扶醉桌前 提交于 2019-12-02 23:13:06
I need to build a RPM, with the sole purpose of installing a few fonts. I have read several tutorials about that, however everyone seems to suggests something different and I haven't been able to find something like a very basic setup to do that. Is it possible to just reference the files within the %files section of the spec? I tried however, rpm always tries to find the files within the tmp directory. Do I need to add a specific build step that copies everything I need to the tmp directory? Should these files go into the SOURCE or the BUILD directory when building the rpm? I have been

RPM spec file - Is it possible to dynamically populate a spec file variable

巧了我就是萌 提交于 2019-12-02 21:56:43
I have a spec file. I need to %define a spec variable that gets its value from a one line file on the system. For example %define path `cat /home/user/path_file` and in path_file is one line /var/www/html/hosts This partially works. I say that begins in the RPM BUILD output sometimes the value of ${path} is literally my command cat /home/user/path_file and sometimes the value is the line in the path_file (/var/www/html/hosts) as it should be? You can define rpmbuild variables with %(cmd) at the top of the spec file. Notice the command is in parenthesis, not curly brackets. An example: %define

building RPM package: force to install in path of a dependent relocated package

自闭症网瘾萝莉.ら 提交于 2019-12-02 09:03:07
问题 I have 2 dependent packages who should be placed in the same target. Package B is dependent on package A. Package A can be relocated to any another location. I now want package B forced to be placed in the same target as package A. Or simply, package B should not be able to install without the same --prefix. Any ideas how to acieve this? I thought of putting a %pre script to check this. But thats not helpful I think, since I can't read the given "prefix" in this script - or can I? Thank you

How to create many sub packages automatically in rpm spec

ぐ巨炮叔叔 提交于 2019-12-02 08:40:54
The number of sub-packages I want to create are so many (about 300 over). I think.. to make the sub-package, the files should be installed (%install) early. So I installed whole files to some specific directories. Now I want to pack the file for each directory name. in summaries, Is it possible to repeat rpm macros? (ex, %package %description %files) If it's possible, what should I use to repeat? (ex for ??) As I know, to use %files macro, the real files should be installed previously. then where should I write the codes? Natively, no there isn't. You'll have to use an external templating

RPM: returning values from included RPM macro

泪湿孤枕 提交于 2019-12-02 05:55:13
问题 This is a follow-up question to RPM: loading bash script in %pre scriptlet. I am trying to define some utility functions as macros, so later I can %include them when building other RPM packages too. Let's say I want to have a function testfunc() which I want use to check if something is present on the target system. If the condition is unmet, I want to break the execution of my RPM %pre scriptlet. Things I've tried: Defining a bash function in the macro common.spec %define importfunction()

building RPM package: force to install in path of a dependent relocated package

↘锁芯ラ 提交于 2019-12-02 02:47:55
I have 2 dependent packages who should be placed in the same target. Package B is dependent on package A. Package A can be relocated to any another location. I now want package B forced to be placed in the same target as package A. Or simply, package B should not be able to install without the same --prefix. Any ideas how to acieve this? I thought of putting a %pre script to check this. But thats not helpful I think, since I can't read the given "prefix" in this script - or can I? Thank you for your help! Hah. So I did a bit of source diving and discovered that apparently (at least for rpm 4.8

How to abort the installation of an rpm package if some conditions are not met in specfile?

时间秒杀一切 提交于 2019-12-02 01:41:07
There are some more things that the Requires tag does not satisfy. So i wrote a script to verify these things but where do I place them ? And if not found then i want to quit installation prompting user to do the steps before attempting to install this rpm again. writing exit 1 in %install tag fails to build the rpm using rpmbuild. says %install has a bad exit code. EDIT: let me provide you an example. What i initially wanted to test was is if Oracle Java 6 is present. If not then provide the path to Java6. If user fails to provide one ... exit the RPM. Higher Java is not allowed and

What does the || : in this line of bash script from an rpm spec file do?

梦想的初衷 提交于 2019-12-01 19:00:53
ln -s /var/log/$SERVICE_NAME $RPM_INSTALL_PREFIX/logs || : In the rpm spec file every line ends with || : What is the significance of the || : and why is it there? It causes any error to be ignored so that the rpm operation isn't canceled. || causes the next command to run if the previous command failed, and : always succeeds. It swallows the exit code. || does the thing after it if the thing before it fails (i.e., has a non-zero exit code). : is the “do nothing” command. Put them together… bash-o-logist `||` is OR operator. `:` means "do nothing". Your statement says, "do the soft linking or