From 759e855566a08d965059ca08d4f4510d335f1c7d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 1 Jul 2011 21:47:30 +0100 Subject: refactor: rename gitCommitFileName to manualVersionFileName since bin/.version doesn't necessary have to be a git hash --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework/Servers/BaseOpenSimServer.cs') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 21e1e09..98a92dd 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -460,21 +460,20 @@ namespace OpenSim.Framework.Servers // elsewhere as well string svnRevisionFileName = "svn_revision"; string svnFileName = ".svn/entries"; - string gitCommitFileName = ".version"; + string manualVersionFileName = ".version"; string inputLine; int strcmp; - if (File.Exists(gitCommitFileName)) + if (File.Exists(manualVersionFileName)) { - StreamReader CommitFile = File.OpenText(gitCommitFileName); + StreamReader CommitFile = File.OpenText(manualVersionFileName); buildVersion = CommitFile.ReadLine(); CommitFile.Close(); m_version += buildVersion ?? ""; } - - // Remove the else logic when subversion mirror is no longer used else { + // Remove the else logic when subversion mirror is no longer used if (File.Exists(svnRevisionFileName)) { StreamReader RevisionFile = File.OpenText(svnRevisionFileName); -- cgit v1.1 From e765759f504b86a643fd8843e41b0283422f7980 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 1 Jul 2011 22:48:00 +0100 Subject: If OpenSim has been built from a git tree, then include version information automatically by dereferencing .git/HEAD A blank bin/.version file will stop this being displayed. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 43 +++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/Servers/BaseOpenSimServer.cs') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 98a92dd..d4c3d08 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -31,6 +31,7 @@ using System.Diagnostics; using System.IO; using System.Reflection; using System.Text; +using System.Text.RegularExpressions; using System.Threading; using System.Timers; using log4net; @@ -124,7 +125,6 @@ namespace OpenSim.Framework.Servers m_logFileAppender = appender; } } - } /// @@ -458,6 +458,9 @@ namespace OpenSim.Framework.Servers // This allows to make the revision available in simulators not running from the source tree. // FIXME: Making an assumption about the directory we're currently in - we do this all over the place // elsewhere as well + string gitDir = "../.git/"; + string gitRefPointerPath = gitDir + "HEAD"; + string svnRevisionFileName = "svn_revision"; string svnFileName = ".svn/entries"; string manualVersionFileName = ".version"; @@ -466,13 +469,45 @@ namespace OpenSim.Framework.Servers if (File.Exists(manualVersionFileName)) { - StreamReader CommitFile = File.OpenText(manualVersionFileName); - buildVersion = CommitFile.ReadLine(); - CommitFile.Close(); + using (StreamReader CommitFile = File.OpenText(manualVersionFileName)) + buildVersion = CommitFile.ReadLine(); + m_version += buildVersion ?? ""; } + else if (File.Exists(gitRefPointerPath)) + { +// m_log.DebugFormat("[OPENSIM]: Found {0}", gitRefPointerPath); + + string rawPointer = ""; + + using (StreamReader pointerFile = File.OpenText(gitRefPointerPath)) + rawPointer = pointerFile.ReadLine(); + +// m_log.DebugFormat("[OPENSIM]: rawPointer [{0}]", rawPointer); + + Match m = Regex.Match(rawPointer, "^ref: (.+)$"); + + if (m.Success) + { +// m_log.DebugFormat("[OPENSIM]: Matched [{0}]", m.Groups[1].Value); + + string gitRef = m.Groups[1].Value; + string gitRefPath = gitDir + gitRef; + if (File.Exists(gitRefPath)) + { +// m_log.DebugFormat("[OPENSIM]: Found gitRefPath [{0}]", gitRefPath); + + using (StreamReader refFile = File.OpenText(gitRefPath)) + { + string gitHash = refFile.ReadLine(); + m_version += gitHash.Substring(0, 7); + } + } + } + } else { + m_log.DebugFormat("[OPENSIM]: Looking for SVN"); // Remove the else logic when subversion mirror is no longer used if (File.Exists(svnRevisionFileName)) { -- cgit v1.1 From fba961c63f2168eb560eec84b66203b1a875b952 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 1 Jul 2011 23:06:46 +0100 Subject: Make default serverside_object_permissions = true since this better matches user expectations. It also matches the default setting in the OpenSim.ini.example file --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'OpenSim/Framework/Servers/BaseOpenSimServer.cs') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index d4c3d08..688be3f 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -443,15 +443,6 @@ namespace OpenSim.Framework.Servers { string buildVersion = string.Empty; - // Add commit hash and date information if available - // The commit hash and date are stored in a file bin/.version - // This file can automatically created by a post - // commit script in the opensim git master repository or - // by issuing the follwoing command from the top level - // directory of the opensim repository - // git log -n 1 --pretty="format:%h: %ci" >bin/.version - // For the full git commit hash use %H instead of %h - // // The subversion information is deprecated and will be removed at a later date // Add subversion revision information if available // Try file "svn_revision" in the current directory first, then the .svn info. @@ -507,7 +498,6 @@ namespace OpenSim.Framework.Servers } else { - m_log.DebugFormat("[OPENSIM]: Looking for SVN"); // Remove the else logic when subversion mirror is no longer used if (File.Exists(svnRevisionFileName)) { @@ -515,7 +505,6 @@ namespace OpenSim.Framework.Servers buildVersion = RevisionFile.ReadLine(); buildVersion.Trim(); RevisionFile.Close(); - } if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) -- cgit v1.1