Fix OSGi version used in Require-Bundle, thanks to Gert Vanthienen.

git-svn-id: https://svn.apache.org/repos/asf/ode/branches/ode-1.3.5.x@1060839 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/.gitignore b/.gitignore
index 42bfd6c..06d4daa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,4 @@
 target
 reports
 test-output
+_buildr.rb
diff --git a/Rakefile b/Rakefile
index c7ce096..a67ab3c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -450,8 +450,8 @@
       BUNDLE_VERSIONS.each {|key, value| bnd[key] = value }
       bnd['Bundle-Name'] = "Apache ODE :: Commands"
       bnd['Bundle-Version'] = VERSION_NUMBER
-      bnd['Require-Bundle'] = "org.apache.ode.ode-jbi-bundle;version=#{VERSION_NUMBER}"
-      bnd['Import-Package'] = 'org.osgi.service.command,org.apache.karaf.shell.console;version="[2.0,2.1)",*'
+      bnd['Require-Bundle'] = "org.apache.ode.ode-jbi-bundle;bundle-version=#{osgi_version_for(VERSION_NUMBER)}"
+      bnd['Import-Package'] = 'org.osgi.service.command,org.apache.karaf.shell.console;version="[2.1,2.2)",*'
       bnd['Private-Package'] = "org.apache.ode.karaf.commands;version=#{VERSION_NUMBER}"
       bnd['Include-Resource'] = _('src/main/resources')
     end
@@ -468,7 +468,7 @@
         bnd['Bundle-Name'] = "Apache ODE :: Hello World Example"
         bnd['Bundle-SymbolicName'] = "org.apache.ode.examples-helloworld2-bundle"
         bnd['Bundle-Version'] = VERSION_NUMBER
-        bnd['Require-Bundle'] = "org.apache.ode.ode-jbi-bundle;version=#{VERSION_NUMBER}"
+        bnd['Require-Bundle'] = "org.apache.ode.ode-jbi-bundle;bundle-version=#{osgi_version_for(VERSION_NUMBER)}"
         bnd['Import-Package'] = "org.apache.servicemix.cxfbc,org.apache.servicemix.common.osgi"
         bnd['Export-Package'] = ""
         bnd['-exportcontents'] = ""
@@ -489,7 +489,7 @@
         bnd['Bundle-Name'] = "Apache ODE :: Ping-Pong Example"
         bnd['Bundle-SymbolicName'] = "org.apache.ode.examples-ping-pong-bundle"
         bnd['Bundle-Version'] = VERSION_NUMBER
-        bnd['Require-Bundle'] = "org.apache.ode.ode-jbi-bundle;version=#{VERSION_NUMBER}"
+        bnd['Require-Bundle'] = "org.apache.ode.ode-jbi-bundle;bundle-version=#{osgi_version_for(VERSION_NUMBER)}"
         bnd['Import-Package'] = "org.apache.servicemix.cxfbc,org.apache.servicemix.common.osgi"
         bnd['Export-Package'] = "org.apache.ode.ping"
         bnd['Include-Resource'] = _('src/main/resources')
@@ -507,7 +507,7 @@
       bnd['Bundle-Name'] = "Apache ODE :: PMAPI HTTP Binding"
       bnd['Bundle-SymbolicName'] = "org.apache.ode-pmapi-httpbinding"
       bnd['Bundle-Version'] = VERSION_NUMBER
-      bnd['Require-Bundle'] = "org.apache.ode.ode-jbi-bundle;version=#{VERSION_NUMBER}"
+      bnd['Require-Bundle'] = "org.apache.ode.ode-jbi-bundle;bundle-version=#{osgi_version_for(VERSION_NUMBER)}"
       bnd['Import-Package'] = "org.apache.servicemix.cxfbc,org.apache.servicemix.common.osgi"
       bnd['-exportcontents'] = ""
       bnd['Include-Resource'] = _('src/main/resources')
diff --git a/tasks/helpers.rake b/tasks/helpers.rake
new file mode 100644
index 0000000..d42ee33
--- /dev/null
+++ b/tasks/helpers.rake
@@ -0,0 +1,27 @@
+# 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.
+
+def osgi_version_for(version)
+  parts = version.split(/[\.,-]/)
+  result = Array.new(3, 0)
+  parts.each_index { |i|
+    if (result.size == 3) then
+      if (parts[i] =~ /\d+/) then result[i] = parts[i] else result = result << parts[i] end
+    else
+      result[3] = [result[3], parts[i]].join("-")
+    end
+  }
+  result.join(".")
+end