You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find the current practice of always having to specify a compatibility end a bit strange. Since there's often no good reason to expect that something will stop working at a future version, the current "convention" seems to be to specify the next major version.
This means that now that main has changed to 5.0.0-SNAPSHOT pretty much all add-ons with a version range are now hidden - and in reality, the vast majority are likely to work just fine with 5.0.0. This means that a lot of Community Marketplace entries will have to be edited, or they will disappear from future versions. I think the upper bound only makes sense when there's a known reason why it would stop working.
Thus, I'm proposing to change the logic to accept an open-ended range in the form [x.x.x(.x)?;) or[x.x.x(.x)?;].
The change necessary is small, but as I can't submit a PR, I'll just have to make a suggestion here:
.../java/org/openhab/core/addon/marketplace/BundleVersion.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/BundleVersion.java b/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/BundleVersion.java
index ee01b7b51..c9ac47a28 100644
--- a/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/BundleVersion.java+++ b/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/BundleVersion.java@@ -29,7 +29,7 @@ public class BundleVersion {
private static final Pattern VERSION_PATTERN = Pattern.compile(
"(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<micro>\\d+)(\\.((?<rc>RC)|(?<milestone>M))?(?<qualifier>\\d+))?");
public static final Pattern RANGE_PATTERN = Pattern.compile(
- "\\[(?<start>\\d+\\.\\d+(?<startmicro>\\.\\d+(\\.\\w+)?)?);(?<end>\\d+\\.\\d+(?<endmicro>\\.\\d+(\\.\\w+)?)?)(?<endtype>[)\\]])");+ "\\[(?<start>\\d+\\.\\d+(?<startmicro>\\.\\d+(\\.\\w+)?)?);(?<end>\\d+\\.\\d+(?<endmicro>\\.\\d+(\\.\\w+)?)?)?(?<endtype>[)\\]])");
private final String version;
private final int major;
@@ -87,7 +87,10 @@ public class BundleVersion {
return false;
}
- String endString = matcher.group("endmicro") != null ? matcher.group("end") : matcher.group("stop") + ".0";+ if (matcher.group("end") == null) {+ return true;+ }+ String endString = matcher.group("endmicro") != null ? matcher.group("end") : matcher.group("end") + ".0";
boolean inclusive = "]".equals(matcher.group("endtype"));
BundleVersion endVersion = new BundleVersion(endString);
int comparison = this.compareTo(endVersion);
I've tested the above code, and it seems to work just fine.
Please note that there's also a bug fix here, since matcher.group("stop") throws an exception it that code is ever reached, since there's no stop group defined RANGE_PATTERN. I'm pretty sure it should be end instead of stop.
The text was updated successfully, but these errors were encountered:
I find the current practice of always having to specify a compatibility end a bit strange. Since there's often no good reason to expect that something will stop working at a future version, the current "convention" seems to be to specify the next major version.
This means that now that
main
has changed to5.0.0-SNAPSHOT
pretty much all add-ons with a version range are now hidden - and in reality, the vast majority are likely to work just fine with5.0.0
. This means that a lot of Community Marketplace entries will have to be edited, or they will disappear from future versions. I think the upper bound only makes sense when there's a known reason why it would stop working.Thus, I'm proposing to change the logic to accept an open-ended range in the form
[x.x.x(.x)?;)
or[x.x.x(.x)?;]
.The change necessary is small, but as I can't submit a PR, I'll just have to make a suggestion here:
I've tested the above code, and it seems to work just fine.
Please note that there's also a bug fix here, since
matcher.group("stop")
throws an exception it that code is ever reached, since there's nostop
group definedRANGE_PATTERN
. I'm pretty sure it should beend
instead ofstop
.The text was updated successfully, but these errors were encountered: