You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2017/06/29 06:26:25 UTC
[2/2] karaf git commit: [KARAF-5230] Support version range when
installing features The feature is still pre-selected,
but at least it does not reject the feature
[KARAF-5230] Support version range when installing features
The feature is still pre-selected, but at least it does not reject the feature
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/2cfdcadc
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/2cfdcadc
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/2cfdcadc
Branch: refs/heads/master
Commit: 2cfdcadc99849e01ffac33b96f139d4fe08369bf
Parents: 9803938
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Jun 29 08:26:15 2017 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Jun 29 08:26:15 2017 +0200
----------------------------------------------------------------------
.../internal/service/FeaturesServiceImpl.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/2cfdcadc/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
index e27b796..9600f11 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
@@ -793,7 +793,9 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall
List<String> featuresToAdd = new ArrayList<>();
List<String> featuresToRemove = new ArrayList<>();
for (String feature : features) {
- feature = normalize(feature);
+ if (!feature.contains(VERSION_SEPARATOR)) {
+ feature += "/0.0.0";
+ }
String name = feature.substring(0, feature.indexOf(VERSION_SEPARATOR));
String version = feature.substring(feature.indexOf(VERSION_SEPARATOR) + 1);
Pattern pattern = Pattern.compile(name);
@@ -837,10 +839,18 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall
}
}
featuresToAdd = new ArrayList<>(new LinkedHashSet<>(featuresToAdd));
- print("Adding features: " + join(featuresToAdd), options.contains(Option.Verbose));
+ List<String> featuresToDisplay = new ArrayList<>();
for (String feature : featuresToAdd) {
fl.add(FEATURE_OSGI_REQUIREMENT_PREFIX + feature);
+ String v = feature.substring(feature.indexOf(VERSION_SEPARATOR) + VERSION_SEPARATOR.length());
+ VersionRange vr = new VersionRange(v, true);
+ if (vr.isPointVersion()) {
+ v = feature.substring(0, feature.indexOf(VERSION_SEPARATOR) + VERSION_SEPARATOR.length())
+ + vr.getCeiling().toString();
+ }
+ featuresToDisplay.add(v);
}
+ print("Adding features: " + join(featuresToDisplay), options.contains(Option.Verbose));
Map<String, Map<String, FeatureState>> stateChanges = Collections.emptyMap();
doProvisionInThread(required, stateChanges, state, options);
}