Skip to content

Files being listed as directories when mapping is directoryIncluded and recurseDirectories #118

Description

@bokken

We want to be able to have the spec file to explicitly define every directory and sub-directory with specific permissions. We have historically accomplished this by having a top level mapping defining the top level directory with no sources, directoryIncluded set to true and recurse directories set to true.

<mapping>
  <directory>/usr/myuser/appDir</directory>
  <filemode>775</filemode>
  <directoryIncluded>true</directoryIncluded>
  <recurseDirectories>true</recurseDirectories>
</mapping>

This is then followed by various mappings which land files and directories under /usr/myuser/appDir, all of which have directoryIncluded set to false. I am pretty certain this worked when directoryIncluded and recurseDirectories were originally added.
Now, however, it appears[1] that if recurseDirectories is true, all of the files will be listed explicitly. Not only is this not desired (by virtue of fact that no sources were defined), it is also incorrectly defining the files as directories. This latter point is because the baseFileString[2] is obtained from the Mapping[3], which (rightly) believes it is only describing directories.

So if we take the above example, and then have another mapping which attempts to land someFile into /usr/myuser/appDir with 644 permissions, the result is the following in the spec file:

%dir %attr(775,cps,cps)  "/usr/myuser/appDir/"
%dir %attr(775,cps,cps)  "/usr/myuser/appDir/someFile"
%attr(644,cps,cps)  "/usr/myuser/appDir/someFile"

[1] - https://github.com/mojohaus/rpm-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/rpm/SpecWriter.java#L275
[2] - https://github.com/mojohaus/rpm-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/rpm/SpecWriter.java#L179
[3] - https://github.com/mojohaus/rpm-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/rpm/Mapping.java#L413

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions