[javapackages/big-refactoring] Big cleanup for 4.1.0: initial something
by Michal Srb
commit f32f74bfbb1ba93232aff6b8c2ff1d406d907d4b
Author: Michal Srb <msrb(a)redhat.com>
Date: Mon Jun 2 17:00:50 2014 +0200
Big cleanup for 4.1.0: initial something
python/javapackages/pom/artifact.py | 195 ++++++++++++++++++++++++++++++++++
python/javapackages/pom/pom.py | 119 +++++++++++++++++++++
python/javapackages/pom/pomreader.py | 40 +++++++
python/javapackages/pom/printer.py | 34 ++++++
4 files changed, 388 insertions(+), 0 deletions(-)
---
diff --git a/python/javapackages/pom/artifact.py b/python/javapackages/pom/artifact.py
new file mode 100644
index 0000000..72acdef
--- /dev/null
+++ b/python/javapackages/pom/artifact.py
@@ -0,0 +1,195 @@
+import sys
+
+from printer import Printer
+from lxml.etree import Element, SubElement, tostring
+
+
+class ArtifactException(Exception):
+ pass
+
+
+class ArtifactFormatException(Exception):
+ pass
+
+
+class AbstractArtifact(object):
+
+ def get_mvn_str(self):
+ m = self.__get_members()
+ return Printer.get_mvn_str(m['groupId'], m['artifactId'],
+ m['extension'], m['classifier'],
+ m['version'])
+
+ def get_rpm_str(self, namespace="", compat=False, pkgver=None):
+ m = self.__get_members()
+ return Printer.get_rpm_str(m['groupId'], m['artifactId'],
+ m['extension'], m['classifier'],
+ m['version'], namespace=namespace,
+ compat=compat, pkgver=pkgver)
+
+ def __get_members(self):
+ m = {'groupId': '',
+ 'artifactId': '',
+ 'extension': '',
+ 'classifier': '',
+ 'version': ''}
+
+ for key in m:
+ if hasattr(self, key):
+ m[key] = getattr(self, key)
+
+ return m
+
+
+class Artifact(AbstractArtifact):
+ """
+ Simplified representation of Maven artifact for purpose of packaging
+
+ Package consists mostly of simple properties and string formatting and
+ loading functions to prevent code duplication elsewhere
+ """
+
+ def __init__(self, groupId, artifactId, extension="",
+ classifier="", version=""):
+ self.groupId = groupId.strip()
+ self.artifactId = artifactId.strip()
+ self.extension = extension.strip()
+ self.classifier = classifier.strip()
+ self.version = version.strip()
+
+ def __unicode__(self):
+ return u"{gid}:{aid}:{ext}:{cla}:{ver}".format(gid=self.groupId,
+ aid=self.artifactId,
+ ext=self.extension,
+ cla=self.classifier,
+ ver=self.version)
+
+ def __str__(self):
+ return unicode(self).encode(sys.getfilesystemencoding())
+
+ def get_xml_element(self, root="artifact"):
+ """
+ Return XML Element node representation of the Artifact
+ """
+ root = Element(root)
+
+ for key in ("artifactId", "groupId", "extension", "version",
+ "classifier"):
+ if hasattr(self, key) and getattr(self, key):
+ item = SubElement(root, key)
+ item.text = getattr(self, key)
+ return root
+
+ def get_xml_str(self, root="artifact"):
+ """
+ Return XML formatted string representation of the Artifact
+ """
+ root = self.get_xml_element(root)
+ return tostring(root, pretty_print=True)
+
+ def __eq__(self, other):
+ if type(other) is type(self):
+ return self.__dict__ == other.__dict__
+ return False
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __hash__(self):
+ return self.groupId.__hash__() + \
+ self.artifactId.__hash__() + \
+ self.version.__hash__() + \
+ self.extension.__hash__() + \
+ self.classifier.__hash__() + \
+ self.namespace.__hash__()
+
+
+ @classmethod
+ def merge_artifacts(cls, dominant, recessive):
+ """
+ Merge two artifacts into one. Information missing in dominant artifact will
+ be copied from recessive artifact. Returns new merged artifact
+ """
+ ret = cls(dominant.groupId, dominant.artifactId, dominant.extension,
+ dominant.classifier, dominant.version)
+ for key in ("artifactId", "groupId", "extension", "version",
+ "classifier"):
+ if not getattr(ret, key):
+ setattr(ret, key, getattr(recessive, key))
+ return ret
+
+ @classmethod
+ def from_xml_element(cls, xmlnode):
+ """
+ Create Artifact from xml.etree.ElementTree.Element as contained
+ within pom.xml or a dependency map.
+ """
+
+ # TODO: find better way of handling pom/ivy/xyz differences
+ parts = {'groupId':'',
+ 'artifactId':'',
+ 'extension':'',
+ 'classifier':'',
+ 'version':''}
+
+ ivyparts = {'org': '',
+ 'name': '',
+ 'revision': ''}
+
+ for key in parts:
+ node = xmlnode.find("./{*}" + key)
+ if node is not None and node.text is not None:
+ parts[key] = node.text.strip()
+
+ if hasattr(xmlnode, "attrib"):
+ attribs = xmlnode.attrib
+ for key in ivyparts:
+ try:
+ ivyparts[key] = attribs[key]
+ except KeyError:
+ pass
+
+ parts['groupId'] = parts['groupId'] or ivyparts['org']
+ parts['artifactId'] = parts['artifactId'] or ivyparts['name']
+ parts['version'] = parts['version'] or ivyparts['revision']
+
+ if not parts['groupId'] or not parts['artifactId']:
+ raise ArtifactFormatException(
+ "Empty groupId or artifactId encountered. "
+ "This is a bug, please report it!")
+
+
+ return cls(parts['groupId'], parts['artifactId'], parts['extension'],
+ parts['classifier'], parts['version'])
+
+ @classmethod
+ def from_mvn_str(cls, mvnstr):
+ """
+ Create Artifact from Maven-style definition
+
+ The string should be in the format of:
+ groupId:artifactId[:extension[:classifier]][:version]
+
+ Where last part is always considered to be version unless empty
+ """
+ tup = mvnstr.split(":")
+
+ # groupId and artifactId are always present
+ if len(tup) < 2:
+ raise ArtifactFormatException("Artifact string '{mvnstr}' does not "
+ "contain ':' character. Can not parse"
+ .format(mvnstr=mvnstr))
+
+ if len(tup) > 5:
+ raise ArtifactFormatException("Artifact string '{mvnstr}' contains "
+ "too many colons. Can not parse"
+ .format(mvnstr=mvnstr))
+
+ groupId = tup[0]
+ artifactId = tup[1]
+ extension = tup[2] if len(tup) >= 4 else ""
+ classifier = tup[3] if len(tup) >= 5 else ""
+ version = tup[-1] if len(tup) >= 3 else ""
+
+ return cls(groupId, artifactId, extension,
+ classifier, version)
diff --git a/python/javapackages/pom/pom.py b/python/javapackages/pom/pom.py
new file mode 100644
index 0000000..b8d0b1c
--- /dev/null
+++ b/python/javapackages/pom/pom.py
@@ -0,0 +1,119 @@
+from pomreader import POMReader, PomLoadingException
+
+
+class POM(object):
+ """
+ Class for querying basic information from pom.xml files used by Apache Maven
+ """
+ def __init__(self, path):
+ self.__doc = POMReader.load(path)
+
+ def __str__(self):
+ return ":".join([self.groupId, self.artifactId, self.version])
+
+ @property
+ def parentGroupId(self):
+ """
+ groupId of the parent artifact or None
+ """
+ gId = POMReader.find(self.__doc, './pom:parent/pom:groupId')
+ if gId is None:
+ return None
+ else:
+ return gId.text.strip()
+
+ @property
+ def parentArtifactId(self):
+ """
+ artifactId of the parent artifact or None
+ """
+ aId = POMReader.find(self.__doc, './pom:parent/pom:artifactId')
+ if aId is None:
+ return None
+ else:
+ return aId.text.strip()
+
+ @property
+ def parentVersion(self):
+ """
+ version of the parent artifact or None
+ """
+ ver = POMReader.find(self.__doc, './pom:parent/pom:version')
+ if ver is None:
+ return None
+ else:
+ return ver.text.strip()
+
+ @property
+ def groupId(self):
+ """
+ Effective groupId of the pom Artifact taking into account parent groupId
+ """
+ gId = POMReader.find(self.__doc, './pom:groupId')
+ if gId is None:
+ gId = POMReader.find(self.__doc, './pom:parent/pom:groupId')
+ if gId is None:
+ gId = POMReader.find(self.__doc, '/ivy-module/info')
+ if gId is not None:
+ gId = gId.attrib["organisation"]
+ if gId is not None:
+ return gId
+ if gId is None:
+ raise PomLoadingException("Unable to determine groupId")
+ if len(gId) != 0:
+ raise PomLoadingException("Unexpected child nodes under groupId")
+ return gId.text.strip()
+
+ @property
+ def artifactId(self):
+ """
+ Effective artifactId of the pom Artifact
+ """
+ aId = POMReader.find(self.__doc, './pom:artifactId')
+ if aId is None:
+ aId = POMReader.find(self.__doc, '/ivy-module/info')
+ if aId is not None:
+ aId = aId.attrib["module"]
+ if aId is not None:
+ return aId
+ if aId is None:
+ raise PomLoadingException("Unable to determine artifactID")
+ if len(aId) != 0:
+ raise PomLoadingException("Unexpected child nodes under artifactId")
+ return aId.text.strip()
+
+ @property
+ def version(self):
+ """
+ Effective version of the pom Artifact taking into account parent
+ version
+ """
+ version = POMReader.find(self.__doc, './pom:version')
+ if version is None:
+ version = POMReader.find(self.__doc, './pom:parent/pom:version')
+ if version is None:
+ version = POMReader.find(self.__doc, '/ivy-module/info')
+ if version is not None:
+ version = version.attrib["revision"]
+ if version is not None:
+ return version
+ if version is None:
+ raise PomLoadingException("Unable to determine artifact version")
+ if len(version) != 0:
+ raise PomLoadingException("Unexpected child nodes under version")
+ return version.text.strip()
+
+ @property
+ def packaging(self):
+ """
+ Packaging type of artifact or None if unspecified
+ """
+ p = POMReader.find(self.__doc, './pom:packaging')
+ if p is not None:
+ if len(p) != 0:
+ raise PomLoadingException("Unexpected child nodes under packaging")
+ return p.text.strip()
+ p = POMReader.find(self.__doc, '/ivy-module/info')
+ if p is not None:
+ return 'ivy'
+ return None
diff --git a/python/javapackages/pom/pomreader.py b/python/javapackages/pom/pomreader.py
new file mode 100644
index 0000000..9066d2d
--- /dev/null
+++ b/python/javapackages/pom/pomreader.py
@@ -0,0 +1,40 @@
+from lxml.etree import ElementTree, XMLParser
+
+
+class PomLoadingException(Exception):
+ pass
+
+
+class POMReader(object):
+
+ POM_NAMESPACE = "http://maven.apache.org/POM/4.0.0"
+
+ @staticmethod
+ def load(pom_path):
+ et = ElementTree()
+ parser = XMLParser(remove_comments=True, strip_cdata=True)
+ try:
+ doc = et.parse(pom_path, parser=parser)
+ except IOError:
+ raise PomLoadingException("Cannot read file {0}".format(pom_path))
+
+ if doc is None:
+ raise PomLoadingException("Failed to load pom.xml")
+ return doc
+
+ @staticmethod
+ def find(doc, xpath, namespace=POM_NAMESPACE):
+ ret = POMReader.xpath(doc, xpath, namespace)
+ if len(ret) > 0:
+ ret = ret[0]
+ else:
+ ret = None
+ return ret
+
+ @staticmethod
+ def xpath(doc, xpath, namespace=POM_NAMESPACE):
+ ret = doc.xpath(xpath, namespaces=dict(pom=namespace))
+ # perhaps there is no namespace?
+ if len(ret) == 0:
+ ret = doc.xpath(xpath.replace('pom:', ''))
+ return ret
diff --git a/python/javapackages/pom/printer.py b/python/javapackages/pom/printer.py
new file mode 100644
index 0000000..0839497
--- /dev/null
+++ b/python/javapackages/pom/printer.py
@@ -0,0 +1,34 @@
+class Printer(object):
+ @staticmethod
+ def get_mvn_str(gid, aid, ext="", cla="", ver=""):
+ mvnstr = "{gid}:{aid}".format(gid=gid, aid=aid)
+
+ if ext:
+ mvnstr = mvnstr + ":{ext}".format(ext=ext)
+
+ if cla:
+ if not ext:
+ mvnstr = mvnstr + ":"
+ mvnstr = mvnstr + ":{cla}".format(cla=cla)
+
+ if ver:
+ mvnstr = mvnstr + ":{ver}".format(ver=ver)
+ elif cla or ext:
+ mvnstr = mvnstr + ":"
+
+ return mvnstr
+
+ @staticmethod
+ def get_rpm_str(gid, aid, ext="", cla="", ver="", namespace="",
+ compat=False, pkgver=None):
+
+ mvnstr = Printer.get_mvn_str(gid, aid, ext, cla, ver if compat else "")
+ rpmstr = "mvn({mvnstr})".format(mvnstr=mvnstr)
+
+ if namespace:
+ rpmstr = "{ns}-{rpmstr}".format(ns=namespace, rpmstr=rpmstr)
+
+ if pkgver is not None:
+ rpmstr = "{rpmstr} = {ver}".format(rpmstr=rpmstr, ver=pkgver)
+
+ return rpmstr
9 years, 10 months
[javapackages] (9 commits) ...[xmvn_resolve] Remove forgotten debug code
by Michal Srb
Summary of changes:
a35d75f... [xmvn_resolve] Initial implementation (*)
c0881a2... [xmvn_resolve] Add classmethod from_artifact() to Resolutio (*)
3bf1aa1... [pom] Add ability to read parent's version (*)
91cc552... [maven.req] Migrate to xmvn-resolve wrapper and raw request (*)
54719dc... [maven.req] Fix rebase bugs (*)
4c10679... [maven.req] Versioned reqs on subpackages (*)
ab9c1a2... [test] Fix tests for usage with xmvn-resolve wrapper (*)
80fd66a... [test] Add forgotten test data (*)
5553a29... [xmvn_resolve] Remove forgotten debug code (*)
(*) This commit already existed in another branch; no separate mail sent
9 years, 10 months
[javapackages/xmvn-resolve-wrapper] [xmvn_resolve] Remove forgotten debug code
by Michal Srb
commit 5553a2994a1eeffc929fe690e8d8ae3955cb4a1f
Author: Michal Srb <msrb(a)redhat.com>
Date: Mon Jun 2 13:19:45 2014 +0200
[xmvn_resolve] Remove forgotten debug code
python/javapackages/xmvn_resolve.py | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
---
diff --git a/python/javapackages/xmvn_resolve.py b/python/javapackages/xmvn_resolve.py
index b4daedd..fd1b227 100644
--- a/python/javapackages/xmvn_resolve.py
+++ b/python/javapackages/xmvn_resolve.py
@@ -124,13 +124,3 @@ class ResolutionRequest(object):
def from_artifact(cls, artifact):
return cls(artifact.artifactId, artifact.groupId,
artifact.extension, artifact.classifier, artifact.version)
-
-
-if __name__ == "__main__":
- artifact = Artifact("junit", "junit")
-
- req = ResolutionRequest.from_artifact(artifact)
-
- results = XMvnResolve.process_raw_request([req])
- print(len(results))
- print(results[0])
9 years, 10 months
[javapackages/xmvn-resolve-wrapper] [test] Add forgotten test data
by Michal Srb
commit 80fd66a31089ad05413aed4209e44fe7748413a6
Author: Michal Srb <msrb(a)redhat.com>
Date: Mon Jun 2 13:17:46 2014 +0200
[test] Add forgotten test data
test/metadata/require3/maven-metadata/require.xml | 15 ++
test/metadata/require3/maven-poms/pom.xml | 244 +++++++++++++++++++++
2 files changed, 259 insertions(+), 0 deletions(-)
---
diff --git a/test/metadata/require3/maven-metadata/require.xml b/test/metadata/require3/maven-metadata/require.xml
new file mode 100644
index 0000000..2e74269
--- /dev/null
+++ b/test/metadata/require3/maven-metadata/require.xml
@@ -0,0 +1,15 @@
+<metadata xmlns="http://fedorahosted.org/xmvn/METADATA/2.0.0">
+ <uuid>432048235932</uuid>
+ <artifacts>
+ <artifact>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugins</artifactId>
+ <version>25</version>
+ <extension>pom</extension>
+ <compatVersions>
+ <version>1.0</version>
+ </compatVersions>
+ <path>/usr/share/maven-poms/plexus-plexus-ant-factory.pom</path>
+ </artifact>
+ </artifacts>
+</metadata>
diff --git a/test/metadata/require3/maven-poms/pom.xml b/test/metadata/require3/maven-poms/pom.xml
new file mode 100644
index 0000000..2fb4ecb
--- /dev/null
+++ b/test/metadata/require3/maven-poms/pom.xml
@@ -0,0 +1,244 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-parent</artifactId>
+ <version>24</version>
+ <relativePath>../../pom/maven/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugins</artifactId>
+ <version>25</version>
+ <packaging>pom</packaging>
+
+ <name>Apache Maven Plugins</name>
+ <description>Maven Plugins</description>
+ <url>http://maven.apache.org/plugins/</url>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-plugins-25</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-plugins-25</developerConnection>
+ <url>http://svn.apache.org/viewvc/maven/plugins/tags/maven-plugins-25</url>
+ </scm>
+ <ciManagement>
+ <system>Jenkins</system>
+ <url>https://builds.apache.org/job/maven-plugins/</url>
+ </ciManagement>
+
+ <distributionManagement>
+ <site><!-- to be copied in every plugin pom, since inheritance adds unwanted artifactId -->
+ <id>apache.website</id>
+ <url>scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/cont...</url>
+ </site>
+ </distributionManagement>
+
+ <properties>
+ <maven.site.path>plugins-archives/${project.artifactId}-LATEST</maven.site.path>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://repository.apache.org/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <issueManagementSystems>
+ <issueManagementSystem>JIRA</issueManagementSystem>
+ </issueManagementSystems>
+ <maxEntries>1000</maxEntries>
+ <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
+ <!-- Used by announcement-generate goal -->
+ <templateDirectory>org/apache/maven/plugins</templateDirectory>
+ <!-- Used by announcement-mail goal -->
+ <subject>[ANN] ${project.name} ${project.version} Released</subject>
+ <toAddresses>
+ <toAddress implementation="java.lang.String">announce(a)maven.apache.org</toAddress>
+ <toAddress implementation="java.lang.String">users(a)maven.apache.org</toAddress>
+ </toAddresses>
+ <ccAddresses>
+ <ccAddress implementation="java.lang.String">dev(a)maven.apache.org</ccAddress>
+ </ccAddresses>
+ <!-- These values need to be specified as properties in the profile apache-release in your settings.xml -->
+ <fromDeveloperId>${apache.availid}</fromDeveloperId>
+ <smtpHost>${smtp.host}</smtpHost>
+ </configuration>
+ <dependencies>
+ <!-- Used by announcement-generate goal -->
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-shared-resources</artifactId>
+ <version>1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <tagBase>https://svn.apache.org/repos/asf/maven/plugins/tags</tagBase>
+ <releaseProfiles>apache-release,rat,run-its</releaseProfiles>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <!-- plugin disabled by maintainer: org.apache.maven.plugins:maven-scm-publish-plugin -->
+ <!-- plugin disabled by maintainer: maven-enforcer-plugin -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generated-helpmojo</id>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>3.2</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <profiles>
+ <profile>
+ <id>quality-checks</id>
+ <activation>
+ <property>
+ <name>quality-checks</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-docck-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>docck-check</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>run-its</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <configuration>
+ <debug>true</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <preBuildHookScript>setup</preBuildHookScript>
+ <postBuildHookScript>verify</postBuildHookScript>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>reporting</id>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ </plugin>
+ </plugins>
+ </reporting>
+ </profile>
+ <profile>
+ <id>maven-3</id>
+ <activation>
+ <file>
+ <!-- This employs that the basedir expression is only recognized by Maven 3.x (see MNG-2363) -->
+ <exists>${basedir}</exists>
+ </file>
+ </activation>
+ <build>
+ <plugins>
+ <!-- if releasing current pom with Maven 3, site descriptor must be attached -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <goals>
+ <goal>attach-descriptor</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
9 years, 10 months
[javapackages/xmvn-resolve-wrapper] [test] Fix tests for usage with xmvn-resolve wrapper
by Michal Srb
commit ab9c1a21512c9f52d55c7ba2aeb7c1ea9b7d7faf
Author: Michal Srb <msrb(a)redhat.com>
Date: Mon Jun 2 13:14:16 2014 +0200
[test] Fix tests for usage with xmvn-resolve wrapper
test/maven_req_test.py | 2 +-
.../require4/maven-metadata/require_dep.xml | 9 +-
test/metadata/require4/maven-poms/pom.xml | 217 +-------------------
3 files changed, 6 insertions(+), 222 deletions(-)
---
diff --git a/test/maven_req_test.py b/test/maven_req_test.py
index bf69222..7829e20 100644
--- a/test/maven_req_test.py
+++ b/test/maven_req_test.py
@@ -215,7 +215,7 @@ class TestMavenReq(unittest.TestCase):
# self.assertEquals(return_value, 0, stderr)
# sout = [x for x in stdout.split('\n') if x]
# want = ("mvn(org.apache.maven.plugins:maven-plugin-plugin)", "jpackage-utils",
- # "mvn(org.codehaus.plexus:plexus-ant-factory-dep:pom:) = 1.0", "java-headless")
+ # "mvn(org.fedoraproject.xmvn:xmvn-api:pom:) = 1.0", "java-headless")
# self.assertEquals(set(want), set(sout))
if __name__ == '__main__':
diff --git a/test/metadata/require4/maven-metadata/require_dep.xml b/test/metadata/require4/maven-metadata/require_dep.xml
index 5c08934..9d80937 100644
--- a/test/metadata/require4/maven-metadata/require_dep.xml
+++ b/test/metadata/require4/maven-metadata/require_dep.xml
@@ -2,14 +2,11 @@
<uuid>432048235932</uuid>
<artifacts>
<artifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-ant-factory-dep</artifactId>
+ <groupId>org.fedoraproject.xmvn</groupId>
+ <artifactId>xmvn-api</artifactId>
<version>1.0</version>
<extension>pom</extension>
- <compatVersions>
- <version>1.0</version>
- </compatVersions>
- <path>/usr/share/maven-poms/plexus-plexus-ant-factory.pom</path>
+ <path>/usr/share/maven-poms/xmvn-api.pom</path>
</artifact>
</artifacts>
</metadata>
diff --git a/test/metadata/require4/maven-poms/pom.xml b/test/metadata/require4/maven-poms/pom.xml
index 0c595b9..e18483c 100644
--- a/test/metadata/require4/maven-poms/pom.xml
+++ b/test/metadata/require4/maven-poms/pom.xml
@@ -1,29 +1,10 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-ant-factory-dep</artifactId>
+ <groupId>org.fedoraproject.xmvn</groupId>
+ <artifactId>xmvn-api</artifactId>
<version>1.0</version>
- <relativePath>../../pom/maven/pom.xml</relativePath>
</parent>
<groupId>org.apache.maven.plugins</groupId>
@@ -31,91 +12,8 @@ under the License.
<version>25</version>
<packaging>pom</packaging>
- <name>Apache Maven Plugins</name>
- <description>Maven Plugins</description>
- <url>http://maven.apache.org/plugins/</url>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-plugins-25</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-plugins-25</developerConnection>
- <url>http://svn.apache.org/viewvc/maven/plugins/tags/maven-plugins-25</url>
- </scm>
- <ciManagement>
- <system>Jenkins</system>
- <url>https://builds.apache.org/job/maven-plugins/</url>
- </ciManagement>
-
- <distributionManagement>
- <site><!-- to be copied in every plugin pom, since inheritance adds unwanted artifactId -->
- <id>apache.website</id>
- <url>scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/cont...</url>
- </site>
- </distributionManagement>
-
- <properties>
- <maven.site.path>plugins-archives/${project.artifactId}-LATEST</maven.site.path>
- </properties>
-
- <repositories>
- <repository>
- <id>apache.snapshots</id>
- <name>Apache Snapshot Repository</name>
- <url>http://repository.apache.org/snapshots</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-changes-plugin</artifactId>
- <version>2.9</version>
- <configuration>
- <issueManagementSystems>
- <issueManagementSystem>JIRA</issueManagementSystem>
- </issueManagementSystems>
- <maxEntries>1000</maxEntries>
- <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
- <!-- Used by announcement-generate goal -->
- <templateDirectory>org/apache/maven/plugins</templateDirectory>
- <!-- Used by announcement-mail goal -->
- <subject>[ANN] ${project.name} ${project.version} Released</subject>
- <toAddresses>
- <toAddress implementation="java.lang.String">announce(a)maven.apache.org</toAddress>
- <toAddress implementation="java.lang.String">users(a)maven.apache.org</toAddress>
- </toAddresses>
- <ccAddresses>
- <ccAddress implementation="java.lang.String">dev(a)maven.apache.org</ccAddress>
- </ccAddresses>
- <!-- These values need to be specified as properties in the profile apache-release in your settings.xml -->
- <fromDeveloperId>${apache.availid}</fromDeveloperId>
- <smtpHost>${smtp.host}</smtpHost>
- </configuration>
- <dependencies>
- <!-- Used by announcement-generate goal -->
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-resources</artifactId>
- <version>1</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <tagBase>https://svn.apache.org/repos/asf/maven/plugins/tags</tagBase>
- <releaseProfiles>apache-release,rat,run-its</releaseProfiles>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
<plugins>
- <!-- plugin disabled by maintainer: org.apache.maven.plugins:maven-scm-publish-plugin -->
- <!-- plugin disabled by maintainer: maven-enforcer-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
@@ -130,115 +28,4 @@ under the License.
</plugin>
</plugins>
</build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>3.2</version>
- </plugin>
- </plugins>
- </reporting>
-
- <profiles>
- <profile>
- <id>quality-checks</id>
- <activation>
- <property>
- <name>quality-checks</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-docck-plugin</artifactId>
- <executions>
- <execution>
- <id>docck-check</id>
- <phase>verify</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>run-its</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-invoker-plugin</artifactId>
- <configuration>
- <debug>true</debug>
- <projectsDirectory>src/it</projectsDirectory>
- <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
- <preBuildHookScript>setup</preBuildHookScript>
- <postBuildHookScript>verify</postBuildHookScript>
- <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
- <settingsFile>src/it/settings.xml</settingsFile>
- <pomIncludes>
- <pomInclude>*/pom.xml</pomInclude>
- </pomIncludes>
- </configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>install</goal>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>reporting</id>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-invoker-plugin</artifactId>
- <version>1.8</version>
- </plugin>
- </plugins>
- </reporting>
- </profile>
- <profile>
- <id>maven-3</id>
- <activation>
- <file>
- <!-- This employs that the basedir expression is only recognized by Maven 3.x (see MNG-2363) -->
- <exists>${basedir}</exists>
- </file>
- </activation>
- <build>
- <plugins>
- <!-- if releasing current pom with Maven 3, site descriptor must be attached -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <inherited>false</inherited>
- <executions>
- <execution>
- <id>attach-descriptor</id>
- <goals>
- <goal>attach-descriptor</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
</project>
9 years, 10 months
[javapackages/xmvn-resolve-wrapper] [maven.req] Versioned reqs on subpackages
by Michal Srb
commit 4c10679897b1374522b3fc95ccc685e92a377737
Author: Michal Srb <msrb(a)redhat.com>
Date: Mon Jun 2 13:12:44 2014 +0200
[maven.req] Versioned reqs on subpackages
depgenerators/maven.req | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/depgenerators/maven.req b/depgenerators/maven.req
index 39c5ab0..146bfc5 100755
--- a/depgenerators/maven.req
+++ b/depgenerators/maven.req
@@ -179,6 +179,10 @@ class TagBuilder(object):
results = XMvnResolve.process_raw_request(reqs)
for i, r in enumerate(results):
dep = Dependency(deps[i].groupId, deps[i].artifactId, requestedVersion=deps[i].version)
+ dver = self.__is_provided_by_subpackage(dep)
+ if dver is not None:
+ print("{rpmstr} = {version}".format(rpmstr=dep.get_rpm_str(), version=dver))
+ continue
if not r:
unresolvable.append(dep)
continue
@@ -196,7 +200,11 @@ class TagBuilder(object):
req = ResolutionRequest(pgid, paid, extension="pom")
r = XMvnResolve.process_raw_request([req])[0]
dep = Dependency(pgid, paid, pver, extension="pom")
- if not r:
+
+ dver = self.__is_provided_by_subpackage(dep)
+ if dver is not None:
+ print("{rpmstr} = {version}".format(rpmstr=dep.get_rpm_str(), version=dver))
+ elif not r:
unresolvable.append(dep)
else:
if r.compatVersion != "SYSTEM":
9 years, 10 months