SHA256
1
0
forked from pool/antlr3
Fridrich Strba 2023-09-15 16:05:45 +00:00 committed by Git OBS Bridge
parent 94558cfa59
commit 2da23db509
4 changed files with 55 additions and 0 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Sep 15 16:02:58 UTC 2023 - Fridrich Strba <fstrba@suse.com>
- Added patches:
* reproducible-order.patch
+ ensure reproducible elements order by sorting
* reproducible-timestamp.patch
+ support SOURCE_DATE_EPOCH for generatedTimestamp
-------------------------------------------------------------------
Fri Sep 15 08:19:19 UTC 2023 - Bernhard Wiedemann <bwiedemann@suse.com>

View File

@ -37,6 +37,8 @@ Source0: https://github.com/antlr/antlr3/archive/%{antlr_version}.tar.gz
Patch0: antlr3-java8-fix.patch
# Generate OSGi metadata
Patch1: antlr3-osgi-manifest.patch
Patch2: reproducible-order.patch
Patch3: reproducible-timestamp.patch
Patch100: antlr3-generated_sources.patch
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
@ -131,6 +133,8 @@ BuildArch: noarch
sed -i "s,\${buildNumber},`date -u -d@${SOURCE_DATE_EPOCH:-$(date +%%s)}`," tool/src/main/resources/org/antlr/antlr.properties
%patch0 -p1
%patch1
%patch2 -p1
%patch3 -p1
# remove pre-built artifacts
find -type f -a -name *.jar -delete

30
reproducible-order.patch Normal file
View File

@ -0,0 +1,30 @@
--- antlr3-3.5.3/tool/src/main/antlr3/org/antlr/grammar/v3/CodeGenTreeWalker.g 2023-09-15 17:54:38.044172037 +0200
+++ antlr3-3.5.3/tool/src/main/antlr3/org/antlr/grammar/v3/CodeGenTreeWalker.g 2023-09-15 17:58:10.758972706 +0200
@@ -56,6 +56,7 @@
import java.util.HashSet;
import java.util.Set;
import java.util.Collection;
+import java.util.Collections;
import org.antlr.runtime.BitSet;
import org.antlr.runtime.DFA;
import org.stringtemplate.v4.ST;
@@ -284,6 +285,7 @@
}
labels.add( label );
}
+ Collections.sort(labels); // ensure reproducible order
return labels;
}
--- antlr3-3.5.3/tool/src/main/java/org/antlr/Tool.java 2023-09-15 17:54:38.044172037 +0200
+++ antlr3-3.5.3/tool/src/main/java/org/antlr/Tool.java 2023-09-15 17:54:49.090915002 +0200
@@ -1052,6 +1052,9 @@
*/
public static String getCurrentTimeStamp() {
GregorianCalendar calendar = new java.util.GregorianCalendar();
+ if (System.getenv("SOURCE_DATE_EPOCH") != null) {
+ calendar.setTimeInMillis(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
+ }
int y = calendar.get(Calendar.YEAR);
int m = calendar.get(Calendar.MONTH) + 1; // zero-based for months
int d = calendar.get(Calendar.DAY_OF_MONTH);

View File

@ -0,0 +1,12 @@
--- antlr3-3.5.3/tool/src/main/java/org/antlr/Tool.java 2023-09-15 17:54:38.044172037 +0200
+++ antlr3-3.5.3/tool/src/main/java/org/antlr/Tool.java 2023-09-15 17:54:49.090915002 +0200
@@ -1052,6 +1052,9 @@
*/
public static String getCurrentTimeStamp() {
GregorianCalendar calendar = new java.util.GregorianCalendar();
+ if (System.getenv("SOURCE_DATE_EPOCH") != null) {
+ calendar.setTimeInMillis(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
+ }
int y = calendar.get(Calendar.YEAR);
int m = calendar.get(Calendar.MONTH) + 1; // zero-based for months
int d = calendar.get(Calendar.DAY_OF_MONTH);