OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Provides convenience routines to access the GBB on the current BIOS. | 6 """Provides convenience routines to access the GBB on the current BIOS. |
7 | 7 |
8 GBBUtility is a wrapper of gbb_utility program. | 8 GBBUtility is a wrapper of gbb_utility program. |
9 """ | 9 """ |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 It accesses the GBB on the current BIOS image. | 22 It accesses the GBB on the current BIOS image. |
23 """ | 23 """ |
24 def __init__(self, | 24 def __init__(self, |
25 gbb_command='gbb_utility', | 25 gbb_command='gbb_utility', |
26 temp_dir=None, | 26 temp_dir=None, |
27 keep_temp_files=False): | 27 keep_temp_files=False): |
28 self._gbb_command = gbb_command | 28 self._gbb_command = gbb_command |
29 self._temp_dir = temp_dir | 29 self._temp_dir = temp_dir |
30 self._keep_temp_files = keep_temp_files | 30 self._keep_temp_files = keep_temp_files |
31 self._need_commit = False | 31 self._need_commit = False |
| 32 self._gbb_file = None |
32 self._clear_cached() | 33 self._clear_cached() |
33 | 34 |
34 | 35 |
35 def __del__(self): | 36 def __del__(self): |
36 if self._gbb_file: | 37 if self._gbb_file: |
37 self._remove_temp_file(self._gbb_file) | 38 self._remove_temp_file(self._gbb_file) |
38 if self._need_commit: | 39 if self._need_commit: |
39 raise error.TestError( | 40 raise error.TestError( |
40 'You changed somethings; should commit or discard them.') | 41 'You changed somethings; should commit or discard them.') |
41 | 42 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 self._remove_temp_file(rootkey_file) | 184 self._remove_temp_file(rootkey_file) |
184 self._need_commit = False | 185 self._need_commit = False |
185 self._clear_cached() | 186 self._clear_cached() |
186 | 187 |
187 | 188 |
188 def discard(self): | 189 def discard(self): |
189 """Discard all uncommitted changes.""" | 190 """Discard all uncommitted changes.""" |
190 if self._need_commit: | 191 if self._need_commit: |
191 self._need_commit = False | 192 self._need_commit = False |
192 self._clear_cached() | 193 self._clear_cached() |
OLD | NEW |