Skip to contentSkip to conversation

update-alternatives.bbclass: Add missing runtime dependency

PATCH Superseded Mark Hatle 2 participants 3 messages Dec 5, 2012 – Dec 6, 2012

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

PATCH v2 3/22 update-alternatives.bbclass: Add missing runtime dependency

When using update-alternatives, there should be a runtime dependency on ${VIRTUAL-RUNTIME_update-alternatives}. Without this, it's possible to get into a situation where the package is not installable.

(If VIRTUAL-RUNTIME_update-alternatives is not defined, no requirement is added.)

---
 meta/classes/update-alternatives.bbclass |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
meta/classes/update-alternatives.bbclass +8 -0
index 4e1ff27..96fd1e8 100644
@@ -304,6 +304,14 @@ python populate_packages_prepend () {
             alt_remove_links += '\tupdate-alternatives --remove  %s %s\n' % (alt_name, alt_target)
 
         if alt_setup_links:
+            # RDEPENDS setup
+            provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives', True)
+            if provider:
+                bb.note('adding runtime requirement for update-alternatives for %s' % pkg)
+                rdepends = d.getVar('RDEPENDS_%s' % pkg, True) or ""
+                rdepends += ' ' + d.getVar('MLPREFIX') + provider
+                d.setVar("RDEPENDS_%s" % pkg, rdepends)
+
             bb.note('adding update-alternatives calls to postinst/postrm for %s' % pkg)
             bb.note('%s' % alt_setup_links)
             postinst = (d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)) or '#!/bin/sh\n'
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 21 lines · Mark Hatle

When using update-alternatives, there should be a runtime dependency on ${VIRTUAL-RUNTIME_update-alternatives}. Without this, it's possible to get into a situation where the package is not installable.

(If VIRTUAL-RUNTIME_update-alternatives is not defined, no requirement is added.)

---
 meta/classes/update-alternatives.bbclass |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
meta/classes/update-alternatives.bbclass +1 -0
index 4e1ff27..96fd1e8 100644
@@ -304,6 +304,14 @@ python populate_packages_prepend () {
             alt_remove_links += '\tupdate-alternatives --remove  %s %s\n' % (alt_name, alt_target)
 
         if alt_setup_links:
+            # RDEPENDS setup

meta/classes/update-alternatives.bbclass python populate_packages_prepend () { · line 317

Quoted 10 lines
meta/classes/update-alternatives.bbclass +7 -0
+            provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives', True)
+            if provider:
+                bb.note('adding runtime requirement for update-alternatives for %s' % pkg)
+                rdepends = d.getVar('RDEPENDS_%s' % pkg, True) or ""
+                rdepends += ' ' + d.getVar('MLPREFIX') + provider
+                d.setVar("RDEPENDS_%s" % pkg, rdepends)
+
             bb.note('adding update-alternatives calls to postinst/postrm for %s' % pkg)
             bb.note('%s' % alt_setup_links)
             postinst = (d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)) or '#!/bin/sh\n'

I'm afraid I don't like this patch. Firstly, do we really need a bb.note in there? We don't note every little thing we do, not least as it would kill performance.

Secondly, why not simply do:

d.appendVar('RDEPENDS_%s' % pkg, ' ' + d.getVar('MLPREFIX') + provider)

?

Cheers,

Richard

author
#2 lore raw
Quoted 20 lines · Richard Purdie
Quoted 19 lines · Mark Hatle

When using update-alternatives, there should be a runtime dependency on ${VIRTUAL-RUNTIME_update-alternatives}. Without this, it's possible to get into a situation where the package is not installable.

(If VIRTUAL-RUNTIME_update-alternatives is not defined, no requirement is added.)

---
  meta/classes/update-alternatives.bbclass |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
meta/classes/update-alternatives.bbclass +0 -0
index 4e1ff27..96fd1e8 100644
@@ -304,6 +304,14 @@ python populate_packages_prepend () {
              alt_remove_links += '\tupdate-alternatives --remove  %s %s\n' % (alt_name, alt_target)
 
Quoted 16 lines

meta/classes/update-alternatives.bbclass python populate_packages_prepend () { · line 317

Quoted 12 lines
meta/classes/update-alternatives.bbclass +8 -0
          if alt_setup_links:
+            # RDEPENDS setup
+            provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives', True)
+            if provider:
+                bb.note('adding runtime requirement for update-alternatives for %s' % pkg)
+                rdepends = d.getVar('RDEPENDS_%s' % pkg, True) or ""
+                rdepends += ' ' + d.getVar('MLPREFIX') + provider
+                d.setVar("RDEPENDS_%s" % pkg, rdepends)
+
              bb.note('adding update-alternatives calls to postinst/postrm for %s' % pkg)
              bb.note('%s' % alt_setup_links)
              postinst = (d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)) or '#!/bin/sh\n'

I'm afraid I don't like this patch. Firstly, do we really need a bb.note in there? We don't note every little thing we do, not least as it would kill performance.

There are very few instances of this, I'm surprised if performance would be impacted beyond the noise. The next item has a similar bb.note as well.

Quoted 3 lines

Secondly, why not simply do:

d.appendVar('RDEPENDS_%s' % pkg, ' ' + d.getVar('MLPREFIX') + provider)

There was originally code in there to remove duplicates, when it got refactored out the rest was never changed. I'll fix that up.

--Mark

Quoted 6 lines

?

Cheers,

Richard