The PACKAGE_FEED_ARCHS is highly related to ALL_MULTILIB_PACKAGE_ARCHS, set it
automatically is better than manually, for example, we may forget to upgrade
PACKAGE_FEED_ARCHS when ALL_MULTILIB_PACKAGE_ARCHS is changed if set it
manually.

The workflow is:
Use PACKAGE_FEED_ARCHS if it is defined, if not, check DEPLOY_DIR_XXX/<arch>, 
add
<arch> to PACKAGE_FEED_ARCHS if it exists.

Signed-off-by: Robert Yang <[email protected]>
---
 meta/lib/oe/rootfs.py | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 890ba5f039..f26b66ba7a 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -89,12 +89,36 @@ class Rootfs(object, metaclass=ABCMeta):
     def _log_check_error(self):
         self._log_check_common('error', self.log_check_regex)
 
+    def _get_feed_archs(self):
+        feed_archs = self.d.getVar('PACKAGE_FEED_ARCHS') or ''
+        if not feed_archs:
+            bb.note("  Figuring PACKAGE_FEED_ARCHS from 
ALL_MULTILIB_PACKAGE_ARCHS")
+            manager = self.d.getVar('ROOTFS_PKGMANAGE')
+            deploy_dir = ''
+            if 'rpm' in manager:
+                deploy_dir = self.d.getVar('DEPLOY_DIR_RPM')
+            elif 'opkg' in manager:
+                deploy_dir = self.d.getVar('DEPLOY_DIR_IPK')
+            elif 'dpkg' in manager:
+                deploy_dir = self.d.getVar('DEPLOY_DIR_DEB')
+            else:
+                bb.warn('Failed to figure out deploy_dir')
+                return ''
+
+            for arch in self.d.getVar('ALL_MULTILIB_PACKAGE_ARCHS').split():
+                if 'rpm' in manager:
+                    arch = arch.replace("-", "_")
+                arch_path = os.path.join(deploy_dir, arch)
+                if os.path.exists(arch_path):
+                    feed_archs += " %s" % arch
+        return feed_archs.strip()
+
     def _insert_feed_uris(self):
         if bb.utils.contains("IMAGE_FEATURES", "package-management",
                          True, False, self.d):
             self.pm.insert_feeds_uris(self.d.getVar('PACKAGE_FEED_URIS') or "",
                 self.d.getVar('PACKAGE_FEED_BASE_PATHS') or "",
-                self.d.getVar('PACKAGE_FEED_ARCHS'))
+                self._get_feed_archs())
 
 
     """
-- 
2.39.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#177127): 
https://lists.openembedded.org/g/openembedded-core/message/177127
Mute This Topic: https://lists.openembedded.org/mt/96955951/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to