mojohaus / rpm-maven-plugin

http://www.mojohaus.org/rpm-maven-plugin/
Other
56 stars 48 forks source link

Why is it not possible to set dirmode on individual mappings? #33

Closed sc1478 closed 6 years ago

sc1478 commented 8 years ago

(moved from original misposting on mojohaus parent).

I would like to build an rpm where one directory has a different dirmode than the default. This option is not available, whereas , , and are available on the mapping level. Why the difference?

By the way, this issue has been floating around since 2010:

http://mojo.10943.n7.nabble.com/rpm-maven-plugin-is-there-any-way-to-specify-the-dirmode-other-than-the-defaultDirmode-attribute-td37839.html

khmarbaise commented 8 years ago

Was no problem..just to address this to the correct area... But my question stays...Can you show a full pom file which shows the wrong/missing behaviour ? Have you tested with the most recent version?

sc1478 commented 8 years ago

I'm using the latest release version, 2.1.4. I've not investigated any others.

This really isn't a bug - it's a missing feature. Simply put a <dirmode> element into any mapping and the build will fail, as of course it should, becuase <dirmode> is not a supported parameter.

But why not? With a handmade rpm spec one can define a different mode on a directory than the rpm default, and this capability is missing from the rpm-maven-plugin. As I am trying to port an existing and extensive rpm-based system to maven, this is a capability I need.

bokken commented 8 years ago

The current solution to accomplish this is to provide a separate mapping exclusively for the directory with the mode you desire.

sc1478 commented 8 years ago

I don't understand this solution. My original point was that there is no way to specify a <dirmode> for a mapping, and the only way to define the mode at all was by specifying a <defaultDirmode> at the plugin configuration level.

What am I missing?

bokken commented 8 years ago

If a mapping only includes a directory, then the file mode defined is effectively the dir mode.

sc1478 commented 8 years ago

And if I want a filemode of 640 and a dirmode of 750?

bokken commented 8 years ago

Put the directory and files in different mappings with the desired modes.

                    <mapping>
                        <directory>/my/dir</directory>
                        <directoryIncluded>true</directoryIncluded>
                        <filemode>750</filemode>
                    </mapping>
                    <mapping>
                        <directory>/my/dir</directory>
                        <directoryIncluded>false</directoryIncluded>
                        <filemode>604</filemode>
                        <sources>
                            <source>
                                <location>src/main/stuff</location>
                            </source>
                        </sources>
                    </mapping>
sc1478 commented 8 years ago

Ok, thanks. A bit kludgey, but it will work.

Might possibly be worth a paragraph on the doc site.

Thanks.

dantran commented 8 years ago

a PR doc is very much appreciated. 2.1.5 release is comming

gunslingor commented 3 years ago

I wish you could do the following with all these mapping subtags, maybe change filemode to defaultfilemode for example... but user, dirmode, etc... all these settings:

                    <mappings>
                        <filemode>644</filemode>
                        ....
                        <mapping>
                            <directory>/etc/opt/blahblah</directory>
                            ...

I also wish the syntax of this plugin could be shortened a bunch... well... I mean, I have probably 100 files that need to be installed to 20 different locations... but I think the above wish would solve that issue.

FYI the docs don't appear to tell you what the setting defaults are so I'm forced to set them.