Skip to content

Commit 0afb091

Browse files
authored
Extra package version digits (#11)
Teenage mutant ninja turtles ...sorry. Occasionally we need to publish the same OpenSSL version several times, such as when the version did not really change but Apple platforms did. Normally you increment the "patch version" for this, or some dedicated "package version", but we don't have that luxury with OpenSSL. We must keep the version strictly semver, and all the digits are already taken with OpenSSL version, even with some extra on top. The current latest version of OpenSSL is 1.1.1h. However, semver does not allow letters so we transform that into 1.1.108: 1.1.1h => 1.1.(1 * 100) + ('h' - 'a' + 1) => 1.1.108 In the similar vein, add yet another 'package version' part to this whole mess: 1.1.1h-1 => 1.1.((1 * 100) + ('h' - 'a' + 1)) * 100 + 1 => 1.1.10801 It's not the prettiest solution but... doin' what I can with what I got. This approach is semver-compatible, pleasing our fruit company overlords. The resulting version ordering is useful. Since the 1.1.107 has been the only release so far, migration to 1.1.10701 is smooth. The transformation is reversible and unambiguous (well, let's hope we won't need to release more than 100 versions of the same OpenSSL). The source of truth for CLOpenSSL is the PACKAGE_VERSION variable in the Makefile. Bump it to release a new package version. Reset it to "1" when updating OpenSSL version. Note that the tag names are using the same approach because they are significant to Carthage and CocoaPods.
1 parent 62ccf2e commit 0afb091

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ endif
1313
## OpenSSL version to build
1414
VERSION ?= 1.1.1g
1515

16+
## Extra version of the distributed package
17+
PACKAGE_VERSION ?= 1
18+
1619
MIN_IOS_SDK = 10.0
1720
MIN_OSX_SDK = 10.11
1821

@@ -91,7 +94,7 @@ endif
9194
.PHONY: packages
9295

9396
$(OUTPUT)/done.packages: $(OUTPUT)/done.build
94-
@scripts/create-packages.sh
97+
@PACKAGE_VERSION=$(PACKAGE_VERSION) scripts/create-packages.sh
9598
@mkdir -p $(OUTPUT)
9699
@touch $(OUTPUT)/done.packages
97100

RELEASING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ How to update to newer OpenSSL version, build, and publish a release.
1212

1313
The version number is in the [`Makefile`](Makefile).
1414

15+
Increment `PACKAGE_VERSION` if you are repackaging the same OpenSSL version.
16+
Otherwise, update `VERSION` to OpenSSL version and reset `PACKAGE_VERSION` to `1`.
17+
1518
Also update tarball checksums in [`build-libssl.sh`](build-libssl.sh).
1619

1720
3. **Update platform configuration.**
@@ -34,9 +37,9 @@ How to update to newer OpenSSL version, build, and publish a release.
3437
```shell
3538
git add carthage
3639
git commit -S -e -m "OpenSSL 1.1.1g"
37-
git tag -s -e -m "OpenSSL 1.1.1g" v1.1.107
40+
git tag -s -e -m "OpenSSL 1.1.1g" v1.1.10701
3841
git push origin cossacklabs # Push the branch
39-
git push origin v1.1.107 # Push the tag
42+
git push origin v1.1.10701 # Push the tag
4043
```
4144

4245
Make will remind you how to do this.

create-openssl-framework.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ FWTYPE=$1
1616
FWNAME=openssl
1717
FWROOT=frameworks
1818

19+
PACKAGE_VERSION="${PACKAGE_VERSION:-1}"
20+
1921
if [ -d $FWROOT ]; then
2022
echo "Removing previous $FWNAME.framework copies"
2123
rm -rf $FWROOT
@@ -103,6 +105,12 @@ function get_min_sdk() {
103105
# 'g' = 103 -> 6 + 1 = 07 (zero-padded)
104106
# 1.1.107
105107
#
108+
# Also, to allow multiple releases of the same OpenSSL packaging
109+
# tack two extra version digits to the end using PACKAGE_VERSION:
110+
#
111+
# 1.1.10701
112+
#
113+
# This is what Debian might have called "1.1.1g-1".
106114
function get_openssl_version() {
107115
local opensslv=$1
108116
local std_version=$(awk '/define OPENSSL_VERSION_TEXT/ && !/-fips/ {print $5}' "$opensslv")
@@ -114,7 +122,8 @@ function get_openssl_version() {
114122
local subpatch=${std_version: -1}
115123
local subpatch_number=$(($(printf '%d' \'$subpatch) - 97 + 1))
116124
local normalized_version="${generic_version}$(printf '%02d' $subpatch_number)"
117-
echo $normalized_version
125+
local package_version="${normalized_version}$(printf '%02d' $PACKAGE_VERSION)"
126+
echo $package_version
118127
}
119128

120129
if [ $FWTYPE == "dynamic" ]; then

0 commit comments

Comments
 (0)