diff --git a/base/cli/mirrors.go b/base/cli/mirrors.go index 3f8fa57e..9f454579 100644 --- a/base/cli/mirrors.go +++ b/base/cli/mirrors.go @@ -42,18 +42,18 @@ func init() { var _release = "" func release(m *ice.Message) string { - osid := runtime.GOOS - if osid != LINUX || !nfs.Exists(m, "/etc/os-release") { - return osid + list := []string{runtime.GOOS} + if list[0] != LINUX || !nfs.Exists(m, "/etc/os-release") { + return list[0] } m.Option(nfs.CAT_CONTENT, _release) _release = m.Cmdx(nfs.CAT, "/etc/os-release", kit.Dict(ice.MSG_USERROLE, aaa.ROOT), func(text string, _ int) string { if ls := kit.Split(text, mdb.EQ); len(ls) > 1 { - kit.Switch(ls[0], []string{"ID", "ID_LIKE"}, func() { osid = strings.TrimSpace(ls[1] + lex.SP + osid) }) + kit.Switch(ls[0], []string{"ID", "ID_LIKE"}, func() { list = append(list, strings.TrimSpace(ls[1])) }) } return text }) - return osid + return strings.Join(list, lex.SP) } func insert(m *ice.Message, sys, cmd string, arg ...string) bool { if !strings.Contains(release(m), sys) { diff --git a/base/cli/runtime.go b/base/cli/runtime.go index 156d6c0f..5a874a24 100644 --- a/base/cli/runtime.go +++ b/base/cli/runtime.go @@ -42,6 +42,7 @@ func _runtime_init(m *ice.Message) { ice.Info.Hostname = m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME)) ice.Info.Pathname = m.Conf(RUNTIME, kit.Keys(BOOT, PATHNAME)) ice.Info.Username = m.Conf(RUNTIME, kit.Keys(BOOT, USERNAME)) + ice.Info.System = m.Conf(RUNTIME, kit.Keys(HOST, OSID)) aaa.UserRoot(ice.Pulse, "", ice.Info.Username, aaa.ROOT, ice.OPS) aaa.UserRoot(ice.Pulse, "", ice.Info.Make.Username, aaa.TECH, ice.DEV) if runtime.GOARCH != MIPSLE { diff --git a/base/ctx/config.go b/base/ctx/config.go index eedd095a..83e42a4b 100644 --- a/base/ctx/config.go +++ b/base/ctx/config.go @@ -150,6 +150,9 @@ func _config_make(m *ice.Message, key string, arg ...string) { msg := m.Spawn(m.Source()) if len(arg) > 1 { kit.If(strings.HasPrefix(arg[1], mdb.AT), func() { arg[1] = msg.Cmdx(nfs.CAT, arg[1][1:]) }) + if !kit.IsIn(strings.Split(arg[0], nfs.PT)[0], mdb.META, mdb.HASH, mdb.LIST) { + arg[0] = kit.Keys(mdb.META, arg[0]) + } mdb.Confv(msg, key, arg[0], kit.Parse(nil, "", arg[1:]...)) } if len(arg) > 0 { diff --git a/core/code/autogen.go b/core/code/autogen.go index 71ce736a..71a85823 100644 --- a/core/code/autogen.go +++ b/core/code/autogen.go @@ -63,7 +63,7 @@ func _autogen_version(m *ice.Message) string { } m.Cmd(nfs.DEFS, ".gitignore", nfs.Template(m, "gitignore")) m.Cmd(nfs.DEFS, ice.SRC_BINPACK_GO, nfs.Template(m, ice.SRC_BINPACK_GO)) - m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(nfs.Template(m, ice.SRC_VERSION_GO), _autogen_gits(m, nfs.MODULE, _autogen_mod(m, ice.GO_MOD), tcp.HOSTNAME, ice.Info.Hostname))) + m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(nfs.Template(m, ice.SRC_VERSION_GO), _autogen_gits(m))) m.Cmd(cli.SYSTEM, "gofmt", "-w", ice.SRC_VERSION_GO) m.Cmdy(nfs.DIR, ice.SRC_BINPACK_GO) m.Cmdy(nfs.DIR, ice.SRC_VERSION_GO) @@ -79,11 +79,12 @@ func _autogen_gits(m *ice.Message, arg ...string) string { } func _autogen_git(m *ice.Message, arg ...string) ice.Map { msg := m.Cmd("web.code.git.repos", "remote") - return kit.Dict(arg, - mdb.TIME, m.Time(), nfs.PATH, kit.Path("")+nfs.PS, web.DOMAIN, tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB)), - mdb.HASH, msg.Append(mdb.HASH), nfs.REMOTE, msg.Append(nfs.REMOTE), nfs.BRANCH, msg.Append(nfs.BRANCH), nfs.VERSION, msg.Append(nfs.VERSION), - aaa.EMAIL, msg.Append(aaa.EMAIL), aaa.USERNAME, msg.Append(aaa.USERNAME), - msg.AppendSimple("when,message,forword"), + return kit.Dict(arg, aaa.USERNAME, ice.Info.Username, tcp.HOSTNAME, ice.Info.Hostname, nfs.PATH, kit.Path("")+nfs.PS, mdb.TIME, m.Time(), + GIT, m.Cmdx(cli.SYSTEM, GIT, VERSION), GO, m.Cmdx(cli.SYSTEM, GO, VERSION), + msg.AppendSimple("remote,branch,version,forword,author,email,hash,when,message"), + web.DOMAIN, tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB)), + nfs.MODULE, _autogen_mod(m, ice.GO_MOD), + cli.SYSTEM, ice.Info.System, ) } func _autogen_mod(m *ice.Message, file string) (mod string) { @@ -100,12 +101,12 @@ func _autogen_mod(m *ice.Message, file string) (mod string) { return } +const ( + VERSION = "version" +) const AUTOGEN = "autogen" func init() { - const ( - VERSION = "version" - ) Index.MergeCommands(ice.Commands{ AUTOGEN: {Name: "autogen path auto script module version", Help: "生成", Actions: ice.Actions{ mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { diff --git a/info.go b/info.go index 2ab910a5..38bdec85 100644 --- a/info.go +++ b/info.go @@ -10,31 +10,38 @@ import ( ) type MakeInfo struct { - Hash string - Time string - Path string - Module string - Domain string - Remote string - Branch string - Version string - Hostname string Username string - Email string - When string - Message string - Forword string + Hostname string + Path string + Time string + Git string + Go string + + Remote string + Branch string + Version string + Forword string + Author string + Email string + Hash string + When string + Message string + + Domain string + Module string + System string } var Info = struct { Make MakeInfo + Username string Hostname string Pathname string - Username string PidPath string Colors bool + System string Domain string NodeType string NodeName string diff --git a/misc/git/repos.go b/misc/git/repos.go index 93568e30..ff3387ab 100644 --- a/misc/git/repos.go +++ b/misc/git/repos.go @@ -555,20 +555,18 @@ func init() { if _remote, err := repos.Remote(ORIGIN); err == nil { m.Push(REMOTE, kit.Select("", _remote.Config().URLs, 0)) } - version := "" if refer := _repos_recent(m, repos); refer != nil { m.Push(nfs.VERSION, refer.Name().Short()) - version = refer.Hash().String() + m.Push("forword", _repos_forword(m, repos, refer.Hash().String())) } if refer, err := repos.Head(); err == nil { m.Push(BRANCH, refer.Name().Short()) m.Push(mdb.HASH, refer.Hash().String()) if commit, err := repos.CommitObject(refer.Hash()); err == nil { - m.Push(aaa.USERNAME, commit.Author.Name) m.Push(aaa.EMAIL, commit.Author.Email) + m.Push("author", commit.Author.Name) m.Push("when", commit.Author.When) m.Push("message", commit.Message) - m.Push("forword", _repos_forword(m, repos, version)) } } }}, diff --git a/misc/git/service.go b/misc/git/service.go index 63e413e0..63cefd5d 100644 --- a/misc/git/service.go +++ b/misc/git/service.go @@ -54,7 +54,10 @@ func _service_param(m *ice.Message, arg ...string) (string, string) { repos, service := arg[0], kit.Select(arg[len(arg)-1], m.Option(SERVICE)) return _service_path(m, repos), strings.TrimPrefix(service, "git-") } -func _service_repos2(m *ice.Message, arg ...string) error { +func _service_repos(m *ice.Message, arg ...string) error { + if mdb.Conf(m, "web.code.git.service", "meta.cmd") == "git" { + return _service_repos0(m, arg...) + } repos, service := _service_param(m, arg...) m.Logs(m.R.Method, service, repos) info := false @@ -81,9 +84,7 @@ func _service_repos2(m *ice.Message, arg ...string) error { return ServeUploadPack(info, stream, repos) } } -func _service_repos(m *ice.Message, arg ...string) error { - return _service_repos2(m, arg...) - +func _service_repos0(m *ice.Message, arg ...string) error { repos, service := _service_param(m, arg...) m.Logs(m.R.Method, service, repos) if m.Option(cli.CMD_DIR, repos); strings.HasSuffix(path.Join(arg...), INFO_REFS) { @@ -191,6 +192,9 @@ func init() { mdb.HashSelect(m, arg...).Table(func(value ice.Maps) { m.PushScript(kit.Format("git clone %s", tcp.PublishLocalhost(m, kit.Split(web.MergeURL2(m, "/x/"+value[REPOS]+".git"), mdb.QS)[0]))) }).Sort(REPOS).Echo(strings.ReplaceAll(m.Cmdx("web.code.publish", ice.CONTEXTS), "app username", "dev username")) + m.Table(func(value ice.Maps) { + m.Push(nfs.SIZE, kit.Split(m.Cmdx(cli.SYSTEM, "du", "-sh", path.Join(ice.USR_LOCAL_REPOS, value[REPOS])))[0]) + }) } else if len(arg) == 1 { _repos_branch(m, _repos_open(m, arg[0])) m.EchoScript(tcp.PublishLocalhost(m, kit.Split(web.MergeURL2(m, "/x/"+arg[0]), mdb.QS)[0]))