diff options
-rw-r--r-- | meta/lib/oe/manifest.py | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/meta/lib/oe/manifest.py b/meta/lib/oe/manifest.py index a4bc04b4f2..60c788ef06 100644 --- a/meta/lib/oe/manifest.py +++ b/meta/lib/oe/manifest.py | |||
@@ -1,6 +1,8 @@ | |||
1 | from abc import ABCMeta, abstractmethod | 1 | from abc import ABCMeta, abstractmethod |
2 | from oe.package_manager import * | ||
2 | import os | 3 | import os |
3 | import re | 4 | import re |
5 | import bb | ||
4 | 6 | ||
5 | 7 | ||
6 | class Manifest(object): | 8 | class Manifest(object): |
@@ -69,6 +71,7 @@ class Manifest(object): | |||
69 | 71 | ||
70 | self.initial_manifest = os.path.join(self.manifest_dir, "%s_initial_manifest" % manifest_type) | 72 | self.initial_manifest = os.path.join(self.manifest_dir, "%s_initial_manifest" % manifest_type) |
71 | self.final_manifest = os.path.join(self.manifest_dir, "%s_final_manifest" % manifest_type) | 73 | self.final_manifest = os.path.join(self.manifest_dir, "%s_final_manifest" % manifest_type) |
74 | self.full_manifest = os.path.join(self.manifest_dir, "%s_full_manifest" % manifest_type) | ||
72 | 75 | ||
73 | # packages in the following vars will be split in 'must install' and | 76 | # packages in the following vars will be split in 'must install' and |
74 | # 'multilib' | 77 | # 'multilib' |
@@ -128,6 +131,15 @@ class Manifest(object): | |||
128 | pass | 131 | pass |
129 | 132 | ||
130 | """ | 133 | """ |
134 | This creates the manifest after the package in initial manifest has been | ||
135 | dummy installed. It lists all *to be installed* packages. There is no real | ||
136 | installation, just a test. | ||
137 | """ | ||
138 | @abstractmethod | ||
139 | def create_full(self, pm): | ||
140 | pass | ||
141 | |||
142 | """ | ||
131 | The following function parses an initial manifest and returns a dictionary | 143 | The following function parses an initial manifest and returns a dictionary |
132 | object with the must install, attempt only, multilib and language packages. | 144 | object with the must install, attempt only, multilib and language packages. |
133 | """ | 145 | """ |
@@ -158,6 +170,22 @@ class Manifest(object): | |||
158 | 170 | ||
159 | return pkgs | 171 | return pkgs |
160 | 172 | ||
173 | ''' | ||
174 | This following function parses a full manifest and return a list | ||
175 | object with packages. | ||
176 | ''' | ||
177 | def parse_full_manifest(self): | ||
178 | installed_pkgs = list() | ||
179 | if not os.path.exists(self.full_manifest): | ||
180 | bb.note('full manifest not exist') | ||
181 | return installed_pkgs | ||
182 | |||
183 | with open(self.full_manifest, 'r') as manifest: | ||
184 | for pkg in manifest.read().split('\n'): | ||
185 | installed_pkgs.append(pkg.strip()) | ||
186 | |||
187 | return installed_pkgs | ||
188 | |||
161 | 189 | ||
162 | class RpmManifest(Manifest): | 190 | class RpmManifest(Manifest): |
163 | """ | 191 | """ |
@@ -202,10 +230,12 @@ class RpmManifest(Manifest): | |||
202 | for pkg in pkgs[pkg_type].split(): | 230 | for pkg in pkgs[pkg_type].split(): |
203 | manifest.write("%s,%s\n" % (pkg_type, pkg)) | 231 | manifest.write("%s,%s\n" % (pkg_type, pkg)) |
204 | 232 | ||
205 | |||
206 | def create_final(self): | 233 | def create_final(self): |
207 | pass | 234 | pass |
208 | 235 | ||
236 | def create_full(self, pm): | ||
237 | pass | ||
238 | |||
209 | 239 | ||
210 | class OpkgManifest(Manifest): | 240 | class OpkgManifest(Manifest): |
211 | """ | 241 | """ |
@@ -253,6 +283,28 @@ class OpkgManifest(Manifest): | |||
253 | def create_final(self): | 283 | def create_final(self): |
254 | pass | 284 | pass |
255 | 285 | ||
286 | def create_full(self, pm): | ||
287 | if not os.path.exists(self.initial_manifest): | ||
288 | self.create_initial() | ||
289 | |||
290 | initial_manifest = self.parse_initial_manifest() | ||
291 | pkgs_to_install = list() | ||
292 | for pkg_type in initial_manifest: | ||
293 | pkgs_to_install += initial_manifest[pkg_type] | ||
294 | if len(pkgs_to_install) == 0: | ||
295 | return | ||
296 | |||
297 | output = pm.dummy_install(pkgs_to_install) | ||
298 | |||
299 | with open(self.full_manifest, 'w+') as manifest: | ||
300 | pkg_re = re.compile('^Installing ([^ ]+) [^ ].*') | ||
301 | for line in set(output.split('\n')): | ||
302 | m = pkg_re.match(line) | ||
303 | if m: | ||
304 | manifest.write(m.group(1) + '\n') | ||
305 | |||
306 | return | ||
307 | |||
256 | 308 | ||
257 | class DpkgManifest(Manifest): | 309 | class DpkgManifest(Manifest): |
258 | def create_initial(self): | 310 | def create_initial(self): |
@@ -272,6 +324,9 @@ class DpkgManifest(Manifest): | |||
272 | def create_final(self): | 324 | def create_final(self): |
273 | pass | 325 | pass |
274 | 326 | ||
327 | def create_full(self, pm): | ||
328 | pass | ||
329 | |||
275 | 330 | ||
276 | def create_manifest(d, final_manifest=False, manifest_dir=None, | 331 | def create_manifest(d, final_manifest=False, manifest_dir=None, |
277 | manifest_type=Manifest.MANIFEST_TYPE_IMAGE): | 332 | manifest_type=Manifest.MANIFEST_TYPE_IMAGE): |