Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports
Path: blob/main/lang/dotnet8/files/0003-Fix-assembly-version-calculation-in-2026.patch
28271 views
1
diff --git a/updateAssemblyInfo.sh b/updateAssemblyInfo.sh
2
index c5117975..e71b6c45 100755
3
--- a/updateAssemblyInfo.sh
4
+++ b/updateAssemblyInfo.sh
5
@@ -5,12 +5,23 @@ scriptroot=$(cd -P "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
6
7
packageType=${1:-preview}
8
9
+# Get current date components
10
+year=$(date '+%Y')
11
+year_offset=$((year - 2019))
12
+month=$(date '+%m')
13
+day=$(date '+%d')
14
+
15
+# Calculate revision using the new formula that prevents overflow
16
+# Base: 61232 (ensures revision is higher than already shipped packages)
17
+# This will overflow in 2029 and needs a long term fix
18
+revision=$((61232 + (year_offset * 416) + (10#$month * 32) + 10#$day))
19
+
20
date=$(date '+%y%m%d%H%M%S')
21
# Formats the date by replacing the 4-digit year with a 2-digit value and then subtract 19
22
dateTimeStamp=$(echo $((10#${date:0:2}-19)))${date:2}
23
24
assemblyVersion=$(sed -n 's/.*<assemblyVersion>\([^<]*\)<.*/\1/p' ${scriptroot}/buildConfiguration.xml)
25
-assemblyFileVersion="$assemblyVersion.${dateTimeStamp::$((${#dateTimeStamp} - 6))}" # Trim minutes/seconds
26
+assemblyFileVersion="$assemblyVersion.$revision"
27
assemblyInformationalVersion="$assemblyVersion.$dateTimeStamp"
28
29
echo "assemblyVersion: $assemblyVersion"
30
31