summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2014-02-21 14:10:17 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-21 16:14:15 +0000
commitf4de8399ba6ddc38656cc1fb08098e7c4588151f (patch)
tree4204b9496317d447f8fe9d0650b89bf847becc27 /meta/lib/oe
parent363b7c9adb8ad3b612becdc1ab2606f73bf42398 (diff)
downloadpoky-f4de8399ba6ddc38656cc1fb08098e7c4588151f.tar.gz
manifest.py: add create_full for OpkgManifest class
The function create_full creates the manifest after the package in initial manifest has been dummy installed. It lists all *to be installed* packages. There is no real installation, just a test. [YOCTO #1894] (From OE-Core rev: 494adecd878496c2edc663ba09a456a9735d8252) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/manifest.py57
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 @@
1from abc import ABCMeta, abstractmethod 1from abc import ABCMeta, abstractmethod
2from oe.package_manager import *
2import os 3import os
3import re 4import re
5import bb
4 6
5 7
6class Manifest(object): 8class 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
162class RpmManifest(Manifest): 190class 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
210class OpkgManifest(Manifest): 240class 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
257class DpkgManifest(Manifest): 309class 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
276def create_manifest(d, final_manifest=False, manifest_dir=None, 331def create_manifest(d, final_manifest=False, manifest_dir=None,
277 manifest_type=Manifest.MANIFEST_TYPE_IMAGE): 332 manifest_type=Manifest.MANIFEST_TYPE_IMAGE):