[Git][java-team/maven-debian-helper][master] 7 commits: Endless loops are bad endless loops are bad endless loops...
Emmanuel Bourg
gitlab at salsa.debian.org
Thu Jun 28 11:06:22 BST 2018
Emmanuel Bourg pushed to branch master at Debian Java Maintainers / maven-debian-helper
Commits:
6832e3bf by Emmanuel Bourg at 2018-06-28T10:00:38+02:00
Endless loops are bad endless loops are bad endless loops...
- - - - -
037009aa by Emmanuel Bourg at 2018-06-28T10:53:41+02:00
Add the DH parameter --buildsystem=maven when a build.xml file is present (Closes: #902587)
- - - - -
1985ea32 by Emmanuel Bourg at 2018-06-28T11:24:30+02:00
Support GitHub endpoints using the git at github.com:group/name.git format
- - - - -
e130b327 by Emmanuel Bourg at 2018-06-28T11:30:24+02:00
Ignore the source files reported as generated by licensecheck when generating debian/copyright
- - - - -
52bcf3dd by Emmanuel Bourg at 2018-06-28T11:33:13+02:00
Replaced BSD with BSD-<n>-clause in the list of suggested licenses
- - - - -
63c2bc03 by Emmanuel Bourg at 2018-06-28T11:33:45+02:00
Minor simplification of LicensesScanner
- - - - -
328cd84f by Emmanuel Bourg at 2018-06-28T12:05:04+02:00
Detect the BSD-<n>-clause licenses when generating the debian/copyright file
- - - - -
5 changed files:
- debian/changelog
- maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
- maven-packager-utils/src/main/java/org/debian/maven/packager/util/LicensesScanner.java
- maven-packager-utils/src/main/resources/rules.vm
- maven-packager-utils/src/test/java/org/debian/maven/packager/util/LicensesScannerTest.java
Changes:
=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,13 @@ 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)
+ * Add the DH parameter --buildsystem=maven when a build.xml file is present
+ (Closes: #902587)
+ * Support GitHub endpoints using the git at github.com:group/name.git format
+ * Ignore the source files reported as generated by licensecheck when
+ generating the debian/copyright file
+ * Replaced BSD with BSD-<n>-clause in the list of suggested licenses
+ * Detect the BSD-<n>-clause licenses when generating the debian/copyright file
* 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
=====================================
maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
=====================================
--- a/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
+++ b/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
@@ -189,6 +189,7 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
context.put("collectedProjects", wrapMavenProjects(collectedProjects));
context.put("runTests", Boolean.valueOf(runTests));
context.put("generateJavadoc", Boolean.valueOf(generateJavadoc));
+ context.put("hasBuildXml", new File(project.getBasedir().getAbsolutePath(), "build.xml").exists());
Set<String> licenses = licensesScanner.discoverLicenses(project.getLicenses());
context.put("licenses", licenses);
@@ -383,7 +384,7 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
}
if (downloadUrl != null && downloadUrl.startsWith("scm:git:") && downloadUrl.contains("github")) {
- Pattern pattern = Pattern.compile("github\\.com/([^/]+)/([^/\\.]+)");
+ Pattern pattern = Pattern.compile("github\\.com[/:]([^/]+)/([^/\\.]+)");
Matcher matcher = pattern.matcher(downloadUrl);
if (matcher.find()) {
downloadType = DownloadType.GITHUB;
@@ -554,7 +555,7 @@ public class GenerateDebianFilesMojo extends AbstractMojo {
}
private void generateFile(VelocityContext context, String templateName, File destDir, String fileName) throws IOException {
- generateFile(context, templateName, destDir, fileName);
+ generateFile(context, templateName, destDir, fileName, false);
}
private void generateFile(VelocityContext context, String templateName, File destDir, String fileName, boolean executable) throws IOException {
=====================================
maven-packager-utils/src/main/java/org/debian/maven/packager/util/LicensesScanner.java
=====================================
--- a/maven-packager-utils/src/main/java/org/debian/maven/packager/util/LicensesScanner.java
+++ b/maven-packager-utils/src/main/java/org/debian/maven/packager/util/LicensesScanner.java
@@ -24,21 +24,16 @@ import java.util.Set;
import java.util.TreeSet;
public class LicensesScanner {
+
public Set<String> discoverLicenses(List<License> projectLicenses) {
Set<String> licenses = new TreeSet<String>();
for (License license : projectLicenses) {
- String licenseName = "";
- if (license.getName() != null) {
- licenseName = license.getName() + " ";
- }
- String licenseUrl = "";
- if (license.getUrl() != null) {
- licenseUrl = license.getUrl();
- }
- boolean recognized = recognizeLicense(licenses, licenseName, licenseUrl);
- if (!recognized) {
+ String licenseName = license.getName() != null ? license.getName() + " " : "";
+ String licenseUrl = license.getUrl() != null ? license.getUrl() : "";
+
+ if (!recognizeLicense(licenses, licenseName, licenseUrl)) {
String s = new SimpleQuestion("License " + licenseName + licenseUrl + " was not recognized, " +
- "please enter a license name preferably in one of:" + getAvailableLicenses()).ask();
+ "please enter a license name preferably in one of: " + getAvailableLicenses()).ask();
if (s.length() > 0) {
licenses.add(s);
}
@@ -48,11 +43,9 @@ public class LicensesScanner {
System.out.println();
System.out.println("Checking licenses in the upstream sources...");
LicenseCheckResult licenseResult = new LicenseCheckResult();
- IOUtil.executeProcess(new String[]{"/bin/sh", "-c", "licensecheck `find . -type f`"},
- licenseResult);
+ IOUtil.executeProcess(new String[]{"/bin/sh", "-c", "licensecheck `find . -type f`"}, licenseResult);
for (String license : licenseResult.getLicenses()) {
- boolean recognized = recognizeLicense(licenses, license, "");
- if (!recognized) {
+ if (!recognizeLicense(licenses, license, "")) {
String s = new SimpleQuestion("License " + license + " was not recognized, " +
"please enter a license name preferably in one of:" + getAvailableLicenses()).ask();
if (s.length() > 0) {
@@ -71,9 +64,10 @@ public class LicensesScanner {
}
private String getAvailableLicenses() {
- return "Apache-2.0 Artistic BSD FreeBSD ISC CC-BY CC-BY-SA CC-BY-ND CC-BY-NC CC-BY-NC-SA\n"
- + "CC-BY-NC-ND CC0 CDDL CPL Eiffel EPL-1.0 Expat GPL-2 GPL-3 LGPL-2 LGPL-2.1 LGPL-3"
- + "GFDL-1.2 GFDL-1.3 GFDL-NIV LPPL MPL-1.1 MPL-2.0 Perl PSF QPL W3C-Software ZLIB Zope";
+ return "Apache-2.0 Artistic BSD-2-clause BSD-3-clause BSD-4-clause ISC CC-BY CC-BY-SA\n"
+ + "CC-BY-ND CC-BY-NC CC-BY-NC-SA CC-BY-NC-ND CC0 CDDL CPL Eiffel EPL-1.0 Expat\n"
+ + "GPL-2 GPL-3 LGPL-2 LGPL-2.1 LGPL-3 GFDL-1.2 GFDL-1.3 GFDL-NIV LPPL MPL-1.1\n"
+ + "MPL-2.0 Perl PSF QPL W3C-Software ZLIB Zope";
}
boolean recognizeLicense(Set<String> licenses, String licenseName, String licenseUrl) {
@@ -83,6 +77,15 @@ public class LicensesScanner {
if (licenseName.contains("mit ") || licenseUrl.contains("mit-license")) {
licenses.add("MIT");
recognized = true;
+ } else if (licenseName.matches(".*bsd \\(?2[ -]clause\\)?.*") || licenseUrl.contains("bsd-2-clause")) {
+ licenses.add("BSD-2-clause");
+ recognized = true;
+ } else if (licenseName.matches(".*bsd \\(?3[ -]clause\\)?.*") || licenseUrl.contains("bsd-3-clause")) {
+ licenses.add("BSD-3-clause");
+ recognized = true;
+ } else if (licenseName.matches(".*bsd \\(?4[ -]clause\\)?.*") || licenseUrl.contains("bsd-4-clause")) {
+ licenses.add("BSD-4-clause");
+ recognized = true;
} else if (licenseName.contains("bsd ") || licenseUrl.contains("bsd-license")) {
licenses.add("BSD");
recognized = true;
@@ -135,6 +138,9 @@ public class LicensesScanner {
} else if (licenseUrl.contains("http://creativecommons.org/licenses/by-sa/3.0")) {
licenses.add("CC-BY-SA-3.0");
recognized = true;
+ } else if (licenseName.contains("generated file")) {
+ // ignore the files reported as generated by licensecheck
+ recognized = true;
}
return recognized;
}
=====================================
maven-packager-utils/src/main/resources/rules.vm
=====================================
--- a/maven-packager-utils/src/main/resources/rules.vm
+++ b/maven-packager-utils/src/main/resources/rules.vm
@@ -1,4 +1,4 @@
#!/usr/bin/make -f
%:
- dh $@
+ dh $@#if($hasBuildXml) --buildsystem=maven#end
=====================================
maven-packager-utils/src/test/java/org/debian/maven/packager/util/LicensesScannerTest.java
=====================================
--- a/maven-packager-utils/src/test/java/org/debian/maven/packager/util/LicensesScannerTest.java
+++ b/maven-packager-utils/src/test/java/org/debian/maven/packager/util/LicensesScannerTest.java
@@ -35,10 +35,38 @@ public class LicensesScannerTest extends TestCase {
assertEquals("Apache-2.0", licenses.iterator().next());
licenses.clear();
+ assertTrue(scanner.recognizeLicense(licenses, "", "https://opensource.org/licenses/BSD-2-Clause"));
+ assertEquals("BSD-2-clause", licenses.iterator().next());
+ licenses.clear();
+
+ assertTrue(scanner.recognizeLicense(licenses, "BSD (2 clause)", ""));
+ assertEquals("BSD-2-clause", licenses.iterator().next());
+ licenses.clear();
+
+ assertTrue(scanner.recognizeLicense(licenses, "", "https://opensource.org/licenses/BSD-3-Clause"));
+ assertEquals("BSD-3-clause", licenses.iterator().next());
+ licenses.clear();
+
+ assertTrue(scanner.recognizeLicense(licenses, "BSD (3 clause)", ""));
+ assertEquals("BSD-3-clause", licenses.iterator().next());
+ licenses.clear();
+
+ assertTrue(scanner.recognizeLicense(licenses, "", "https://opensource.org/licenses/BSD-4-Clause"));
+ assertEquals("BSD-4-clause", licenses.iterator().next());
+ licenses.clear();
+
+ assertTrue(scanner.recognizeLicense(licenses, "BSD (4 clause)", ""));
+ assertEquals("BSD-4-clause", licenses.iterator().next());
+ licenses.clear();
+
assertTrue(scanner.recognizeLicense(licenses, "MPL (v1.1)", ""));
assertEquals("MPL-1.1", licenses.iterator().next());
licenses.clear();
+ assertTrue(scanner.recognizeLicense(licenses, "GENERATED FILE", ""));
+ assertTrue(licenses.isEmpty());
+ licenses.clear();
+
assertTrue(scanner.recognizeLicense(licenses, "", "https://www.mozilla.org/MPL/2.0/"));
assertEquals("MPL-2.0", licenses.iterator().next());
licenses.clear();
View it on GitLab: https://salsa.debian.org/java-team/maven-debian-helper/compare/d42c6a35427380ed906193cf0c9f4a5766727281...328cd84f1a52b6f6a466129ea254b8e51d31d3fb
--
View it on GitLab: https://salsa.debian.org/java-team/maven-debian-helper/compare/d42c6a35427380ed906193cf0c9f4a5766727281...328cd84f1a52b6f6a466129ea254b8e51d31d3fb
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20180628/668b0306/attachment.html>
More information about the pkg-java-commits
mailing list