1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
Description: putting the timestamp of the latest debian/changelog entry instead
of the one of compile time, in order to enhance build reproducibility
Author: Pierre Gruet <pgt@debian.org>
Forwarded: not-needed
Last-Update: 2023-10-08
--- a/build.gradle
+++ b/build.gradle
@@ -7,6 +7,7 @@
import org.gradle.api.internal.PropertiesTransformer
import org.gradle.util.ConfigureUtil
import java.security.MessageDigest
+import java.text.SimpleDateFormat
import java.util.regex.Matcher
import java.util.concurrent.Executors
import java.util.concurrent.Future
@@ -80,7 +81,26 @@
ext {
jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath()
jalviewDirRelativePath = jalviewDir
- date = new Date()
+
+ // Verbose and maybe not efficient hack to put the changelog date into the
+ // "date" variable, which will be used to insert e.g. years in doc files.
+ // This is to make the build reproducible.
+ def outBAdate = new ByteArrayOutputStream()
+ exec {
+ commandLine 'dpkg-parsechangelog', '-Stimestamp'
+ standardOutput = outBAdate
+ }
+ dateWithEOL = outBAdate.toString()
+ dateWithoutEOL = dateWithEOL.substring(0, dateWithEOL.length() - 1)
+
+ def outBA = new ByteArrayOutputStream()
+ exec {
+ commandLine 'date', '--utc', "--date=@${dateWithoutEOL}", '+"%d/%m/%Y-%H:%M:%S"'
+ standardOutput = outBA
+ }
+ toParseWithEOLAndQuotes = outBA.toString()
+ toParseWithoutEOLAndQuotes = toParseWithEOLAndQuotes.substring(1, toParseWithEOLAndQuotes.length() - 2)
+ date = new SimpleDateFormat("dd/MM/yyyy-HH:mm:ss").parse(toParseWithoutEOLAndQuotes)
// default to "default". Currently only has different cosmetics for "develop", "release", "default"
propertiesChannelName = "default"
|