From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: AKhatskevich <avkhatskevich@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH 4/4] Introduce storage reload evolution Date: Mon, 30 Jul 2018 14:55:28 +0300 [thread overview] Message-ID: <3d8a81f7-33a6-bf1d-809f-ae5b95730a64@tarantool.org> (raw) In-Reply-To: <1e067dd68d69270ccf5aea2ab73548ebd9a0f2ad.1532940401.git.avkhatskevich@tarantool.org> Thanks for the patch! See 3 comments below. > diff --git a/test/lua_libs/git_util.lua b/test/lua_libs/git_util.lua > new file mode 100644 > index 0000000..a75bb08 > --- /dev/null > +++ b/test/lua_libs/git_util.lua > @@ -0,0 +1,51 @@ > +-- > +-- Lua bridge for some of the git commands. > +-- > +local os = require('os') > + > +local temp_file = 'some_strange_rare_unique_file_name_for_git_util' 1. C library has a ready solution: tmpfile() and tmpnam() functions that have Lua API: io.tmpfile() to open a tmp file and automatically delete it on close, and os.tmpname that generates really unique tmp file name. Please, use. > + > +-- > +-- Exec a git command. > +-- @param params Table of parameters: > +-- * options - git options. > +-- * cmd - git command. > +-- * args - command arguments. > +-- * dir - working directory. > +-- * fout - write output to the file. > +local function exec_cmd(params) > + local fout = params.fout > + local shell_cmd = {'git'} > + for _, param in pairs({'options', 'cmd', 'args'}) do > + table.insert(shell_cmd, params[param]) > + end > + if fout then > + table.insert(shell_cmd, ' >' .. fout) > + end > + shell_cmd = table.concat(shell_cmd, ' ') > + if params.dir then > + shell_cmd = string.format('cd %s && %s', params.dir, shell_cmd) > + end > + local res = os.execute(shell_cmd) > + assert(res == 0, 'Git cmd error: ' .. res) > +end > + > +local function log_hashes(params) > + params.args = "--format='%h' " .. params.args > + local local_temp_file = string.format('%s/%s', os.getenv('PWD'), temp_file) > + params.fout = local_temp_file > + params.cmd = 'log' > + exec_cmd(params) > + local lines = {} > + for line in io.lines(local_temp_file) do > + table.insert(lines, line) > + end > + os.remove(local_temp_file) > + return lines > +end > + > + 2. Too many empty lines. > +return { > + exec_cmd = exec_cmd, > + log_hashes = log_hashes > +} 3. What about router evolution?
next prev parent reply other threads:[~2018-07-30 11:55 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-30 8:56 [tarantool-patches] [PATCH v4] vshard module reload AKhatskevich 2018-07-30 8:56 ` [tarantool-patches] [PATCH 1/4] Fix races related to object outdating AKhatskevich 2018-07-30 11:55 ` [tarantool-patches] " Vladislav Shpilevoy 2018-07-30 16:46 ` Alex Khatskevich 2018-07-30 17:50 ` Vladislav Shpilevoy 2018-07-31 11:05 ` Alex Khatskevich 2018-08-01 12:36 ` Vladislav Shpilevoy 2018-08-01 17:44 ` Alex Khatskevich 2018-08-02 11:51 ` Vladislav Shpilevoy 2018-07-30 8:56 ` [tarantool-patches] [PATCH 2/4] Refactor reloadable fiber AKhatskevich 2018-07-30 11:55 ` [tarantool-patches] " Vladislav Shpilevoy 2018-07-31 11:24 ` Alex Khatskevich 2018-07-31 11:30 ` Alex Khatskevich 2018-08-01 11:54 ` Vladislav Shpilevoy 2018-07-30 8:56 ` [tarantool-patches] [PATCH 3/4] tests: separate bootstrap routine to a lua_libs AKhatskevich 2018-08-01 12:03 ` [tarantool-patches] " Vladislav Shpilevoy 2018-07-30 8:56 ` [tarantool-patches] [PATCH 4/4] Introduce storage reload evolution AKhatskevich 2018-07-30 11:55 ` Vladislav Shpilevoy [this message] 2018-07-31 11:29 ` [tarantool-patches] " Alex Khatskevich 2018-07-31 11:33 ` Alex Khatskevich 2018-08-01 12:36 ` Vladislav Shpilevoy 2018-08-01 18:09 ` Alex Khatskevich 2018-08-02 11:40 ` Vladislav Shpilevoy 2018-08-02 11:46 ` Vladislav Shpilevoy 2018-08-06 10:59 ` Alex Khatskevich 2018-08-06 15:36 ` Vladislav Shpilevoy 2018-08-06 16:08 ` Alex Khatskevich 2018-08-06 17:18 ` Vladislav Shpilevoy 2018-08-07 9:14 ` Alex Khatskevich 2018-08-08 10:35 ` Vladislav Shpilevoy 2018-08-01 14:07 ` [tarantool-patches] [PATCH] Check self arg passed for router objects AKhatskevich -- strict thread matches above, loose matches on Subject: below -- 2018-07-23 11:14 [tarantool-patches] [PATCH v2] vshard reload mechanism AKhatskevich 2018-07-23 11:14 ` [tarantool-patches] [PATCH 4/4] Introduce storage reload evolution AKhatskevich 2018-07-23 14:44 ` [tarantool-patches] " Vladislav Shpilevoy 2018-07-23 20:10 ` Alex Khatskevich
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=3d8a81f7-33a6-bf1d-809f-ae5b95730a64@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=avkhatskevich@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH 4/4] Introduce storage reload evolution' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox