diff options
author | Richard Purdie <richard@openedhand.com> | 2008-08-18 07:56:04 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-08-18 07:56:04 +0000 |
commit | 5ca566349c46362be64fc6a88ed88ad3ad601069 (patch) | |
tree | 4377347a371d7dd47bcb2940657d838f1f9b6ee9 /bitbake/lib/bb | |
parent | 77c01014e02e3e0a9879673352010c67cba206ea (diff) | |
download | openembedded-core-5ca566349c46362be64fc6a88ed88ad3ad601069.tar.gz openembedded-core-5ca566349c46362be64fc6a88ed88ad3ad601069.tar.bz2 openembedded-core-5ca566349c46362be64fc6a88ed88ad3ad601069.tar.xz openembedded-core-5ca566349c46362be64fc6a88ed88ad3ad601069.zip |
bitbake/utils.py: Add prunedir function to utils collection
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5065 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/fetch/git.py | 13 | ||||
-rw-r--r-- | bitbake/lib/bb/utils.py | 10 |
2 files changed, 12 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py index f4ae724f8..aa26a500c 100644 --- a/bitbake/lib/bb/fetch/git.py +++ b/bitbake/lib/bb/fetch/git.py @@ -27,15 +27,6 @@ from bb.fetch import Fetch from bb.fetch import FetchError from bb.fetch import runfetchcmd -def prunedir(topdir): - # Delete everything reachable from the directory named in 'topdir'. - # CAUTION: This is dangerous! - for root, dirs, files in os.walk(topdir, topdown=False): - for name in files: - os.remove(os.path.join(root, name)) - for name in dirs: - os.rmdir(os.path.join(root, name)) - class Git(Fetch): """Class to fetch a module or modules from git repositories""" def supports(self, url, ud, d): @@ -107,7 +98,7 @@ class Git(Fetch): runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d) if os.path.exists(codir): - prunedir(codir) + bb.utils.prunedir(codir) bb.mkdirhier(codir) os.chdir(repodir) @@ -119,7 +110,7 @@ class Git(Fetch): runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d) os.chdir(repodir) - prunedir(codir) + bb.utils.prunedir(codir) def suppports_srcrev(self): return True diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 19327b715..ec46021b5 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -268,3 +268,13 @@ def sha256_file(filename): for line in open(filename): s.update(line) return s.hexdigest() + +def prunedir(topdir): + # Delete everything reachable from the directory named in 'topdir'. + # CAUTION: This is dangerous! + for root, dirs, files in os.walk(topdir, topdown=False): + for name in files: + os.remove(os.path.join(root, name)) + for name in dirs: + os.rmdir(os.path.join(root, name)) + os.rmdir(topdir) |