summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-08-18 07:56:04 +0000
committerRichard Purdie <richard@openedhand.com>2008-08-18 07:56:04 +0000
commit5ca566349c46362be64fc6a88ed88ad3ad601069 (patch)
tree4377347a371d7dd47bcb2940657d838f1f9b6ee9
parent77c01014e02e3e0a9879673352010c67cba206ea (diff)
downloadpoky-5ca566349c46362be64fc6a88ed88ad3ad601069.tar.gz
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
-rw-r--r--bitbake/lib/bb/fetch/git.py13
-rw-r--r--bitbake/lib/bb/utils.py10
2 files changed, 12 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index f4ae724f87..aa26a500c7 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -27,15 +27,6 @@ from bb.fetch import Fetch
27from bb.fetch import FetchError 27from bb.fetch import FetchError
28from bb.fetch import runfetchcmd 28from bb.fetch import runfetchcmd
29 29
30def prunedir(topdir):
31 # Delete everything reachable from the directory named in 'topdir'.
32 # CAUTION: This is dangerous!
33 for root, dirs, files in os.walk(topdir, topdown=False):
34 for name in files:
35 os.remove(os.path.join(root, name))
36 for name in dirs:
37 os.rmdir(os.path.join(root, name))
38
39class Git(Fetch): 30class Git(Fetch):
40 """Class to fetch a module or modules from git repositories""" 31 """Class to fetch a module or modules from git repositories"""
41 def supports(self, url, ud, d): 32 def supports(self, url, ud, d):
@@ -107,7 +98,7 @@ class Git(Fetch):
107 runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d) 98 runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d)
108 99
109 if os.path.exists(codir): 100 if os.path.exists(codir):
110 prunedir(codir) 101 bb.utils.prunedir(codir)
111 102
112 bb.mkdirhier(codir) 103 bb.mkdirhier(codir)
113 os.chdir(repodir) 104 os.chdir(repodir)
@@ -119,7 +110,7 @@ class Git(Fetch):
119 runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d) 110 runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
120 111
121 os.chdir(repodir) 112 os.chdir(repodir)
122 prunedir(codir) 113 bb.utils.prunedir(codir)
123 114
124 def suppports_srcrev(self): 115 def suppports_srcrev(self):
125 return True 116 return True
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 19327b7157..ec46021b55 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -268,3 +268,13 @@ def sha256_file(filename):
268 for line in open(filename): 268 for line in open(filename):
269 s.update(line) 269 s.update(line)
270 return s.hexdigest() 270 return s.hexdigest()
271
272def prunedir(topdir):
273 # Delete everything reachable from the directory named in 'topdir'.
274 # CAUTION: This is dangerous!
275 for root, dirs, files in os.walk(topdir, topdown=False):
276 for name in files:
277 os.remove(os.path.join(root, name))
278 for name in dirs:
279 os.rmdir(os.path.join(root, name))
280 os.rmdir(topdir)