maven rpm plugin: create empty rpm

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

maven rpm plugin: create empty rpm

Lezz Giles

I have a top-level project with children modules.  Three of the children modules create rpms, so I want the top-level project to create an empty rpm with ‘requires’ for these three rpms.  The relevant part of my pom.xml is…

 

                                                <build><plugins><plugin>

                                                                <groupId>org.codehaus.mojo</groupId>

                                                                <artifactId>rpm-maven-plugin</artifactId>

                                                                <configuration>

                                                                                <name>eso</name>

                                                                                <requires>

                                                                                                <require>eso-webapp</require>

                                                                                                <require>eso-core</require>

                                                                                                <require>eso-dbtools</require>

                                                                                </requires>

                                                                                <mappings>

                                                                                </mappings>

                                                                </configuration>

                                                </plugin></plugins></build>

 

Other settings for the plugin are in <pluginManagement>.

 

I tried creating this without the <mappings> section, but it complained that <mappings> didn’t exist, so I created the empty <mappings>, but now rpmbuild dies because the plugin-generated spec file contains this…

 

%install

if [ -e $RPM_BUILD_ROOT ];

then

  mv /home/lezz.giles/osa/target/rpm/eso/tmp-buildroot/* $RPM_BUILD_ROOT

else

  mv /home/lezz.giles/osa/target/rpm/eso/tmp-buildroot $RPM_BUILD_ROOT

fi

 

…which is a problem because tmp-buildroot contains no files, and so (long story short) tmp-buildroot/* upsets shell and causes it to die.

 

One solution is to check explicitly for no <mapping> elements and to generate an appropriate %install section.

 

I can’t believe I’m the first maven rpm user to want to do this, so if there is a proper way to get an empty rpm that would be good to know. I think my workaround in the short term will be to have a dummy file installed by the rpm, just to keep it happy.



This email and attachments may contain privileged or confidential information intended only for the addressee(s) indicated. The sender does not waive any of its rights, privileges or protections respecting this information. If you are not the named addressee, an employee, or agent responsible for sending this message to the named addressee (or this message was received by mistake), you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If received in error, please notify us immediately by e-mail, discard any paper copies and delete all electronic files of the email.

Computer viruses can be transmitted via email. The recipient should check this email and any attachments for viruses. Email transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender accepts no liability for any damage caused by any transmitted viruses or errors or omissions in the contents of this message.

Overture Networks, Inc. 637 Davis Drive, Morrisville, NC USA 27560 www.overturenetworks.com
Reply | Threaded
Open this post in threaded view
|

Re: maven rpm plugin: create empty rpm

Anders Hammar
Can't help you much with the rpm stuff, but you should move this generation of an empty rpm package to a separate module. Doing it in the parent/aggregation project is not correct out of a Maven perspective.

Also, if you think your use case is fair you should file a JIRA ticket for your issue. That will increase the likelihood of it being fixed. Providing a patch will increase it even more....:-)

/Anders


On Fri, Aug 2, 2013 at 10:11 PM, Lezz Giles <[hidden email]> wrote:

I have a top-level project with children modules.  Three of the children modules create rpms, so I want the top-level project to create an empty rpm with ‘requires’ for these three rpms.  The relevant part of my pom.xml is…

 

                                                <build><plugins><plugin>

                                                                <groupId>org.codehaus.mojo</groupId>

                                                                <artifactId>rpm-maven-plugin</artifactId>

                                                                <configuration>

                                                                                <name>eso</name>

                                                                                <requires>

                                                                                                <require>eso-webapp</require>

                                                                                                <require>eso-core</require>

                                                                                                <require>eso-dbtools</require>

                                                                                </requires>

                                                                                <mappings>

                                                                                </mappings>

                                                                </configuration>

                                                </plugin></plugins></build>

 

Other settings for the plugin are in <pluginManagement>.

 

I tried creating this without the <mappings> section, but it complained that <mappings> didn’t exist, so I created the empty <mappings>, but now rpmbuild dies because the plugin-generated spec file contains this…

 

%install

if [ -e $RPM_BUILD_ROOT ];

then

  mv /home/lezz.giles/osa/target/rpm/eso/tmp-buildroot/* $RPM_BUILD_ROOT

else

  mv /home/lezz.giles/osa/target/rpm/eso/tmp-buildroot $RPM_BUILD_ROOT

fi

 

…which is a problem because tmp-buildroot contains no files, and so (long story short) tmp-buildroot/* upsets shell and causes it to die.

 

One solution is to check explicitly for no <mapping> elements and to generate an appropriate %install section.

 

I can’t believe I’m the first maven rpm user to want to do this, so if there is a proper way to get an empty rpm that would be good to know. I think my workaround in the short term will be to have a dummy file installed by the rpm, just to keep it happy.



This email and attachments may contain privileged or confidential information intended only for the addressee(s) indicated. The sender does not waive any of its rights, privileges or protections respecting this information. If you are not the named addressee, an employee, or agent responsible for sending this message to the named addressee (or this message was received by mistake), you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If received in error, please notify us immediately by e-mail, discard any paper copies and delete all electronic files of the email.

Computer viruses can be transmitted via email. The recipient should check this email and any attachments for viruses. Email transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender accepts no liability for any damage caused by any transmitted viruses or errors or omissions in the contents of this message.

Overture Networks, Inc. 637 Davis Drive, Morrisville, NC USA 27560 www.overturenetworks.com