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

Redline creates empty parent directories #28

Open
mplaxton opened this issue Feb 5, 2013 · 0 comments
Open

Redline creates empty parent directories #28

mplaxton opened this issue Feb 5, 2013 · 0 comments

Comments

@mplaxton
Copy link

mplaxton commented Feb 5, 2013

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

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

No branches or pull requests

1 participant