// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/PgpConfiguration.java
// public class PgpConfiguration {
// 
//     @Parameter(required = true)
//     private String alias = null;
// 
//     @Parameter(required = true)
//     private File keyring = null;
// 
//     @Parameter(required = true)
//     private String passphrase = null;
// 
//     public String getAlias() {
//         return checkNotNull(alias);
//     }
// 
//     public PgpConfiguration setAlias(final String alias) {
//         this.alias = alias;
//         return this;
//     }
// 
//     public File getKeyring() {
//         return checkNotNull(keyring);
//     }
// 
//     public PgpConfiguration setKeyring(final File keyring) {
//         this.keyring = keyring;
//         return this;
//     }
// 
//     public String getPassphrase() {
//         return checkNotNull(passphrase);
//     }
// 
//     public PgpConfiguration setPassphrase(final String passphrase) {
//         this.passphrase = passphrase;
//         return this;
//     }
// }
// 
// Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java
// public abstract class Resource {
// 
//     private final boolean filter;
//     private final String target;
//     private final String user;
//     private final String group;
//     private final int mode;
// 
//     public Resource(final boolean filter, final String target, final String user, final String group, final int mode) {
//         this.target = checkNotNull(target);
//         this.user = checkNotNull(user);
//         this.group = checkNotNull(group);
//         this.filter = filter;
//         this.mode = mode;
//     }
// 
//     public abstract ByteSource getSource();
// 
//     public boolean isFilter() {
//         return filter;
//     }
// 
//     public String getTarget() {
//         return target;
//     }
// 
//     public String getUser() {
//         return user;
//     }
// 
//     public String getGroup() {
//         return group;
//     }
// 
//     public int getMode() {
//         return mode;
//     }
// }
// 
// Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceDataProducer.java
// public class ResourceDataProducer implements Function<Resource, DataProducer> {
//     
//     private final File inputDir;
// 
//     public ResourceDataProducer(final File inputDir) {
//         this.inputDir = inputDir;
//     }
// 
//     @Override
//     public DataProducer apply(final Resource resource) {
//         final File source = new File(inputDir, "files" + resource.getTarget());
//         return new DataProducer() {
//             @Override
//             public void produce(DataConsumer receiver) throws IOException {
//                 try (final InputStream in = new FileInputStream(source)) {
//                     receiver.onEachFile(
//                             in,
//                             resource.getTarget(),
//                             "",
//                             resource.getUser(), 0,
//                             resource.getGroup(), 0,
//                             resource.getMode(),
//                             source.length()
//                     );
//                 }
//             }
//         };
//     }
// }


import com.google.common.base.Optional;
import com.google.common.collect.Collections2;
import com.jamierf.dropwizard.debpkg.config.PgpConfiguration;
import com.jamierf.dropwizard.debpkg.resource.Resource;
import com.jamierf.dropwizard.debpkg.transforms.ResourceDataProducer;
import org.vafer.jdeb.*;
import java.io.File;
import java.net.URI;
import java.util.Collection;
import java.util.Collections;
package com.jamierf.dropwizard.debpkg.packaging;



public class PackageBuilder {

    private static final Compression COMPRESSION = Compression.GZIP;

    private final String title;
    private final String description;
    private final URI homepage;
    private final Console log;
    private final Optional<PgpConfiguration> pgpConfiguration;

    public PackageBuilder(final String title, final String description, final URI homepage, final Console log, final Optional<PgpConfiguration> pgpConfiguration) {
        this.title = title;
        this.description = description;
        this.homepage = homepage;
        this.log = log;
        this.pgpConfiguration = pgpConfiguration;
    }

// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/PgpConfiguration.java
// public class PgpConfiguration {
// 
//     @Parameter(required = true)
//     private String alias = null;
// 
//     @Parameter(required = true)
//     private File keyring = null;
// 
//     @Parameter(required = true)
//     private String passphrase = null;
// 
//     public String getAlias() {
//         return checkNotNull(alias);
//     }
// 
//     public PgpConfiguration setAlias(final String alias) {
//         this.alias = alias;
//         return this;
//     }
// 
//     public File getKeyring() {
//         return checkNotNull(keyring);
//     }
// 
//     public PgpConfiguration setKeyring(final File keyring) {
//         this.keyring = keyring;
//         return this;
//     }
// 
//     public String getPassphrase() {
//         return checkNotNull(passphrase);
//     }
// 
//     public PgpConfiguration setPassphrase(final String passphrase) {
//         this.passphrase = passphrase;
//         return this;
//     }
// }
// 
// Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java
// public abstract class Resource {
// 
//     private final boolean filter;
//     private final String target;
//     private final String user;
//     private final String group;
//     private final int mode;
// 
//     public Resource(final boolean filter, final String target, final String user, final String group, final int mode) {
//         this.target = checkNotNull(target);
//         this.user = checkNotNull(user);
//         this.group = checkNotNull(group);
//         this.filter = filter;
//         this.mode = mode;
//     }
// 
//     public abstract ByteSource getSource();
// 
//     public boolean isFilter() {
//         return filter;
//     }
// 
//     public String getTarget() {
//         return target;
//     }
// 
//     public String getUser() {
//         return user;
//     }
// 
//     public String getGroup() {
//         return group;
//     }
// 
//     public int getMode() {
//         return mode;
//     }
// }
// 
// Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceDataProducer.java
// public class ResourceDataProducer implements Function<Resource, DataProducer> {
//     
//     private final File inputDir;
// 
//     public ResourceDataProducer(final File inputDir) {
//         this.inputDir = inputDir;
//     }
// 
//     @Override
//     public DataProducer apply(final Resource resource) {
//         final File source = new File(inputDir, "files" + resource.getTarget());
//         return new DataProducer() {
//             @Override
//             public void produce(DataConsumer receiver) throws IOException {
//                 try (final InputStream in = new FileInputStream(source)) {
//                     receiver.onEachFile(
//                             in,
//                             resource.getTarget(),
//                             "",
//                             resource.getUser(), 0,
//                             resource.getGroup(), 0,
//                             resource.getMode(),
//                             source.length()
//                     );
//                 }
//             }
//         };
//     }
// }


// Path: src/main/java/com/jamierf/dropwizard/debpkg/packaging/PackageBuilder.java
import com.google.common.base.Optional;
import com.google.common.collect.Collections2;
import com.jamierf.dropwizard.debpkg.config.PgpConfiguration;
import com.jamierf.dropwizard.debpkg.resource.Resource;
import com.jamierf.dropwizard.debpkg.transforms.ResourceDataProducer;
import org.vafer.jdeb.*;
import java.io.File;
import java.net.URI;
import java.util.Collection;
import java.util.Collections;

package com.jamierf.dropwizard.debpkg.packaging;



public class PackageBuilder {

    private static final Compression COMPRESSION = Compression.GZIP;

    private final String title;
    private final String description;
    private final URI homepage;
    private final Console log;
    private final Optional<PgpConfiguration> pgpConfiguration;

    public PackageBuilder(final String title, final String description, final URI homepage, final Console log, final Optional<PgpConfiguration> pgpConfiguration) {
        this.title = title;
        this.description = description;
        this.homepage = homepage;
        this.log = log;
        this.pgpConfiguration = pgpConfiguration;
    }

    public void createPackage(final Collection<Resource> resources, final File inputDir, final File debFile) throws PackagingException {