diff options
author | Joshua Lock <josh@openedhand.com> | 2008-09-30 16:54:37 +0000 |
---|---|---|
committer | Joshua Lock <josh@openedhand.com> | 2008-09-30 16:54:37 +0000 |
commit | cbaab65ff4bb3e4fc77066032a8858f4d5d61241 (patch) | |
tree | 393dcbb8a980e4d8c0c9d9db4eb3405e9c7f5f90 | |
parent | d54280dd315810ad8cdbce5c52a1af3de902f6ef (diff) | |
download | poky-cbaab65ff4bb3e4fc77066032a8858f4d5d61241.tar.gz |
Merge changes from Poky bitbake 1.8
Update bitbake-dev to have extra fixes from Poky's internal (1.8) version of bitbake.
Should be able to use bitbake-dev with Poky now.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5340 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r-- | bitbake-dev/lib/bb/cache.py | 2 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/cooker.py | 1 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/__init__.py | 5 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/git.py | 13 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/hg.py | 10 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/osc.py | 155 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/parse/__init__.py | 4 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/providers.py | 1 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/utils.py | 37 |
9 files changed, 214 insertions, 14 deletions
diff --git a/bitbake-dev/lib/bb/cache.py b/bitbake-dev/lib/bb/cache.py index bcf393a578..fe38ea0aee 100644 --- a/bitbake-dev/lib/bb/cache.py +++ b/bitbake-dev/lib/bb/cache.py | |||
@@ -39,7 +39,7 @@ except ImportError: | |||
39 | import pickle | 39 | import pickle |
40 | bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.") | 40 | bb.msg.note(1, bb.msg.domain.Cache, "Importing cPickle failed. Falling back to a very slow implementation.") |
41 | 41 | ||
42 | __cache_version__ = "128" | 42 | __cache_version__ = "129" |
43 | 43 | ||
44 | class Cache: | 44 | class Cache: |
45 | """ | 45 | """ |
diff --git a/bitbake-dev/lib/bb/cooker.py b/bitbake-dev/lib/bb/cooker.py index c92ad70a2c..8eb1a410f2 100644 --- a/bitbake-dev/lib/bb/cooker.py +++ b/bitbake-dev/lib/bb/cooker.py | |||
@@ -758,6 +758,7 @@ class BBCooker: | |||
758 | self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) ) | 758 | self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) ) |
759 | 759 | ||
760 | bb.msg.debug(1, bb.msg.domain.Collection, "collecting .bb files") | 760 | bb.msg.debug(1, bb.msg.domain.Collection, "collecting .bb files") |
761 | bb.data.renameVar("__depends", "__base_depends", self.configuration.data) | ||
761 | (filelist, masked) = self.collect_bbfiles() | 762 | (filelist, masked) = self.collect_bbfiles() |
762 | self.parse_bbfiles(filelist, masked) | 763 | self.parse_bbfiles(filelist, masked) |
763 | bb.msg.debug(1, bb.msg.domain.Collection, "parsing complete") | 764 | bb.msg.debug(1, bb.msg.domain.Collection, "parsing complete") |
diff --git a/bitbake-dev/lib/bb/fetch/__init__.py b/bitbake-dev/lib/bb/fetch/__init__.py index c3bea447c1..721eb4d646 100644 --- a/bitbake-dev/lib/bb/fetch/__init__.py +++ b/bitbake-dev/lib/bb/fetch/__init__.py | |||
@@ -49,6 +49,9 @@ class ParameterError(Exception): | |||
49 | class MD5SumError(Exception): | 49 | class MD5SumError(Exception): |
50 | """Exception raised when a MD5SUM of a file does not match the expected one""" | 50 | """Exception raised when a MD5SUM of a file does not match the expected one""" |
51 | 51 | ||
52 | class InvalidSRCREV(Exception): | ||
53 | """Exception raised when an invalid SRCREV is encountered""" | ||
54 | |||
52 | def uri_replace(uri, uri_find, uri_replace, d): | 55 | def uri_replace(uri, uri_find, uri_replace, d): |
53 | # bb.msg.note(1, bb.msg.domain.Fetcher, "uri_replace: operating on %s" % uri) | 56 | # bb.msg.note(1, bb.msg.domain.Fetcher, "uri_replace: operating on %s" % uri) |
54 | if not uri or not uri_find or not uri_replace: | 57 | if not uri or not uri_find or not uri_replace: |
@@ -425,6 +428,8 @@ class Fetch(object): | |||
425 | rev = data.getVar("SRCREV_pn-" + pn + "_" + ud.parm['name'], d, 1) | 428 | rev = data.getVar("SRCREV_pn-" + pn + "_" + ud.parm['name'], d, 1) |
426 | if not rev: | 429 | if not rev: |
427 | rev = data.getVar("SRCREV", d, 1) | 430 | rev = data.getVar("SRCREV", d, 1) |
431 | if rev == "INVALID": | ||
432 | raise InvalidSRCREV("Please set SRCREV to a valid value") | ||
428 | if not rev: | 433 | if not rev: |
429 | return False | 434 | return False |
430 | if rev is "SRCREVINACTION": | 435 | if rev is "SRCREVINACTION": |
diff --git a/bitbake-dev/lib/bb/fetch/git.py b/bitbake-dev/lib/bb/fetch/git.py index f4ae724f87..aa26a500c7 100644 --- a/bitbake-dev/lib/bb/fetch/git.py +++ b/bitbake-dev/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-dev/lib/bb/fetch/hg.py b/bitbake-dev/lib/bb/fetch/hg.py index ee3bd2f7fe..1cd5a8aa5c 100644 --- a/bitbake-dev/lib/bb/fetch/hg.py +++ b/bitbake-dev/lib/bb/fetch/hg.py | |||
@@ -79,7 +79,10 @@ class Hg(Fetch): | |||
79 | host = "/" | 79 | host = "/" |
80 | ud.host = "localhost" | 80 | ud.host = "localhost" |
81 | 81 | ||
82 | hgroot = host + ud.path | 82 | if ud.user == None: |
83 | hgroot = host + ud.path | ||
84 | else: | ||
85 | hgroot = ud.user + "@" + host + ud.path | ||
83 | 86 | ||
84 | if command is "info": | 87 | if command is "info": |
85 | return "%s identify -i %s://%s/%s" % (basecmd, proto, hgroot, ud.module) | 88 | return "%s identify -i %s://%s/%s" % (basecmd, proto, hgroot, ud.module) |
@@ -91,7 +94,10 @@ class Hg(Fetch): | |||
91 | if command is "fetch": | 94 | if command is "fetch": |
92 | cmd = "%s clone %s %s://%s/%s %s" % (basecmd, " ".join(options), proto, hgroot, ud.module, ud.module) | 95 | cmd = "%s clone %s %s://%s/%s %s" % (basecmd, " ".join(options), proto, hgroot, ud.module, ud.module) |
93 | elif command is "pull": | 96 | elif command is "pull": |
94 | cmd = "%s pull %s" % (basecmd, " ".join(options)) | 97 | # do not pass options list; limiting pull to rev causes the local |
98 | # repo not to contain it and immediately following "update" command | ||
99 | # will crash | ||
100 | cmd = "%s pull" % (basecmd) | ||
95 | elif command is "update": | 101 | elif command is "update": |
96 | cmd = "%s update -C %s" % (basecmd, " ".join(options)) | 102 | cmd = "%s update -C %s" % (basecmd, " ".join(options)) |
97 | else: | 103 | else: |
diff --git a/bitbake-dev/lib/bb/fetch/osc.py b/bitbake-dev/lib/bb/fetch/osc.py new file mode 100644 index 0000000000..2c34caf6c9 --- /dev/null +++ b/bitbake-dev/lib/bb/fetch/osc.py | |||
@@ -0,0 +1,155 @@ | |||
1 | # ex:ts=4:sw=4:sts=4:et | ||
2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
3 | """ | ||
4 | Bitbake "Fetch" implementation for osc (Opensuse build service client). | ||
5 | Based on the svn "Fetch" implementation. | ||
6 | |||
7 | """ | ||
8 | |||
9 | import os | ||
10 | import sys | ||
11 | import bb | ||
12 | from bb import data | ||
13 | from bb.fetch import Fetch | ||
14 | from bb.fetch import FetchError | ||
15 | from bb.fetch import MissingParameterError | ||
16 | from bb.fetch import runfetchcmd | ||
17 | |||
18 | class Osc(Fetch): | ||
19 | """Class to fetch a module or modules from Opensuse build server | ||
20 | repositories.""" | ||
21 | |||
22 | def supports(self, url, ud, d): | ||
23 | """ | ||
24 | Check to see if a given url can be fetched with osc. | ||
25 | """ | ||
26 | return ud.type in ['osc'] | ||
27 | |||
28 | def localpath(self, url, ud, d): | ||
29 | if not "module" in ud.parm: | ||
30 | raise MissingParameterError("osc method needs a 'module' parameter.") | ||
31 | |||
32 | ud.module = ud.parm["module"] | ||
33 | |||
34 | # Create paths to osc checkouts | ||
35 | relpath = ud.path | ||
36 | if relpath.startswith('/'): | ||
37 | # Remove leading slash as os.path.join can't cope | ||
38 | relpath = relpath[1:] | ||
39 | ud.pkgdir = os.path.join(data.expand('${OSCDIR}', d), ud.host) | ||
40 | ud.moddir = os.path.join(ud.pkgdir, relpath, ud.module) | ||
41 | |||
42 | if 'rev' in ud.parm: | ||
43 | ud.revision = ud.parm['rev'] | ||
44 | else: | ||
45 | pv = data.getVar("PV", d, 0) | ||
46 | rev = Fetch.srcrev_internal_helper(ud, d) | ||
47 | if rev and rev != True: | ||
48 | ud.revision = rev | ||
49 | else: | ||
50 | ud.revision = "" | ||
51 | |||
52 | ud.localfile = data.expand('%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.path.replace('/', '.'), ud.revision), d) | ||
53 | |||
54 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | ||
55 | |||
56 | def _buildosccommand(self, ud, d, command): | ||
57 | """ | ||
58 | Build up an ocs commandline based on ud | ||
59 | command is "fetch", "update", "info" | ||
60 | """ | ||
61 | |||
62 | basecmd = data.expand('${FETCHCMD_osc}', d) | ||
63 | |||
64 | proto = "ocs" | ||
65 | if "proto" in ud.parm: | ||
66 | proto = ud.parm["proto"] | ||
67 | |||
68 | options = [] | ||
69 | |||
70 | config = "-c %s" % self.generate_config(ud, d) | ||
71 | |||
72 | if ud.revision: | ||
73 | options.append("-r %s" % ud.revision) | ||
74 | |||
75 | coroot = ud.path | ||
76 | if coroot.startswith('/'): | ||
77 | # Remove leading slash as os.path.join can't cope | ||
78 | coroot= coroot[1:] | ||
79 | |||
80 | if command is "fetch": | ||
81 | osccmd = "%s %s co %s/%s %s" % (basecmd, config, coroot, ud.module, " ".join(options)) | ||
82 | elif command is "update": | ||
83 | osccmd = "%s %s up %s" % (basecmd, config, " ".join(options)) | ||
84 | else: | ||
85 | raise FetchError("Invalid osc command %s" % command) | ||
86 | |||
87 | return osccmd | ||
88 | |||
89 | def go(self, loc, ud, d): | ||
90 | """ | ||
91 | Fetch url | ||
92 | """ | ||
93 | |||
94 | # Try to use the tarball stash | ||
95 | if Fetch.try_mirror(d, ud.localfile): | ||
96 | bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists or was mirrored, skipping osc checkout." % ud.localpath) | ||
97 | return | ||
98 | |||
99 | bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: checking for module directory '" + ud.moddir + "'") | ||
100 | |||
101 | if os.access(os.path.join(data.expand('${OSCDIR}', d), ud.path, ud.module), os.R_OK): | ||
102 | oscupdatecmd = self._buildosccommand(ud, d, "update") | ||
103 | bb.msg.note(1, bb.msg.domain.Fetcher, "Update "+ loc) | ||
104 | # update sources there | ||
105 | os.chdir(ud.moddir) | ||
106 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % oscupdatecmd) | ||
107 | runfetchcmd(oscupdatecmd, d) | ||
108 | else: | ||
109 | oscfetchcmd = self._buildosccommand(ud, d, "fetch") | ||
110 | bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) | ||
111 | # check out sources there | ||
112 | bb.mkdirhier(ud.pkgdir) | ||
113 | os.chdir(ud.pkgdir) | ||
114 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % oscfetchcmd) | ||
115 | runfetchcmd(oscfetchcmd, d) | ||
116 | |||
117 | os.chdir(os.path.join(ud.pkgdir + ud.path)) | ||
118 | # tar them up to a defined filename | ||
119 | try: | ||
120 | runfetchcmd("tar -czf %s %s" % (ud.localpath, ud.module), d) | ||
121 | except: | ||
122 | t, v, tb = sys.exc_info() | ||
123 | try: | ||
124 | os.unlink(ud.localpath) | ||
125 | except OSError: | ||
126 | pass | ||
127 | raise t, v, tb | ||
128 | |||
129 | def supports_srcrev(self): | ||
130 | return False | ||
131 | |||
132 | def generate_config(self, ud, d): | ||
133 | """ | ||
134 | Generate a .oscrc to be used for this run. | ||
135 | """ | ||
136 | |||
137 | config_path = "%s/oscrc" % data.expand('${OSCDIR}', d) | ||
138 | if (os.path.exists(config_path)): | ||
139 | os.remove(config_path) | ||
140 | |||
141 | f = open(config_path, 'w') | ||
142 | f.write("[general]\n") | ||
143 | f.write("apisrv = %s\n" % ud.host) | ||
144 | f.write("scheme = http\n") | ||
145 | f.write("su-wrapper = su -c\n") | ||
146 | f.write("build-root = %s\n" % data.expand('${WORKDIR}', d)) | ||
147 | f.write("urllist = http://moblin-obs.jf.intel.com:8888/build/%(project)s/%(repository)s/%(buildarch)s/:full/%(name)s.rpm\n") | ||
148 | f.write("extra-pkgs = gzip\n") | ||
149 | f.write("\n") | ||
150 | f.write("[%s]\n" % ud.host) | ||
151 | f.write("user = %s\n" % ud.parm["user"]) | ||
152 | f.write("pass = %s\n" % ud.parm["pswd"]) | ||
153 | f.close() | ||
154 | |||
155 | return config_path | ||
diff --git a/bitbake-dev/lib/bb/parse/__init__.py b/bitbake-dev/lib/bb/parse/__init__.py index 3c9ba8e6da..5dd96c4136 100644 --- a/bitbake-dev/lib/bb/parse/__init__.py +++ b/bitbake-dev/lib/bb/parse/__init__.py | |||
@@ -50,6 +50,10 @@ def cached_mtime_noerror(f): | |||
50 | return 0 | 50 | return 0 |
51 | return __mtime_cache[f] | 51 | return __mtime_cache[f] |
52 | 52 | ||
53 | def update_mtime(f): | ||
54 | __mtime_cache[f] = os.stat(f)[8] | ||
55 | return __mtime_cache[f] | ||
56 | |||
53 | def mark_dependency(d, f): | 57 | def mark_dependency(d, f): |
54 | if f.startswith('./'): | 58 | if f.startswith('./'): |
55 | f = "%s/%s" % (os.getcwd(), f[2:]) | 59 | f = "%s/%s" % (os.getcwd(), f[2:]) |
diff --git a/bitbake-dev/lib/bb/providers.py b/bitbake-dev/lib/bb/providers.py index 63d4f5b3cb..3504efc86e 100644 --- a/bitbake-dev/lib/bb/providers.py +++ b/bitbake-dev/lib/bb/providers.py | |||
@@ -296,6 +296,7 @@ def getRuntimeProviders(dataCache, rdepend): | |||
296 | 296 | ||
297 | # Only search dynamic packages if we can't find anything in other variables | 297 | # Only search dynamic packages if we can't find anything in other variables |
298 | for pattern in dataCache.packages_dynamic: | 298 | for pattern in dataCache.packages_dynamic: |
299 | pattern = pattern.replace('+', "\+") | ||
299 | try: | 300 | try: |
300 | regexp = re.compile(pattern) | 301 | regexp = re.compile(pattern) |
301 | except: | 302 | except: |
diff --git a/bitbake-dev/lib/bb/utils.py b/bitbake-dev/lib/bb/utils.py index 17e22e389e..0a0c9ada34 100644 --- a/bitbake-dev/lib/bb/utils.py +++ b/bitbake-dev/lib/bb/utils.py | |||
@@ -96,7 +96,34 @@ def explode_deps(s): | |||
96 | #r[-1] += ' ' + ' '.join(j) | 96 | #r[-1] += ' ' + ' '.join(j) |
97 | return r | 97 | return r |
98 | 98 | ||
99 | def explode_dep_versions(s): | ||
100 | """ | ||
101 | Take an RDEPENDS style string of format: | ||
102 | "DEPEND1 (optional version) DEPEND2 (optional version) ..." | ||
103 | and return a dictonary of dependencies and versions. | ||
104 | """ | ||
105 | r = {} | ||
106 | l = s.split() | ||
107 | lastdep = None | ||
108 | lastver = "" | ||
109 | inversion = False | ||
110 | for i in l: | ||
111 | if i[0] == '(': | ||
112 | inversion = True | ||
113 | lastver = i[1:] or "" | ||
114 | #j = [] | ||
115 | elif inversion and i.endswith(')'): | ||
116 | inversion = False | ||
117 | lastver = lastver + " " + (i[:-1] or "") | ||
118 | r[lastdep] = lastver | ||
119 | elif not inversion: | ||
120 | r[i] = None | ||
121 | lastdep = i | ||
122 | lastver = "" | ||
123 | elif inversion: | ||
124 | lastver = lastver + " " + i | ||
99 | 125 | ||
126 | return r | ||
100 | 127 | ||
101 | def _print_trace(body, line): | 128 | def _print_trace(body, line): |
102 | """ | 129 | """ |
@@ -268,3 +295,13 @@ def sha256_file(filename): | |||
268 | for line in open(filename): | 295 | for line in open(filename): |
269 | s.update(line) | 296 | s.update(line) |
270 | return s.hexdigest() | 297 | return s.hexdigest() |
298 | |||
299 | def prunedir(topdir): | ||
300 | # Delete everything reachable from the directory named in 'topdir'. | ||
301 | # CAUTION: This is dangerous! | ||
302 | for root, dirs, files in os.walk(topdir, topdown=False): | ||
303 | for name in files: | ||
304 | os.remove(os.path.join(root, name)) | ||
305 | for name in dirs: | ||
306 | os.rmdir(os.path.join(root, name)) | ||
307 | os.rmdir(topdir) | ||