diff options
author | Adam <Adam@anope.org> | 2012-02-15 00:06:25 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-02-15 00:06:25 -0500 |
commit | e1f5fc6a0c139eae035d20facb95914642cad50c (patch) | |
tree | 60a12e03999b2cbd1ec77dd5b5bf6aef6b0057b3 /src | |
parent | db59f1a70f75d26a94df73492dc4aa462546f3d9 (diff) |
Remove revision numbers as they're only ever set by Config reading git since we've switched off of SVN. Instead just use the hash for the current head when building. Also recheck the hash on every make not just Config.
Diffstat (limited to 'src')
-rw-r--r-- | src/misc.cpp | 9 | ||||
-rw-r--r-- | src/module.cpp | 6 | ||||
-rw-r--r-- | src/modulemanager.cpp | 35 | ||||
-rw-r--r-- | src/version.sh | 3 |
4 files changed, 29 insertions, 24 deletions
diff --git a/src/misc.cpp b/src/misc.cpp index bb8658a56..5f36358d3 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -769,12 +769,16 @@ const Anope::string Anope::LastError() ModuleVersion Module::GetVersion() const { - return ModuleVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD); + return ModuleVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); } Anope::string Anope::Version() { - return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH) + VERSION_EXTRA + " (" + stringify(VERSION_BUILD) + ")"; +#ifdef VERSION_GIT + return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH) + VERSION_EXTRA + " (" + VERSION_GIT + ")"; +#else + return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH) + VERSION_EXTRA; +#endif } Anope::string Anope::VersionShort() @@ -790,7 +794,6 @@ Anope::string Anope::VersionBuildString() int Anope::VersionMajor() { return VERSION_MAJOR; } int Anope::VersionMinor() { return VERSION_MINOR; } int Anope::VersionPatch() { return VERSION_PATCH; } -int Anope::VersionBuild() { return VERSION_BUILD; } /** * Normalize buffer stripping control characters and colors diff --git a/src/module.cpp b/src/module.cpp index d3406ec22..8a253042a 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -84,7 +84,7 @@ void Module::SetAuthor(const Anope::string &nauthor) this->author = nauthor; } -ModuleVersion::ModuleVersion(int vMajor, int vMinor, int vBuild) : Major(vMajor), Minor(vMinor), Build(vBuild) +ModuleVersion::ModuleVersion(int vMajor, int vMinor, int vPatch) : Major(vMajor), Minor(vMinor), Patch(vPatch) { } @@ -102,8 +102,8 @@ int ModuleVersion::GetMinor() const return this->Minor; } -int ModuleVersion::GetBuild() const +int ModuleVersion::GetPatch() const { - return this->Build; + return this->Patch; } diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 39a4fcc45..d16b71cad 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -186,22 +186,30 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) ModuleVersion v = m->GetVersion(); if (v.GetMajor() < Anope::VersionMajor() || (v.GetMajor() == Anope::VersionMajor() && v.GetMinor() < Anope::VersionMinor())) { - Log() << "Module " << modname << " is compiled against an older version of Anope " << v.GetMajor() << "." << v.GetMinor() << ", this is " << Anope::VersionMajor() << "." << Anope::VersionMinor(); + Log() << "Module " << modname << " is compiled against an older version of Anope " << v.GetMajor() << "." << v.GetMinor() << ", this is " << Anope::VersionShort(); DeleteModule(m); return MOD_ERR_VERSION; } else if (v.GetMajor() > Anope::VersionMajor() || (v.GetMajor() == Anope::VersionMajor() && v.GetMinor() > Anope::VersionMinor())) { - Log() << "Module " << modname << " is compiled against a newer version of Anope " << v.GetMajor() << "." << v.GetMinor() << ", this is " << Anope::VersionMajor() << "." << Anope::VersionMinor(); + Log() << "Module " << modname << " is compiled against a newer version of Anope " << v.GetMajor() << "." << v.GetMinor() << ", this is " << Anope::VersionShort(); DeleteModule(m); return MOD_ERR_VERSION; } - else if (v.GetBuild() < Anope::VersionBuild()) - Log() << "Module " << modname << " is compiled against an older revision of Anope " << v.GetBuild() << ", this is " << Anope::VersionBuild(); - else if (v.GetBuild() > Anope::VersionBuild()) - Log() << "Module " << modname << " is compiled against a newer revision of Anope " << v.GetBuild() << ", this is " << Anope::VersionBuild(); - else if (v.GetBuild() == Anope::VersionBuild()) - Log(LOG_DEBUG) << "Module " << modname << " compiled against current version of Anope " << v.GetBuild(); + else if (v.GetPatch() < Anope::VersionPatch()) + { + Log() << "Module " << modname << " is compiled against an older version of Anope, " << v.GetMajor() << "." << v.GetMinor() << "." << v.GetPatch() << ", this is " << Anope::VersionShort(); + DeleteModule(m); + return MOD_ERR_VERSION; + } + else if (v.GetPatch() > Anope::VersionPatch()) + { + Log() << "Module " << modname << " is compiled against a newer version of Anope, " << v.GetMajor() << "." << v.GetMinor() << "." << v.GetPatch() << ", this is " << Anope::VersionShort(); + DeleteModule(m); + return MOD_ERR_VERSION; + } + else + Log(LOG_DEBUG) << "Module " << modname << " is compiled against current version of Anope " << Anope::VersionShort(); if (m->type == PROTOCOL && ModuleManager::FindFirstOf(PROTOCOL) != m) { @@ -251,7 +259,7 @@ Module *ModuleManager::FindFirstOf(ModType type) return NULL; } -void ModuleManager::RequireVersion(int major, int minor, int patch, int build) +void ModuleManager::RequireVersion(int major, int minor, int patch) { if (Anope::VersionMajor() > major) return; @@ -268,16 +276,11 @@ void ModuleManager::RequireVersion(int major, int minor, int patch, int build) else if (Anope::VersionPatch() > patch) return; else if (Anope::VersionPatch() == patch) - { - if (build == -1) - return; - else if (Anope::VersionBuild() >= build) - return; - } + return; } } - throw ModuleException("This module requires version " + stringify(major) + "." + stringify(minor) + "." + stringify(patch) + "-" + build + " - this is " + Anope::Version()); + throw ModuleException("This module requires version " + stringify(major) + "." + stringify(minor) + "." + stringify(patch) + " - this is " + Anope::VersionShort()); } ModuleReturn ModuleManager::DeleteModule(Module *m) diff --git a/src/version.sh b/src/version.sh index 6b3f3be14..c50b9c1a1 100644 --- a/src/version.sh +++ b/src/version.sh @@ -1,8 +1,7 @@ #!/bin/sh + VERSION_MAJOR="1" VERSION_MINOR="9" VERSION_PATCH="7" VERSION_EXTRA="-avoid-direct-visual-contact" -VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA" - |