Skip to content

Commit c8b0907

Browse files
metsmaJakuje
authored andcommitted
Normalize windows package name and strip version number from git tag
Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent 3b2919b commit c8b0907

File tree

7 files changed

+23
-22
lines changed

7 files changed

+23
-22
lines changed

.github/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
1717
fi
1818
else
1919
BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
20-
if [ "$BRANCH" != "master" ]; then
20+
if [ "$GITHUB_REF_TYPE" == "tag" ] && [[ "$BRANCH" =~ ^[0-9]+\.[0-9]+\.[0-9]+(.+)$ ]]; then
21+
SUFFIX="${BASH_REMATCH[1]}"
22+
elif [ "$BRANCH" != "master" ]; then
2123
SUFFIX="$BRANCH"
2224
fi
2325
fi

.github/workflows/windows.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,25 @@ jobs:
3838
steps:
3939
- name: Checkout
4040
uses: actions/checkout@v6
41-
- name: Package name
41+
- name: Package suffix
4242
shell: bash
4343
run: |
44-
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_name }}" == "master" ]]; then
45-
SUFFIX=""
46-
elif [[ "${{ github.event_name }}" == "push" ]]; then
47-
SUFFIX="-${{ github.ref_name }}"
48-
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "master" ]]; then
49-
SUFFIX="-pr${{ github.event.number }}"
50-
else
51-
SUFFIX="-${{ github.base_ref }}-pr${{ github.event.number }}"
44+
if [[ "${{ github.event_name }}" == "push" ]]; then
45+
if [[ "${{ github.ref_type }}" == "tag" && "${{ github.ref_name }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(.+)$ ]]; then
46+
SUFFIX="${BASH_REMATCH[1]}"
47+
elif [[ "${{ github.ref_name }}" != "master" ]]; then
48+
SUFFIX="-${{ github.ref_name }}"
49+
fi
50+
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
51+
if [[ "${{ github.base_ref }}" == "master" ]]; then
52+
SUFFIX="-pr${{ github.event.number }}"
53+
else
54+
SUFFIX="-${{ github.base_ref }}-pr${{ github.event.number }}"
55+
fi
5256
fi
53-
echo "DIST_SUFFIX=${{ matrix.configuration == 'Light' && '-Light' || '' }}${SUFFIX}" >> $GITHUB_ENV
57+
PACKAGE_SUFFIX="${{ matrix.configuration == 'Light' && '-Light' || '' }}${SUFFIX}"
58+
sed -i.bak "s/^PACKAGE_SUFFIX=\([-~]*[0-9a-zA-Z]*\)$/PACKAGE_SUFFIX=$PACKAGE_SUFFIX/g" VERSION.mk
59+
cat VERSION.mk
5460
- name: Install CPDK
5561
run: choco install windows-cryptographic-provider-development-kit -y > $null
5662
- name: Setup dev env

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ ChangeLog
6464
.cache
6565
compile_commands.json
6666
.dirstamp
67+
VERSION.mk.bak
6768

6869
doc/tools/*-tool
6970
doc/tools/eidenv
@@ -150,7 +151,6 @@ src/tests/fuzzing/fuzz_pkcs15_tool
150151
src/tests/fuzzing/fuzz_pkcs15init
151152
src/tests/fuzzing/fuzz_scconf_parse_string
152153

153-
version.m4.ci
154154
openssl_arm64
155155
openssl_bin
156156
openpace_bin

bootstrap.ci

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ if [ -f Makefile ]; then
4141
make distclean
4242
fi
4343

44-
rm -rf *~ *.cache config.guess config.log config.status config.sub depcomp ltmain.sh m4/version.m4.ci
44+
rm -rf *~ *.cache config.guess config.log config.status config.sub depcomp ltmain.sh VERSION.mk.bak
4545

4646
if [ -n "$SUFFIX" ]
4747
then
4848
echo Set package suffix "$SUFFIX"
49-
sed 's/^define(\[PACKAGE_SUFFIX\],\s*\[\([-~]*[0-9a-zA-Z]*\)\])$/define(\[PACKAGE_SUFFIX\], \['$SUFFIX'\])/g' < m4/version.m4 > m4/version.m4.ci
49+
sed -i.bak 's/^PACKAGE_SUFFIX=\([-~]*[0-9a-zA-Z]*\)$/PACKAGE_SUFFIX='$SUFFIX'/g' VERSION.mk
5050
fi
5151

5252
./bootstrap

configure.ac

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ m4_esyscmd([awk -F= '
1313
}
1414
' "VERSION.mk"])
1515

16-
m4_sinclude(m4/version.m4.ci)
17-
1816
# Hint: MacOSX/build contains minimum OpenSSL reference
1917
m4_define([openssl_minimum_version], [1.1.1])
2018

m4/version.m4

Lines changed: 0 additions & 5 deletions
This file was deleted.

win32/Make.rules.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ MINIDRIVER_DEF = /DENABLE_MINIDRIVER
1818
WIXFLAGS = -d ENABLE_MINIDRIVER $(WIXFLAGS)
1919

2020
#Build MSI with the Windows Installer XML (WIX) toolkit
21-
MSI_NAME = $(PRODUCT_NAME)-$(PACKAGE_VERSION_MAJOR).$(PACKAGE_VERSION_MINOR).$(PACKAGE_VERSION_FIX)_$(PLATFORM)$(DIST_SUFFIX).msi
21+
MSI_NAME = $(PRODUCT_NAME)-$(PACKAGE_VERSION_MAJOR).$(PACKAGE_VERSION_MINOR).$(PACKAGE_VERSION_FIX)$(PACKAGE_SUFFIX)_$(PLATFORM).msi
2222
!IF "$(WIX_PACKAGES)" == ""
2323
WIX_PACKAGES = $(TOPDIR)\win32\packages
2424
WIX_VERSION = 6.0.2

0 commit comments

Comments
 (0)