[javapackages] [test] Another Python 2.6 compatibility fix
by Michal Srb
commit 087a86a9867df0f97ebce491bd4c06d74004afeb
Author: Michal Srb <msrb(a)redhat.com>
Date: Thu Jun 11 07:11:34 2015 +0200
[test] Another Python 2.6 compatibility fix
test/maven_depmap_test.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/test/maven_depmap_test.py b/test/maven_depmap_test.py
index 5185069..186ceec 100644
--- a/test/maven_depmap_test.py
+++ b/test/maven_depmap_test.py
@@ -4,7 +4,8 @@ import six
import os
import unittest
import shutil
-from test_common import DIRPATH, mvn_depmap, call_script, prepare_metadata
+from test_common import (DIRPATH, mvn_depmap, call_script,
+ prepare_metadata, assertIn)
from test_rpmbuild import Package
from lxml import etree
@@ -334,7 +335,7 @@ class TestMavenDepmap(unittest.TestCase):
p.append_to_prep("%add_maven_depmap g:a:1 this/file/doesnt/exist.jar")
_, stderr, return_value = p.run_prep()
self.assertEqual(1, return_value, 'bad return value')
- self.assertIn('file not found', stderr)
+ assertIn(self, 'file not found', stderr)
if __name__ == '__main__':
unittest.main()
8 years, 9 months
[javapackages] [test] Fix compatibility with Python 2.6
by Michal Srb
commit 09e988cad6c1cdbd6efb992dc661f004fab14cd6
Author: Michal Srb <msrb(a)redhat.com>
Date: Wed Jun 10 15:31:53 2015 +0200
[test] Fix compatibility with Python 2.6
test/maven_req_test.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/test/maven_req_test.py b/test/maven_req_test.py
index 908e412..a9fde87 100644
--- a/test/maven_req_test.py
+++ b/test/maven_req_test.py
@@ -152,7 +152,7 @@ class TestMavenReq(unittest.TestCase):
lines = stderr.split('\n')
self.assertEqual(True, len(lines) > 1)
self.assertEqual("g:skipped:UNKNOWN required by g:a1", lines[-5])
- self.assertIn("%mvn_package", lines[-3])
+ assertIn(self, "%mvn_package", lines[-3])
# rhbz#1017701 comment 2
@mavenreq(["aether/buildroot/usr/share/maven-metadata/require.xml"])
8 years, 9 months
[javapackages] Macro %add_maven_depmap should fail if given JAR file doesn't exist (rhbz#1230193)
by Michal Srb
commit 495823642b01a60b38827d6527b89ad8cbd86738
Author: Michal Srb <msrb(a)redhat.com>
Date: Wed Jun 10 15:24:48 2015 +0200
Macro %add_maven_depmap should fail if given JAR file doesn't exist (rhbz#1230193)
macros.d/macros.fjava | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/macros.d/macros.fjava b/macros.d/macros.fjava
index 73f51df..bb419ae 100644
--- a/macros.d/macros.fjava
+++ b/macros.d/macros.fjava
@@ -181,12 +181,17 @@ set -e \
%endif \
_filelist=".mfiles%{-f*:-%{-f*}}" \
install -dm 755 %{buildroot}%{_datadir}/maven-metadata \
+_jbase= \
+_jpath= \
for _dir in %{_jnidir} %{_javadir}; do \
if [ -f %{buildroot}$_dir/$_jarpart ]; then \
_jbase="%{buildroot}$_dir" \
_jpath="$_jbase/$_jarpart" \
fi \
done \
+%if %# != 1 \
+ [ -z "$_jpath" ] && (echo "%0 error: $_jarpart - file not found" 1>&2; exit 1) \
+%endif \
%{pyinterpreter} %{javadir}-utils/maven_depmap.py %{-a} %{-v*:-r %{-v*}} \\\
-n "%{?scl}" \\\
--pom-base %{buildroot}%{_mavenpomdir} \\\
8 years, 9 months
[javapackages] [test] Add test for rhbz#1230193
by Michal Srb
commit 18bca97c60ae78d5f7c5d2defa50c5a925a62f2d
Author: Michal Srb <msrb(a)redhat.com>
Date: Wed Jun 10 15:24:01 2015 +0200
[test] Add test for rhbz#1230193
test/maven_depmap_test.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/test/maven_depmap_test.py b/test/maven_depmap_test.py
index 399ac10..5185069 100644
--- a/test/maven_depmap_test.py
+++ b/test/maven_depmap_test.py
@@ -5,11 +5,12 @@ import os
import unittest
import shutil
from test_common import DIRPATH, mvn_depmap, call_script, prepare_metadata
-
+from test_rpmbuild import Package
from lxml import etree
from xml_compare import compare_lxml_etree
+
class TestMavenDepmap(unittest.TestCase):
maxDiff = 2048
@@ -328,5 +329,12 @@ class TestMavenDepmap(unittest.TestCase):
depmap)
self.assertEqual(report, '', report)
+ def test_missing_jar(self):
+ p = Package('test')
+ p.append_to_prep("%add_maven_depmap g:a:1 this/file/doesnt/exist.jar")
+ _, stderr, return_value = p.run_prep()
+ self.assertEqual(1, return_value, 'bad return value')
+ self.assertIn('file not found', stderr)
+
if __name__ == '__main__':
unittest.main()
8 years, 9 months
Broken dependencies: ambari
by Fedora Koji Build System
ambari has broken dependencies in the rawhide tree:
On x86_64:
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-server)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-json)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-client)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-multipart)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-guice)
On i386:
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-server)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-json)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-client)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-multipart)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-guice)
On armhfp:
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-server)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-json)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-client)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-multipart)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-guice)
On x86_64:
ambari-views-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-core)
On i386:
ambari-views-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-core)
On armhfp:
ambari-views-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-core)
Please resolve this as soon as possible.
8 years, 9 months
[javapackages] Keeping optional elements with pom_change_dep (rhbz#1229735)
by Michael Šimáček
commit b42ca5f041a9b438f4c7269c206c7bb1ac28a189
Author: Michael Simacek <msimacek(a)redhat.com>
Date: Tue Jun 9 18:19:28 2015 +0200
Keeping optional elements with pom_change_dep (rhbz#1229735)
java-utils/pom_editor.py | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/java-utils/pom_editor.py b/java-utils/pom_editor.py
index 0e7bdcd..077462d 100644
--- a/java-utils/pom_editor.py
+++ b/java-utils/pom_editor.py
@@ -60,11 +60,6 @@ def MetaArtifact(specification, attributes=False, namespace=None, **defaults):
if value:
self[key] = value
- def remove_items(self, fn):
- for prop, val in six.iteritems(dict(self.values)):
- if fn(val):
- del self.values[prop]
-
def __getitem__(self, key):
return self.values.get(key, '')
@@ -97,6 +92,20 @@ def MetaArtifact(specification, attributes=False, namespace=None, **defaults):
xml.append('</{0}>'.format(node))
return etree.fromstring('\n'.join(xml))
+ def merge_into_xml(self, element):
+ for key in parts:
+ value = self.values.get(key, defaults.get(key, ''))
+ if value:
+ child = element.xpath('ns:' + key,
+ namespaces={'ns': namespace})
+ if child:
+ if value == '-':
+ element.remove(child[0])
+ else:
+ child[0].text = value
+ elif value != '-':
+ element.append(element.makeelement(name=key, text=value))
+
def get_xpath_condition(self):
expr = "normalize-space(pom:{0})='{1}'"
conditions = []
@@ -122,6 +131,14 @@ def MetaArtifact(specification, attributes=False, namespace=None, **defaults):
return etree.fromstring('<{0} {1}>{2}</{0}>'
.format(node, ' '.join(xml), extra))
+ def merge_into_xml(self, element):
+ for key in parts:
+ value = self.values.get(key, defaults.get(key, ''))
+ if value == '-':
+ del element.attrib[key]
+ elif value:
+ element.attrib[key] = value
+
def get_xpath_condition(self):
expr = "@{0}='{1}'"
conditions = []
@@ -260,15 +277,12 @@ class XmlFile(object):
parent.insert(idx + i, element)
self.reformat(parent, parent[idx: idx + items])
- def replace_xml_content(self, parent, content, replace_attrib=False):
+ def replace_xml_content(self, parent, content):
if hasattr(parent, 'is_attribute'):
if parent.is_attribute:
parent.getparent().attrib[parent.attrname] = content.text
return
parent[:] = content
- if replace_attrib and hasattr(content, 'attrib'):
- parent.attrib.clear()
- parent.attrib.update(content.attrib.iteritems())
parent.text = content.text
self.reformat(parent, parent)
@@ -610,9 +624,7 @@ def pom_change_dep(old, new, pom=None, xml_string=''):
for element in elements:
new_artifact = pom.create_artifact().from_xml(element)
new_artifact.update(pom.create_artifact().from_mvn_str(new))
- new_artifact.remove_items(lambda x: x == '-')
- new_xml = new_artifact.get_xml(extra=xml_string)
- pom.replace_xml_content(element, new_xml, replace_attrib=True)
+ new_artifact.merge_into_xml(element)
except PomQueryNoMatch:
raise PomQueryNoMatch("Dependency '{0}' not found.".format(old))
8 years, 9 months
[javapackages] Test for keeping optional elements with pom_change_dep
by Michael Šimáček
commit 6fbef7550ca30db8ea4c4442ebc42ce9923a4a1b
Author: Michael Simacek <msimacek(a)redhat.com>
Date: Tue Jun 9 16:59:26 2015 +0200
Test for keeping optional elements with pom_change_dep
test/data/pom_editor/optional.xml | 41 +++++++++++++++++++++++++++
test/data/pom_editor/want/keep_optional.xml | 41 +++++++++++++++++++++++++++
test/pom_editor_artifact_test.py | 7 ++++
3 files changed, 89 insertions(+), 0 deletions(-)
---
diff --git a/test/data/pom_editor/optional.xml b/test/data/pom_editor/optional.xml
new file mode 100644
index 0000000..7e7d3d5
--- /dev/null
+++ b/test/data/pom_editor/optional.xml
@@ -0,0 +1,41 @@
+<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/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>com.example</groupId>
+ <artifactId>parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.example</groupId>
+ <artifactId>common</artifactId>
+ <version>2.6</version>
+ <name>Example common</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-ioX</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_editor/want/keep_optional.xml b/test/data/pom_editor/want/keep_optional.xml
new file mode 100644
index 0000000..1eff06f
--- /dev/null
+++ b/test/data/pom_editor/want/keep_optional.xml
@@ -0,0 +1,41 @@
+<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/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>com.example</groupId>
+ <artifactId>parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.example</groupId>
+ <artifactId>common</artifactId>
+ <version>2.6</version>
+ <name>Example common</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-ioX</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/pom_editor_artifact_test.py b/test/pom_editor_artifact_test.py
index 5bf9d8a..af710c8 100644
--- a/test/pom_editor_artifact_test.py
+++ b/test/pom_editor_artifact_test.py
@@ -94,5 +94,12 @@ class TestPomChange(WorkdirTestCase):
self.assertEqual(0, return_value, stderr)
self.assertEqual('', report, report)
+ def test_keep_optional(self):
+ return_value, stderr, report = exec_pom_macro_simple(\
+ "%pom_change_dep commons-io: org.apache.commons-io:",
+ 'optional.xml', 'keep_optional.xml')
+ self.assertEqual(0, return_value, stderr)
+ self.assertEqual('', report, report)
+
if __name__ == '__main__':
unittest.main()
8 years, 9 months
Broken dependencies: ambari
by Fedora Koji Build System
ambari has broken dependencies in the rawhide tree:
On x86_64:
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-server)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-json)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-client)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-multipart)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-guice)
On i386:
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-server)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-json)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-client)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-multipart)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-guice)
On armhfp:
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-server)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-json)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-client)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-multipart)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-guice)
On x86_64:
ambari-views-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-core)
On i386:
ambari-views-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-core)
On armhfp:
ambari-views-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-core)
Please resolve this as soon as possible.
8 years, 9 months
Broken dependencies: ambari
by Fedora Koji Build System
ambari has broken dependencies in the rawhide tree:
On x86_64:
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-server)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-json)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-client)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-multipart)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-guice)
On i386:
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-server)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-json)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-client)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-multipart)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-guice)
On armhfp:
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-server)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-json)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-client)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-multipart)
ambari-server-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey.contribs:jersey-guice)
On x86_64:
ambari-views-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-core)
On i386:
ambari-views-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-core)
On armhfp:
ambari-views-1.5.1-3.fc22.noarch requires mvn(com.sun.jersey:jersey-core)
Please resolve this as soon as possible.
8 years, 9 months