Skip to content
......@@ -2,6 +2,8 @@ maven-debian-helper (2.3~exp2) UNRELEASED; urgency=medium
* Team upload.
* No longer support generating CDBS based packages
* No longer ignore the JavaBeans Activation Framework dependencies (removed from Java 9)
* Use XZ compression by default when repacking tarballs downloaded from GitHub
* Standards-Version updated to 4.1.4
* The generated control file now specifies Standards-Version: 4.1.4
* No longer generate the get-orig-source target in debian/rules
......
......@@ -19,6 +19,7 @@ package org.debian.maven.packager;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
......@@ -154,6 +155,7 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
/**
* If true, generate the Javadoc packaged in a separate package.
*
* @parameter expression="${generateJavadoc}" default-value="false"
*/
protected boolean generateJavadoc;
......@@ -162,17 +164,6 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
private LicensesScanner licensesScanner = new LicensesScanner();
public void execute() throws MojoExecutionException {
File f = outputDirectory;
if (!f.exists()) {
f.mkdirs();
}
String controlTemplate = "control.vm";
String rulesTemplate = "rules.vm";
if ("ant".equals(packageType)) {
controlTemplate = "control.ant.vm";
rulesTemplate = "rules.ant.vm";
}
// #638788: clean up email
if (email != null && email.indexOf('<') >= 0 && email.indexOf('>') >= 0) {
email = email.substring(email.indexOf('<') + 1, email.indexOf('>') - 1);
......@@ -239,7 +230,7 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
}
context.put("copyrightOwner", copyrightOwner);
if (projectTeam == null || projectTeam.isEmpty()) {
if (projectTeam.isEmpty()) {
projectTeam = project.getName() + " developers";
}
context.put("projectTeam", projectTeam);
......@@ -255,7 +246,7 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
copyrightYear = String.valueOf(currentYear);
}
context.put("copyrightYear", copyrightYear);
context.put("currentYear", new Integer(currentYear));
context.put("currentYear", currentYear);
if (project.getDescription() == null || project.getDescription().trim().isEmpty()) {
project.setDescription(new MultilineQuestion("Please enter a short description of the project, press Enter twice to stop.").ask());
......@@ -332,7 +323,7 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
context.put("testJars", testJars);
}
} else {
System.err.println("Cannot find file " + substvarsFile);
getLog().warn("Cannot find file " + substvarsFile);
}
if ("ant".equals(packageType)) {
......@@ -378,8 +369,8 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
baseUrl = baseUrl.substring(0, slashPos);
}
if (tagPos < 0 && downloadUrl.contains("/trunk")) {
System.out.println("Download URL does not include a tagged revision but /trunk found,");
System.out.println("Trying to guess the address of the tagged revision.");
getLog().warn("Download URL does not include a tagged revision but /trunk found,");
getLog().warn("Trying to guess the address of the tagged revision.");
tag = "trunk";
tagPos = downloadUrl.indexOf(tag);
baseUrl = downloadUrl.substring(0, tagPos);
......@@ -393,14 +384,12 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
context.put("suffixUrl", suffixUrl);
generateFile(context, "watch.svn.vm", outputDirectory, "watch");
generateFile(context, "orig-tar.svn.vm", outputDirectory, "orig-tar.sh");
new File("debian/orig-tar.sh").setExecutable(true);
generateFile(context, "orig-tar.svn.vm", outputDirectory, "orig-tar.sh", true);
} else {
System.err.println("Cannot locate the version in the download url (" + downloadUrl + ").");
System.err.println("Please run again and provide the download location with an explicit version tag, e.g.");
System.err.println("-DdownloadUrl=scm:svn:http://svn.codehaus.org/modello/tags/modello-1.0-alpha-21/");
getLog().warn("Cannot locate the version in the download url (" + downloadUrl + ").");
getLog().warn("Please run again and provide the download location with an explicit version tag, e.g.");
getLog().warn("-DdownloadUrl=scm:svn:http://svn.codehaus.org/modello/tags/modello-1.0-alpha-21/");
}
}
......@@ -419,22 +408,17 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
}
if (downloadType == DownloadType.UNKNOWN) {
System.err.println("Cannot recognize the download url (" +
downloadUrl + ").");
getLog().warn("Cannot recognize the download url (" + downloadUrl + ").");
}
String rulesTemplate = "ant".equals(packageType) ? "rules.ant.vm" : "rules.vm";
generateFile(context, "README.source.vm", outputDirectory, "README.source");
generateFile(context, "copyright.vm", outputDirectory, "copyright");
generateFile(context, "compat.vm", outputDirectory, "compat");
generateFile(context, rulesTemplate, outputDirectory, "rules");
new File("debian/rules").setExecutable(true);
generateFile(context, rulesTemplate, outputDirectory, "rules", true);
String debianVersion = projectVersion.replace("-alpha-", "~alpha");
debianVersion = debianVersion.replace("-beta-", "~beta");
debianVersion = debianVersion.replace("-rc-", "~rc");
debianVersion += "-1";
context.put("version.vm", debianVersion);
context.put("version.vm", mangleVersion(projectVersion) + "-1");
generateFile(context, rulesTemplate, new File("."), ".debianVersion");
......@@ -478,14 +462,24 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
generateFile(context, "maven.properties.vm", outputDirectory, "maven.properties");
}
generateFile(context, controlTemplate, outputDirectory, "control");
generateFile(context, "ant".equals(packageType) ? "control.ant.vm" : "control.vm", outputDirectory, "control");
generateFile(context, "format.vm", new File(outputDirectory, "source"), "format");
} catch (Exception ex) {
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* Normalizes the project version for use as a Debian package version.
*/
private String mangleVersion(String projectVersion) {
String debianVersion = projectVersion.replace("-alpha-", "~alpha");
debianVersion = debianVersion.replace("-beta-", "~beta");
debianVersion = debianVersion.replace("-rc-", "~rc");
return debianVersion;
}
/**
* Format the specified text to be suitable as a package long description.
* Lines are wrapped after 70 characters and a dot is placed on empty lines.
......@@ -558,12 +552,20 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
}
}
private void generateFile(VelocityContext context, String templateName, File destDir, String fileName) throws Exception {
private void generateFile(VelocityContext context, String templateName, File destDir, String fileName) throws IOException {
generateFile(context, templateName, destDir, fileName);
}
private void generateFile(VelocityContext context, String templateName, File destDir, String fileName, boolean executable) throws IOException {
destDir.mkdirs();
FileWriter out = new FileWriter(new File(destDir, fileName));
File file = new File(destDir, fileName);
FileWriter out = new FileWriter(file);
Velocity.mergeTemplate(templateName, "UTF8", context, out);
out.flush();
out.close();
if (executable) {
file.setExecutable(true);
}
}
private List<String> split(String s) {
......
......@@ -20,12 +20,6 @@ public class IgnoreDependencyQuestions {
{"org.apache.geronimo.specs", "geronimo-jaxb_2.1_spec"},
{"org.apache.geronimo.specs", "geronimo-jaxb_2.2_spec"},
{"jaxb", "jsr173_api"},
// Java Activation Framework (added to Java 6)
{"activation", "activation"},
{"javax.activation", "activation"},
{"jaf", "activation"},
{"org.apache.geronimo.specs", "geronimo-activation_1.0.2_spec"},
{"org.apache.geronimo.specs", "geronimo-activation_1.1_spec"},
// JMX (added to Java 5)
{"mx4j", "mx4j"},
{"mx4j", "mx4j-jmx"},
......
version=3
opts="repack,compression=xz" \
https://github.com/${userId}/${repository}/tags .*/(?:.*?)([\d\.]+)\.tar\.gz