From 8931c8d6b481a7db93dcec5ccf6938e14e34111d Mon Sep 17 00:00:00 2001 From: f1ori Date: Sat, 11 Jul 2009 17:03:22 +0000 Subject: [PATCH] improvments to debianpackage: * autoupdate completely disabled, display hint * restart-button in interface works! * moved all build-Variables to yacyBuildProperties * fixed some warnings git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6195 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- addon/yacyInit.m4 | 2 +- build.xml | 24 +++++----- debian/changelog | 2 +- debian/control | 2 +- debian/rules | 2 +- htroot/ConfigUpdate_p.html | 5 +- htroot/ConfigUpdate_p.java | 31 +++++++----- htroot/Status.java | 8 ++-- htroot/Steering.java | 2 +- htroot/Threaddump_p.java | 3 +- htroot/User.java | 2 +- htroot/ViewImage.java | 2 +- htroot/ViewProfile.java | 2 +- htroot/api/version.java | 7 +-- htroot/api/version.xml | 2 +- htroot/opensearchdescription.java | 2 +- htroot/www/welcome.java | 2 +- htroot/yacy/hello.java | 6 +-- htroot/yacysearch.java | 2 +- htroot/yacysearchitem.java | 2 +- source/de/anomic/http/httpdFileHandler.java | 3 +- .../de/anomic/plasma/plasmaSwitchboard.java | 8 ++-- .../de/anomic/yacy/yacyBuildProperties.java | 36 +++++++++++++- source/de/anomic/yacy/yacyRelease.java | 27 ++++++++++- source/de/anomic/yacy/yacyVersion.java | 11 ++--- source/yacy.java | 48 ++++--------------- 26 files changed, 141 insertions(+), 102 deletions(-) diff --git a/addon/yacyInit.m4 b/addon/yacyInit.m4 index d2188e9e0..3f837da92 100644 --- a/addon/yacyInit.m4 +++ b/addon/yacyInit.m4 @@ -178,7 +178,7 @@ ifdef(`ArchLinux', ` ')dnl ARGS="$JAVA_ARGS -classpath $CLASSPATH yacy" define(`START_YACY_WITH_START_STOP_DAEMON',` - start-stop-daemon --start --background --make-pidfile --chuid $USER\ + /sbin/start-stop-daemon --start --background --make-pidfile --chuid $USER\ --pidfile $PID_FILE --chdir $YACY_HOME --startas $JAVA\ --nicelevel $NICE_VAL\ -- $ARGS diff --git a/build.xml b/build.xml index 236902f87..46c95e91a 100644 --- a/build.xml +++ b/build.xml @@ -57,7 +57,8 @@ - + + @@ -146,11 +147,10 @@ - + + - - - + @@ -197,11 +197,12 @@ - + + @@ -211,6 +212,7 @@ debug="true" debuglevel="lines,vars,source" source="${javacSource}" target="${javacTarget}"> + @@ -218,7 +220,9 @@ excludes="processing/**" classpathref="project.class.path" debug="true" debuglevel="lines,vars,source" - source="${javacSource}" target="${javacTarget}"/> + source="${javacSource}" target="${javacTarget}"> + + @@ -240,7 +244,6 @@ - @@ -591,7 +594,7 @@ - + @@ -624,7 +627,6 @@ - diff --git a/debian/changelog b/debian/changelog index fc54839a7..a507b234d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -yacy (0.91svn6172) unstable; urgency=low +yacy (*auto-svn-version*) unstable; urgency=low * SVN Update diff --git a/debian/control b/debian/control index d78a9aea2..347838fad 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.7.2 Package: yacy Architecture: all -Depends: java-virtual-machine, java2-runtime, sudo +Depends: java-virtual-machine, java2-runtime, sudo, debconf Description: P2P Web Search Engine YaCy is a Java-based peer-2-peer search engine. It provoids a personal websearch engine, which is diff --git a/debian/rules b/debian/rules index cb2cfa196..f110a8b1a 100755 --- a/debian/rules +++ b/debian/rules @@ -19,7 +19,7 @@ build: build-stamp build-stamp: configure-stamp # build yacy - ant build-jar + ant build-jar -DPKGMANAGER=true m4 -DDebian addon/yacyInit.m4 >debian/yacy.init clean: diff --git a/htroot/ConfigUpdate_p.html b/htroot/ConfigUpdate_p.html index ad75cac6f..ba66f77c4 100644 --- a/htroot/ConfigUpdate_p.html +++ b/htroot/ConfigUpdate_p.html @@ -110,8 +110,11 @@ :: + You installed YaCy with a package manage. To update YaCy, use the packager manager:

+ Debian: apt-get update yacy + :: #(/candeploy)# #%env/templates/footer.template%# - \ No newline at end of file + diff --git a/htroot/ConfigUpdate_p.java b/htroot/ConfigUpdate_p.java index 1756f2205..58865fa5d 100644 --- a/htroot/ConfigUpdate_p.java +++ b/htroot/ConfigUpdate_p.java @@ -35,6 +35,7 @@ import de.anomic.plasma.plasmaSwitchboard; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.server.serverSystem; +import de.anomic.yacy.yacyBuildProperties; import de.anomic.yacy.yacyURL; import de.anomic.yacy.yacyRelease; import de.anomic.yacy.yacyVersion; @@ -46,6 +47,19 @@ public class ConfigUpdate_p { final serverObjects prop = new serverObjects(); final plasmaSwitchboard sb = (plasmaSwitchboard) env; + // set if this should be visible + if (yacyBuildProperties.isPkgManager()) { + prop.put("candeploy", "2"); + return prop; + } else if (serverSystem.canExecUnix || serverSystem.isWindows) { + // we can deploy a new system with (i.e.) + // cd DATA/RELEASE;tar xfz $1;cp -Rf yacy/* ../../;rm -Rf yacy + prop.put("candeploy", "1"); + } else { + prop.put("candeploy", "0"); + } + + prop.put("candeploy_configCommit", "0"); prop.put("candeploy_autoUpdate", "0"); @@ -107,7 +121,7 @@ public class ConfigUpdate_p { sb.getLog().logInfo("AUTO-UPDATE: downloading more recent release " + updateVersion.getUrl()); final File downloaded = updateVersion.downloadRelease(); prop.putHTML("candeploy_autoUpdate_downloadedRelease", updateVersion.getName()); - final boolean devenvironment = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev"); + final boolean devenvironment = new File(sb.getRootPath(), ".svn").exists(); if (devenvironment) { sb.getLog().logInfo("AUTO-UPDATE: omiting update because this is a development environment"); prop.put("candeploy_autoUpdate", "3"); @@ -133,20 +147,11 @@ public class ConfigUpdate_p { } } - // set if this should be visible - if (serverSystem.canExecUnix || serverSystem.isWindows) { - // we can deploy a new system with (i.e.) - // cd DATA/RELEASE;tar xfz $1;cp -Rf yacy/* ../../;rm -Rf yacy - prop.put("candeploy", "1"); - } else { - prop.put("candeploy", "0"); - } - // version information - final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")); + final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision(); prop.putHTML("candeploy_versionpp", versionstring); - final boolean devenvironment = versionstring.startsWith("dev"); - double thisVersion = Double.parseDouble(sb.getConfig("version","0.1")); + final boolean devenvironment = new File(sb.getRootPath(), ".svn").exists(); + double thisVersion = Double.parseDouble(yacyBuildProperties.getVersion()); // cut off the SVN Rev in the Version try {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (final NumberFormatException e) {} diff --git a/htroot/Status.java b/htroot/Status.java index 5cea1c217..6d970992c 100644 --- a/htroot/Status.java +++ b/htroot/Status.java @@ -44,6 +44,7 @@ import de.anomic.server.serverObjects; import de.anomic.server.serverProcessor; import de.anomic.server.serverSwitch; import de.anomic.tools.Formatter; +import de.anomic.yacy.yacyBuildProperties; import de.anomic.yacy.yacySeed; import de.anomic.yacy.yacyVersion; @@ -138,13 +139,10 @@ public class Status { // version information - final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")); + //final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")); + final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision(); prop.put("versionpp", versionstring); - double thisVersion = Double.parseDouble(sb.getConfig("version","0.1")); - // cut off the SVN Rev in the Version - try {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (final NumberFormatException e) {} - // place some more hints if ((adminaccess) && (sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount() == 0) && (sb.getThread(plasmaSwitchboardConstants.INDEXER).getJobCount() == 0)) { prop.put("hintCrawlStart", "1"); diff --git a/htroot/Steering.java b/htroot/Steering.java index af60c9494..18e5b3beb 100644 --- a/htroot/Steering.java +++ b/htroot/Steering.java @@ -67,7 +67,7 @@ public class Steering { } if (post.containsKey("update")) { - final boolean devenvironment = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev"); + final boolean devenvironment = new File(sb.getRootPath(), ".svn").exists(); final String releaseFileName = post.get("releaseinstall", ""); final File releaseFile = new File(sb.getRootPath(), "DATA/RELEASE/".replace("/", File.separator) + releaseFileName); if ((!devenvironment) && (releaseFile.length() > 0) && (releaseFile.exists())) { diff --git a/htroot/Threaddump_p.java b/htroot/Threaddump_p.java index c687b5518..b79f88aae 100644 --- a/htroot/Threaddump_p.java +++ b/htroot/Threaddump_p.java @@ -45,6 +45,7 @@ import de.anomic.plasma.plasmaSwitchboard; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.tools.nxTools; +import de.anomic.yacy.yacyBuildProperties; import de.anomic.yacy.yacyVersion; public class Threaddump_p { @@ -62,7 +63,7 @@ public class Threaddump_p { prop.put("dump", "1"); // Thread dump final Date dt = new Date(); - final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")); + final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision(); bufferappend(buffer, plain, "************* Start Thread Dump " + dt + " *******************"); bufferappend(buffer, plain, ""); diff --git a/htroot/User.java b/htroot/User.java index da9bc1c0e..e8e5aff23 100644 --- a/htroot/User.java +++ b/htroot/User.java @@ -150,7 +150,7 @@ public class User{ sb.userDB.adminLogout(userDB.getLoginToken(requestHeader.getHeaderCookies())); } //XXX: This should not be needed anymore, because of isLoggedout - if(! ((String) requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")).equals("xxxxxx")){ + if(! (requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")).equals("xxxxxx")){ prop.put("AUTHENTICATE","admin log-in"); } } diff --git a/htroot/ViewImage.java b/htroot/ViewImage.java index f9682343b..026ab9398 100644 --- a/htroot/ViewImage.java +++ b/htroot/ViewImage.java @@ -62,7 +62,7 @@ public class ViewImage { String urlString = post.get("url", ""); final String urlLicense = post.get("code", ""); - final boolean auth = ((String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true); // handle access rights + final boolean auth = (header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true); // handle access rights yacyURL url = null; if ((urlString.length() > 0) && (auth)) try { diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.java index a71a25393..8ad3aa512 100644 --- a/htroot/ViewProfile.java +++ b/htroot/ViewProfile.java @@ -56,7 +56,7 @@ public class ViewProfile { final boolean authenticated = sb.adminAuthenticated(header) >= 2; final int display = ((post == null) || (!authenticated)) ? 0 : post.getInt("display", 0); prop.put("display", display); - final String hash = (post == null) ? null : (String) post.get("hash"); + final String hash = (post == null) ? null : post.get("hash"); if ((hash == null) || (sb.peers == null)) { // wrong access diff --git a/htroot/api/version.java b/htroot/api/version.java index 67b421dad..fb08b5fa3 100644 --- a/htroot/api/version.java +++ b/htroot/api/version.java @@ -3,6 +3,7 @@ import de.anomic.http.httpRequestHeader; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; +import de.anomic.yacy.yacyBuildProperties; public class version { @@ -10,9 +11,9 @@ public class version { // return variable that accumulates replacements final serverObjects prop = new serverObjects(); - prop.put("version", env.getConfig("version", "0.0")); - prop.put("svnRev", env.getConfig("svnRevision", "0")); - prop.put("buildDate", env.getConfig("vdate", "19700101")); + prop.put("versionstring", yacyBuildProperties.getLongVersion()); + prop.put("svnRev", yacyBuildProperties.getSVNRevision()); + prop.put("buildDate", yacyBuildProperties.getBuildDate()); // return rewrite properties return prop; } diff --git a/htroot/api/version.xml b/htroot/api/version.xml index 004341959..d75a5be48 100644 --- a/htroot/api/version.xml +++ b/htroot/api/version.xml @@ -1,6 +1,6 @@ - #[version]# + #[versionstring]# #[svnRev]# #[buildDate]# diff --git a/htroot/opensearchdescription.java b/htroot/opensearchdescription.java index 8c03eaa9d..ed1cc1725 100644 --- a/htroot/opensearchdescription.java +++ b/htroot/opensearchdescription.java @@ -39,7 +39,7 @@ public class opensearchdescription { String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, ""); if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", ""); - String thisaddress = (String) header.get("Host", "localhost"); + String thisaddress = header.get("Host", "localhost"); if (thisaddress.indexOf(":") == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8080")); int compareyacy = 0; diff --git a/htroot/www/welcome.java b/htroot/www/welcome.java index 48d64694f..92b0a67be 100644 --- a/htroot/www/welcome.java +++ b/htroot/www/welcome.java @@ -62,7 +62,7 @@ public class welcome { prop.put("hostip", "Unknown Host Exception"); } prop.put("port", serverCore.getPortNr(env.getConfig("port","8080"))); - prop.put("clientip", (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")); + prop.put("clientip", header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")); final String peertype = (sb.peers.mySeed() == null) ? yacySeed.PEERTYPE_JUNIOR : sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN); final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL)); diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java index 206309594..25a4f2049 100644 --- a/htroot/yacy/hello.java +++ b/htroot/yacy/hello.java @@ -72,8 +72,8 @@ public final class hello { final String countStr = post.get("count", "0"); int count = 0; try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (final NumberFormatException e) {count = 0;} -// final Date remoteTime = yacyCore.parseUniversalDate((String) post.get(MYTIME)); // read remote time - final String clientip = (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, ""); // read an artificial header addendum +// final Date remoteTime = yacyCore.parseUniversalDate(post.get(MYTIME)); // read remote time + final String clientip = header.get(httpHeader.CONNECTION_PROP_CLIENTIP, ""); // read an artificial header addendum final InetAddress ias = serverDomains.dnsResolve(clientip); if (ias == null) { prop.put("message", "cannot resolve your IP from your reported location " + clientip); @@ -97,7 +97,7 @@ public final class hello { // if ((properTest != null) && (! properTest.substring(0,1).equals("IP"))) { return null; } // we easily know the caller's IP: - final String userAgent = (String) header.get(httpHeader.USER_AGENT, ""); + final String userAgent = header.get(httpHeader.USER_AGENT, ""); final String reportedip = remoteSeed.getIP(); final String reportedPeerType = remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR); final float clientversion = remoteSeed.getVersion(); diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index a71047296..0c3035ed8 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -602,7 +602,7 @@ public class yacysearch { prop.put("depth", "0"); // adding some additional properties needed for the rss feed - String hostName = (String) header.get("Host", "localhost"); + String hostName = header.get("Host", "localhost"); if (hostName.indexOf(":") == -1) hostName += ":" + serverCore.getPortNr(env.getConfig("port", "8080")); prop.put("searchBaseURL", "http://" + hostName + "/yacysearch.html"); prop.put("rssYacyImageURL", "http://" + hostName + "/env/grafics/yacy.gif"); diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index d3f47f77f..23937919d 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -62,7 +62,7 @@ public class yacysearchitem { final String eventID = post.get("eventID", ""); final boolean authenticated = sb.adminAuthenticated(header) >= 2; final int item = post.getInt("item", -1); - final boolean auth = ((String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true); + final boolean auth = (header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true); final int display = (post == null) ? 0 : post.getInt("display", 0); // default settings for blank item diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java index a48a8007a..5bfa67de7 100644 --- a/source/de/anomic/http/httpdFileHandler.java +++ b/source/de/anomic/http/httpdFileHandler.java @@ -95,6 +95,7 @@ import de.anomic.server.serverCore; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.server.servletProperties; +import de.anomic.yacy.yacyBuildProperties; import de.anomic.yacy.yacyURL; import de.anomic.yacy.logging.Log; import de.anomic.ymage.ymageMatrix; @@ -785,7 +786,7 @@ public final class httpdFileHandler { return; } // add the application version, the uptime and the client name to every rewrite table - templatePatterns.put(servletProperties.PEER_STAT_VERSION, switchboard.getConfig("version", "")); + templatePatterns.put(servletProperties.PEER_STAT_VERSION, yacyBuildProperties.getVersion()); templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, switchboard.getConfig("peerName", "anomic")); templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, ((plasmaSwitchboard) switchboard).peers.myID()); diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index e5bdcee7e..1feaf6979 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -1557,7 +1557,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch 256) return 0; @@ -1964,7 +1964,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch/var/lib/yacy/RELEASE/log" + serverCore.LF_STRING; + final File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/restart.sh"); + serverSystem.deployScript(scriptFile, script); + Log.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath()); + serverSystem.execAsynchronous(scriptFile); + Log.logInfo("RESTART", "script is running"); + } catch (final IOException e) { + Log.logSevere("RESTART", "restart failed", e); + } + } else if (serverSystem.canExecUnix) { // start a re-start daemon try { Log.logInfo("RESTART", "INITIATED"); @@ -452,6 +474,9 @@ public final class yacyRelease extends yacyVersion { * @param releaseFile */ public static void deployRelease(final File releaseFile) { + if(yacyBuildProperties.isPkgManager()) { + return; + } //byte[] script = ("cd " + plasmaSwitchboard.getSwitchboard().getRootPath() + ";while [ -e ../yacy.running ]; do sleep 1;done;tar xfz " + release + ";cp -Rf yacy/* ../../;rm -Rf yacy;cd ../../;startYACY.sh").getBytes(); try { final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard(); diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.java index 9ccbc9be6..b7290dcf7 100644 --- a/source/de/anomic/yacy/yacyVersion.java +++ b/source/de/anomic/yacy/yacyVersion.java @@ -88,12 +88,11 @@ public class yacyVersion implements Comparator, Comparable, Comparable