diff options
| author | Sergey Lapin <slapin@ossfans.org> | 2009-09-04 13:27:50 +0400 |
|---|---|---|
| committer | Sergey Lapin <slapin@ossfans.org> | 2009-09-04 13:27:50 +0400 |
| commit | 43653cf44fc541bd55cb094392444a7faa7bb3be (patch) | |
| tree | e7e3e129d04e8bed53c2ced0e3f9fbd7ceec099a /classes/package.bbclass | |
| parent | 5d87cec7a3e962afb7cfa621d172abc3effc085d (diff) | |
| parent | c26fc5db90702b035bd545cff3ee7575a0f9b70f (diff) | |
Merge branch 'org.openembedded.dev' of git@git.openembedded.net:openembedded into org.openembedded.dev
Diffstat (limited to 'classes/package.bbclass')
| -rw-r--r-- | classes/package.bbclass | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/classes/package.bbclass b/classes/package.bbclass index f6bd7c5b4a..5a9fa503ae 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -202,6 +202,51 @@ def runstrip(file, d): return 1 +def write_package_md5sums (root, outfile, ignorepaths): + # For each regular file under root, writes an md5sum to outfile. + # With thanks to patch.bbclass. + import bb, os + + try: + # Python 2.5+ + import hashlib + ctor = hashlib.md5 + except ImportError: + import md5 + ctor = md5.new + + outf = file(outfile, 'w') + + # Each output line looks like: "<hex...> <filename without leading slash>" + striplen = len(root) + if not root.endswith('/'): + striplen += 1 + + for walkroot, dirs, files in os.walk(root): + # Skip e.g. the DEBIAN directory + if walkroot[striplen:] in ignorepaths: + dirs[:] = [] + continue + + for name in files: + fullpath = os.path.join(walkroot, name) + if os.path.islink(fullpath) or (not os.path.isfile(fullpath)): + continue + + m = ctor() + f = file(fullpath, 'rb') + while True: + d = f.read(8192) + if not d: + break + m.update(d) + f.close() + + print >> outf, "%s %s" % (m.hexdigest(), fullpath[striplen:]) + + outf.close() + + # # Package data handling routines # |
