diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2014-02-05 11:08:34 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-11 11:53:44 +0000 |
commit | f4fa44cf914dc504709eb8c302566429071f2b80 (patch) | |
tree | 13462d94fe54df0f8d5d97075626fcdfd6b6bbb5 /meta/lib | |
parent | ab8cbf35d6d9906e72ebc25d18f19a1f3dc82fd9 (diff) | |
download | poky-f4fa44cf914dc504709eb8c302566429071f2b80.tar.gz |
rootfs.py, package_manager.py, sdk.py: Fix building from feeds feature for opkg
When using opkg as the PM backend, one has the option to provide custom
feeds to create the rootfs from.
This commit:
* fixes this in the refactored code;
* moves the custom config creation code to python;
* clean up the package-ipk.bbclass;
(From OE-Core rev: 19c538f57c8fa7c566e88a6dbe13ea4826d4f26c)
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 | 47 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 5 | ||||
-rw-r--r-- | meta/lib/oe/sdk.py | 4 |
3 files changed, 51 insertions, 5 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 969292c093..d3e8a0885b 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -805,7 +805,10 @@ class OpkgPM(PackageManager): | |||
805 | 805 | ||
806 | bb.utils.mkdirhier(self.opkg_dir) | 806 | bb.utils.mkdirhier(self.opkg_dir) |
807 | 807 | ||
808 | self._create_config() | 808 | if (self.d.getVar('BUILD_IMAGES_FROM_FEEDS', True) or "") != "1": |
809 | self._create_config() | ||
810 | else: | ||
811 | self._create_custom_config() | ||
809 | 812 | ||
810 | """ | 813 | """ |
811 | This function will change a package's status in /var/lib/opkg/status file. | 814 | This function will change a package's status in /var/lib/opkg/status file. |
@@ -835,6 +838,45 @@ class OpkgPM(PackageManager): | |||
835 | 838 | ||
836 | os.rename(status_file + ".tmp", status_file) | 839 | os.rename(status_file + ".tmp", status_file) |
837 | 840 | ||
841 | def _create_custom_config(self): | ||
842 | bb.note("Building from feeds activated!") | ||
843 | |||
844 | with open(self.config_file, "w+") as config_file: | ||
845 | priority = 1 | ||
846 | for arch in self.pkg_archs.split(): | ||
847 | config_file.write("arch %s %d\n" % (arch, priority)) | ||
848 | priority += 5 | ||
849 | |||
850 | for line in (self.d.getVar('IPK_FEED_URIS', True) or "").split(): | ||
851 | feed_match = re.match("^[ \t]*(.*)##([^ \t]*)[ \t]*$", line) | ||
852 | |||
853 | if feed_match is not None: | ||
854 | feed_name = feed_match.group(1) | ||
855 | feed_uri = feed_match.group(2) | ||
856 | |||
857 | bb.note("Add %s feed with URL %s" % (feed_name, feed_uri)) | ||
858 | |||
859 | config_file.write("src/gz %s %s\n" % (feed_name, feed_uri)) | ||
860 | |||
861 | """ | ||
862 | Allow to use package deploy directory contents as quick devel-testing | ||
863 | feed. This creates individual feed configs for each arch subdir of those | ||
864 | specified as compatible for the current machine. | ||
865 | NOTE: Development-helper feature, NOT a full-fledged feed. | ||
866 | """ | ||
867 | if (self.d.getVar('FEED_DEPLOYDIR_BASE_URI', True) or "") != "": | ||
868 | for arch in self.pkg_archs.split(): | ||
869 | cfg_file_name = os.path.join(self.target_rootfs, | ||
870 | self.d.getVar("sysconfdir", True), | ||
871 | "opkg", | ||
872 | "local-%s-feed.conf" % arch) | ||
873 | |||
874 | with open(cfg_file_name, "w+") as cfg_file: | ||
875 | cfg_file.write("src/gz local-%s %s/%s" % | ||
876 | arch, | ||
877 | self.d.getVar('FEED_DEPLOYDIR_BASE_URI', True), | ||
878 | arch) | ||
879 | |||
838 | def _create_config(self): | 880 | def _create_config(self): |
839 | with open(self.config_file, "w+") as config_file: | 881 | with open(self.config_file, "w+") as config_file: |
840 | priority = 1 | 882 | priority = 1 |
@@ -847,7 +889,8 @@ class OpkgPM(PackageManager): | |||
847 | for arch in self.pkg_archs.split(): | 889 | for arch in self.pkg_archs.split(): |
848 | pkgs_dir = os.path.join(self.deploy_dir, arch) | 890 | pkgs_dir = os.path.join(self.deploy_dir, arch) |
849 | if os.path.isdir(pkgs_dir): | 891 | if os.path.isdir(pkgs_dir): |
850 | config_file.write("src oe-%s file:%s\n" % (arch, pkgs_dir)) | 892 | config_file.write("src oe-%s file:%s\n" % |
893 | (arch, pkgs_dir)) | ||
851 | 894 | ||
852 | def update(self): | 895 | def update(self): |
853 | self.deploy_dir_lock() | 896 | self.deploy_dir_lock() |
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 95c275875f..7455a865a4 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -534,8 +534,9 @@ class OpkgRootfs(Rootfs): | |||
534 | opkg_post_process_cmds = self.d.getVar('OPKG_POSTPROCESS_COMMANDS', True) | 534 | opkg_post_process_cmds = self.d.getVar('OPKG_POSTPROCESS_COMMANDS', True) |
535 | rootfs_post_install_cmds = self.d.getVar('ROOTFS_POSTINSTALL_COMMAND', True) | 535 | rootfs_post_install_cmds = self.d.getVar('ROOTFS_POSTINSTALL_COMMAND', True) |
536 | 536 | ||
537 | # update PM index files | 537 | # update PM index files, unless users provide their own feeds |
538 | self.pm.write_index() | 538 | if (self.d.getVar('BUILD_IMAGES_FROM_FEEDS', True) or "") != "1": |
539 | self.pm.write_index() | ||
539 | 540 | ||
540 | execute_pre_post_process(self.d, opkg_pre_process_cmds) | 541 | execute_pre_post_process(self.d, opkg_pre_process_cmds) |
541 | 542 | ||
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py index b54e51697c..518076e75d 100644 --- a/meta/lib/oe/sdk.py +++ b/meta/lib/oe/sdk.py | |||
@@ -216,7 +216,9 @@ class OpkgSdk(Sdk): | |||
216 | def _populate_sysroot(self, pm, manifest): | 216 | def _populate_sysroot(self, pm, manifest): |
217 | pkgs_to_install = manifest.parse_initial_manifest() | 217 | pkgs_to_install = manifest.parse_initial_manifest() |
218 | 218 | ||
219 | pm.write_index() | 219 | if (self.d.getVar('BUILD_IMAGES_FROM_FEEDS', True) or "") != "1": |
220 | pm.write_index() | ||
221 | |||
220 | pm.update() | 222 | pm.update() |
221 | 223 | ||
222 | for pkg_type in self.install_order: | 224 | for pkg_type in self.install_order: |