Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPM %define support attempt #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ncolton
Copy link

@ncolton ncolton commented Feb 20, 2013

I can't claim I fully know what I'm doing, but some hacking on the code resulted in what appears to not break things, as the tests pass Let me know your thoughts?

To use the %define support, add in a defineStatements tag with define tags specifying the values to use for %define lines:

<configuration>
  <rpm>
    <defineStatements>
      <define>_source_filedigest_algorithm md5</define>
      <define>_binary_filedigest_algorithm md5</define>
      <define>_source_payload w9.gzdio</define>
      <define>_binary_payload w9.gzdio</define>
    </defineStatements>
...
</configuration>

Added support for %define lines in the RPM spec file. To use them, add in a defineStatements tag with define tags specifying the values to use for %define lines:
<configuration>
  <rpm>
    <defineStatements>
      <define>_source_filedigest_algorithm md5</define>
      <define>_binary_filedigest_algorithm md5</define>
      <define>_source_payload w9.gzdio</define>
      <define>_binary_payload w9.gzdio</define>
    </defineStatements>
...
</configuration>
@trygvis
Copy link
Owner

trygvis commented Feb 20, 2013

That seems like a reasonable approach. I'm not very used to RPM stuff, but I'm wondering if it might better to have a simple include mechanism so people can include anything into the spec file? Something like:

<rpm>
  <fragments>
    <fragment>src/main/unix/fragment/woot</fragment>
  </fragments>
</rpm>

It makes it possible to add any kind of stuff they want.

@ncolton
Copy link
Author

ncolton commented Feb 20, 2013

Including an external file makes a LOT of sense for the %pre, %prep, %post, %install, etc. script sections, as having those inside the pom would be painful.

SpecFile.java has what looks to be the necessary pieces in it already for nearly all the valid portions of an RPM SPEC file, but there aren't any means of getting values from the pom file through the plugin so that they can be used. As it was already there, I tried to do the minimum amount of code to reasonably expose the mechanism for setting %define values.

@trygvis
Copy link
Owner

trygvis commented Feb 21, 2013

The pre/post install/remove is already supported and works fine, I was more wondering about other parts of the spec file that the plugin doesn't care much about.

The SpecFile is just the DAO object, but your patch itself seems fine. If you want to copy stuff from the file system or access the Maven project the RpmUnixPackage.prepare() where that should happen.

What is the define stuff used for in RPMs? Do you know if there are equivalent features in the deb format?

1 similar comment
@trygvis
Copy link
Owner

trygvis commented Feb 21, 2013

The pre/post install/remove is already supported and works fine, I was more wondering about other parts of the spec file that the plugin doesn't care much about.

The SpecFile is just the DAO object, but your patch itself seems fine. If you want to copy stuff from the file system or access the Maven project the RpmUnixPackage.prepare() where that should happen.

What is the define stuff used for in RPMs? Do you know if there are equivalent features in the deb format?

@ncolton
Copy link
Author

ncolton commented Feb 27, 2013

For RPM land, the %define directive allows creating macros and setting variable values for use in the SPEC file. In some cases these influence the RPM building behavior. For the example I used:

%define _source_filedigest_algorithm md5
%define _binary_filedigest_algorithm md5
%define _source_payload w9.gzdio
%define _binary_payload w9.gzdio

Those settings change the hash generation and compression used for RPM creation so that they are compatible with RHEL 5 (and 4, etc., I think) when created on a RHEL 6 system and it's newer hash and compression settings.

I've had to do some reading, as I knew nothing about Debian packages (and know only a tiny bit now), and it looks like override_dh_auto_install in debian/rules does similar in some cases, but in what appears to be a very different manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants