Revive package, update to 1.3.0

This commit is contained in:
Sandro Mani 2016-04-15 11:40:34 +02:00
parent 0ed248a4a0
commit 60d68cddb9
11 changed files with 7388 additions and 1 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
libkml-0.6.1.tar.gz libkml-0.6.1.tar.gz
/libkml-1.3.0.tar.gz

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
From 77cf351a61f3683b74e07857ca77b5580d1cedf0 Mon Sep 17 00:00:00 2001
From: Sandro Mani <manisandro@gmail.com>
Date: Fri, 8 Apr 2016 23:21:26 +0200
Subject: [PATCH 2/4] Fix mistaken use of std::cerr instead of std::endl
---
examples/engine/inlinestyles.cc | 8 ++++----
examples/engine/splitstyles.cc | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/examples/engine/inlinestyles.cc b/examples/engine/inlinestyles.cc
index 1cb4755..8ad1f57 100644
--- a/examples/engine/inlinestyles.cc
+++ b/examples/engine/inlinestyles.cc
@@ -35,20 +35,20 @@
bool InlineStyles(const char* input_filename, const char* output_filename) {
std::string kml_input;
if (!kmlbase::File::ReadFileToString(input_filename, &kml_input)) {
- std::cerr << "read failed: " << input_filename << std::cerr;
+ std::cerr << "read failed: " << input_filename << std::endl;
return false;
}
std::string errors;
kmldom::ElementPtr root = kmlengine::InlineStyles(kml_input, &errors);
if (!root) {
- std::cerr << "parse failed: " << input_filename << std::cerr;
- std::cerr << "parse failed: " << errors << std::cerr;
+ std::cerr << "parse failed: " << input_filename << std::endl;
+ std::cerr << "parse failed: " << errors << std::endl;
return false;
}
std::string kml_output = kmldom::SerializePretty(root);
if (!kmlbase::File::WriteStringToFile(kml_output, output_filename)) {
- std::cerr << "write failed: " << output_filename << std::cerr;
+ std::cerr << "write failed: " << output_filename << std::endl;
return false;
}
return true;
diff --git a/examples/engine/splitstyles.cc b/examples/engine/splitstyles.cc
index a3b190a..56203c9 100644
--- a/examples/engine/splitstyles.cc
+++ b/examples/engine/splitstyles.cc
@@ -35,20 +35,20 @@
bool SplitStyles(const char* input_filename, const char* output_filename) {
std::string kml_input;
if (!kmlbase::File::ReadFileToString(input_filename, &kml_input)) {
- std::cerr << "read failed: " << input_filename << std::cerr;
+ std::cerr << "read failed: " << input_filename << std::endl;
return false;
}
std::string errors;
kmldom::ElementPtr root = kmlengine::SplitStyles(kml_input, &errors);
if (!root) {
- std::cerr << "parse failed: " << input_filename << std::cerr;
- std::cerr << "parse failed: " << errors << std::cerr;
+ std::cerr << "parse failed: " << input_filename << std::endl;
+ std::cerr << "parse failed: " << errors << std::endl;
return false;
}
std::string kml_output = kmldom::SerializePretty(root);
if (!kmlbase::File::WriteStringToFile(kml_output, output_filename)) {
- std::cerr << "write failed: " << output_filename << std::cerr;
+ std::cerr << "write failed: " << output_filename << std::endl;
return false;
}
return true;
--
2.8.1

View File

@ -0,0 +1,71 @@
From b728c0815edc06c826fb5be8cd25cbb7f3b816b3 Mon Sep 17 00:00:00 2001
From: Sandro Mani <manisandro@gmail.com>
Date: Fri, 8 Apr 2016 23:22:12 +0200
Subject: [PATCH 3/4] Fix python tests
---
tests/swig/CMakeLists.txt | 6 ++++++
tests/swig/kmldom_test.py | 2 +-
tests/swig/kmlengine_test.py | 3 ++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/tests/swig/CMakeLists.txt b/tests/swig/CMakeLists.txt
index 52e398e..5ba1cd1 100644
--- a/tests/swig/CMakeLists.txt
+++ b/tests/swig/CMakeLists.txt
@@ -1,12 +1,18 @@
if(WITH_PYTHON)
add_test(NAME test_python_kmlbase
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlbase_test.py)
+set_tests_properties(test_python_kmlbase
+ PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
add_test(NAME test_python_kmldom
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmldom_test.py)
+set_tests_properties(test_python_kmldom
+ PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
add_test(NAME test_python_kmlengine
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlengine_test.py)
+set_tests_properties(test_python_kmlengine
+ PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
endif()
if(WITH_JAVA)
diff --git a/tests/swig/kmldom_test.py b/tests/swig/kmldom_test.py
index e18c5a7..4762d6e 100644
--- a/tests/swig/kmldom_test.py
+++ b/tests/swig/kmldom_test.py
@@ -753,7 +753,7 @@ def TestColorStyle(colorstyle):
color = kmlbase.Color32(0xf0f0c80f)
colorstyle.set_color(color)
assert colorstyle.has_color()
- assert color == colorstyle.get_color()
+ assert color.to_string_argb() == colorstyle.get_color().to_string_argb()
# Clear <color> and verify has_
colorstyle.clear_color()
assert not colorstyle.has_color()
diff --git a/tests/swig/kmlengine_test.py b/tests/swig/kmlengine_test.py
index 8850221..7eb3c09 100644
--- a/tests/swig/kmlengine_test.py
+++ b/tests/swig/kmlengine_test.py
@@ -32,6 +32,7 @@ This file contains unit tests for the KML Engine Python SWIG bindings.
import unittest
import kmldom
import kmlengine
+import os
# These VerySimple tests really only verify that the function/class exists.
@@ -239,7 +240,7 @@ class BasicKmlFileSerializeToStringTestCase(unittest.TestCase):
class BasicKmzFileTestCase(unittest.TestCase):
def runTest(self):
- kmz_filepath = '../../testdata/kmz/model-macky.kmz'
+ kmz_filepath = os.path.join(os.path.dirname(__file__), '../../testdata/kmz/model-macky.kmz')
kmzfile = kmlengine.KmzFile.OpenFromFile(kmz_filepath)
assert kmzfile
(ok, kml) = kmzfile.ReadKml()
--
2.8.1

View File

@ -0,0 +1,91 @@
From 2382618c2de489b860228b74283a581b4333030d Mon Sep 17 00:00:00 2001
From: Sandro Mani <manisandro@gmail.com>
Date: Fri, 8 Apr 2016 23:23:20 +0200
Subject: [PATCH 4/4] Correctly build and run java test
---
cmake/JUnit.cmake | 38 ++++++++++++++++++++++++++++++++++++++
tests/swig/CMakeLists.txt | 23 +++++++++++++++++------
2 files changed, 55 insertions(+), 6 deletions(-)
create mode 100644 cmake/JUnit.cmake
diff --git a/cmake/JUnit.cmake b/cmake/JUnit.cmake
new file mode 100644
index 0000000..3c114fd
--- /dev/null
+++ b/cmake/JUnit.cmake
@@ -0,0 +1,38 @@
+include(FindJava)
+
+# add_junit_test(<target name>
+# CLASSPATH [path1 ...]
+# TESTS [class1 ...]
+# )
+function(add_junit_test TARGET_NAME)
+
+ if (WIN32 AND NOT CYGWIN)
+ set(SEPARATOR ";")
+ else (WIN32 AND NOT CYGWIN)
+ set(SEPARATOR ":")
+ endif(WIN32 AND NOT CYGWIN)
+
+ foreach (ARG ${ARGN})
+ if (ARG MATCHES "CLASSPATH" OR ARG MATCHES "TESTS" OR ARG MATCHES "JVMARGS")
+ set(TYPE ${ARG})
+
+ else ()
+
+ if (TYPE MATCHES "CLASSPATH")
+ set(CLASSPATH "${CLASSPATH}${SEPARATOR}${ARG}")
+
+ elseif (TYPE MATCHES "TESTS")
+ set(TESTS ${TESTS} ${ARG})
+
+ elseif (TYPE MATCHES "JVMARGS")
+ set(JVMARGS ${JVMARGS} ${ARG})
+
+ endif()
+
+ endif()
+
+ endforeach(ARG)
+
+ add_test(NAME ${TARGET_NAME} COMMAND ${Java_JAVA_EXECUTABLE} ${JVMARGS} -classpath ${CLASSPATH} org.junit.runner.JUnitCore ${TESTS})
+
+endfunction(add_junit_test)
diff --git a/tests/swig/CMakeLists.txt b/tests/swig/CMakeLists.txt
index 5ba1cd1..c859d4d 100644
--- a/tests/swig/CMakeLists.txt
+++ b/tests/swig/CMakeLists.txt
@@ -16,10 +16,21 @@ set_tests_properties(test_python_kmlengine
endif()
if(WITH_JAVA)
-add_test( NAME test_java_kmlbase
- COMMAND
- ${Java_JAVA_EXECUTABLE}
- -cp "${CMAKE_JAVA_INCLUDE_PATH}${PATH_SEPARATOR}${CMAKE_BINARY_DIR}/src/swig/LibKML.jar;${CMAKE_CURRENT_BINARY_DIR}"
- KmlBaseTest )
+include(UseJava)
+include(JUnit)
+find_file(JUNIT_JAR NAMES junit.jar PATHS ${JAVA_LIB_INSTALL_DIR} /usr/share/java)
+find_file(HAMCREST_JAR NAMES hamcrest/core.jar PATHS ${JAVA_LIB_INSTALL_DIR} /usr/share/java)
-endif()
\ No newline at end of file
+add_jar(KmlBaseTest KmlBaseTest.java INCLUDE_JARS /usr/share/java/junit.jar ${CMAKE_BINARY_DIR}/src/swig/LibKML.jar)
+add_dependencies(KmlBaseTest LibKML_jar)
+
+if(WIN32 AND NOT CYGWIN)
+ set(PATH_SEPARATOR ";")
+else(WIN32 AND NOT CYGWIN)
+ set(PATH_SEPARATOR ":")
+endif(WIN32 AND NOT CYGWIN)
+
+add_junit_test(test_java_kmlbase CLASSPATH "${JUNIT_JAR}${PATH_SEPARATOR}${HAMCREST_JAR}${PATH_SEPARATOR}${CMAKE_BINARY_DIR}/src/swig/LibKML.jar${PATH_SEPARATOR}${CMAKE_CURRENT_BINARY_DIR}/KmlBaseTest.jar" TESTS KmlBaseTest)
+set_tests_properties(test_java_kmlbase
+ PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib")
+endif()
--
2.8.1

View File

@ -1 +0,0 @@
This package was retired on 2012-08-06 due to failure to build for multiple releases.

13
fragile_test.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/tests/kml/engine/feature_view_test.cc b/tests/kml/engine/feature_view_test.cc
index ce572bb..0b53851 100644
--- a/tests/kml/engine/feature_view_test.cc
+++ b/tests/kml/engine/feature_view_test.cc
@@ -144,7 +144,7 @@ TEST(FeatureViewTest, TestComputeBboxLookAt) {
// These fields are expected to be set to these values.
ASSERT_DOUBLE_EQ(-86.032775, lookat->get_longitude());
ASSERT_DOUBLE_EQ(35.78925, lookat->get_latitude());
- ASSERT_DOUBLE_EQ(712928.68603440293, lookat->get_range());
+ ASSERT_NEAR(712928.68603440, lookat->get_range(), 0.0000001);
// These fields are not set by ComputeBboxLookAt.
ASSERT_FALSE(lookat->has_altitude());
ASSERT_FALSE(lookat->has_heading());

161
libkml.spec Normal file
View File

@ -0,0 +1,161 @@
Name: libkml
Version: 1.3.0
Release: 2%{?dist}
Summary: Reference implementation of OGC KML 2.2
License: BSD
URL: https://github.com/libkml/libkml
Source0: https://github.com/libkml/libkml/archive/%{version}/libkml-%{version}.tar.gz
## See https://github.com/libkml/libkml/pull/239
Patch0: 0001-Fix-build-failure-due-to-failure-to-convert-pointer-.patch
Patch1: 0002-Fix-mistaken-use-of-std-cerr-instead-of-std-endl.patch
Patch2: 0003-Fix-python-tests.patch
Patch3: 0004-Correctly-build-and-run-java-test.patch
# Fix a fragile test failing on i686
Patch4: fragile_test.patch
BuildRequires: cmake
BuildRequires: curl-devel
BuildRequires: boost-devel
BuildRequires: expat-devel
BuildRequires: gtest-devel
BuildRequires: java-devel
BuildRequires: junit
BuildRequires: minizip-devel
BuildRequires: python2-devel
BuildRequires: swig
BuildRequires: uriparser-devel
BuildRequires: zlib-devel
%global __requires_exclude_from ^%{_docdir}/.*$
%global __provides_exclude_from ^%{python2_sitearch}/.*\\.so$
%description
Reference implementation of OGC KML 2.2.
It also includes implementations of Google's gx: extensions used by Google
Earth, as well as several utility libraries for working with other formats.
%package -n python2-%{name}
Summary: Python bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{name}
The python2-%{name} package contains Python bindings for %{name}.
%package java
Summary: Java bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description java
The %{name}-java package contains Java bindings for %{name}.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: boost-devel
Requires: expat-devel
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
%cmake -DWITH_SWIG=ON -DWITH_PYTHON=ON -DWITH_JAVA=ON \
-DJNI_INSTALL_DIR=%{_libdir}/%{name} \
-DCMAKE_INSTALL_DIR=%{_libdir}/cmake/%{name} \
-DINCLUDE_INSTALL_DIR=%{_includedir}/kml \
-DBUILD_TESTING=ON \
-DBUILD_EXAMPLES=ON
make %{?_smp_mflags}
%install
%make_install
%check
ctest -V
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%license LICENSE
%doc AUTHORS README.md
%{_libdir}/libkml*.so.*
%files -n python2-%{name}
%{python2_sitearch}/*.so
%{python2_sitearch}/*.py*
%files java
%{_javadir}/LibKML.jar
%{_libdir}/%{name}/
%files devel
%doc examples
%{_includedir}/kml/
%{_libdir}/libkml*.so
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/cmake/%{name}/
%changelog
* Fri Apr 08 2016 Sandro Mani <manisandro@gmail.com> - 1.3.0-2
- Don't call it Google's reference implementation in Summary/Description
- Update Source URL
- Add python_provide macro
- Enable tests
* Thu Mar 31 2016 Sandro Mani <manisandro@gmail.com> - 1.3.0-1
- Update to 1.3.0
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Mon Aug 02 2010 Orcan Ogetbil <oget[dot]fedora[at]gmail[dot]com> - 0.6.1-7
- Fix gcc warning that lead to failure due to -Werror flag
* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 0.6.1-6
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Sun Apr 12 2009 Rakesh Pandit <rakesh@fedoraproject.org> 0.6.1-4
- Included *pyc and pyo files in %%files and added BuildRequires libgcj-devel.
* Sun Apr 12 2009 Rakesh Pandit <rakesh@fedoraproject.org> 0.6.1-3
- libkml-0.6.1.configure_ac.patch patch for swig > 1.3.35
* Sat Mar 07 2009 Rakesh Pandit <rakesh@fedoraproject.org> 0.6.1-2
- updated to 0.6.1
- libkml-third_party_removal.diff Removes third part dependency
- (provided by Peter Lemenkov)
* Fri Jan 16 2009 Rakesh Pandit <rakesh@fedoraproject.org> 0.6.1-1
- Updated to 0.6.1
* Mon Oct 06 2008 Rakesh Pandit <rakesh@fedoraproject.org> 0.4.0-2
- Added >= 1.3.35 for swing
* Sat Aug 09 2008 Rakesh Pandit <rakesh@fedoraproject.org> 0.4.0-1
- Initial package

3411
libkml_build.patch Normal file

File diff suppressed because it is too large Load Diff

73
libkml_tests.patch Normal file
View File

@ -0,0 +1,73 @@
diff -rupN libkml-1.3.0/tests/swig/CMakeLists.txt libkml-1.3.0-new/tests/swig/CMakeLists.txt
--- libkml-1.3.0/tests/swig/CMakeLists.txt 2015-12-21 18:23:05.000000000 +0100
+++ libkml-1.3.0-new/tests/swig/CMakeLists.txt 2016-04-08 23:16:10.010988071 +0200
@@ -1,19 +1,32 @@
if(WITH_PYTHON)
+
add_test(NAME test_python_kmlbase
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlbase_test.py)
+set_tests_properties(test_python_kmlbase
+ PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
add_test(NAME test_python_kmldom
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmldom_test.py)
+set_tests_properties(test_python_kmldom
+ PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
add_test(NAME test_python_kmlengine
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlengine_test.py)
+set_tests_properties(test_python_kmlengine
+ PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
endif()
if(WITH_JAVA)
+
+include(UseJava)
+add_jar(KmlBaseTest KmlBaseTest.java INCLUDE_JARS /usr/share/java/junit.jar ${CMAKE_BINARY_DIR}/src/swig/LibKML.jar)
+add_dependencies(KmlBaseTest LibKML_jar)
+
add_test( NAME test_java_kmlbase
COMMAND
${Java_JAVA_EXECUTABLE}
- -cp "${CMAKE_JAVA_INCLUDE_PATH}${PATH_SEPARATOR}${CMAKE_BINARY_DIR}/src/swig/LibKML.jar;${CMAKE_CURRENT_BINARY_DIR}"
+ -cp "/usr/share/java/junit.jar:/usr/share/java/hamcrest/core.jar:${CMAKE_BINARY_DIR}/src/swig/LibKML.jar:${CMAKE_CURRENT_BINARY_DIR}/KmlBaseTest.jar" org.junit.runner.JUnitCore KmlBaseTest
KmlBaseTest )
-
-endif()
\ No newline at end of file
+set_tests_properties(test_java_kmlbase
+ PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib")
+endif()
Binary files libkml-1.3.0/tests/swig/KmlBaseTest.class and libkml-1.3.0-new/tests/swig/KmlBaseTest.class differ
diff -rupN libkml-1.3.0/tests/swig/kmldom_test.py libkml-1.3.0-new/tests/swig/kmldom_test.py
--- libkml-1.3.0/tests/swig/kmldom_test.py 2015-12-21 18:23:05.000000000 +0100
+++ libkml-1.3.0-new/tests/swig/kmldom_test.py 2016-04-08 22:38:23.086695444 +0200
@@ -753,7 +753,7 @@ def TestColorStyle(colorstyle):
color = kmlbase.Color32(0xf0f0c80f)
colorstyle.set_color(color)
assert colorstyle.has_color()
- assert color == colorstyle.get_color()
+ assert color.to_string_argb() == colorstyle.get_color().to_string_argb()
# Clear <color> and verify has_
colorstyle.clear_color()
assert not colorstyle.has_color()
diff -rupN libkml-1.3.0/tests/swig/kmlengine_test.py libkml-1.3.0-new/tests/swig/kmlengine_test.py
--- libkml-1.3.0/tests/swig/kmlengine_test.py 2015-12-21 18:23:05.000000000 +0100
+++ libkml-1.3.0-new/tests/swig/kmlengine_test.py 2016-04-08 22:42:03.317347774 +0200
@@ -32,6 +32,7 @@ This file contains unit tests for the KM
import unittest
import kmldom
import kmlengine
+import os
# These VerySimple tests really only verify that the function/class exists.
@@ -239,7 +240,7 @@ class BasicKmlFileSerializeToStringTestC
class BasicKmzFileTestCase(unittest.TestCase):
def runTest(self):
- kmz_filepath = '../../testdata/kmz/model-macky.kmz'
+ kmz_filepath = os.path.join(os.path.dirname(__file__), '../../testdata/kmz/model-macky.kmz')
kmzfile = kmlengine.KmzFile.OpenFromFile(kmz_filepath)
assert kmzfile
(ok, kml) = kmzfile.ReadKml()

1
sources Normal file
View File

@ -0,0 +1 @@
e663141e9ebd480538b25d226e1b2979 libkml-1.3.0.tar.gz