mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
move version.go to top level package
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
parent
d52091fa55
commit
ffc74391d5
@ -5,8 +5,8 @@ import (
|
||||
"path"
|
||||
"runtime"
|
||||
|
||||
version "github.com/ipfs/go-ipfs"
|
||||
cmds "github.com/ipfs/go-ipfs/commands"
|
||||
"github.com/ipfs/go-ipfs/repo"
|
||||
|
||||
manet "gx/ipfs/QmV6FjemM1K8oXjrvuq3wuVWWoU2TLDPmNnKrxHzY3v6Ai/go-multiaddr-net"
|
||||
sysi "gx/ipfs/QmZRjKbHa6DenStpQJFiaPcEwkZqrx7TH6xTf342LDU3qM/go-sysinfo"
|
||||
@ -57,8 +57,8 @@ Prints out information about your computer to aid in easier debugging.
|
||||
return
|
||||
}
|
||||
|
||||
info["ipfs_version"] = repo.CurrentVersionNumber
|
||||
info["ipfs_commit"] = repo.CurrentCommit
|
||||
info["ipfs_version"] = version.CurrentVersionNumber
|
||||
info["ipfs_commit"] = version.CurrentCommit
|
||||
res.SetOutput(info)
|
||||
},
|
||||
}
|
||||
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
version "github.com/ipfs/go-ipfs"
|
||||
cmds "github.com/ipfs/go-ipfs/commands"
|
||||
e "github.com/ipfs/go-ipfs/core/commands/e"
|
||||
repo "github.com/ipfs/go-ipfs/repo"
|
||||
fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
|
||||
|
||||
"gx/ipfs/QmdE4gMduCKCGAcczM2F5ioYDfdeKuPix138wrES1YSr7f/go-ipfs-cmdkit"
|
||||
@ -36,8 +36,8 @@ var VersionCmd = &cmds.Command{
|
||||
},
|
||||
Run: func(req cmds.Request, res cmds.Response) {
|
||||
res.SetOutput(&VersionOutput{
|
||||
Version: repo.CurrentVersionNumber,
|
||||
Commit: repo.CurrentCommit,
|
||||
Version: version.CurrentVersionNumber,
|
||||
Commit: version.CurrentCommit,
|
||||
Repo: fmt.Sprint(fsrepo.RepoVersion),
|
||||
System: runtime.GOARCH + "/" + runtime.GOOS, //TODO: Precise version here
|
||||
Golang: runtime.Version(),
|
||||
|
||||
@ -20,6 +20,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
version "github.com/ipfs/go-ipfs"
|
||||
rp "github.com/ipfs/go-ipfs/exchange/reprovide"
|
||||
filestore "github.com/ipfs/go-ipfs/filestore"
|
||||
mount "github.com/ipfs/go-ipfs/fuse/mount"
|
||||
@ -44,6 +45,8 @@ import (
|
||||
logging "gx/ipfs/QmRREK2CAZ5Re2Bd9zZFG6FeYDppUWt5cMgsoUEp3ktgSr/go-log"
|
||||
floodsub "gx/ipfs/QmRXefkwjreRT6XfYh3Ag4hsVnWBbpcUicGJPcg8TWbhBK/go-libp2p-floodsub"
|
||||
goprocess "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess"
|
||||
bitswap "gx/ipfs/QmNQQEYL3Vpj4beteqyeRpVpivuX1wBP6Q5GZMdBPPTV3S/go-bitswap"
|
||||
bsnet "gx/ipfs/QmNQQEYL3Vpj4beteqyeRpVpivuX1wBP6Q5GZMdBPPTV3S/go-bitswap/network"
|
||||
mamask "gx/ipfs/QmSMZwvs3n4GBikZ7hKzT17c3bk65FmyZo2JqtJ16swqCv/multiaddr-filter"
|
||||
mafilter "gx/ipfs/QmSW4uNHbvQia8iZDXzbwjiyHQtnyo9aFqfQAMasj3TJ6Y/go-maddr-filter"
|
||||
libp2p "gx/ipfs/QmUDzeFgYrRmHL2hUB6NZmqcBVQtUzETwmFRUc9onfSSHr/go-libp2p"
|
||||
@ -94,7 +97,7 @@ const (
|
||||
)
|
||||
|
||||
func init() {
|
||||
identify.ClientVersion = "go-ipfs/" + repo.CurrentVersionNumber + "/" + repo.CurrentCommit
|
||||
identify.ClientVersion = "go-ipfs/" + version.CurrentVersionNumber + "/" + version.CurrentCommit
|
||||
}
|
||||
|
||||
// IpfsNode is IPFS Core module. It represents an IPFS instance.
|
||||
|
||||
@ -9,10 +9,10 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
version "github.com/ipfs/go-ipfs"
|
||||
oldcmds "github.com/ipfs/go-ipfs/commands"
|
||||
core "github.com/ipfs/go-ipfs/core"
|
||||
"github.com/ipfs/go-ipfs/core"
|
||||
corecommands "github.com/ipfs/go-ipfs/core/commands"
|
||||
repo "github.com/ipfs/go-ipfs/repo"
|
||||
|
||||
path "gx/ipfs/QmPqCBrmkm7jNfYi7xFS7mUZsrN6DEumBMrxLnL7axNJx1/go-path"
|
||||
cmds "gx/ipfs/QmbWGdyATxHpmbDC2z7zMNnmPmiHCRXS5f2vyxBfgz8bVb/go-ipfs-cmds"
|
||||
@ -78,7 +78,7 @@ func addHeadersFromConfig(c *cmdsHttp.ServerConfig, nc *config.Config) {
|
||||
for h, v := range nc.API.HTTPHeaders {
|
||||
c.Headers[h] = v
|
||||
}
|
||||
c.Headers["Server"] = []string{"go-ipfs/" + repo.CurrentVersionNumber}
|
||||
c.Headers["Server"] = []string{"go-ipfs/" + version.CurrentVersionNumber}
|
||||
}
|
||||
|
||||
func addCORSDefaults(c *cmdsHttp.ServerConfig) {
|
||||
@ -153,7 +153,7 @@ func CommandsROOption(cctx oldcmds.Context) ServeOption {
|
||||
|
||||
// CheckVersionOption returns a ServeOption that checks whether the client ipfs version matches. Does nothing when the user agent string does not contain `/go-ipfs/`
|
||||
func CheckVersionOption() ServeOption {
|
||||
daemonVersion := repo.ApiVersion
|
||||
daemonVersion := version.ApiVersion
|
||||
|
||||
return ServeOption(func(n *core.IpfsNode, l net.Listener, parent *http.ServeMux) (*http.ServeMux, error) {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
@ -5,9 +5,9 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
version "github.com/ipfs/go-ipfs"
|
||||
core "github.com/ipfs/go-ipfs/core"
|
||||
coreapi "github.com/ipfs/go-ipfs/core/coreapi"
|
||||
repo "github.com/ipfs/go-ipfs/repo"
|
||||
|
||||
id "gx/ipfs/QmUDzeFgYrRmHL2hUB6NZmqcBVQtUzETwmFRUc9onfSSHr/go-libp2p/p2p/protocol/identify"
|
||||
)
|
||||
@ -41,7 +41,7 @@ func GatewayOption(writable bool, paths ...string) ServeOption {
|
||||
func VersionOption() ServeOption {
|
||||
return func(_ *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
|
||||
mux.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Commit: %s\n", repo.CurrentCommit)
|
||||
fmt.Fprintf(w, "Commit: %s\n", version.CurrentCommit)
|
||||
fmt.Fprintf(w, "Client Version: %s\n", id.ClientVersion)
|
||||
fmt.Fprintf(w, "Protocol Version: %s\n", id.LibP2PVersion)
|
||||
})
|
||||
|
||||
@ -11,6 +11,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
version "github.com/ipfs/go-ipfs"
|
||||
core "github.com/ipfs/go-ipfs/core"
|
||||
coreunix "github.com/ipfs/go-ipfs/core/coreunix"
|
||||
namesys "github.com/ipfs/go-ipfs/namesys"
|
||||
@ -545,7 +546,7 @@ func TestGoGetSupport(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestVersion(t *testing.T) {
|
||||
repo.CurrentCommit = "theshortcommithash"
|
||||
version.CurrentCommit = "theshortcommithash"
|
||||
|
||||
ns := mockNamesys{}
|
||||
ts, _ := newTestServerAndNode(t, ns)
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/ipfs/go-ipfs/repo"
|
||||
version "github.com/ipfs/go-ipfs"
|
||||
)
|
||||
|
||||
type testcasecheckversion struct {
|
||||
@ -20,7 +20,7 @@ type testcasecheckversion struct {
|
||||
|
||||
func (tc testcasecheckversion) body() string {
|
||||
if !tc.shouldHandle && tc.responseBody == "" {
|
||||
return fmt.Sprintf("%s (%s != %s)\n", errAPIVersionMismatch, repo.ApiVersion, tc.userAgent)
|
||||
return fmt.Sprintf("%s (%s != %s)\n", errAPIVersionMismatch, version.ApiVersion, tc.userAgent)
|
||||
}
|
||||
|
||||
return tc.responseBody
|
||||
@ -30,7 +30,7 @@ func TestCheckVersionOption(t *testing.T) {
|
||||
tcs := []testcasecheckversion{
|
||||
{"/go-ipfs/0.1/", APIPath + "/test/", false, "", http.StatusBadRequest},
|
||||
{"/go-ipfs/0.1/", APIPath + "/version", true, "check!", http.StatusOK},
|
||||
{repo.ApiVersion, APIPath + "/test", true, "check!", http.StatusOK},
|
||||
{version.ApiVersion, APIPath + "/test", true, "check!", http.StatusOK},
|
||||
{"Mozilla Firefox/no go-ipfs node", APIPath + "/test", true, "check!", http.StatusOK},
|
||||
{"/go-ipfs/0.1/", "/webui", true, "check!", http.StatusOK},
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ will be allowed up to release day.
|
||||
- [ ] publish gx version with `gx release`, as per [gx release guidelines](https://github.com/whyrusleeping/gx#publishing-and-releasing)
|
||||
|
||||
## Post-Release
|
||||
- [ ] bump version string in `repo/version.go` to `vX.Y.Z-dev`
|
||||
- [ ] Bump version string in `repo/version.go` to `vX.Y.Z-dev`
|
||||
- [ ] Upload the final release to the github releases page: https://github.com/ipfs/go-ipfs/releases
|
||||
- Communication
|
||||
- [ ] Create the release issue
|
||||
|
||||
@ -130,7 +130,7 @@ We need the `git` commit hash to be included in our build so that in the extreme
|
||||
|
||||
Finally, we'll build and test `ipfs` itself.
|
||||
```
|
||||
go install -ldflags="-X "github.com/ipfs/go-ipfs/repo".CurrentCommit=%SHA%"
|
||||
go install -ldflags="-X "github.com/ipfs/go-ipfs".CurrentCommit=%SHA%"
|
||||
%GOPATH%\bin\ipfs.exe version --all
|
||||
```
|
||||
You can check that the ipfs output versions match with `go version` and `git rev-parse --short HEAD`.
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package repo
|
||||
package ipfs
|
||||
|
||||
// CurrentCommit is the current git commit, this is set as a ldflag in the Makefile
|
||||
var CurrentCommit string
|
||||
|
||||
// CurrentVersionNumber is the current application's version literal
|
||||
const CurrentVersionNumber = "0.4.17-dev"
|
||||
const CurrentVersionNumber = "0.4.18-dev"
|
||||
|
||||
const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/"
|
||||
Loading…
Reference in New Issue
Block a user