changed ording on release files: main criteria is not the svn any more; releases are now ordered by

- release number
- date
- svn number

additionally there is a new option to remove the svn number completely

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@8135 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 13 years ago
parent 11729061f2
commit 402e9d71ef

@ -26,6 +26,7 @@
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.NavigableSet; import java.util.NavigableSet;
import java.util.Set; import java.util.Set;
@ -40,7 +41,6 @@ import net.yacy.peers.operation.yacyBuildProperties;
import net.yacy.peers.operation.yacyRelease; import net.yacy.peers.operation.yacyRelease;
import net.yacy.peers.operation.yacyVersion; import net.yacy.peers.operation.yacyVersion;
import net.yacy.search.Switchboard; import net.yacy.search.Switchboard;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
@ -86,7 +86,7 @@ public class ConfigUpdate_p {
yacyRelease versionToDownload = new yacyRelease(new DigestURI(release)); yacyRelease versionToDownload = new yacyRelease(new DigestURI(release));
// replace this version with version which contains public key // replace this version with version which contains public key
yacyRelease.DevAndMainVersions allReleases = yacyRelease.allReleases(false, false); final yacyRelease.DevAndMainVersions allReleases = yacyRelease.allReleases(false, false);
final Set<yacyRelease> mostReleases = versionToDownload.isMainRelease() ? allReleases.main : allReleases.dev; final Set<yacyRelease> mostReleases = versionToDownload.isMainRelease() ? allReleases.main : allReleases.dev;
for (final yacyRelease rel : mostReleases) { for (final yacyRelease rel : mostReleases) {
if (rel.equals(versionToDownload)) { if (rel.equals(versionToDownload)) {
@ -174,7 +174,7 @@ public class ConfigUpdate_p {
final NavigableSet<yacyRelease> downloadedReleases = new TreeSet<yacyRelease>(); final NavigableSet<yacyRelease> downloadedReleases = new TreeSet<yacyRelease>();
for (final File downloaded : downloadedFiles) { for (final File downloaded : downloadedFiles) {
try { try {
yacyRelease release = new yacyRelease(downloaded); final yacyRelease release = new yacyRelease(downloaded);
downloadedReleases.add(release); downloadedReleases.add(release);
} catch (final RuntimeException e) { } catch (final RuntimeException e) {
// not a valid release // not a valid release
@ -186,7 +186,7 @@ public class ConfigUpdate_p {
} }
} }
// latest downloaded release // latest downloaded release
yacyVersion dflt = (downloadedReleases.isEmpty()) ? null : downloadedReleases.last(); final yacyVersion dflt = (downloadedReleases.isEmpty()) ? null : downloadedReleases.last();
// check if there are any downloaded releases and if there are enable the update buttons // check if there are any downloaded releases and if there are enable the update buttons
prop.put("candeploy_downloadsAvailable", (downloadedReleases.isEmpty()) ? "0" : "1"); prop.put("candeploy_downloadsAvailable", (downloadedReleases.isEmpty()) ? "0" : "1");
prop.put("candeploy_deployenabled_buttonsActive", (downloadedReleases.isEmpty() || devenvironment) ? "0" : "1"); prop.put("candeploy_deployenabled_buttonsActive", (downloadedReleases.isEmpty() || devenvironment) ? "0" : "1");
@ -205,28 +205,27 @@ public class ConfigUpdate_p {
final yacyRelease.DevAndMainVersions releasess = yacyRelease.allReleases(false, false); final yacyRelease.DevAndMainVersions releasess = yacyRelease.allReleases(false, false);
relcount = 0; relcount = 0;
// main final ArrayList<yacyRelease> rlist = new ArrayList<yacyRelease>();
final Set<yacyRelease> remoteDevReleases = releasess.dev;
remoteDevReleases.removeAll(downloadedReleases);
for (final yacyRelease release : remoteDevReleases) {
rlist.add(release);
}
final Set<yacyRelease> remoteMainReleases = releasess.main; final Set<yacyRelease> remoteMainReleases = releasess.main;
remoteMainReleases.removeAll(downloadedReleases); remoteMainReleases.removeAll(downloadedReleases);
for (final yacyRelease release : remoteMainReleases) { for (final yacyRelease release : remoteMainReleases) {
prop.put("candeploy_availreleases_" + relcount + "_name", ((release.isMainRelease()) ? "main" : "dev") + " " + release.getReleaseNr() + "/" + release.getSvn()); rlist.add(release);
prop.put("candeploy_availreleases_" + relcount + "_url", release.getUrl().toString());
prop.put("candeploy_availreleases_" + relcount + "_signatures", (release.getPublicKey()!=null?"1":"0"));
prop.put("candeploy_availreleases_" + relcount + "_selected", "0");
relcount++;
} }
yacyRelease release;
// dev for (int i = rlist.size() - 1; i >= 0; i--) {
dflt = (releasess.dev.isEmpty()) ? null : releasess.dev.last(); release = rlist.get(i);
final Set<yacyRelease> remoteDevReleases = releasess.dev;
remoteDevReleases.removeAll(downloadedReleases);
for (final yacyRelease release : remoteDevReleases) {
prop.put("candeploy_availreleases_" + relcount + "_name", ((release.isMainRelease()) ? "main" : "dev") + " " + release.getReleaseNr() + "/" + release.getSvn()); prop.put("candeploy_availreleases_" + relcount + "_name", ((release.isMainRelease()) ? "main" : "dev") + " " + release.getReleaseNr() + "/" + release.getSvn());
prop.put("candeploy_availreleases_" + relcount + "_url", release.getUrl().toString()); prop.put("candeploy_availreleases_" + relcount + "_url", release.getUrl().toString());
prop.put("candeploy_availreleases_" + relcount + "_signatures", (release.getPublicKey()!=null?"1":"0")); prop.put("candeploy_availreleases_" + relcount + "_signatures", (release.getPublicKey()!=null?"1":"0"));
prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? "1" : "0"); prop.put("candeploy_availreleases_" + relcount + "_selected", (relcount == 0) ? "1" : "0");
relcount++; relcount++;
} }
prop.put("candeploy_availreleases", relcount); prop.put("candeploy_availreleases", relcount);
// properties for automated system update // properties for automated system update

@ -65,7 +65,7 @@ NO OTHER SOFTWARE IS REQUIRED!
== HOW DO I START THIS SOFTWARE? == == HOW DO I START THIS SOFTWARE? ==
Startup and Shutdown of YaCy: Startup and Shutdown of YaCy:
- on Linux: - on GNU/Linux:
to start: execute ./startYACY.sh to start: execute ./startYACY.sh
to stop : execute ./stopYACY.sh to stop : execute ./stopYACY.sh

@ -85,7 +85,7 @@ public final class yacyRelease extends yacyVersion {
this.url = url; this.url = url;
} }
public yacyRelease(final MultiProtocolURI url, final PublicKey publicKey) { private yacyRelease(final MultiProtocolURI url, final PublicKey publicKey) {
this(url); this(url);
this.publicKey = publicKey; this.publicKey = publicKey;
} }

@ -38,7 +38,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* i.e. yacy_v0.51_20070321_3501.tar.gz * i.e. yacy_v0.51_20070321_3501.tar.gz
* @param release * @param release
*/ */
public yacyVersion(String release, String host) { public yacyVersion(String release, final String host) {
this.name = release; this.name = release;
if (release == null || !(release.endsWith(".tar.gz") || release.endsWith(".tar"))) { if (release == null || !(release.endsWith(".tar.gz") || release.endsWith(".tar"))) {
@ -54,7 +54,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
// now all release names have the form // now all release names have the form
// ${releaseVersion}_${DSTAMP}_${releaseNr} // ${releaseVersion}_${DSTAMP}_${releaseNr}
final String[] comp = release.split("_"); // should be 3 parts final String[] comp = release.split("_"); // should be 3 parts
if (comp.length != 3) { if (comp.length < 2 || comp.length > 3) {
throw new RuntimeException("release file name '" + release + "' is not valid, 3 information parts expected"); throw new RuntimeException("release file name '" + release + "' is not valid, 3 information parts expected");
} }
try { try {
@ -62,17 +62,21 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[0] + "' should be a float number"); throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[0] + "' should be a float number");
} }
this.mainRelease = ((int) (this.getReleaseNr() * 100)) % 10 == 0 || (host != null && host.endsWith("yacy.net")); this.mainRelease = ((int) (getReleaseNr() * 100)) % 10 == 0 || (host != null && host.endsWith("yacy.net"));
//System.out.println("Release version " + this.releaseNr + " is " + ((this.mainRelease) ? "main" : "std")); //System.out.println("Release version " + this.releaseNr + " is " + ((this.mainRelease) ? "main" : "std"));
this.dateStamp = comp[1]; this.dateStamp = comp[1];
if (this.getDateStamp().length() != 8) { if (getDateStamp().length() != 8) {
throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[1] + "' should be a 8-digit date string"); throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[1] + "' should be a 8-digit date string");
} }
if (comp.length > 2) {
try { try {
this.svn = Integer.parseInt(comp[2]); this.svn = Integer.parseInt(comp[2]);
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[2] + "' should be a integer number"); throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[2] + "' should be a integer number");
} }
} else {
this.svn = 0; // we migrate to git
}
// finished! we parsed a relase string // finished! we parsed a relase string
} }
@ -105,19 +109,23 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* a ordered structure, like TreeSet or TreeMap * a ordered structure, like TreeSet or TreeMap
*/ */
public int compare(final yacyVersion v0, final yacyVersion v1) { public int compare(final yacyVersion v0, final yacyVersion v1) {
int r = (Float.valueOf(v0.getReleaseNr())).compareTo(Float.valueOf(v1.getReleaseNr()));
if (r != 0) return r;
r = v0.getDateStamp().compareTo(v1.getDateStamp());
if (r != 0) return r;
return (Integer.valueOf(v0.getSvn())).compareTo(Integer.valueOf(v1.getSvn())); return (Integer.valueOf(v0.getSvn())).compareTo(Integer.valueOf(v1.getSvn()));
} }
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (obj instanceof yacyVersion) { if (obj instanceof yacyVersion) {
final yacyVersion v = (yacyVersion) obj; final yacyVersion v = (yacyVersion) obj;
return (this.getSvn() == v.getSvn()) && (this.getName().equals(v.getName())); return (getReleaseNr() == v.getReleaseNr()) && (getSvn() == v.getSvn()) && (getName().equals(v.getName()));
} }
return false; return false;
} }
public int hashCode() { public int hashCode() {
return this.getName().hashCode(); return getName().hashCode();
} }
/** /**
@ -169,7 +177,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* @return timestamp * @return timestamp
*/ */
public String getDateStamp() { public String getDateStamp() {
return dateStamp; return this.dateStamp;
} }
/** /**
@ -177,7 +185,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* @return svn revision as integer * @return svn revision as integer
*/ */
public int getSvn() { public int getSvn() {
return svn; return this.svn;
} }
/** /**
@ -185,7 +193,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* @return * @return
*/ */
public boolean isMainRelease() { public boolean isMainRelease() {
return mainRelease; return this.mainRelease;
} }
/** /**
@ -193,12 +201,22 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* @return * @return
*/ */
public float getReleaseNr() { public float getReleaseNr() {
return releaseNr; return this.releaseNr;
} }
public String getName() { public String getName() {
return name; return this.name;
}
public static void main(final String[] args) {
final yacyVersion y1 = new yacyVersion("yacy_v0.51_20070321_3501.tar.gz", null);
final yacyVersion y2 = new yacyVersion("yacy_v1.0_20111203_8134.tar.gz", null);
final yacyVersion y3 = new yacyVersion("yacy_v1.01_20111206_8140.tar.gz", null);
final yacyVersion y4 = new yacyVersion("yacy_v1.01_20111207.tar.gz", null);
System.out.println(y1.compareTo(y2));
System.out.println(y2.compareTo(y3));
System.out.println(y3.compareTo(y4));
} }
} }

Loading…
Cancel
Save