deb_version 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/HACKING.md +37 -0
- data/README.md +2 -0
- data/lib/deb_version/compare.rb +8 -0
- data/lib/deb_version/version.rb +1 -1
- data/lib/deb_version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 888af66ba17b645ae1ef3a98bbadf772a7486c59ccb2c6fb4eb7ca8b4a18449c
|
4
|
+
data.tar.gz: 7a656c657e4189e79f06ea9712d1be5584d42526931efc72d912bc5e36d9938d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 223bab3293c88121f74f3aa95c5fb489d955131c63548c9d140faabcce94ab1ebcadca37203648da562d21ff5c72992a8aa4a575fbb39f4dded6039303f73220
|
7
|
+
data.tar.gz: b5a4960c5205ae620092a5523c04a4f0ae8ac1e2b96ceba7225632d9d05e262d624ff98d5d7583b6147b2fcc554cd7aa2780ff0dbed25cc91c3e3f0d8e47c8d6
|
data/Gemfile.lock
CHANGED
data/HACKING.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Development
|
2
|
+
|
3
|
+
The all-debian-versions.lst file is a sorted version of the file
|
4
|
+
from https://github.com/FauxFaux/deb-version/blob/42c0e61f62b6776fa1bd77b0da3327fa31dcc1c4/all-debian-versions.lst. The sorting was done using the following script:
|
5
|
+
|
6
|
+
```
|
7
|
+
import sys
|
8
|
+
from functools import cmp_to_key
|
9
|
+
import apt_pkg
|
10
|
+
apt_pkg.init_system()
|
11
|
+
def compare_versions(version1, version2):
|
12
|
+
# Implement your comparison logic here
|
13
|
+
# Return -1 if version1 < version2
|
14
|
+
# Return 0 if version1 == version2
|
15
|
+
# Return 1 if version1 > version2
|
16
|
+
# You can use apt_pkg.version_compare or any other comparison logic
|
17
|
+
|
18
|
+
# Example comparison logic using apt_pkg.version_compare
|
19
|
+
return apt_pkg.version_compare(version1, version2)
|
20
|
+
|
21
|
+
def sort_debian_package_numbers(package_numbers):
|
22
|
+
# Sort the package numbers using cmp_to_key and compare_versions
|
23
|
+
return sorted(package_numbers, key=cmp_to_key(compare_versions))
|
24
|
+
|
25
|
+
if __name__ == "__main__":
|
26
|
+
# Read package numbers from stdin
|
27
|
+
package_numbers = [line.strip() for line in sys.stdin]
|
28
|
+
|
29
|
+
# Sort the package numbers
|
30
|
+
sorted_package_numbers = sort_debian_package_numbers(package_numbers)
|
31
|
+
|
32
|
+
# Write the sorted list to stdout
|
33
|
+
for package_number in sorted_package_numbers:
|
34
|
+
sys.stdout.write(package_number + '\n')
|
35
|
+
```
|
36
|
+
|
37
|
+
Keeping a sorted version in the repository lets us avoid the libapt dependency.
|
data/README.md
CHANGED
@@ -34,6 +34,8 @@ Run `bundle exec rake rubocop` to check for style violations.
|
|
34
34
|
|
35
35
|
Run `bundle exec rake test` to run tests.
|
36
36
|
|
37
|
+
See [HACKING.md](HACKING.md) for further details.
|
38
|
+
|
37
39
|
## Contributing
|
38
40
|
|
39
41
|
Bug reports and pull requests are welcome on GitHub at https://github.com/captn3m0/ruby-deb-version. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/captn3m0/ruby-deb-version/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/deb_version/compare.rb
CHANGED
@@ -31,6 +31,14 @@ class DebVersion
|
|
31
31
|
[@epoch, @upstream_version, @debian_revision]
|
32
32
|
end
|
33
33
|
|
34
|
+
def to_s
|
35
|
+
result = ""
|
36
|
+
result << "#{@epoch}:" if @epoch != 0
|
37
|
+
result << @upstream_version
|
38
|
+
result << "-#{@debian_revision}" unless @debian_revision.empty?
|
39
|
+
result
|
40
|
+
end
|
41
|
+
|
34
42
|
# Internal method to get the largest digit prefix
|
35
43
|
def get_digit_prefix(characters)
|
36
44
|
value = 0
|
data/lib/deb_version/version.rb
CHANGED
data/lib/deb_version.rb
CHANGED
@@ -14,7 +14,7 @@ class DebVersion
|
|
14
14
|
|
15
15
|
# Sorted list of characters used by Debian Version sort.
|
16
16
|
# see https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
|
17
|
-
SORT_LIST = ["~", ""] + ("A"
|
17
|
+
SORT_LIST = ["~", ""] + ("A".."Z").to_a + ("a".."z").to_a + PUNCTUATION
|
18
18
|
|
19
19
|
mapping = {}
|
20
20
|
SORT_LIST.each_with_index do |char, index|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deb_version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nemo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- CODE_OF_CONDUCT.md
|
93
93
|
- Gemfile
|
94
94
|
- Gemfile.lock
|
95
|
+
- HACKING.md
|
95
96
|
- LICENSE.txt
|
96
97
|
- README.md
|
97
98
|
- Rakefile
|