Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (7)
Endless loops are bad endless loops are bad endless loops...
· 6832e3bf
Emmanuel Bourg
authored
Jun 28, 2018
6832e3bf
Add the DH parameter --buildsystem=maven when a build.xml file is present (Closes: #902587)
· 037009aa
Emmanuel Bourg
authored
Jun 28, 2018
037009aa
Support GitHub endpoints using the git@github.com:group/name.git format
· 1985ea32
Emmanuel Bourg
authored
Jun 28, 2018
1985ea32
Ignore the source files reported as generated by licensecheck when generating debian/copyright
· e130b327
Emmanuel Bourg
authored
Jun 28, 2018
e130b327
Replaced BSD with BSD-<n>-clause in the list of suggested licenses
· 52bcf3dd
Emmanuel Bourg
authored
Jun 28, 2018
52bcf3dd
Minor simplification of LicensesScanner
· 63c2bc03
Emmanuel Bourg
authored
Jun 28, 2018
63c2bc03
Detect the BSD-<n>-clause licenses when generating the debian/copyright file
· 328cd84f
Emmanuel Bourg
authored
Jun 28, 2018
328cd84f
Show whitespace changes
Inline
Side-by-side
debian/changelog
View file @
328cd84f
...
...
@@ -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@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
View file @
328cd84f
...
...
@@ -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
View file @
328cd84f
...
...
@@ -24,19 +24,14 @@ 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
();
if
(
s
.
length
()
>
0
)
{
...
...
@@ -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
View file @
328cd84f
#
!/usr/bin/make -f
%:
dh
$
@
dh
$
@
#
if
($
hasBuildXml
)
--buildsystem=maven
#
end
maven-packager-utils/src/test/java/org/debian/maven/packager/util/LicensesScannerTest.java
View file @
328cd84f
...
...
@@ -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
();
...
...