Skip to content

Commit eb84d3c

Browse files
committed
Prepare for next release
1 parent fec85d7 commit eb84d3c

3 files changed

Lines changed: 38 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
## [5.1.0] - 2026-02-01
11+
1012
### Added
1113

14+
- Support for Debian package versions
1215
- Improved Javadoc for a number of version parsing methods.
1316

1417
## [5.0.0] - 2024-10-25
@@ -115,7 +118,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
115118

116119
- Parsing versions of various formats using the `Version` class.
117120

118-
[unreleased]: https://github.com/cthing/versionparser/compare/5.0.0...HEAD
121+
[unreleased]: https://github.com/cthing/versionparser/compare/5.1.0...HEAD
122+
[5.1.0]: https://github.com/cthing/versionparser/releases/tag/5.1.0
119123
[5.0.0]: https://github.com/cthing/versionparser/releases/tag/5.0.0
120124
[4.5.0]: https://github.com/cthing/versionparser/releases/tag/4.5.0
121125
[4.4.0]: https://github.com/cthing/versionparser/releases/tag/4.4.0

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The following version and version constraint schemes are supported:
1818
* [RubyGems](https://rubygems.org/)
1919
* [Semantic Versioning](https://semver.org/)
2020
* [Calendar Versioning](https://calver.org/)
21+
* [Debian Package Versioning](https://www.debian.org/doc/debian-policy/ch-controlfields.html#version)
2122

2223
## Usage
2324
See the [examples folder](examples) for complete working code demonstrating the usage of this library. The
@@ -27,19 +28,20 @@ following Maven dependency:
2728
<dependency>
2829
<groupId>org.cthing</groupId>
2930
<artifactId>versionparser</artifactId>
30-
<version>5.0.0</version>
31+
<version>5.1.0</version>
3132
</dependency>
3233
```
3334
or the following Gradle dependency:
3435
```kotlin
35-
implementation("org.cthing:versionparser:5.0.0")
36+
implementation("org.cthing:versionparser:5.1.0")
3637
```
3738

3839
### Versioning Overview
3940

4041
| Scheme | Version Factory | Version Constraint Factory |
4142
|----------|---------------------------------------------------|-----------------------------------------------|
4243
| Calendar | `CalendarVersionScheme.parse(String)`<sup>1</sup> | N/A |
44+
| Debian | `DebVersionScheme.parseVersion(String)` | `DebVersionScheme.parseConstraint(String)` |
4345
| Gradle | `GradleVersionScheme.parseVersion(String)` | `GradleVersionScheme.parseConstraint(String)` |
4446
| Java | `JavaVersionScheme.parseVersion(String)` | `JavaVersionScheme.parseRange(String)` |
4547
| Maven | `MvnVersionScheme.parseVersion(String)` | `MvnVersionScheme.parseConstraint(String)` |
@@ -321,6 +323,34 @@ assertThat(component1.getCategory()).isEqualTo(ComponentCategory.YEAR);
321323
assertThat(version2.compareTo(version3)).isEqualTo(-1);
322324
```
323325

326+
### Debian Packageg Versioning
327+
Support is provided for parsing Debian package versions and version constraints.
328+
329+
```java
330+
// Parse versions
331+
final DebVersion version1 = DebVersionScheme.parseVersion("22.07.5-2ubuntu1.5");
332+
final Version version2 = DebVersionScheme.parseVersion("20.01.2-1ubuntu1.5");
333+
334+
// Obtain information from the parsed version
335+
assertThat(version1.getOriginalVersion()).isEqualTo("22.07.5-2ubuntu1.5");
336+
assertThat(version1.isPreRelease()).isFalse();
337+
assertThat(version1.getEpoch()).isEqualTo(0);
338+
assertThat(version1.getUpstream()).isEqualTo("22.07.5");
339+
assertThat(version1.getRevision()).isEqualTo("2ubuntu1.5");
340+
341+
// Verify ordering
342+
assertThat(version1.compareTo(version2)).isEqualTo(1);
343+
344+
// Parse version constraints
345+
final VersionConstraint constraint1 = DebVersionScheme.parseConstraint(">20");
346+
final VersionConstraint constraint2 = DebVersionScheme.parseConstraint(">21 <=23");
347+
348+
// Perform constraint checking
349+
assertThat(constraint1.allows(version2)).isTrue();
350+
assertThat(constraint2.allows(version1)).isTrue();
351+
assertThat(constraint2.allows(version2)).isFalse();
352+
```
353+
324354
## Additional Information
325355
In preparation for creating this library, a [survey of many popular versioning schemes](docs/VersioningSurvey.md) was conducted.
326356
Among other things, this lead to the recognition that all version constraint specifications could be expressed using a single notation.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ plugins {
3232
alias(libs.plugins.versions)
3333
}
3434

35-
version = ProjectVersion("5.1.0", BuildType.release)
35+
version = ProjectVersion("5.1.1", BuildType.snapshot)
3636
group = "org.cthing"
3737
description = "Parses version numbers, ranges and constraints in a variety of formats."
3838

0 commit comments

Comments
 (0)