diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2014-02-14 13:01:05 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-14 12:30:19 +0000 |
commit | a0a045098115d94d31f6fcd3c16dd286ce16d84a (patch) | |
tree | 93649f13ee5a5a6d0bcb1d59f90b482e81c254cd /meta/lib | |
parent | aed96f6a6aee74d677c4647af159174477c134ab (diff) | |
download | poky-a0a045098115d94d31f6fcd3c16dd286ce16d84a.tar.gz |
package_manager.py, rootfs.py, sdk.py: add Indexer class
Because the package-index.bb needs to create package indexes outside
do_rootfs environment, move the indexing capability out of
PackageManager class to a smaller Indexer class.
This commit:
* simply moves the indexing functions for ipk/deb with no changes;
* rewrites the RPM indexing function so that it can be easily moved out
of the PackageManager class;
* removes some RPM duplicate code, moves it into a method inside
RpmPM class and changes the RpmPM constructor so that the new method
is effective;
(From OE-Core rev: d339d6f48f81330e94162f333aad76f3c65d6bfd)
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/package_manager.py | 339 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 58 | ||||
-rw-r--r-- | meta/lib/oe/sdk.py | 48 |
3 files changed, 221 insertions, 224 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 9884c3a712..af14d5ad7f 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -22,6 +22,144 @@ def create_index(arg): | |||
22 | return None | 22 | return None |
23 | 23 | ||
24 | 24 | ||
25 | class Indexer(object): | ||
26 | __metaclass__ = ABCMeta | ||
27 | |||
28 | def __init__(self, d, deploy_dir): | ||
29 | self.d = d | ||
30 | self.deploy_dir = deploy_dir | ||
31 | |||
32 | @abstractmethod | ||
33 | def write_index(self): | ||
34 | pass | ||
35 | |||
36 | |||
37 | class RpmIndexer(Indexer): | ||
38 | def write_index(self): | ||
39 | sdk_pkg_archs = (self.d.getVar('SDK_PACKAGE_ARCHS', True) or "").replace('-', '_').split() | ||
40 | mlb_prefix_list = (self.d.getVar('MULTILIB_PREFIX_LIST', True) or "").replace('-', '_').split() | ||
41 | all_mlb_pkg_archs = (self.d.getVar('ALL_MULTILIB_PACKAGE_ARCHS', True) or "").replace('-', '_').split() | ||
42 | |||
43 | archs = set() | ||
44 | for item in mlb_prefix_list: | ||
45 | archs = archs.union(set(item.split(':')[1:])) | ||
46 | |||
47 | if len(archs) == 0: | ||
48 | archs = archs.union(set(all_mlb_pkg_archs)) | ||
49 | |||
50 | archs = archs.union(set(sdk_pkg_archs)) | ||
51 | |||
52 | rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo") | ||
53 | index_cmds = [] | ||
54 | rpm_dirs_found = False | ||
55 | for arch in archs: | ||
56 | arch_dir = os.path.join(self.deploy_dir, arch) | ||
57 | if not os.path.isdir(arch_dir): | ||
58 | continue | ||
59 | |||
60 | index_cmds.append("%s --update -q %s" % (rpm_createrepo, arch_dir)) | ||
61 | |||
62 | rpm_dirs_found = True | ||
63 | |||
64 | if not rpm_dirs_found: | ||
65 | return("There are no packages in %s" % self.deploy_dir) | ||
66 | |||
67 | nproc = multiprocessing.cpu_count() | ||
68 | pool = bb.utils.multiprocessingpool(nproc) | ||
69 | results = list(pool.imap(create_index, index_cmds)) | ||
70 | pool.close() | ||
71 | pool.join() | ||
72 | |||
73 | for result in results: | ||
74 | if result is not None: | ||
75 | return(result) | ||
76 | |||
77 | |||
78 | class OpkgIndexer(Indexer): | ||
79 | def write_index(self): | ||
80 | arch_vars = ["ALL_MULTILIB_PACKAGE_ARCHS", | ||
81 | "SDK_PACKAGE_ARCHS", | ||
82 | "MULTILIB_ARCHS"] | ||
83 | |||
84 | opkg_index_cmd = bb.utils.which(os.getenv('PATH'), "opkg-make-index") | ||
85 | |||
86 | if not os.path.exists(os.path.join(self.deploy_dir, "Packages")): | ||
87 | open(os.path.join(self.deploy_dir, "Packages"), "w").close() | ||
88 | |||
89 | index_cmds = [] | ||
90 | for arch_var in arch_vars: | ||
91 | archs = self.d.getVar(arch_var, True) | ||
92 | if archs is None: | ||
93 | continue | ||
94 | |||
95 | for arch in archs.split(): | ||
96 | pkgs_dir = os.path.join(self.deploy_dir, arch) | ||
97 | pkgs_file = os.path.join(pkgs_dir, "Packages") | ||
98 | |||
99 | if not os.path.isdir(pkgs_dir): | ||
100 | continue | ||
101 | |||
102 | if not os.path.exists(pkgs_file): | ||
103 | open(pkgs_file, "w").close() | ||
104 | |||
105 | index_cmds.append('%s -r %s -p %s -m %s' % | ||
106 | (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir)) | ||
107 | |||
108 | if len(index_cmds) == 0: | ||
109 | return("There are no packages in %s!" % self.deploy_dir) | ||
110 | |||
111 | nproc = multiprocessing.cpu_count() | ||
112 | pool = bb.utils.multiprocessingpool(nproc) | ||
113 | results = list(pool.imap(create_index, index_cmds)) | ||
114 | pool.close() | ||
115 | pool.join() | ||
116 | |||
117 | for result in results: | ||
118 | if result is not None: | ||
119 | return(result) | ||
120 | |||
121 | |||
122 | class DpkgIndexer(Indexer): | ||
123 | def write_index(self): | ||
124 | pkg_archs = self.d.getVar('PACKAGE_ARCHS', True) | ||
125 | if pkg_archs is not None: | ||
126 | arch_list = pkg_archs.split() | ||
127 | sdk_pkg_archs = self.d.getVar('SDK_PACKAGE_ARCHS', True) | ||
128 | if sdk_pkg_archs is not None: | ||
129 | arch_list += sdk_pkg_archs.split() | ||
130 | |||
131 | dpkg_scanpackages = bb.utils.which(os.getenv('PATH'), "dpkg-scanpackages") | ||
132 | gzip = bb.utils.which(os.getenv('PATH'), "gzip") | ||
133 | |||
134 | index_cmds = [] | ||
135 | deb_dirs_found = False | ||
136 | for arch in arch_list: | ||
137 | arch_dir = os.path.join(self.deploy_dir, arch) | ||
138 | if not os.path.isdir(arch_dir): | ||
139 | continue | ||
140 | |||
141 | with open(os.path.join(arch_dir, "Release"), "w+") as release: | ||
142 | release.write("Label: %s" % arch) | ||
143 | |||
144 | index_cmds.append("cd %s; %s . | %s > Packages.gz" % | ||
145 | (arch_dir, dpkg_scanpackages, gzip)) | ||
146 | |||
147 | deb_dirs_found = True | ||
148 | |||
149 | if not deb_dirs_found: | ||
150 | return("There are no packages in %s" % self.deploy_dir) | ||
151 | |||
152 | nproc = multiprocessing.cpu_count() | ||
153 | pool = bb.utils.multiprocessingpool(nproc) | ||
154 | results = list(pool.imap(create_index, index_cmds)) | ||
155 | pool.close() | ||
156 | pool.join() | ||
157 | |||
158 | for result in results: | ||
159 | if result is not None: | ||
160 | return(result) | ||
161 | |||
162 | |||
25 | class PackageManager(object): | 163 | class PackageManager(object): |
26 | """ | 164 | """ |
27 | This is an abstract class. Do not instantiate this directly. | 165 | This is an abstract class. Do not instantiate this directly. |
@@ -136,14 +274,13 @@ class RpmPM(PackageManager): | |||
136 | def __init__(self, | 274 | def __init__(self, |
137 | d, | 275 | d, |
138 | target_rootfs, | 276 | target_rootfs, |
139 | package_archs, | ||
140 | target_os, | ||
141 | target_vendor, | 277 | target_vendor, |
142 | task_name='target', | 278 | task_name='target', |
143 | providename=None): | 279 | providename=None, |
280 | arch_var=None, | ||
281 | os_var=None): | ||
144 | super(RpmPM, self).__init__(d) | 282 | super(RpmPM, self).__init__(d) |
145 | self.target_rootfs = target_rootfs | 283 | self.target_rootfs = target_rootfs |
146 | self.ml_os_list = target_os | ||
147 | self.target_vendor = target_vendor | 284 | self.target_vendor = target_vendor |
148 | self.task_name = task_name | 285 | self.task_name = task_name |
149 | self.providename = providename | 286 | self.providename = providename |
@@ -164,19 +301,58 @@ class RpmPM(PackageManager): | |||
164 | if not os.path.exists(self.d.expand('${T}/saved')): | 301 | if not os.path.exists(self.d.expand('${T}/saved')): |
165 | bb.utils.mkdirhier(self.d.expand('${T}/saved')) | 302 | bb.utils.mkdirhier(self.d.expand('${T}/saved')) |
166 | 303 | ||
167 | # arch order is reversed. This ensures the -best- match is | 304 | self.indexer = RpmIndexer(self.d, self.deploy_dir) |
168 | # listed first! | 305 | |
169 | self.ml_prefix_list = dict() | 306 | self.ml_prefix_list, self.ml_os_list = self._get_prefix_and_os_list(arch_var, os_var) |
307 | |||
308 | def _get_prefix_and_os_list(self, arch_var, os_var): | ||
309 | package_archs = { | ||
310 | 'default': [], | ||
311 | } | ||
312 | |||
313 | target_os = { | ||
314 | 'default': "", | ||
315 | } | ||
316 | |||
317 | if arch_var is not None and os_var is not None: | ||
318 | package_archs['default'] = self.d.getVar(arch_var, True).split() | ||
319 | package_archs['default'].reverse() | ||
320 | target_os['default'] = self.d.getVar(os_var, True).strip() | ||
321 | else: | ||
322 | package_archs['default'] = self.d.getVar("PACKAGE_ARCHS", True).split() | ||
323 | # arch order is reversed. This ensures the -best- match is | ||
324 | # listed first! | ||
325 | package_archs['default'].reverse() | ||
326 | target_os['default'] = self.d.getVar("TARGET_OS", True).strip() | ||
327 | multilibs = self.d.getVar('MULTILIBS', True) or "" | ||
328 | for ext in multilibs.split(): | ||
329 | eext = ext.split(':') | ||
330 | if len(eext) > 1 and eext[0] == 'multilib': | ||
331 | localdata = bb.data.createCopy(self.d) | ||
332 | default_tune_key = "DEFAULTTUNE_virtclass-multilib-" + eext[1] | ||
333 | default_tune = localdata.getVar(default_tune_key, False) | ||
334 | if default_tune: | ||
335 | localdata.setVar("DEFAULTTUNE", default_tune) | ||
336 | bb.data.update_data(localdata) | ||
337 | package_archs[eext[1]] = localdata.getVar('PACKAGE_ARCHS', | ||
338 | True).split() | ||
339 | package_archs[eext[1]].reverse() | ||
340 | target_os[eext[1]] = localdata.getVar("TARGET_OS", | ||
341 | True).strip() | ||
342 | |||
343 | ml_prefix_list = dict() | ||
170 | for mlib in package_archs: | 344 | for mlib in package_archs: |
171 | if mlib == 'default': | 345 | if mlib == 'default': |
172 | self.ml_prefix_list[mlib] = package_archs[mlib] | 346 | ml_prefix_list[mlib] = package_archs[mlib] |
173 | else: | 347 | else: |
174 | self.ml_prefix_list[mlib] = list() | 348 | ml_prefix_list[mlib] = list() |
175 | for arch in package_archs[mlib]: | 349 | for arch in package_archs[mlib]: |
176 | if arch in ['all', 'noarch', 'any']: | 350 | if arch in ['all', 'noarch', 'any']: |
177 | self.ml_prefix_list[mlib].append(arch) | 351 | ml_prefix_list[mlib].append(arch) |
178 | else: | 352 | else: |
179 | self.ml_prefix_list[mlib].append(mlib + "_" + arch) | 353 | ml_prefix_list[mlib].append(mlib + "_" + arch) |
354 | |||
355 | return (ml_prefix_list, target_os) | ||
180 | 356 | ||
181 | ''' | 357 | ''' |
182 | Create configs for rpm and smart, and multilib is supported | 358 | Create configs for rpm and smart, and multilib is supported |
@@ -552,39 +728,10 @@ class RpmPM(PackageManager): | |||
552 | self._invoke_smart('upgrade') | 728 | self._invoke_smart('upgrade') |
553 | 729 | ||
554 | def write_index(self): | 730 | def write_index(self): |
555 | arch_list = set() | 731 | result = self.indexer.write_index() |
556 | for mlib in self.ml_prefix_list: | ||
557 | for arch in self.ml_prefix_list[mlib]: | ||
558 | if arch not in arch_list: | ||
559 | arch_list.add(arch.replace('-', '_')) | ||
560 | 732 | ||
561 | sdk_pkg_archs = (self.d.getVar('SDK_PACKAGE_ARCHS', True) or "").replace('-', '_') | 733 | if result is not None: |
562 | arch_list = arch_list.union(set(sdk_pkg_archs.split())) | 734 | bb.fatal(result) |
563 | |||
564 | rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo") | ||
565 | index_cmds = [] | ||
566 | rpm_dirs_found = False | ||
567 | for arch in arch_list: | ||
568 | arch_dir = os.path.join(self.deploy_dir, arch) | ||
569 | if not os.path.isdir(arch_dir): | ||
570 | continue | ||
571 | |||
572 | index_cmds.append("%s --update -q %s" % (rpm_createrepo, arch_dir)) | ||
573 | |||
574 | rpm_dirs_found = True | ||
575 | |||
576 | if not rpm_dirs_found: | ||
577 | bb.fatal("There are no packages in %s" % self.deploy_dir) | ||
578 | |||
579 | nproc = multiprocessing.cpu_count() | ||
580 | pool = bb.utils.multiprocessingpool(nproc) | ||
581 | results = list(pool.imap(create_index, index_cmds)) | ||
582 | pool.close() | ||
583 | pool.join() | ||
584 | |||
585 | for result in results: | ||
586 | if result is not None: | ||
587 | bb.fatal(result) | ||
588 | 735 | ||
589 | def remove_packaging_data(self): | 736 | def remove_packaging_data(self): |
590 | bb.utils.remove(self.image_rpmlib, True) | 737 | bb.utils.remove(self.image_rpmlib, True) |
@@ -810,6 +957,8 @@ class OpkgPM(PackageManager): | |||
810 | else: | 957 | else: |
811 | self._create_custom_config() | 958 | self._create_custom_config() |
812 | 959 | ||
960 | self.indexer = OpkgIndexer(self.d, self.deploy_dir) | ||
961 | |||
813 | """ | 962 | """ |
814 | This function will change a package's status in /var/lib/opkg/status file. | 963 | This function will change a package's status in /var/lib/opkg/status file. |
815 | If 'packages' is None then the new_status will be applied to all | 964 | If 'packages' is None then the new_status will be applied to all |
@@ -943,53 +1092,14 @@ class OpkgPM(PackageManager): | |||
943 | "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) | 1092 | "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) |
944 | 1093 | ||
945 | def write_index(self): | 1094 | def write_index(self): |
946 | arch_vars = ["ALL_MULTILIB_PACKAGE_ARCHS", | ||
947 | "SDK_PACKAGE_ARCHS", | ||
948 | "MULTILIB_ARCHS"] | ||
949 | |||
950 | tmpdir = self.d.getVar('TMPDIR', True) | ||
951 | |||
952 | self.deploy_dir_lock() | 1095 | self.deploy_dir_lock() |
953 | 1096 | ||
954 | opkg_index_cmd = bb.utils.which(os.getenv('PATH'), "opkg-make-index") | 1097 | result = self.indexer.write_index() |
955 | |||
956 | if not os.path.exists(os.path.join(self.deploy_dir, "Packages")): | ||
957 | open(os.path.join(self.deploy_dir, "Packages"), "w").close() | ||
958 | |||
959 | index_cmds = [] | ||
960 | for arch_var in arch_vars: | ||
961 | archs = self.d.getVar(arch_var, True) | ||
962 | if archs is None: | ||
963 | continue | ||
964 | |||
965 | for arch in archs.split(): | ||
966 | pkgs_dir = os.path.join(self.deploy_dir, arch) | ||
967 | pkgs_file = os.path.join(pkgs_dir, "Packages") | ||
968 | |||
969 | if not os.path.isdir(pkgs_dir): | ||
970 | continue | ||
971 | |||
972 | if not os.path.exists(pkgs_file): | ||
973 | open(pkgs_file, "w").close() | ||
974 | |||
975 | index_cmds.append('%s -r %s -p %s -m %s' % | ||
976 | (opkg_index_cmd, pkgs_file, pkgs_file, pkgs_dir)) | ||
977 | |||
978 | if len(index_cmds) == 0: | ||
979 | self.deploy_dir_unlock() | ||
980 | bb.fatal("There are no packages in %s!" % self.deploy_dir) | ||
981 | |||
982 | nproc = multiprocessing.cpu_count() | ||
983 | pool = bb.utils.multiprocessingpool(nproc) | ||
984 | results = list(pool.imap(create_index, index_cmds)) | ||
985 | pool.close() | ||
986 | pool.join() | ||
987 | 1098 | ||
988 | self.deploy_dir_unlock() | 1099 | self.deploy_dir_unlock() |
989 | 1100 | ||
990 | for result in results: | 1101 | if result is not None: |
991 | if result is not None: | 1102 | bb.fatal(result) |
992 | bb.fatal(result) | ||
993 | 1103 | ||
994 | def remove_packaging_data(self): | 1104 | def remove_packaging_data(self): |
995 | bb.utils.remove(self.opkg_dir, True) | 1105 | bb.utils.remove(self.opkg_dir, True) |
@@ -1078,6 +1188,8 @@ class DpkgPM(PackageManager): | |||
1078 | 1188 | ||
1079 | self._create_configs(archs, base_archs) | 1189 | self._create_configs(archs, base_archs) |
1080 | 1190 | ||
1191 | self.indexer = DpkgIndexer(self.d, self.deploy_dir) | ||
1192 | |||
1081 | """ | 1193 | """ |
1082 | This function will change a package's status in /var/lib/dpkg/status file. | 1194 | This function will change a package's status in /var/lib/dpkg/status file. |
1083 | If 'packages' is None then the new_status will be applied to all | 1195 | If 'packages' is None then the new_status will be applied to all |
@@ -1215,49 +1327,14 @@ class DpkgPM(PackageManager): | |||
1215 | "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) | 1327 | "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) |
1216 | 1328 | ||
1217 | def write_index(self): | 1329 | def write_index(self): |
1218 | tmpdir = self.d.getVar('TMPDIR', True) | ||
1219 | |||
1220 | pkg_archs = self.d.getVar('PACKAGE_ARCHS', True) | ||
1221 | if pkg_archs is not None: | ||
1222 | arch_list = pkg_archs.split() | ||
1223 | sdk_pkg_archs = self.d.getVar('SDK_PACKAGE_ARCHS', True) | ||
1224 | if sdk_pkg_archs is not None: | ||
1225 | arch_list += sdk_pkg_archs.split() | ||
1226 | |||
1227 | dpkg_scanpackages = bb.utils.which(os.getenv('PATH'), "dpkg-scanpackages") | ||
1228 | gzip = bb.utils.which(os.getenv('PATH'), "gzip") | ||
1229 | |||
1230 | self.deploy_dir_lock() | 1330 | self.deploy_dir_lock() |
1231 | 1331 | ||
1232 | index_cmds = [] | 1332 | result = self.indexer.write_index() |
1233 | deb_dirs_found = False | ||
1234 | for arch in arch_list: | ||
1235 | arch_dir = os.path.join(self.deploy_dir, arch) | ||
1236 | if not os.path.isdir(arch_dir): | ||
1237 | continue | ||
1238 | |||
1239 | with open(os.path.join(arch_dir, "Release"), "w+") as release: | ||
1240 | release.write("Label: %s" % arch) | ||
1241 | |||
1242 | index_cmds.append("cd %s; %s . | %s > Packages.gz" % | ||
1243 | (arch_dir, dpkg_scanpackages, gzip)) | ||
1244 | |||
1245 | deb_dirs_found = True | ||
1246 | |||
1247 | if not deb_dirs_found: | ||
1248 | bb.fatal("There are no packages in %s" % self.deploy_dir) | ||
1249 | |||
1250 | nproc = multiprocessing.cpu_count() | ||
1251 | pool = bb.utils.multiprocessingpool(nproc) | ||
1252 | results = list(pool.imap(create_index, index_cmds)) | ||
1253 | pool.close() | ||
1254 | pool.join() | ||
1255 | 1333 | ||
1256 | self.deploy_dir_unlock() | 1334 | self.deploy_dir_unlock() |
1257 | 1335 | ||
1258 | for result in results: | 1336 | if result is not None: |
1259 | if result is not None: | 1337 | bb.fatal(result) |
1260 | bb.fatal(result) | ||
1261 | 1338 | ||
1262 | def _create_configs(self, archs, base_archs): | 1339 | def _create_configs(self, archs, base_archs): |
1263 | base_archs = re.sub("_", "-", base_archs) | 1340 | base_archs = re.sub("_", "-", base_archs) |
@@ -1365,6 +1442,22 @@ class DpkgPM(PackageManager): | |||
1365 | 1442 | ||
1366 | return output | 1443 | return output |
1367 | 1444 | ||
1445 | |||
1446 | def generate_index_files(d): | ||
1447 | img_type = d.getVar('IMAGE_PKGTYPE', True) | ||
1448 | |||
1449 | result = None | ||
1450 | |||
1451 | if img_type == "rpm": | ||
1452 | result = RpmIndexer(d, d.getVar('DEPLOY_DIR_RPM', True)).write_index() | ||
1453 | elif img_type == "ipk": | ||
1454 | result = OpkgIndexer(d, d.getVar('DEPLOY_DIR_IPK', True)).write_index() | ||
1455 | elif img_type == "deb": | ||
1456 | result = DpkgIndexer(d, d.getVar('DEPLOY_DIR_DEB', True)).write_index() | ||
1457 | |||
1458 | if result is not None: | ||
1459 | bb.fatal(result) | ||
1460 | |||
1368 | if __name__ == "__main__": | 1461 | if __name__ == "__main__": |
1369 | """ | 1462 | """ |
1370 | We should be able to run this as a standalone script, from outside bitbake | 1463 | We should be able to run this as a standalone script, from outside bitbake |
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 6114f5652a..d149ca3eff 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -233,37 +233,8 @@ class RpmRootfs(Rootfs): | |||
233 | 233 | ||
234 | self.manifest = RpmManifest(d, manifest_dir) | 234 | self.manifest = RpmManifest(d, manifest_dir) |
235 | 235 | ||
236 | package_archs = { | ||
237 | 'default': [], | ||
238 | } | ||
239 | target_os = { | ||
240 | 'default': "", | ||
241 | } | ||
242 | package_archs['default'] = self.d.getVar("PACKAGE_ARCHS", True).split() | ||
243 | # arch order is reversed. This ensures the -best- match is | ||
244 | # listed first! | ||
245 | package_archs['default'].reverse() | ||
246 | target_os['default'] = self.d.getVar("TARGET_OS", True).strip() | ||
247 | multilibs = self.d.getVar('MULTILIBS', True) or "" | ||
248 | for ext in multilibs.split(): | ||
249 | eext = ext.split(':') | ||
250 | if len(eext) > 1 and eext[0] == 'multilib': | ||
251 | localdata = bb.data.createCopy(self.d) | ||
252 | default_tune_key = "DEFAULTTUNE_virtclass-multilib-" + eext[1] | ||
253 | default_tune = localdata.getVar(default_tune_key, False) | ||
254 | if default_tune: | ||
255 | localdata.setVar("DEFAULTTUNE", default_tune) | ||
256 | bb.data.update_data(localdata) | ||
257 | package_archs[eext[1]] = localdata.getVar('PACKAGE_ARCHS', | ||
258 | True).split() | ||
259 | package_archs[eext[1]].reverse() | ||
260 | target_os[eext[1]] = localdata.getVar("TARGET_OS", | ||
261 | True).strip() | ||
262 | |||
263 | self.pm = RpmPM(d, | 236 | self.pm = RpmPM(d, |
264 | d.getVar('IMAGE_ROOTFS', True), | 237 | d.getVar('IMAGE_ROOTFS', True), |
265 | package_archs, | ||
266 | target_os, | ||
267 | self.d.getVar('TARGET_VENDOR', True) | 238 | self.d.getVar('TARGET_VENDOR', True) |
268 | ) | 239 | ) |
269 | 240 | ||
@@ -634,37 +605,8 @@ def list_installed_packages(d, format=None, rootfs_dir=None): | |||
634 | 605 | ||
635 | img_type = d.getVar('IMAGE_PKGTYPE', True) | 606 | img_type = d.getVar('IMAGE_PKGTYPE', True) |
636 | if img_type == "rpm": | 607 | if img_type == "rpm": |
637 | package_archs = { | ||
638 | 'default': [], | ||
639 | } | ||
640 | target_os = { | ||
641 | 'default': "", | ||
642 | } | ||
643 | package_archs['default'] = d.getVar("PACKAGE_ARCHS", True).split() | ||
644 | # arch order is reversed. This ensures the -best- match is | ||
645 | # listed first! | ||
646 | package_archs['default'].reverse() | ||
647 | target_os['default'] = d.getVar("TARGET_OS", True).strip() | ||
648 | multilibs = d.getVar('MULTILIBS', True) or "" | ||
649 | for ext in multilibs.split(): | ||
650 | eext = ext.split(':') | ||
651 | if len(eext) > 1 and eext[0] == 'multilib': | ||
652 | localdata = bb.data.createCopy(d) | ||
653 | default_tune_key = "DEFAULTTUNE_virtclass-multilib-" + eext[1] | ||
654 | default_tune = localdata.getVar(default_tune_key, False) | ||
655 | if default_tune: | ||
656 | localdata.setVar("DEFAULTTUNE", default_tune) | ||
657 | bb.data.update_data(localdata) | ||
658 | package_archs[eext[1]] = localdata.getVar('PACKAGE_ARCHS', | ||
659 | True).split() | ||
660 | package_archs[eext[1]].reverse() | ||
661 | target_os[eext[1]] = localdata.getVar("TARGET_OS", | ||
662 | True).strip() | ||
663 | |||
664 | return RpmPM(d, | 608 | return RpmPM(d, |
665 | rootfs_dir, | 609 | rootfs_dir, |
666 | package_archs, | ||
667 | target_os, | ||
668 | d.getVar('TARGET_VENDOR', True) | 610 | d.getVar('TARGET_VENDOR', True) |
669 | ).list_installed(format) | 611 | ).list_installed(format) |
670 | elif img_type == "ipk": | 612 | elif img_type == "ipk": |
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py index 518076e75d..01a1807160 100644 --- a/meta/lib/oe/sdk.py +++ b/meta/lib/oe/sdk.py | |||
@@ -66,59 +66,20 @@ class RpmSdk(Sdk): | |||
66 | self.host_manifest = RpmManifest(d, self.manifest_dir, | 66 | self.host_manifest = RpmManifest(d, self.manifest_dir, |
67 | Manifest.MANIFEST_TYPE_SDK_HOST) | 67 | Manifest.MANIFEST_TYPE_SDK_HOST) |
68 | 68 | ||
69 | package_archs = { | ||
70 | 'default': [], | ||
71 | } | ||
72 | target_os = { | ||
73 | 'default': "", | ||
74 | } | ||
75 | package_archs['default'] = self.d.getVar("PACKAGE_ARCHS", True).split() | ||
76 | # arch order is reversed. This ensures the -best- match is | ||
77 | # listed first! | ||
78 | package_archs['default'].reverse() | ||
79 | target_os['default'] = self.d.getVar("TARGET_OS", True).strip() | ||
80 | multilibs = self.d.getVar('MULTILIBS', True) or "" | ||
81 | for ext in multilibs.split(): | ||
82 | eext = ext.split(':') | ||
83 | if len(eext) > 1 and eext[0] == 'multilib': | ||
84 | localdata = bb.data.createCopy(self.d) | ||
85 | default_tune_key = "DEFAULTTUNE_virtclass-multilib-" + eext[1] | ||
86 | default_tune = localdata.getVar(default_tune_key, False) | ||
87 | if default_tune: | ||
88 | localdata.setVar("DEFAULTTUNE", default_tune) | ||
89 | bb.data.update_data(localdata) | ||
90 | package_archs[eext[1]] = localdata.getVar('PACKAGE_ARCHS', | ||
91 | True).split() | ||
92 | package_archs[eext[1]].reverse() | ||
93 | target_os[eext[1]] = localdata.getVar("TARGET_OS", | ||
94 | True).strip() | ||
95 | target_providename = ['/bin/sh', | 69 | target_providename = ['/bin/sh', |
96 | '/bin/bash', | 70 | '/bin/bash', |
97 | '/usr/bin/env', | 71 | '/usr/bin/env', |
98 | '/usr/bin/perl', | 72 | '/usr/bin/perl', |
99 | 'pkgconfig' | 73 | 'pkgconfig' |
100 | ] | 74 | ] |
75 | |||
101 | self.target_pm = RpmPM(d, | 76 | self.target_pm = RpmPM(d, |
102 | self.sdk_target_sysroot, | 77 | self.sdk_target_sysroot, |
103 | package_archs, | ||
104 | target_os, | ||
105 | self.d.getVar('TARGET_VENDOR', True), | 78 | self.d.getVar('TARGET_VENDOR', True), |
106 | 'target', | 79 | 'target', |
107 | target_providename | 80 | target_providename |
108 | ) | 81 | ) |
109 | 82 | ||
110 | sdk_package_archs = { | ||
111 | 'default': [], | ||
112 | } | ||
113 | sdk_os = { | ||
114 | 'default': "", | ||
115 | } | ||
116 | sdk_package_archs['default'] = self.d.getVar("SDK_PACKAGE_ARCHS", | ||
117 | True).split() | ||
118 | # arch order is reversed. This ensures the -best- match is | ||
119 | # listed first! | ||
120 | sdk_package_archs['default'].reverse() | ||
121 | sdk_os['default'] = self.d.getVar("SDK_OS", True).strip() | ||
122 | sdk_providename = ['/bin/sh', | 83 | sdk_providename = ['/bin/sh', |
123 | '/bin/bash', | 84 | '/bin/bash', |
124 | '/usr/bin/env', | 85 | '/usr/bin/env', |
@@ -127,13 +88,14 @@ class RpmSdk(Sdk): | |||
127 | 'libGL.so()(64bit)', | 88 | 'libGL.so()(64bit)', |
128 | 'libGL.so' | 89 | 'libGL.so' |
129 | ] | 90 | ] |
91 | |||
130 | self.host_pm = RpmPM(d, | 92 | self.host_pm = RpmPM(d, |
131 | self.sdk_host_sysroot, | 93 | self.sdk_host_sysroot, |
132 | sdk_package_archs, | ||
133 | sdk_os, | ||
134 | self.d.getVar('SDK_VENDOR', True), | 94 | self.d.getVar('SDK_VENDOR', True), |
135 | 'host', | 95 | 'host', |
136 | sdk_providename | 96 | sdk_providename, |
97 | "SDK_PACKAGE_ARCHS", | ||
98 | "SDK_OS" | ||
137 | ) | 99 | ) |
138 | 100 | ||
139 | def _populate_sysroot(self, pm, manifest): | 101 | def _populate_sysroot(self, pm, manifest): |