I've found that the Redline Contents class was adding all of the parent directories when asked to add a single text file regardless of the new createDirectoryEntry parameter:
I only asked it to add the config-override.properties file but all of the parent directories were added by Redline.
The fix would be to use a different addFile method overload in Redline's Content class to prevent this from happenning. This overload requires that you pass a boolean parameter for adding parent directories (addParents) as the final parameter, e.g
Hi,
I've found that the Redline Contents class was adding all of the parent directories when asked to add a single text file regardless of the new createDirectoryEntry parameter:
12:20:48.362 [DEBUG] [com.trigonic.gradle.plugins.rpm.RpmCopySpecVisitor] adding file usr/local/jetty/webapps/MercuryImageServlet-uk/WEB-INF/classes/config-override.properties 12:20:48.378 [DEBUG] [org.freecompany.redline.payload.Contents] Adding directory '/usr/local/jetty'. 12:20:48.392 [DEBUG] [org.freecompany.redline.payload.Contents] Adding directory '/usr/local/jetty/webapps'. 12:20:48.407 [DEBUG] [org.freecompany.redline.payload.Contents] Adding directory '/usr/local/jetty/webapps/MercuryImageServlet-uk'. 12:20:48.421 [DEBUG] [org.freecompany.redline.payload.Contents] Adding directory '/usr/local/jetty/webapps/MercuryImageServlet-uk/WEB-INF'. 12:20:48.437 [DEBUG] [org.freecompany.redline.payload.Contents] Adding directory '/usr/local/jetty/webapps/MercuryImageServlet-uk/WEB-INF/classes'. 12:20:48.451 [DEBUG] [org.freecompany.redline.payload.Contents] Adding file '/usr/local/jetty/webapps/MercuryImageServlet-uk/WEB-INF/classes/config-override.properties'.
I only asked it to add the config-override.properties file but all of the parent directories were added by Redline.
The fix would be to use a different addFile method overload in Redline's Content class to prevent this from happenning. This overload requires that you pass a boolean parameter for adding parent directories (addParents) as the final parameter, e.g
@Override void visitFile(FileVisitDetails fileDetails) { logger.debug "adding file {}", fileDetails.relativePath.pathString builder.addFile "/" + fileDetails.relativePath.pathString, fileDetails.file, spec.fileMode == null ? -1 : spec.fileMode, spec.fileType, org.freecompany.redline.payload.Directive.NONE, spec.user ?: task.user, spec.group ?: task.group, spec.createDirectoryEntry }
Could this be added ?
Cheers, Matt