[2/2] package_manager.py: RpmPM: don't add smart channel if already added

Submitted by Laurentiu Palcu on March 3, 2014, 9:43 a.m.

Details

Message ID bb06f92710d0567d5019cf13d6c11caa1fc91d32.1393839480.git.laurentiu.palcu@intel.com
State Accepted
Commit 0574f5390fb8958db5864f41a7bd8037ac046ac5
Headers show

Commit Message

Laurentiu Palcu March 3, 2014, 9:43 a.m.
Make sure the channel was not already added, before attempting to add.

[YOCTO #5890]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/lib/oe/package_manager.py |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 6c133c3..ee42952 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -604,11 +604,11 @@  class RpmPM(PackageManager):
         # self._invoke_smart('config --set rpm-log-level=debug')
         # cmd = 'config --set rpm-log-file=/tmp/smart-debug-logfile'
         # self._invoke_smart(cmd)
-
+        ch_already_added = []
         for canonical_arch in platform_extra:
             arch = canonical_arch.split('-')[0]
             arch_channel = os.path.join(self.deploy_dir, arch)
-            if os.path.exists(arch_channel):
+            if os.path.exists(arch_channel) and not arch in ch_already_added:
                 bb.note('Note: adding Smart channel %s (%s)' %
                         (arch, channel_priority))
                 self._invoke_smart('channel --add %s type=rpm-md baseurl=%s -y'
@@ -617,6 +617,8 @@  class RpmPM(PackageManager):
                                    (arch, channel_priority))
                 channel_priority -= 5
 
+                ch_already_added.append(arch)
+
         bb.note('adding Smart RPM DB channel')
         self._invoke_smart('channel --add rpmsys type=rpm-sys -y')
 

Comments

Mark Hatle March 3, 2014, 3:02 p.m.
On 3/3/14, 3:43 AM, Laurentiu Palcu wrote:
> Make sure the channel was not already added, before attempting to add.
>
> [YOCTO #5890]

When generating the rootfs/etc/rpm/platform file, the order should be in the 
order of highest to lowest priority as well.

Smart uses this order (via an RPM API) to help determine scores when two 
packages from repositories at the same priority (with different architectures) 
are selected.

--Mark

> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> ---
>   meta/lib/oe/package_manager.py |    6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
> index 6c133c3..ee42952 100644
> --- a/meta/lib/oe/package_manager.py
> +++ b/meta/lib/oe/package_manager.py
> @@ -604,11 +604,11 @@ class RpmPM(PackageManager):
>           # self._invoke_smart('config --set rpm-log-level=debug')
>           # cmd = 'config --set rpm-log-file=/tmp/smart-debug-logfile'
>           # self._invoke_smart(cmd)
> -
> +        ch_already_added = []
>           for canonical_arch in platform_extra:
>               arch = canonical_arch.split('-')[0]
>               arch_channel = os.path.join(self.deploy_dir, arch)
> -            if os.path.exists(arch_channel):
> +            if os.path.exists(arch_channel) and not arch in ch_already_added:
>                   bb.note('Note: adding Smart channel %s (%s)' %
>                           (arch, channel_priority))
>                   self._invoke_smart('channel --add %s type=rpm-md baseurl=%s -y'
> @@ -617,6 +617,8 @@ class RpmPM(PackageManager):
>                                      (arch, channel_priority))
>                   channel_priority -= 5
>
> +                ch_already_added.append(arch)
> +
>           bb.note('adding Smart RPM DB channel')
>           self._invoke_smart('channel --add rpmsys type=rpm-sys -y')
>
>
Laurentiu Palcu March 3, 2014, 3:42 p.m.
Hi Mark,

On Mon, Mar 03, 2014 at 09:02:35AM -0600, Mark Hatle wrote:
> On 3/3/14, 3:43 AM, Laurentiu Palcu wrote:
> >Make sure the channel was not already added, before attempting to add.
> >
> >[YOCTO #5890]
> 
> When generating the rootfs/etc/rpm/platform file, the order should
> be in the order of highest to lowest priority as well.
> 
> Smart uses this order (via an RPM API) to help determine scores when
> two packages from repositories at the same priority (with different
> architectures) are selected.
Thanks for the info. This patchset should restore the behavior to the
one you describe. Python's sets messed up the order, so I reverted that
patch.

laurentiu
> 
> --Mark
> 
> >Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> >---
> >  meta/lib/oe/package_manager.py |    6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> >diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
> >index 6c133c3..ee42952 100644
> >--- a/meta/lib/oe/package_manager.py
> >+++ b/meta/lib/oe/package_manager.py
> >@@ -604,11 +604,11 @@ class RpmPM(PackageManager):
> >          # self._invoke_smart('config --set rpm-log-level=debug')
> >          # cmd = 'config --set rpm-log-file=/tmp/smart-debug-logfile'
> >          # self._invoke_smart(cmd)
> >-
> >+        ch_already_added = []
> >          for canonical_arch in platform_extra:
> >              arch = canonical_arch.split('-')[0]
> >              arch_channel = os.path.join(self.deploy_dir, arch)
> >-            if os.path.exists(arch_channel):
> >+            if os.path.exists(arch_channel) and not arch in ch_already_added:
> >                  bb.note('Note: adding Smart channel %s (%s)' %
> >                          (arch, channel_priority))
> >                  self._invoke_smart('channel --add %s type=rpm-md baseurl=%s -y'
> >@@ -617,6 +617,8 @@ class RpmPM(PackageManager):
> >                                     (arch, channel_priority))
> >                  channel_priority -= 5
> >
> >+                ch_already_added.append(arch)
> >+
> >          bb.note('adding Smart RPM DB channel')
> >          self._invoke_smart('channel --add rpmsys type=rpm-sys -y')
> >
> >
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core