com.netflix.gradle.plugins.deb.DataProducerDirectorySimple.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-ospackage-plugin Show documentation
Show all versions of gradle-ospackage-plugin Show documentation
Provides a task similar to Tar and Zip for constructing RPM and DEB package files.
package com.netflix.gradle.plugins.deb
import groovy.transform.Canonical
import org.vafer.jdeb.DataConsumer
import org.vafer.jdeb.DataProducer
import org.vafer.jdeb.shaded.commons.compress.archivers.tar.TarArchiveEntry
@Canonical
class DataProducerDirectorySimple implements DataProducer {
String dirname
String user
int uid = 0
String group
int gid = 0
int mode
@Override
void produce(DataConsumer receiver) throws IOException {
// TODO Investigate what happens if we don't have a uid/gid
receiver.onEachDir(createEntry())
}
private TarArchiveEntry createEntry() {
TarArchiveEntry entry = new TarArchiveEntry(dirname)
entry.userName = user
entry.userId = uid
entry.groupName = group
entry.groupId = gid
entry.mode = mode
entry
}
}