Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (5)
Use the Maven logger in GenerateDebianFilesMojo instead of System.err/out
· 5fae5de4
Emmanuel Bourg
authored
Jun 26, 2018
5fae5de4
Added an 'executable' parameter to the generateFile() method in GenerateDebianFilesMojo
· 5ef52fea
Emmanuel Bourg
authored
Jun 27, 2018
5ef52fea
No longer ignore the JavaBeans Activation Framework dependencies (removed from Java 9)
· dfa79996
Emmanuel Bourg
authored
Jun 27, 2018
dfa79996
Use XZ compression by default when repacking tarballs downloaded from GitHub
· f194bbbd
Emmanuel Bourg
authored
Jun 27, 2018
f194bbbd
Minor code simplification in GenerateDebianFilesMojo
· 2d1010b8
Emmanuel Bourg
authored
Jun 27, 2018
2d1010b8
Show whitespace changes
Inline
Side-by-side
debian/changelog
View file @
2d1010b8
...
...
@@ -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
...
...
maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
View file @
2d1010b8
...
...
@@ -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
.
printl
n
(
"Cannot find file "
+
substvarsFile
);
getLog
().
war
n
(
"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
.
printl
n
(
"Download URL does not include a tagged revision but /trunk found,"
);
System
.
out
.
printl
n
(
"Trying to guess the address of the tagged revision."
);
getLog
().
war
n
(
"Download URL does not include a tagged revision but /trunk found,"
);
getLog
().
war
n
(
"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
.
printl
n
(
"Cannot locate the version in the download url ("
+
downloadUrl
+
")."
);
System
.
err
.
printl
n
(
"Please run again and provide the download location with an explicit version tag, e.g."
);
System
.
err
.
printl
n
(
"-DdownloadUrl=scm:svn:http://svn.codehaus.org/modello/tags/modello-1.0-alpha-21/"
);
getLog
().
war
n
(
"Cannot locate the version in the download url ("
+
downloadUrl
+
")."
);
getLog
().
war
n
(
"Please run again and provide the download location with an explicit version tag, e.g."
);
getLog
().
war
n
(
"-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
(
IO
Exception
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
)
{
...
...
maven-packager-utils/src/main/java/org/debian/maven/packager/util/IgnoreDependencyQuestions.java
View file @
2d1010b8
...
...
@@ -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"
},
...
...
maven-packager-utils/src/main/resources/watch.github.vm
View file @
2d1010b8
version=3
opts="repack,compression=xz" \
https://github.com/
${
userId
}
/
${
repository
}
/tags .*/(?:.*?)([\d\.]+)\.tar\.gz