diff options
| author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2017-01-18 15:40:33 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-14 14:42:17 +0000 |
| commit | b9c550dd6e98dc6c79a01ba27937f3c2a9876ee6 (patch) | |
| tree | 205efb847adcbffdf4878ccd7f0f3b0769ec7713 | |
| parent | cf7e0baffae0bbeb021060b0d10fb263a4651f53 (diff) | |
| download | poky-b9c550dd6e98dc6c79a01ba27937f3c2a9876ee6.tar.gz | |
package_manager.py: improve the API for insert_feed_uris()
No need to store the configuration as class members,
just pass it directly into the method.
(From OE-Core rev: a5cc38481be3c5e6ccbecf951f9fdc049e5101d5)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/oe/package_manager.py | 41 | ||||
| -rw-r--r-- | meta/lib/oe/rootfs.py | 5 |
2 files changed, 26 insertions, 20 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 79f0a8b9f1..725997ce33 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
| @@ -513,9 +513,6 @@ class PackageManager(object, metaclass=ABCMeta): | |||
| 513 | self.d = d | 513 | self.d = d |
| 514 | self.deploy_dir = None | 514 | self.deploy_dir = None |
| 515 | self.deploy_lock = None | 515 | self.deploy_lock = None |
| 516 | self.feed_uris = self.d.getVar('PACKAGE_FEED_URIS') or "" | ||
| 517 | self.feed_base_paths = self.d.getVar('PACKAGE_FEED_BASE_PATHS') or "" | ||
| 518 | self.feed_archs = self.d.getVar('PACKAGE_FEED_ARCHS') | ||
| 519 | 516 | ||
| 520 | """ | 517 | """ |
| 521 | Update the package manager package database. | 518 | Update the package manager package database. |
| @@ -555,8 +552,14 @@ class PackageManager(object, metaclass=ABCMeta): | |||
| 555 | def list_installed(self): | 552 | def list_installed(self): |
| 556 | pass | 553 | pass |
| 557 | 554 | ||
| 555 | """ | ||
| 556 | Add remote package feeds into repository manager configuration. The parameters | ||
| 557 | for the feeds are set by feed_uris, feed_base_paths and feed_archs. | ||
| 558 | See http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#var-PACKAGE_FEED_URIS | ||
| 559 | for their description. | ||
| 560 | """ | ||
| 558 | @abstractmethod | 561 | @abstractmethod |
| 559 | def insert_feeds_uris(self): | 562 | def insert_feeds_uris(self, feed_uris, feed_base_paths, feed_archs): |
| 560 | pass | 563 | pass |
| 561 | 564 | ||
| 562 | """ | 565 | """ |
| @@ -691,14 +694,14 @@ class RpmPM(PackageManager): | |||
| 691 | 694 | ||
| 692 | self.ml_prefix_list, self.ml_os_list = self.indexer.get_ml_prefix_and_os_list(arch_var, os_var) | 695 | self.ml_prefix_list, self.ml_os_list = self.indexer.get_ml_prefix_and_os_list(arch_var, os_var) |
| 693 | 696 | ||
| 694 | def insert_feeds_uris(self): | 697 | def insert_feeds_uris(self, feed_uris, feed_base_paths, feed_archs): |
| 695 | if self.feed_uris == "": | 698 | if feed_uris == "": |
| 696 | return | 699 | return |
| 697 | 700 | ||
| 698 | arch_list = [] | 701 | arch_list = [] |
| 699 | if self.feed_archs is not None: | 702 | if feed_archs is not None: |
| 700 | # User define feed architectures | 703 | # User define feed architectures |
| 701 | arch_list = self.feed_archs.split() | 704 | arch_list = feed_archs.split() |
| 702 | else: | 705 | else: |
| 703 | # List must be prefered to least preferred order | 706 | # List must be prefered to least preferred order |
| 704 | default_platform_extra = list() | 707 | default_platform_extra = list() |
| @@ -721,7 +724,7 @@ class RpmPM(PackageManager): | |||
| 721 | continue | 724 | continue |
| 722 | arch_list.append(arch) | 725 | arch_list.append(arch) |
| 723 | 726 | ||
| 724 | feed_uris = self.construct_uris(self.feed_uris.split(), self.feed_base_paths.split()) | 727 | feed_uris = self.construct_uris(feed_uris.split(), feed_base_paths.split()) |
| 725 | 728 | ||
| 726 | uri_iterator = 0 | 729 | uri_iterator = 0 |
| 727 | channel_priority = 10 + 5 * len(feed_uris) * (len(arch_list) if arch_list else 1) | 730 | channel_priority = 10 + 5 * len(feed_uris) * (len(arch_list) if arch_list else 1) |
| @@ -1707,22 +1710,22 @@ class OpkgPM(OpkgDpkgPM): | |||
| 1707 | config_file.write("option info_dir %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR'), 'opkg', 'info')) | 1710 | config_file.write("option info_dir %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR'), 'opkg', 'info')) |
| 1708 | config_file.write("option status_file %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR'), 'opkg', 'status')) | 1711 | config_file.write("option status_file %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR'), 'opkg', 'status')) |
| 1709 | 1712 | ||
| 1710 | def insert_feeds_uris(self): | 1713 | def insert_feeds_uris(self, feed_uris, feed_base_paths, feed_archs): |
| 1711 | if self.feed_uris == "": | 1714 | if feed_uris == "": |
| 1712 | return | 1715 | return |
| 1713 | 1716 | ||
| 1714 | rootfs_config = os.path.join('%s/etc/opkg/base-feeds.conf' | 1717 | rootfs_config = os.path.join('%s/etc/opkg/base-feeds.conf' |
| 1715 | % self.target_rootfs) | 1718 | % self.target_rootfs) |
| 1716 | 1719 | ||
| 1717 | feed_uris = self.construct_uris(self.feed_uris.split(), self.feed_base_paths.split()) | 1720 | feed_uris = self.construct_uris(feed_uris.split(), feed_base_paths.split()) |
| 1718 | archs = self.pkg_archs.split() if self.feed_archs is None else self.feed_archs.split() | 1721 | archs = self.pkg_archs.split() if feed_archs is None else feed_archs.split() |
| 1719 | 1722 | ||
| 1720 | with open(rootfs_config, "w+") as config_file: | 1723 | with open(rootfs_config, "w+") as config_file: |
| 1721 | uri_iterator = 0 | 1724 | uri_iterator = 0 |
| 1722 | for uri in feed_uris: | 1725 | for uri in feed_uris: |
| 1723 | if archs: | 1726 | if archs: |
| 1724 | for arch in archs: | 1727 | for arch in archs: |
| 1725 | if (self.feed_archs is None) and (not os.path.exists(os.path.join(self.deploy_dir, arch))): | 1728 | if (feed_archs is None) and (not os.path.exists(os.path.join(self.deploy_dir, arch))): |
| 1726 | continue | 1729 | continue |
| 1727 | bb.note('Adding opkg feed url-%s-%d (%s)' % | 1730 | bb.note('Adding opkg feed url-%s-%d (%s)' % |
| 1728 | (arch, uri_iterator, uri)) | 1731 | (arch, uri_iterator, uri)) |
| @@ -2111,23 +2114,23 @@ class DpkgPM(OpkgDpkgPM): | |||
| 2111 | if result is not None: | 2114 | if result is not None: |
| 2112 | bb.fatal(result) | 2115 | bb.fatal(result) |
| 2113 | 2116 | ||
| 2114 | def insert_feeds_uris(self): | 2117 | def insert_feeds_uris(self, feed_uris, feed_base_paths, feed_archs): |
| 2115 | if self.feed_uris == "": | 2118 | if feed_uris == "": |
| 2116 | return | 2119 | return |
| 2117 | 2120 | ||
| 2118 | sources_conf = os.path.join("%s/etc/apt/sources.list" | 2121 | sources_conf = os.path.join("%s/etc/apt/sources.list" |
| 2119 | % self.target_rootfs) | 2122 | % self.target_rootfs) |
| 2120 | arch_list = [] | 2123 | arch_list = [] |
| 2121 | 2124 | ||
| 2122 | if self.feed_archs is None: | 2125 | if feed_archs is None: |
| 2123 | for arch in self.all_arch_list: | 2126 | for arch in self.all_arch_list: |
| 2124 | if not os.path.exists(os.path.join(self.deploy_dir, arch)): | 2127 | if not os.path.exists(os.path.join(self.deploy_dir, arch)): |
| 2125 | continue | 2128 | continue |
| 2126 | arch_list.append(arch) | 2129 | arch_list.append(arch) |
| 2127 | else: | 2130 | else: |
| 2128 | arch_list = self.feed_archs.split() | 2131 | arch_list = feed_archs.split() |
| 2129 | 2132 | ||
| 2130 | feed_uris = self.construct_uris(self.feed_uris.split(), self.feed_base_paths.split()) | 2133 | feed_uris = self.construct_uris(feed_uris.split(), feed_base_paths.split()) |
| 2131 | 2134 | ||
| 2132 | with open(sources_conf, "w+") as sources_file: | 2135 | with open(sources_conf, "w+") as sources_file: |
| 2133 | for uri in feed_uris: | 2136 | for uri in feed_uris: |
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index cc111ff3c8..74c643b3b9 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
| @@ -87,7 +87,10 @@ class Rootfs(object, metaclass=ABCMeta): | |||
| 87 | def _insert_feed_uris(self): | 87 | def _insert_feed_uris(self): |
| 88 | if bb.utils.contains("IMAGE_FEATURES", "package-management", | 88 | if bb.utils.contains("IMAGE_FEATURES", "package-management", |
| 89 | True, False, self.d): | 89 | True, False, self.d): |
| 90 | self.pm.insert_feeds_uris() | 90 | self.pm.insert_feeds_uris(self.d.getVar('PACKAGE_FEED_URIS') or "", |
| 91 | self.d.getVar('PACKAGE_FEED_BASE_PATHS') or "", | ||
| 92 | self.d.getVar('PACKAGE_FEED_ARCHS')) | ||
| 93 | |||
| 91 | 94 | ||
| 92 | @abstractmethod | 95 | @abstractmethod |
| 93 | def _handle_intercept_failure(self, failed_script): | 96 | def _handle_intercept_failure(self, failed_script): |
