". Please check your pom.xml/build.xml and your control file.");
}
deb.getParentFile().mkdirs();
ArArchiveOutputStream ar = new ArArchiveOutputStream(new FileOutputStream(deb));
String binaryName = "debian-binary";
String binaryContent = "2.0\n";
String controlName = "control.tar.gz";
String dataName = "data.tar" + compression.getExtension();
addTo(ar, binaryName, binaryContent);
addTo(ar, controlName, tempControl);
addTo(ar, dataName, tempData);
if (signatureGenerator != null) {
console.info("Signing package with key " + key);
if(signRole == null) {
signRole = "origin";
}
// Use debsig-verify as default
if(signMethod == null || !"dpkg-sig".equals(signMethod)) {
// Sign file to verify with debsig-verify
PGPSignatureOutputStream sigStream = new PGPSignatureOutputStream(signatureGenerator);
addTo(sigStream, binaryContent);
addTo(sigStream, tempControl);
addTo(sigStream, tempData);
addTo(ar, "_gpg" + signRole, sigStream.generateASCIISignature());
} else {
// Sign file to verify with dpkg-sig --verify
final String outputStr =
"Version: 4\n" +
"Signer: \n" +
"Date: " + new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy", Locale.ENGLISH).format(new Date()) + "\n" +
"Role: " + signRole +"\n" +
"Files: \n" +
addFile(binaryName, binaryContent) +
addFile(controlName, tempControl) +
addFile(dataName, tempData);
ByteArrayOutputStream message = new ByteArrayOutputStream();
signer.clearSign(outputStr, message);
addTo(ar, "_gpg" + signRole, message.toString());
}
}
ar.close();
return packageControlFile;
} catch (Exception e) {
throw new PackagingException("Could not create deb package", e);