aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--lib/bb/fetch/git.py13
-rw-r--r--lib/bb/utils.py37
3 files changed, 40 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 2ad0f713f..fc77cbf31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -143,6 +143,7 @@ Changes in Bitbake 1.9.x:
- Revert the '-' character fix in class names since it breaks things
- When a regexp fails to compile for PACKAGES_DYNAMIC, print a more useful error (#4444)
- Allow to checkout CVS by Date and Time. Just add HHmm to the SRCDATE.
+ - Move prunedir function to utils.py and add explode_dep_versions function
Changes in Bitbake 1.8.0:
- Release 1.7.x as a stable series
diff --git a/lib/bb/fetch/git.py b/lib/bb/fetch/git.py
index f4ae724f8..aa26a500c 100644
--- a/lib/bb/fetch/git.py
+++ b/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/lib/bb/utils.py b/lib/bb/utils.py
index 17e22e389..0a0c9ada3 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -96,7 +96,34 @@ def explode_deps(s):
#r[-1] += ' ' + ' '.join(j)
return r
+def explode_dep_versions(s):
+ """
+ Take an RDEPENDS style string of format:
+ "DEPEND1 (optional version) DEPEND2 (optional version) ..."
+ and return a dictonary of dependencies and versions.
+ """
+ r = {}
+ l = s.split()
+ lastdep = None
+ lastver = ""
+ inversion = False
+ for i in l:
+ if i[0] == '(':
+ inversion = True
+ lastver = i[1:] or ""
+ #j = []
+ elif inversion and i.endswith(')'):
+ inversion = False
+ lastver = lastver + " " + (i[:-1] or "")
+ r[lastdep] = lastver
+ elif not inversion:
+ r[i] = None
+ lastdep = i
+ lastver = ""
+ elif inversion:
+ lastver = lastver + " " + i
+ return r
def _print_trace(body, line):
"""
@@ -268,3 +295,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)