new release file names with date and git hash

...without reference to 9000ish SVN
pull/533/head
Michael Peter Christen 2 years ago
parent ede9efe50c
commit 60c9986a0e

@ -4,7 +4,6 @@ javacTarget=1.8
# Release Configuration
releaseVersion=1.925
releaseNr=9749
releaseFileParentDir=yacy
privateKeyFile=private.key

@ -90,28 +90,27 @@
<property name="target-resolve-already-run" value="true" />
</target>
<!-- find git version and write it to git.revision -->
<available file=".git" type="dir" property="git.present"/>
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="--always"/>
<arg value="--abbrev=7"/>
<arg value="HEAD"/>
</exec>
<condition property="repository.version" value="${git.revision}" else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
</target>
<!-- initializing all needed variables -->
<target name="init" depends="git.revision">
<target name="init">
<loadproperties srcFile="build.properties" />
<property name="stdReleaseFile" value="yacy_v${releaseVersion}_${releaseNr}.tar.gz"/>
<exec executable="git" outputproperty="repository.revision.date">
<arg value="log"/>
<arg value="-1"/>
<arg value="--pretty=format:%ad" />
<arg value="--date=format:%Y%m%d" />
</exec>
<exec executable="git" outputproperty="repository.revision.time">
<arg value="log"/>
<arg value="-1"/>
<arg value="--pretty=format:%ad" />
<arg value="--date=format:%H%m" />
</exec>
<exec executable="git" outputproperty="repository.revision.hash">
<arg value="log"/>
<arg value="-1"/>
<arg value="--pretty=format:%h" />
</exec>
<mkdir dir="${data}"/>
<mkdir dir="${release}"/>
@ -120,13 +119,23 @@
<echo message="YaCy Version number: ${releaseVersion}" />
<filter token="REPL_VERSION" value="${releaseVersion}" />
<!-- YaCy Release revision number -->
<echo message="YaCy Release number: ${releaseNr}" />
<filter token="REPL_REVISION_NR" value="${releaseNr}"/>
<!-- GIT Release revision number -->
<echo message="GIT Release Tag: ${repository.version}" />
<filter token="REPL_REPVER" value="${repository.version}"/>
<echo message="GIT Release Date: ${repository.revision.date}" />
<echo message="GIT Release Time: ${repository.revision.time}" />
<echo message="GIT Release Hash: ${repository.revision.hash}" />
<filter token="REPL_REPVERDATE" value="${repository.revision.date}"/>
<filter token="REPL_REPVERTIME" value="${repository.revision.time}"/>
<filter token="REPL_REPVERHASH" value="${repository.revision.hash}"/>
<!-- set time stamp: DSTAMP should have the format yyyyMMdd, TSTAMP hhmm -->
<tstamp/>
<filter token="REPL_DSTAMP" value="${DSTAMP}"/>
<filter token="REPL_TSTAMP" value="${TSTAMP}"/>
<!-- release file names -->
<property name="stdReleaseStub" value="yacy_v${releaseVersion}_${repository.revision.date}${repository.revision.time}_${repository.revision.hash}"/>
<property name="stdReleaseFile" value="${stdReleaseStub}.tar.gz"/>
<filter token="REPL_RELEASESTUB" value="${stdReleaseStub}"/>
<!-- apply replacments -->
<copy file="${defaults}/yacyBuild.properties.template" tofile="${defaults}/yacyBuild.properties" overwrite="true" filtering="true" />
@ -518,8 +527,8 @@
<arg value="-NOCD" />
<arg value="${release_windows}/build.nsi" />
</exec>
<move file="${release_windows}/yacy_v${releaseVersion}_${releaseNr}.exe"
tofile="${release}/yacy_v${releaseVersion}_${releaseNr}.exe" />
<move file="${release_windows}/${stdReleaseStub}.exe"
tofile="${release}/${stdReleaseStub}.exe" />
<delete dir="${release_main}"/>
<delete dir="${release_windows}" failonerror="false" />
@ -535,7 +544,7 @@
<chmod file="${release_mac}/YaCy.app/Contents/MacOS/startYACYMacOS.sh" perm="755"/>
<chmod file="${release_mac}/YaCy.app/Contents/MacOS/startYACY.sh" perm="755"/>
<exec executable="hdiutil">
<arg line="create -srcfolder ${release_mac}/YaCy.app ${release}/yacy_v${releaseVersion}_${releaseNr}.dmg"/>
<arg line="create -srcfolder ${release_mac}/YaCy.app ${release}/${stdReleaseStub}.dmg"/>
</exec>
<delete dir="${release_mac}" failonerror="false" verbose="false" />
</target>

@ -1,3 +1,7 @@
SVNRevision = @REPL_REVISION_NR@
Version = @REPL_VERSION@
RepositoryVersion = @REPL_REPVER@
RepositoryVersionDate = @REPL_REPVERDATE@
RepositoryVersionTime = @REPL_REPVERTIME@
RepositoryVersionHash = @REPL_REPVERHASH@
ReleaseStub = @REPL_RELEASESTUB@
dstamp = @REPL_DSTAMP@
tstamp = @REPL_TSTAMP@

@ -1,6 +1,9 @@
<?xml version="1.0"?>
<version>
<number>#[versionstring]#</number>
<svnRevision>#[svnRev]#</svnRevision>
<buildDate>19700101</buildDate>
<file>#[versionstring]#</file>
<buildDate>#[buildDate]#</buildDate>
<buildTime>#[buildTime]#</buildTime>
<buildDateTime>#[buildDateTime]#</buildDateTime>
<buildHash>#[buildDateTime]#</buildHash>
<buildVersion>#[buildVersion]#</buildVersion>
</version>

@ -163,7 +163,7 @@ public class ConfigUpdate_p {
}
// version information
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
final String versionstring = yacyBuildProperties.getReleaseStub();
prop.putHTML("candeploy_versionpp", versionstring);
final boolean devenvironment = new File(sb.getAppPath(), ".git").exists();
float thisVersion = Float.parseFloat(yacyBuildProperties.getVersion());
@ -180,7 +180,7 @@ public class ConfigUpdate_p {
prop.put("candeploy_deployenabled", (downloadedFilesNum == 0) ? "0" : ((devenvironment) ? "1" : "2")); // prevent that a developer-version is over-deployed
final NavigableSet<yacyRelease> downloadedReleases = new TreeSet<yacyRelease>();
final NavigableSet<yacyRelease> downloadedReleases = new TreeSet<>();
for (final File downloaded : downloadedFiles) {
try {
final yacyRelease release = new yacyRelease(downloaded);
@ -216,7 +216,7 @@ public class ConfigUpdate_p {
final yacyRelease.DevAndMainVersions releasess = yacyRelease.allReleases(false, false);
relcount = 0;
final ArrayList<yacyRelease> rlist = new ArrayList<yacyRelease>();
final ArrayList<yacyRelease> rlist = new ArrayList<>();
final Set<yacyRelease> remoteDevReleases = releasess.dev;
remoteDevReleases.removeAll(downloadedReleases);
for (final yacyRelease release : remoteDevReleases) {

@ -166,7 +166,7 @@ public class Status
// version information
//final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1"));
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
final String versionstring = yacyBuildProperties.getReleaseStub();
prop.put("versionpp", versionstring);
prop.put("java.version", System.getProperty("java.version"));

@ -12,9 +12,12 @@ public class version {
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, @SuppressWarnings("unused") final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
prop.put("versionstring", yacyBuildProperties.getLongVersion());
prop.put("svnRev", yacyBuildProperties.getSVNRevision());
prop.put("versionstring", yacyBuildProperties.getReleaseStub());
prop.put("buildDate", yacyBuildProperties.getRepositoryVersionDate());
prop.put("buildTime", yacyBuildProperties.getRepositoryVersionTime());
prop.put("buildDateTime", yacyBuildProperties.getRepositoryVersionDate() + yacyBuildProperties.getRepositoryVersionTime());
prop.put("buildHash", yacyBuildProperties.getRepositoryVersionHash());
prop.put("buildVersion", yacyBuildProperties.getVersion());
// return rewrite properties
return prop;

@ -57,8 +57,8 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
private static final Pattern multiDumpFilterPattern = Pattern.compile(multiDumpFilter);
public static class StackTrace {
private String text;
private Thread.State state;
private final String text;
private final Thread.State state;
public StackTrace(final String text, final Thread.State state) {
this.state = state;
this.text = text;
@ -81,7 +81,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
}
public static class Lock {
private String id;
private final String id;
public Lock(final String name) {
this.id = name;
}
@ -179,7 +179,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
String line;
String thread = null;
int p;
List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
Thread.State state = null;
Thread.State state0;
while ((line = br.readLine()) != null) {
@ -189,7 +189,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
if (thread != null) {
put(new ThreadDump.StackTrace(thread, state), list);
}
list = new ArrayList<String>();
list = new ArrayList<>();
thread = null;
state = null;
continue;
@ -262,7 +262,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
final String threaddump = sb.toString();
@SuppressWarnings("unlikely-arg-type")
List<String> threads = get(threaddump);
if (threads == null) threads = new ArrayList<String>();
if (threads == null) threads = new ArrayList<>();
Thread.State state = null;
for (final String t: threads) {
final int p = t.indexOf(statestatement);
@ -323,7 +323,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
final boolean plain) {
// collect single dumps
final Map<String, Integer> dumps = new HashMap<String, Integer>();
final Map<String, Integer> dumps = new HashMap<>();
ThreadDump x;
for (final Map<Thread, StackTraceElement[]> trace: stackTraces) {
x = new ThreadDump(rootPath, trace, plain, Thread.State.RUNNABLE);
@ -384,7 +384,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
public List<Map.Entry<StackTrace, List<String>>> freerun() {
final List<Map.Entry<StackTrace, List<String>>> runner = new ArrayList<Map.Entry<StackTrace, List<String>>>();
final List<Map.Entry<StackTrace, List<String>>> runner = new ArrayList<>();
runf: for (final Map.Entry<StackTrace, List<String>> entry: entrySet()) {
// check if the thread is locked or holds a lock
if (entry.getKey().state != Thread.State.RUNNABLE) continue runf;
@ -402,7 +402,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
*/
public Map<Lock, StackTrace> locks() {
int p;
final Map<Lock, StackTrace> locks = new HashMap<Lock, StackTrace>();
final Map<Lock, StackTrace> locks = new HashMap<>();
for (final Map.Entry<StackTrace, List<String>> entry: entrySet()) {
for (final String s: entry.getValue()) {
if ((p = s.indexOf("locked <",0)) > 0) {
@ -433,7 +433,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
public Map<StackTrace, Integer> countLocks() {
final Map<Lock, StackTrace> locks = locks();
final Map<StackTrace, Integer> count = new HashMap<StackTrace, Integer>();
final Map<StackTrace, Integer> count = new HashMap<>();
for (final Map.Entry<Lock, StackTrace> entry: locks.entrySet()) {
// look where the lock has an effect
int c = 0;
@ -461,8 +461,8 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
if (sleep > 0) try {Thread.sleep(sleep);} catch (final InterruptedException e) {}
// Thread dump
final Date dt = new Date();
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
Runtime runtime = Runtime.getRuntime();
final String versionstring = yacyBuildProperties.getReleaseStub();
final Runtime runtime = Runtime.getRuntime();
ThreadDump.bufferappend(buffer, plain, "************* Start Thread Dump " + dt + " *******************");
ThreadDump.bufferappend(buffer, plain, "&nbsp;");
@ -473,9 +473,9 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
ThreadDump.bufferappend(buffer, plain, "&nbsp;");
ThreadDump.bufferappend(buffer, plain, "&nbsp;");
File appPath = sb.getAppPath();
final File appPath = sb.getAppPath();
if (multiple) {
final ArrayList<Map<Thread,StackTraceElement[]>> traces = new ArrayList<Map<Thread,StackTraceElement[]>>();
final ArrayList<Map<Thread,StackTraceElement[]>> traces = new ArrayList<>();
for (int i = 0; i < multipleCount; i++) {
try {
traces.add(ThreadDump.getAllStackTraces());
@ -486,7 +486,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
ThreadDump.appendStackTraceStats(appPath, buffer, traces, plain);
} else {
// write a thread dump to standard error output
File logFile = new File("yacy.log");
final File logFile = new File("yacy.log");
if (ThreadDump.canProduceLockedBy(logFile)) {
try {
new ThreadDump(logFile).appendBlockTraces(buffer, plain);
@ -511,10 +511,10 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
ThreadDump.bufferappend(buffer, plain, "************* End Thread Dump " + dt + " *******************");
ThreadDump.bufferappend(buffer, plain, "");
ThreadMXBean threadbean = ManagementFactory.getThreadMXBean();
final ThreadMXBean threadbean = ManagementFactory.getThreadMXBean();
ThreadDump.bufferappend(buffer, plain, "Thread list from ThreadMXBean, " + threadbean.getThreadCount() + " threads:");
ThreadInfo[] threadinfo = threadbean.dumpAllThreads(true, true);
for (ThreadInfo ti: threadinfo) {
final ThreadInfo[] threadinfo = threadbean.dumpAllThreads(true, true);
for (final ThreadInfo ti: threadinfo) {
ThreadDump.bufferappend(buffer, plain, ti.getThreadName());
}

@ -2,7 +2,6 @@ package net.yacy.peers.operation;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Locale;
import java.util.Properties;
import java.util.regex.Pattern;
@ -14,27 +13,40 @@ public final class yacyBuildProperties {
static {
try {
props.load(new FileInputStream("defaults/yacyBuild.properties"));
} catch (IOException e) {
} catch (final IOException e) {
e.printStackTrace();
props = null;
}
}
public static String getSVNRevision() {
if (props == null) return "0";
final String revision = props.getProperty("SVNRevision");
return revision.contains("@") || revision.contains("$") ? "0" : revision;
public static String getVersion() {
return props.getProperty("Version", "0.1");
}
public static String getVersion() {
if (props == null) return "0.1";
final String version = props.getProperty("Version");
return version.contains("@") ? "0.1" : version;
public static String getRepositoryVersionDate() {
return props.getProperty("RepositoryVersionDate", "20220101");
}
public static final Pattern versionMatcher = Pattern.compile("\\A(\\d+\\.\\d{1,3})(\\d{0,5})\\z");
public static String getRepositoryVersionTime() {
return props.getProperty("RepositoryVersionTime", "0000");
}
public static String getLongVersion() {
return String.format(Locale.US, "%.3f%05d", Float.valueOf(getVersion()), Integer.valueOf(getSVNRevision()));
public static String getRepositoryVersionHash() {
return props.getProperty("RepositoryVersionHash", "0");
}
public static String getReleaseStub() {
return props.getProperty("ReleaseStub", "yacy_v0.1_202201010000_000000000");
}
public static String getDstamp() {
return props.getProperty("dstamp", "20220101");
}
public static String getTstamp() {
return props.getProperty("tstamp", "0000");
}
public static final Pattern versionMatcher = Pattern.compile("\\A(\\d+\\.\\d{1,3})(\\d{0,5})\\z");
}

@ -79,10 +79,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
if (thisVersion == null) {
final Switchboard sb = Switchboard.getSwitchboard();
if (sb == null) return null;
thisVersion = new yacyVersion(
"yacy" +
"_v" + yacyBuildProperties.getVersion() + "_" +
yacyBuildProperties.getSVNRevision() + ".tar.gz", null);
thisVersion = new yacyVersion(yacyBuildProperties.getReleaseStub() + ".tar.gz", null);
}
return thisVersion;
}

@ -4497,7 +4497,7 @@ public final class Switchboard extends serverSwitch {
mySeed.put(Seed.ICOUNT, Long.toString(this.index.RWICount())); // the minimum number of words that the peer has indexed (as it says)
mySeed.put(Seed.SCOUNT, Integer.toString(this.peers.sizeConnected())); // the number of seeds that the peer has stored
mySeed.put(Seed.CCOUNT, Float.toString(((int) ((this.peers.sizeConnected() + this.peers.sizeDisconnected() + this.peers.sizePotential()) * 60.0f / (uptime + 1.01f)) * 100.0f) / 100.0f)); // the number of clients that the peer connects (as connects/hour)
mySeed.put(Seed.VERSION, yacyBuildProperties.getLongVersion());
mySeed.put(Seed.VERSION, yacyBuildProperties.getReleaseStub());
mySeed.setFlagDirectConnect(true);
mySeed.setLastSeenUTC();
mySeed.put(Seed.UTC, GenericFormatter.UTCDiffString());

@ -185,7 +185,7 @@ public final class yacy {
System.out.println("could not find logging properties in homePath=" + dataHome);
ConcurrentLog.logException(e);
}
ConcurrentLog.config("STARTUP", "YaCy version: " + yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision());
ConcurrentLog.config("STARTUP", "YaCy version: " + yacyBuildProperties.getReleaseStub());
ConcurrentLog.config("STARTUP", "Java version: " + System.getProperty("java.version", "no-java-version"));
ConcurrentLog.config("STARTUP", "Operation system: " + System.getProperty("os.name","unknown"));
ConcurrentLog.config("STARTUP", "Application root-path: " + appHome);
@ -235,7 +235,7 @@ public final class yacy {
if (oldRev > 1) {
oldVer = Double.parseDouble(tmpversion) + oldRev / 100000000.0;
} else {
oldVer = Double.parseDouble(yacyBuildProperties.getLongVersion()); // failsafe (assume current version = no migration)
oldVer = Double.parseDouble(yacyBuildProperties.getVersion()); // failsafe (assume current version = no migration)
}
} else {
oldVer = Double.parseDouble(tmpversion);
@ -243,8 +243,8 @@ public final class yacy {
} catch (final NumberFormatException e) {
oldVer = 0.0d;
}
final double newRev = Double.parseDouble(yacyBuildProperties.getLongVersion());
sb.setConfig(Seed.VERSION, yacyBuildProperties.getLongVersion());
final double newRev = Double.parseDouble(yacyBuildProperties.getVersion());
sb.setConfig(Seed.VERSION, yacyBuildProperties.getVersion());
sb.setConfig("applicationRoot", appHome.toString());
sb.setConfig("dataRoot", dataHome.toString());

Loading…
Cancel
Save