diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-08-21 15:57:00 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-30 12:35:49 +0100 |
commit | 69c63728dae38d5b1cc9874268f235a07e04d3db (patch) | |
tree | f83123af7984ff9edb2bca3d023c15ae217e83b7 /scripts/lib/devtool | |
parent | 491e86aafe326ef0357e94e95c608141d4a92637 (diff) | |
download | poky-69c63728dae38d5b1cc9874268f235a07e04d3db.tar.gz |
devtool: make add_md5 a public API
Moved _add_md5 function from standard.py to __init__.py to
be able to call it from other modules.
(From OE-Core rev: ee38bb20dc7ba21dac782d8d13383f81dfedef55)
(From OE-Core rev: b07da7d38bcefe8efdd6b22bb9251bef599ef040)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool')
-rw-r--r-- | scripts/lib/devtool/__init__.py | 6 | ||||
-rw-r--r-- | scripts/lib/devtool/standard.py | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index b54ddf5ff4..1747fff486 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py | |||
@@ -110,3 +110,9 @@ def setup_tinfoil(config_only=False): | |||
110 | tinfoil.logger.setLevel(logger.getEffectiveLevel()) | 110 | tinfoil.logger.setLevel(logger.getEffectiveLevel()) |
111 | return tinfoil | 111 | return tinfoil |
112 | 112 | ||
113 | def add_md5(config, recipename, filename): | ||
114 | """Record checksum of a recipe to the md5-file of the workspace""" | ||
115 | import bb.utils | ||
116 | md5 = bb.utils.md5_file(filename) | ||
117 | with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f: | ||
118 | f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5)) | ||
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index e1c5584a83..4aa6ebd072 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -26,6 +26,7 @@ import argparse | |||
26 | import scriptutils | 26 | import scriptutils |
27 | import errno | 27 | import errno |
28 | from devtool import exec_build_env_command, setup_tinfoil, DevtoolError | 28 | from devtool import exec_build_env_command, setup_tinfoil, DevtoolError |
29 | from devtool import add_md5 | ||
29 | 30 | ||
30 | logger = logging.getLogger('devtool') | 31 | logger = logging.getLogger('devtool') |
31 | 32 | ||
@@ -104,7 +105,7 @@ def add(args, config, basepath, workspace): | |||
104 | except bb.process.ExecutionError as e: | 105 | except bb.process.ExecutionError as e: |
105 | raise DevtoolError('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) | 106 | raise DevtoolError('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) |
106 | 107 | ||
107 | _add_md5(config, args.recipename, recipefile) | 108 | add_md5(config, args.recipename, recipefile) |
108 | 109 | ||
109 | initial_rev = None | 110 | initial_rev = None |
110 | if os.path.exists(os.path.join(srctree, '.git')): | 111 | if os.path.exists(os.path.join(srctree, '.git')): |
@@ -120,7 +121,7 @@ def add(args, config, basepath, workspace): | |||
120 | if initial_rev: | 121 | if initial_rev: |
121 | f.write('\n# initial_rev: %s\n' % initial_rev) | 122 | f.write('\n# initial_rev: %s\n' % initial_rev) |
122 | 123 | ||
123 | _add_md5(config, args.recipename, appendfile) | 124 | add_md5(config, args.recipename, appendfile) |
124 | 125 | ||
125 | return 0 | 126 | return 0 |
126 | 127 | ||
@@ -371,13 +372,6 @@ def _extract_source(srctree, keep_temp, devbranch, d): | |||
371 | shutil.rmtree(tempdir) | 372 | shutil.rmtree(tempdir) |
372 | return initial_rev | 373 | return initial_rev |
373 | 374 | ||
374 | def _add_md5(config, recipename, filename): | ||
375 | """Record checksum of a recipe to the md5-file of the workspace""" | ||
376 | import bb.utils | ||
377 | md5 = bb.utils.md5_file(filename) | ||
378 | with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f: | ||
379 | f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5)) | ||
380 | |||
381 | def _check_preserve(config, recipename): | 375 | def _check_preserve(config, recipename): |
382 | """Check if a recipe was manually changed and needs to be saved in 'attic' | 376 | """Check if a recipe was manually changed and needs to be saved in 'attic' |
383 | directory""" | 377 | directory""" |
@@ -505,7 +499,7 @@ def modify(args, config, basepath, workspace): | |||
505 | for commit in commits: | 499 | for commit in commits: |
506 | f.write('# commit: %s\n' % commit) | 500 | f.write('# commit: %s\n' % commit) |
507 | 501 | ||
508 | _add_md5(config, args.recipename, appendfile) | 502 | add_md5(config, args.recipename, appendfile) |
509 | 503 | ||
510 | logger.info('Recipe %s now set up to build from %s' % (args.recipename, srctree)) | 504 | logger.info('Recipe %s now set up to build from %s' % (args.recipename, srctree)) |
511 | 505 | ||