summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-06 23:03:04 +0800
committerUnknwon <u@gogs.io>2015-08-06 23:03:04 +0800
commit952c480f4f4bedfaa8089ffb45311d63d0ab3fb4 (patch)
treecd06772158c3ccee9e2bae6557c13209449dcb8b /cmd
parent0acf209e2a4e62dab5f7e32661576b7321aac83e (diff)
downloadgitea-952c480f4f4bedfaa8089ffb45311d63d0ab3fb4.tar.gz
gitea-952c480f4f4bedfaa8089ffb45311d63d0ab3fb4.zip
better version checker
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/web.go b/cmd/web.go
index 27e50cd2df..80b4feac14 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -17,6 +17,7 @@ import (
"github.com/Unknwon/macaron"
"github.com/codegangsta/cli"
+ "github.com/go-xorm/xorm"
"github.com/macaron-contrib/binding"
"github.com/macaron-contrib/cache"
"github.com/macaron-contrib/captcha"
@@ -25,6 +26,7 @@ import (
"github.com/macaron-contrib/oauth2"
"github.com/macaron-contrib/session"
"github.com/macaron-contrib/toolbox"
+ "github.com/mcuadros/go-version"
"gopkg.in/ini.v1"
api "github.com/gogits/go-gogs-client"
@@ -35,7 +37,6 @@ import (
"github.com/gogits/gogs/modules/avatar"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/bindata"
- "github.com/gogits/gogs/modules/git"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/setting"
@@ -79,6 +80,7 @@ func checkVersion() {
// Check dependency version.
checkers := []VerChecker{
+ {"github.com/go-xorm/xorm", func() string { return xorm.Version }, "0.4.3.0806"},
{"github.com/Unknwon/macaron", macaron.Version, "0.5.4"},
{"github.com/macaron-contrib/binding", binding.Version, "0.1.0"},
{"github.com/macaron-contrib/cache", cache.Version, "0.0.7"},
@@ -88,9 +90,8 @@ func checkVersion() {
{"gopkg.in/ini.v1", ini.Version, "1.3.4"},
}
for _, c := range checkers {
- ver := strings.Join(strings.Split(c.Version(), ".")[:3], ".")
- if git.MustParseVersion(ver).LessThan(git.MustParseVersion(c.Expected)) {
- log.Fatal(4, "Package '%s' version is too old(%s -> %s), did you forget to update?", c.ImportPath, ver, c.Expected)
+ if !version.Compare(c.Version(), c.Expected, ">=") {
+ log.Fatal(4, "Package '%s' version is too old(%s -> %s), did you forget to update?", c.ImportPath, c.Version(), c.Expected)
}
}
}