diff options
Diffstat (limited to 'bitbake')
-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 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 | |||
27 | from bb.fetch import FetchError | 27 | from bb.fetch import FetchError |
28 | from bb.fetch import runfetchcmd | 28 | from bb.fetch import runfetchcmd |
29 | 29 | ||
30 | def 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 | |||
39 | class Git(Fetch): | 30 | class 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 | |||
272 | def 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) | ||