[pkg-java] r13060 - in trunk/maven-debian-helper: . bin debian maven-packager-utils/src/main/java/org/debian/maven/packager maven-packager-utils/src/main/resources
Ludovic Claude
ludovicc-guest at alioth.debian.org
Wed Nov 3 22:35:18 UTC 2010
Author: ludovicc-guest
Date: 2010-11-03 22:35:06 +0000 (Wed, 03 Nov 2010)
New Revision: 13060
Modified:
trunk/maven-debian-helper/bin/mh_make
trunk/maven-debian-helper/debian/changelog
trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.ant.vm
trunk/maven-debian-helper/maven-packager-utils/src/main/resources/java-doc.doc-base.api.vm
trunk/maven-debian-helper/pom.xml
Log:
* release to experimental
Modified: trunk/maven-debian-helper/bin/mh_make
===================================================================
--- trunk/maven-debian-helper/bin/mh_make 2010-11-03 22:28:38 UTC (rev 13059)
+++ trunk/maven-debian-helper/bin/mh_make 2010-11-03 22:35:06 UTC (rev 13060)
@@ -68,6 +68,7 @@
GEN_JAVADOC=$(getarg d javadoc)
ANT=$(getarg a ant)
FROM_SVN=$(getarg s from-svn)
+VERBOSE=$(getarg v verbose)
if [ "$FROM_SVN" == "true" ]; then
echo "The syntax for the --for-svn option is --from-svn=<url>, please try again"
@@ -124,6 +125,7 @@
fi
if [ -n "$FROM_SVN" ]; then
+ echo
SVN_OPTIONS=
if [[ "$FROM_SVN" =~ https://.*\.dev\.java\.net/.* ]]; then
echo "Press enter if a password is asked"
@@ -137,15 +139,32 @@
mh_unpatchpoms -p$BIN_PACKAGE
fi
-java -cp /usr/share/java/maven-project.jar:/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar:/usr/share/maven2/lib/maven-debian-uber.jar org.debian.maven.packager.DependenciesSolver --package="$BIN_PACKAGE" ${ANT:+--ant} ${GEN_JAVADOC:+--generate-javadoc} ${RUN_TESTS:+--run-tests} --maven-repo=/usr/share/maven-repo
+echo
+echo "Checking that apt-file is installed and has been configured..."
+if [ -f /usr/bin/apt-file ]; then
+ apt-file search /usr/bin/mvnDebug | grep maven > /dev/null
+ if [ $? != 0 ]; then
+ echo "Warning: apt-file doesn't seem to be configured"
+ echo "Running sudo apt-file update"
+ sudo apt-file update
+ fi
+else
+ echo "Warning: apt-file doesn't seem to be installed"
+ echo "Installing apt-file using sudo apt-get install apt-file"
+ sudo apt-get install apt-file
+ sudo apt-file update
+fi
+echo
+java -cp /usr/share/java/maven-project.jar:/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar:/usr/share/maven2/lib/maven-debian-uber.jar org.debian.maven.packager.DependenciesSolver --package="$BIN_PACKAGE" ${ANT:+--ant} ${GEN_JAVADOC:+--generate-javadoc} ${RUN_TESTS:+--run-tests} ${VERBOSE:+--verbose} --maven-repo=/usr/share/maven-repo
+
if [ $? != 0 ]; then
exit 1
fi
eval $(cat debian/$BIN_PACKAGE.substvars | sed -e 's/maven\./maven_/' | grep maven_UpstreamPackageVersion)
-mh_patchpoms -p$BIN_PACKAGE -rdebian/maven.rules -idebian/maven.ignoreRules --keep-pom-version
+mh_patchpoms ${VERBOSE:+--verbose} -p$BIN_PACKAGE -rdebian/maven.rules -idebian/maven.ignoreRules --keep-pom-version
mvn org.debian.maven:maven-packager-utils:$MH_VERSION:generate -Demail="$DEBEMAIL" -Dpackager="$DEBFULLNAME" -DpackagerLicense="$DEBLICENSE" -Dpackage="$PACKAGE" -Dbin.package="$BIN_PACKAGE" -DrunTests="$RUN_TESTS" -DgenerateJavadoc="$GEN_JAVADOC" -Dmaven.repo.local=/usr/share/maven-repo ${ANT:+-DpackageType=ant} ${FROM_SVN:+-DdownloadUrl=scm:svn:$FROM_SVN} --offline
Modified: trunk/maven-debian-helper/debian/changelog
===================================================================
--- trunk/maven-debian-helper/debian/changelog 2010-11-03 22:28:38 UTC (rev 13059)
+++ trunk/maven-debian-helper/debian/changelog 2010-11-03 22:35:06 UTC (rev 13060)
@@ -1,4 +1,4 @@
-maven-debian-helper (1.3) UNRELEASED; urgency=low
+maven-debian-helper (1.3) experimental; urgency=low
* ${maven:Depends} and similar substitution vars: add
version constraints when possible
Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java 2010-11-03 22:28:38 UTC (rev 13059)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java 2010-11-03 22:35:06 UTC (rev 13060)
@@ -140,12 +140,12 @@
private DependencyRuleSet cleanIgnoreRules = new DependencyRuleSet("Ignore rules to be applied during the Maven clean phase",
new File("debian/maven.cleanIgnoreRules"));
private boolean offline;
- private boolean checkedAptFile;
private boolean runTests;
private boolean generateJavadoc;
private boolean interactive = true;
private boolean askedToFilterModules = false;
private boolean filterModules = false;
+ private boolean verbose = false;
private Map pomInfoCache = new HashMap();
// Keep the previous selected rule for a given version
private Map versionToRules = new HashMap();
@@ -155,10 +155,15 @@
public DependenciesSolver() {
pomTransformer.setVerbose(true);
+ pomTransformer.getRules().setWarnRulesFileNotFound(false);
pomTransformer.getRules().setDescription(readResource("maven.rules.description"));
pomTransformer.getIgnoreRules().setDescription(readResource("maven.ignoreRules.description"));
+ pomTransformer.getIgnoreRules().setWarnRulesFileNotFound(false);
pomTransformer.getPublishedRules().setDescription(readResource("maven.publishedRules.description"));
+ pomTransformer.getPublishedRules().setWarnRulesFileNotFound(false);
cleanIgnoreRules.setDescription(readResource("maven.cleanIgnoreRules.description"));
+ cleanIgnoreRules.setWarnRulesFileNotFound(false);
+ cleanIgnoreRules.setVerbose(true);
Rule toDebianRule = new Rule("s/.*/debian/");
toDebianRule.setDescription("Change the version to the symbolic 'debian' version");
@@ -200,6 +205,14 @@
this.generateJavadoc = b;
}
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
private boolean containsPlugin(String[][] pluginDefinitions, Dependency plugin) {
for (int i = 0; i < pluginDefinitions.length; i++) {
if (!plugin.getGroupId().equals(pluginDefinitions[i][0])) {
@@ -349,6 +362,7 @@
depVars.put("maven.Depends", toString(runtimeDepends));
depVars.put("maven.OptionalDepends", toString(optionalDepends));
if (generateJavadoc) {
+ System.out.println("Checking dependencies for documentation packages...");
Set docRuntimeDepends = new TreeSet();
docRuntimeDepends.add("default-jdk-doc");
for (Iterator i = runtimeDepends.iterator(); i.hasNext();) {
@@ -516,38 +530,21 @@
}
String pomRelPath = projectPom.getAbsolutePath().substring(baseDir.getAbsolutePath().length() + 1);
- boolean noParent = getPOMOptions(projectPom).isNoParent();
try {
POMInfo pom = getPOM(projectPom);
pom.setProperties(new HashMap());
pom.getProperties().put("debian.package", getPackageName());
- try {
- if (noParent) {
- pom.setParent(null);
- } else if (pom.getParent() != null) {
- pom.setParent(resolveDependency(pom.getParent(), projectPom, true, false, false));
+ if (getPOMOptions(projectPom).isNoParent()) {
+ pom.setParent(null);
+ } else if (pom.getParent() != null) {
+ boolean oldNoParent = getPOMOptions(projectPom).isNoParent();
+ pom.setParent(resolveDependency(pom.getParent(), projectPom, true, false, false, true));
+ if (getPOMOptions(projectPom).isNoParent() != oldNoParent) {
+ resetPOM(projectPom);
+ pom = getPOM(projectPom);
}
- } catch (DependencyNotFoundException e) {
- System.out.println("Cannot find parent dependency " + e.getDependency());
- if (interactive) {
- noParent = askIgnoreDependency(pomRelPath, pom.getParent(), "Ignore the parent POM for this POM?");
- if (noParent) {
- pom.setParent(null);
- try {
- getRepository().registerPom(projectPom, pom);
- } catch (DependencyNotFoundException e1) {
- // ignore
- }
- getPOMOptions(projectPom).setNoParent(true);
- resetPOM(projectPom);
- pom = getPOM(projectPom);
- try {
- getRepository().registerPom(projectPom, pom);
- } catch (DependencyNotFoundException ignore) {}
- }
- }
}
getRepository().registerPom(projectPom, pom);
@@ -667,7 +664,7 @@
if (pom.getParent() != null) {
POMInfo parentPom = getRepository().searchMatchingPOM(pom.getParent());
if (parentPom == null || parentPom.equals(getRepository().getSuperPOM())) {
- noParent = true;
+ getPOMOptions(projectPom).setNoParent(true);
}
if (!baseDir.equals(projectPom.getParentFile())) {
// System.out.println("Checking the parent dependency in the sub project " + projectPom);
@@ -676,7 +673,6 @@
}
projectPoms.add(pom.getThisPom());
- getPOMOptions(projectPom).setNoParent(noParent);
resolveDependenciesLater(projectPom, POMInfo.DEPENDENCIES, false, false, false);
resolveDependenciesLater(projectPom, POMInfo.DEPENDENCY_MANAGEMENT_LIST, false, false, true);
@@ -701,7 +697,8 @@
}
}
} catch (Exception ex) {
- log.log(Level.SEVERE, "Error while resolving " + projectPom, ex);
+ log.log(Level.SEVERE, "Error while resolving " + projectPom + ": " + ex.getMessage());
+ System.exit(1);
}
}
@@ -710,7 +707,7 @@
if (info != null) {
return info;
}
- File tmpDest = File.createTempFile("pom", ".tmp");
+ File tmpDest = File.createTempFile("pom", ".tmp", baseDir);
tmpDest.deleteOnExit();
ListOfPOMs.POMOptions options = getPOMOptions(projectPom);
boolean noParent = false;
@@ -719,7 +716,7 @@
noParent = options.isNoParent();
hasPackageVersion = options.getHasPackageVersion();
}
- info = pomTransformer.transformPom(projectPom, tmpDest, noParent, hasPackageVersion, false, null, null, true);
+ info = pomTransformer.transformPom(projectPom, tmpDest, noParent, hasPackageVersion, false, false, null, null, true);
pomInfoCache.put(projectPom.getAbsolutePath(), info);
return info;
}
@@ -763,7 +760,16 @@
}
}
+ private Dependency resolveParentDependency(Dependency dependency, File sourcePom, boolean buildTime) throws DependencyNotFoundException {
+ return resolveDependency(dependency, sourcePom, buildTime, false, false);
+ }
+
public Dependency resolveDependency(Dependency dependency, File sourcePom, boolean buildTime, boolean mavenExtension, boolean management) throws DependencyNotFoundException {
+ return resolveDependency(dependency, sourcePom, buildTime, mavenExtension, management, false);
+ }
+
+ private Dependency resolveDependency(Dependency dependency, File sourcePom, boolean buildTime, boolean mavenExtension, boolean management, boolean resolvingParent) throws DependencyNotFoundException {
+
if (containsDependencyIgnoreVersion(ignoredDependencies, dependency) ||
containsDependencyIgnoreVersion(knownProjectDependencies, dependency) ||
(management && isDefaultMavenPlugin(dependency))) {
@@ -773,9 +779,13 @@
String sourcePomLoc = sourcePom.getAbsolutePath();
String baseDirPath = baseDir.getAbsolutePath();
sourcePomLoc = sourcePomLoc.substring(baseDirPath.length() + 1, sourcePomLoc.length());
-
+ if (verbose) {
+ System.out.println("Resolving " + dependency);
+ }
boolean ignoreDependency = false;
- if (canIgnorePlugin(dependency)) {
+ if ("maven-plugin".equals(dependency.getType()) && packageType.equals("ant")) {
+ ignoreDependency = true;
+ } else if (canIgnorePlugin(dependency)) {
ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This plugin is not useful for the build or its use is against Debian policies. Ignore this plugin?");
} else if (canIgnoreExtension(dependency)) {
ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This extension is not useful for the build or its use is against Debian policies. Ignore this extension?");
@@ -828,17 +838,21 @@
if (management) {
return null;
} else {
- if ("maven-plugin".equals(dependency.getType()) && packageType.equals("ant")) {
- ignoreDependency = true;
- }
if (!ignoreDependency) {
- if ("maven-plugin".equals(dependency.getType())) {
+ if (resolvingParent) {
+ boolean noParent = askIgnoreDependency(sourcePomLoc, dependency,
+ "The parent POM cannot be found in the Maven repository for Debian. Ignore it?");
+ getPOMOptions(sourcePom).setNoParent(noParent);
+ if (noParent) {
+ return null;
+ }
+ } else if (isDocumentationOrReportPlugin(dependency)) {
+ ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency,
+ "This documentation or report plugin cannot be found in the Maven repository for Debian. Ignore this plugin?");
+ } else if ("maven-plugin".equals(dependency.getType())) {
issues.add(sourcePomLoc + ": Plugin is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
+ dependency.getArtifactId() + ":" + dependency.getVersion());
ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This plugin cannot be found in the Debian Maven repository. Ignore this plugin?", false);
- } else if (isDocumentationOrReportPlugin(dependency)) {
- ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency,
- "This documentation or report plugin cannot be found in the Maven repository for Debian. Ignore this plugin?");
} else {
issues.add(sourcePomLoc + ": Dependency is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
+ dependency.getArtifactId() + ":" + dependency.getVersion());
@@ -966,23 +980,8 @@
return null;
}
- if (!checkedAptFile) {
- System.out.println("Checking that apt-file is installed and has been configured...");
- if (new File("/usr/bin/apt-file").exists()) {
- executeProcess(new String[]{"apt-file", "search", "/usr/bin/mvnDebug"}, packageResult);
- String checkMvnPkg = packageResult.getResult();
- if ("maven2".equals(checkMvnPkg)) {
- checkedAptFile = true;
- }
- packageResult.setResult(null);
- }
- if (!checkedAptFile) {
- System.err.println("Warning: apt-file doesn't seem to be installed or configured");
- System.err.println("Please run the following commands and start again:");
- System.err.println(" sudo apt-get install apt-file");
- System.err.println(" sudo apt-file update");
- return null;
- }
+ if (!new File("/usr/bin/apt-file").exists()) {
+ return null;
}
executeProcess(new String[]{"apt-file", "search", file.getAbsolutePath()}, packageResult);
String pkg = packageResult.getResult();
@@ -1157,6 +1156,7 @@
if (verbose) {
System.out.println("Solving dependencies for package " + debianPackage);
+ solver.setVerbose(true);
}
solver.solveDependencies();
Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java 2010-11-03 22:28:38 UTC (rev 13059)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java 2010-11-03 22:35:06 UTC (rev 13060)
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import org.apache.maven.model.Developer;
import org.apache.maven.model.License;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -161,12 +162,11 @@
project.setName(readLine());
}
if (project.getUrl() == null || project.getUrl().isEmpty()) {
- System.out.println("\"POM does not contain the project URL. Please enter the URL of the project:");
+ System.out.println("POM does not contain the project URL. Please enter the URL of the project:");
project.setUrl(readLine());
}
Set licenses = new TreeSet();
- String[] knownLicenses = {"Apache-2.0", "GFDL-1.2", "GFDL-1.3", "GPL-2", "LGPL-2.1", "Artistic", "GPL-3", "LGPL-2", "LGPL-3"};
for (Iterator i = project.getLicenses().iterator(); i.hasNext(); ) {
License license = (License) i.next();
String licenseName = "";
@@ -241,24 +241,46 @@
if (licenses.size() == 1) {
packagerLicense = (String) licenses.iterator().next();
- } else {
- // TODO - ask for the chosen packager license
}
+ if (packagerLicense == null) {
+ System.out.println("Packager license for the debian/ filse was not found, please enter a license name preferably in one of:");
+ System.out.println("Apache Artistic BSD FreeBSD ISC CC-BY CC-BY-SA CC-BY-ND CC-BY-NC CC-BY-NC-SA CC-BY-NC-ND CC0 CDDL CPL Eiffel");
+ System.out.println("Expat GPL LGPL GFDL GFDL-NIV LPPL MPL Perl PSF QPL W3C-Software ZLIB Zope");
+ String s = readLine();
+ if (s.length() > 0) {
+ packagerLicense = s;
+ }
+ }
context.put("packagerLicense", packagerLicense);
String copyrightOwner = "";
+ String projectTeam = "";
if (project.getOrganization() != null) {
copyrightOwner = project.getOrganization().getName();
+ projectTeam = project.getOrganization().getName() + " developers";
}
if (copyrightOwner == null || copyrightOwner.isEmpty()) {
Iterator devs = project.getDevelopers().iterator();
if (devs.hasNext()) {
- copyrightOwner = (String) devs.next();
+ Developer dev = (Developer) devs.next();
+ copyrightOwner = dev.getName();
+ if (dev.getEmail() != null && !dev.getEmail().isEmpty()) {
+ copyrightOwner += " <" + dev.getEmail() + ">";
+ }
}
}
- // TODO - ask for the copyright owner
+ if (copyrightOwner == null || copyrightOwner.isEmpty()) {
+ System.out.println("Could not find who owns the copyright for the upstream sources, please enter his name:");
+ copyrightOwner = readLine();
+ }
context.put("copyrightOwner", copyrightOwner);
+ if (projectTeam == null || projectTeam.isEmpty()) {
+ projectTeam = project.getName() + " developers";
+ }
+ context.put("copyrightOwner", copyrightOwner);
+ context.put("projectTeam", projectTeam);
+
String copyrightYear;
int currentYear = new GregorianCalendar().get(Calendar.YEAR);
if (project.getInceptionYear() != null) {
@@ -376,7 +398,7 @@
}
if ("ant".equals(packageType)) {
- ListOfPOMs listOfPOMs = new ListOfPOMs(new File(outputDirectory, "debian/" + binPackageName + ".poms"));
+ ListOfPOMs listOfPOMs = new ListOfPOMs(new File(outputDirectory, binPackageName + ".poms"));
for (Iterator i = collectedProjects.iterator(); i.hasNext();) {
MavenProject mavenProject = (MavenProject) i.next();
String basedir = project.getBasedir().getAbsolutePath();
@@ -511,6 +533,9 @@
private List listSharedJars(String library) {
final List jars = new ArrayList();
+ if (library.indexOf("(") > 0) {
+ library = library.substring(0, library.indexOf("(")).trim();
+ }
DependenciesSolver.executeProcess(new String[]{"/usr/bin/dpkg", "--listfiles", library},
new DependenciesSolver.OutputHandler() {
Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.ant.vm
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.ant.vm 2010-11-03 22:28:38 UTC (rev 13059)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.ant.vm 2010-11-03 22:35:06 UTC (rev 13060)
@@ -19,7 +19,7 @@
Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
Uploaders: ${packager} <${packagerEmail}>
Build-Depends: debhelper (>= 7), cdbs, default-jdk, ant-optional, maven-ant-helper (>> 6.7)
-Build-Depends-Indep: maven-repo-helper,
+Build-Depends-Indep: maven-repo-helper (>= 1.4),
#printDependencies($compileDependencies)$space
Standards-Version: 3.9.1
Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/${package}
Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/resources/java-doc.doc-base.api.vm
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/resources/java-doc.doc-base.api.vm 2010-11-03 22:28:38 UTC (rev 13059)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/resources/java-doc.doc-base.api.vm 2010-11-03 22:35:06 UTC (rev 13060)
@@ -1,6 +1,6 @@
Document: ${binPackage}
Title: API Javadoc for ${project.Name}
-Author: ${project.Organization.Name} developers
+Author: ${projectTeam}
Abstract: This is the API Javadoc provided for the
${binPackage} library.
Section: Programming
Modified: trunk/maven-debian-helper/pom.xml
===================================================================
--- trunk/maven-debian-helper/pom.xml 2010-11-03 22:28:38 UTC (rev 13059)
+++ trunk/maven-debian-helper/pom.xml 2010-11-03 22:35:06 UTC (rev 13060)
@@ -38,7 +38,7 @@
<dependency>
<groupId>org.debian.maven</groupId>
<artifactId>maven-repo-helper</artifactId>
- <version>1.3</version>
+ <version>1.4</version>
</dependency>
</dependencies>
</dependencyManagement>
More information about the pkg-java-commits
mailing list