[U-Boot] [PATCH 3/5] tools: moveconfig: simplify source tree switching
Joe Hershberger
joe.hershberger at gmail.com
Tue Jun 21 18:25:57 CEST 2016
On Mon, Jun 20, 2016 at 8:53 PM, Masahiro Yamada
<yamada.masahiro at socionext.com> wrote:
> 2016-06-21 6:33 GMT+09:00 Joe Hershberger <joe.hershberger at gmail.com>:
>> On Wed, Jun 15, 2016 at 12:33 AM, Masahiro Yamada
>> <yamada.masahiro at socionext.com> wrote:
>>> The subprocess.Popen() does not change the child process's working
>>> directory if cwd=None is given. Let's exploit this fact to refactor
>>> the source directory handling.
>>>
>>> We no longer have to pass "-C <reference_src_dir>" to the sub-process
>>> because self.current_src_dir tracks the source tree against which we
>>> want to run defconfig/autoconf.
>>>
>>> The flag self.use_git_ref is not necessary either because we can know
>>> the current state by checking whether the self.current_src_dir is a
>>> valid string or None.
>>>
>>> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
>>> ---
>>>
>>> tools/moveconfig.py | 22 +++++++++-------------
>>> 1 file changed, 9 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/tools/moveconfig.py b/tools/moveconfig.py
>>> index f4e2580..0e03751 100755
>>> --- a/tools/moveconfig.py
>>> +++ b/tools/moveconfig.py
>>> @@ -645,7 +645,7 @@ class Slot:
>>>
>>> self.defconfig = defconfig
>>> self.log = ''
>>> - self.use_git_ref = True if self.options.git_ref else False
>>> + self.current_src_dir = self.reference_src_dir
>>> self.do_defconfig()
>>> return True
>>>
>>> @@ -674,13 +674,13 @@ class Slot:
>>> if self.ps.poll() != 0:
>>> self.handle_error()
>>> elif self.state == STATE_DEFCONFIG:
>>> - if self.options.git_ref and not self.use_git_ref:
>>> + if self.reference_src_dir and not self.current_src_dir:
>>> self.do_savedefconfig()
>>> else:
>>> self.do_autoconf()
>>> elif self.state == STATE_AUTOCONF:
>>> - if self.use_git_ref:
>>> - self.use_git_ref = False
>>> + if self.current_src_dir:
>>> + self.current_src_dir = None
>>
>> This seems less clear to read. There is no current source dir? I think
>> you need a different name.
>
>
> Maybe, self.subprocess_dir or something?
How about something like self.alternate_src_dir?
-Joe
More information about the U-Boot
mailing list