mojohaus / rpm-maven-plugin

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

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

Open bokken opened 4 years ago

bokken commented 4 years ago

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

JasonWThompson commented 4 years ago

Since this has been merged, is this still an open issue?

This issue is impacting newer versions of rpmbuild. If a file in the spec is incorrectly marked as a directory, newer versions of rpmbuild will fail. For my projects, this is causing builds to fail in our automation.

When can we expect a new release of the plugin with this fix in it? Thanks!