summaryrefslogtreecommitdiff
path: root/scripts/lib/devtool
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-08-21 15:57:00 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-30 12:34:08 +0100
commitb07da7d38bcefe8efdd6b22bb9251bef599ef040 (patch)
tree7460632378042a459482b5a5d918ef0149530f61 /scripts/lib/devtool
parent92e4198575c84f932183e3b1a59c62cfc5f59b38 (diff)
downloadopenembedded-core-b07da7d38bcefe8efdd6b22bb9251bef599ef040.tar.gz
openembedded-core-b07da7d38bcefe8efdd6b22bb9251bef599ef040.tar.bz2
openembedded-core-b07da7d38bcefe8efdd6b22bb9251bef599ef040.zip
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) 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__.py6
-rw-r--r--scripts/lib/devtool/standard.py14
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):
tinfoil.logger.setLevel(logger.getEffectiveLevel())
return tinfoil
+def add_md5(config, recipename, filename):
+ """Record checksum of a recipe to the md5-file of the workspace"""
+ import bb.utils
+ md5 = bb.utils.md5_file(filename)
+ with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f:
+ 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
import scriptutils
import errno
from devtool import exec_build_env_command, setup_tinfoil, DevtoolError
+from devtool import add_md5
logger = logging.getLogger('devtool')
@@ -104,7 +105,7 @@ def add(args, config, basepath, workspace):
except bb.process.ExecutionError as e:
raise DevtoolError('Command \'%s\' failed:\n%s' % (e.command, e.stdout))
- _add_md5(config, args.recipename, recipefile)
+ add_md5(config, args.recipename, recipefile)
initial_rev = None
if os.path.exists(os.path.join(srctree, '.git')):
@@ -120,7 +121,7 @@ def add(args, config, basepath, workspace):
if initial_rev:
f.write('\n# initial_rev: %s\n' % initial_rev)
- _add_md5(config, args.recipename, appendfile)
+ add_md5(config, args.recipename, appendfile)
return 0
@@ -371,13 +372,6 @@ def _extract_source(srctree, keep_temp, devbranch, d):
shutil.rmtree(tempdir)
return initial_rev
-def _add_md5(config, recipename, filename):
- """Record checksum of a recipe to the md5-file of the workspace"""
- import bb.utils
- md5 = bb.utils.md5_file(filename)
- with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f:
- f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5))
-
def _check_preserve(config, recipename):
"""Check if a recipe was manually changed and needs to be saved in 'attic'
directory"""
@@ -505,7 +499,7 @@ def modify(args, config, basepath, workspace):
for commit in commits:
f.write('# commit: %s\n' % commit)
- _add_md5(config, args.recipename, appendfile)
+ add_md5(config, args.recipename, appendfile)
logger.info('Recipe %s now set up to build from %s' % (args.recipename, srctree))