Skip to contentSkip to conversation

Fix update-alternatives and RPM package dependencies

PATCH In review Mark Hatle 6 participants 26 messages Apr 16, 2012 – Apr 27, 2012

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

cover Fix update-alternatives and RPM package dependencies

It was recently noticed that many packages that use update-alternatives were not setting package level provides. So a package that required /usr/bin/env would not be satisfied by coreutils, even though it had a /usr/bin/env alternative.

The first patch in the series adds the enhanced alternatives capatibilities.

The patches that follow resolve Yocto defect 2289 and use these new capabilities to ensure the produced packages are correct.

(Note, this only affects RPM packages as they have enhanced dependency scanning and resolution compared to deb and ipk.)

These patches were tested by running a core-image-minimal build on both qemux86 and qemumips. I also ran a core-image-sato on qemux86 and built each of the items affected manually. Once build, I verified the install time scriptlets were correct and each package provided the correct "Provides".

The following changes since commit 03cfc6ea6df9d1fbf5520c9707a725e38d2e377b:

libzypp: add libproxy to DEPENDS (2012-04-16 23:30:41 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib mhatle/upd-alt
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=mhatle/upd-alt

Mark Hatle (17):
update-alternatives.bbclass: Ensure alternatives end up in per file
deps
coreutils_*.bb: Use update alternatives and add missing manual alt
links
coreutils_*.bb: Sync up file path with busybox and minor cleanup
grep: Use update-alternatives
openssh: Use update-alternatives
hdparm: Use update-alternatives
iputils: Use update-alternatives
net-tools: Use update-alternatives
shadow: Use update-alternatives
findutils: Use update-alternatives
gzip: Use update-alternatives class
module-init-tools: Update to use update-alternatives class
kbd: Use update-alternatives
console-tools: Use update-alternatives
sysvinit: Use update-alternatives in a different way
lrzsz: sz, sx and sb were linked incorrectly
lrzsz: Use update-alternatives to set provides

 meta/classes/package.bbclass                       |   16 +++--
 meta/classes/package_rpm.bbclass                   |    4 -
 meta/classes/update-alternatives.bbclass           |   69 +++++++++++++++++++-
 meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb            |   21 +++++-
 meta/recipes-connectivity/openssh/openssh_5.9p1.bb |    9 ++-
 .../console-tools/console-tools_0.3.2.bb           |   27 ++------
 meta/recipes-core/coreutils/coreutils_6.9.bb       |   44 ++++++-------
 meta/recipes-core/coreutils/coreutils_8.14.bb      |   49 +++++---------
 meta/recipes-core/kbd/kbd_1.15.2.bb                |   34 ++--------
 meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb     |   44 ++++---------
 meta/recipes-extended/findutils/findutils.inc      |    5 +-
 .../recipes-extended/findutils/findutils_4.2.31.bb |   22 ++-----
 meta/recipes-extended/findutils/findutils_4.4.2.bb |   17 +-----
 meta/recipes-extended/grep/grep_2.5.1a.bb          |   25 +++-----
 meta/recipes-extended/grep/grep_2.9.bb             |   22 ++----
 meta/recipes-extended/gzip/gzip.inc                |   32 +++-------
 meta/recipes-extended/gzip/gzip_1.3.12.bb          |   24 ++-----
 meta/recipes-extended/gzip/gzip_1.4.bb             |    2 +-
 meta/recipes-extended/hdparm/hdparm_9.39.bb        |   16 ++---
 meta/recipes-extended/iputils/iputils_s20101006.bb |    5 +-
 .../net-tools/net-tools_1.60-23.bb                 |   28 +++------
 meta/recipes-extended/shadow/shadow_4.1.4.3.bb     |   42 ++++++------
 .../module-init-tools/module-init-tools_3.16.bb    |   35 ++++++----
 23 files changed, 267 insertions(+), 325 deletions(-)
Signature · 1 line
1.7.3.4
author
#1 lore raw

PATCH 1/17 update-alternatives.bbclass: Ensure alternatives end up in per file deps

Ensure that alternatives end up in per file provides, associated with the source of the alternative.

Add a way to specify MANUAL_ALTERNATIVE_LINKS in order for programs that manage their own alternatives to be more easily added to the per file provides.

Add a function, package_do_filedeps_append to handle the setup of these automatic per file dependencies. The method is based on the code in the busybox package that does similar work. It replaces the brute force RPM method that just adds a "Provides:" for each alternative.

Add a check before moving the item to see if the destination already exists, if it does, assume the package already performed the rename. This is necessary to deal with some packages that have symlinks pointing to renamed items.

---
 meta/classes/package.bbclass             |   16 ++++---
 meta/classes/package_rpm.bbclass         |    4 --
 meta/classes/update-alternatives.bbclass |   69 +++++++++++++++++++++++++++++-
 3 files changed, 77 insertions(+), 12 deletions(-)
meta/classes/package.bbclass +10 -6
index c3f077a..99c945d 100644
@@ -1162,6 +1162,15 @@ python package_do_filedeps() {
 	rpmdeps = d.expand("${RPMDEPS}")
 	r = re.compile(r'[<>=]+ +[^ ]*')
 
+	def file_translate(file):
+		ft = file.replace("@", "@at@")
+		ft = ft.replace(" ", "@space@")
+		ft = ft.replace("\t", "@tab@")
+		ft = ft.replace("[", "@openbrace@")
+		ft = ft.replace("]", "@closebrace@")
+		ft = ft.replace("_", "@underscore@")
+		return ft
+
 	# Quick routine to process the results of the rpmdeps call...
 	def process_deps(pipe, pkg, provides_files, requires_files):
 		provides = {}
@@ -1179,12 +1188,7 @@ python package_do_filedeps() {
 				continue
 
 			file = f.replace(pkgdest + "/" + pkg, "")
-			file = file.replace("@", "@at@")
-			file = file.replace(" ", "@space@")
-			file = file.replace("\t", "@tab@")
-			file = file.replace("[", "@openbrace@")
-			file = file.replace("]", "@closebrace@")
-			file = file.replace("_", "@underscore@")
+			file = file_translate(file)
 			value = line.split(":", 1)[1].strip()
 			value = r.sub(r'(\g<0>)', value)
 
meta/classes/package_rpm.bbclass +0 -4
index ffe3b31..30bb08b 100644
@@ -720,10 +720,6 @@ python write_specfile () {
 		splitrconflicts  = strip_multilib(localdata.getVar('RCONFLICTS', True), d) or ""
 		splitrobsoletes  = []
 
-		# For now we need to manually supplement RPROVIDES with any update-alternatives links
-		if pkg == d.getVar("PN", True):
-			splitrprovides = splitrprovides + " " + (d.getVar('ALTERNATIVE_LINK', True) or '') + " " + (d.getVar('ALTERNATIVE_LINKS', True) or '')
-
 		# Gather special src/first package data
 		if srcname == splitname:
 			srcrdepends    = splitrdepends
meta/classes/update-alternatives.bbclass +67 -2

93 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#2 lore raw

Re: [PATCH 01/17] update-alternatives.bbclass: Ensure alternatives end up in per file deps

Quoted 99 lines · Mark Hatle

Ensure that alternatives end up in per file provides, associated with the source of the alternative.

Add a way to specify MANUAL_ALTERNATIVE_LINKS in order for programs that manage their own alternatives to be more easily added to the per file provides.

Add a function, package_do_filedeps_append to handle the setup of these automatic per file dependencies. The method is based on the code in the busybox package that does similar work. It replaces the brute force RPM method that just adds a "Provides:" for each alternative.

Add a check before moving the item to see if the destination already exists, if it does, assume the package already performed the rename. This is necessary to deal with some packages that have symlinks pointing to renamed items.

---
 meta/classes/package.bbclass             |   16 ++++---
 meta/classes/package_rpm.bbclass         |    4 --
 meta/classes/update-alternatives.bbclass |   69 +++++++++++++++++++++++++++++-
 3 files changed, 77 insertions(+), 12 deletions(-)
meta/classes/package.bbclass +10 -6
index c3f077a..99c945d 100644
@@ -1162,6 +1162,15 @@ python package_do_filedeps() {
 	rpmdeps = d.expand("${RPMDEPS}")
 	r = re.compile(r'[<>=]+ +[^ ]*')
 
+	def file_translate(file):
+		ft = file.replace("@", "@at@")
+		ft = ft.replace(" ", "@space@")
+		ft = ft.replace("\t", "@tab@")
+		ft = ft.replace("[", "@openbrace@")
+		ft = ft.replace("]", "@closebrace@")
+		ft = ft.replace("_", "@underscore@")
+		return ft
+
 	# Quick routine to process the results of the rpmdeps call...
 	def process_deps(pipe, pkg, provides_files, requires_files):
 		provides = {}
@@ -1179,12 +1188,7 @@ python package_do_filedeps() {
 				continue
 
 			file = f.replace(pkgdest + "/" + pkg, "")
-			file = file.replace("@", "@at@")
-			file = file.replace(" ", "@space@")
-			file = file.replace("\t", "@tab@")
-			file = file.replace("[", "@openbrace@")
-			file = file.replace("]", "@closebrace@")
-			file = file.replace("_", "@underscore@")
+			file = file_translate(file)
 			value = line.split(":", 1)[1].strip()
 			value = r.sub(r'(\g<0>)', value)
 
meta/classes/package_rpm.bbclass +0 -4
index ffe3b31..30bb08b 100644
@@ -720,10 +720,6 @@ python write_specfile () {
 		splitrconflicts  = strip_multilib(localdata.getVar('RCONFLICTS', True), d) or ""
 		splitrobsoletes  = []
 
-		# For now we need to manually supplement RPROVIDES with any update-alternatives links
-		if pkg == d.getVar("PN", True):
-			splitrprovides = splitrprovides + " " + (d.getVar('ALTERNATIVE_LINK', True) or '') + " " + (d.getVar('ALTERNATIVE_LINKS', True) or '')
-
 		# Gather special src/first package data
 		if srcname == splitname:
 			srcrdepends    = splitrdepends
meta/classes/update-alternatives.bbclass +9 -1
index 7b0518d..85733f7 100644
@@ -35,10 +35,18 @@
 #
 # If above assumption breaks your requirement, then you still need to use
 # your own update-alternatives command directly.
+#
+# Even if you specify your update-alternatives manually, you need to
+# use MANUAL_ALTERNATIVE_LINKS to specify each of the target linked items.
+# This ensures that package dependencies/provides are set appropriately.
+#
+# MANUAL_ALTERNATIVE_LINKS = "<target>:<source>"
+#
+# If no source is specified, it is assumed to be <target>.${PN}
 
 # defaults
 ALTERNATIVE_PRIORITY = "10"
-ALTERNATIVE_LINK = "${bindir}/${ALTERNATIVE_NAME}"
+ALTERNATIVE_LINK = "${@['${bindir}/' + (d.getVar('ALTERNATIVE_NAME') or ""), ''][d.getVar('ALTERNATIVE_NAME') != None]}"
 
 update_alternatives_postinst() {
 update-alternatives --install ${ALTERNATIVE_LINK} ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} ${ALTERNATIVE_PRIORITY}
@@ -71,7 +79,11 @@ done
 update_alternatives_batch_doinstall() {

meta/classes/update-alternatives.bbclass done · line 88

Quoted 10 lines
meta/classes/update-alternatives.bbclass +5 -1
 	for link in ${ALTERNATIVE_LINKS}
 	do
-		mv ${D}${link} ${D}${link}.${PN}
+		# Only do this if not already done..
+		# There are a few cases where a package will do this manually
+		if [ ! -e ${D}${link}.${PN} ]; then
+			mv ${D}${link} ${D}${link}.${PN}
+		fi
 	done
 }

We have cases where the recipe does this yet calls in here?

I'd rather stop packages doing this manually...

meta/classes/update-alternatives.bbclass def update_alternatives_after_parse(d): · line 102

Quoted 8 lines
meta/classes/update-alternatives.bbclass +3 -0
@@ -85,6 +97,9 @@ def update_alternatives_after_parse(d):
         d.setVar('do_install', doinstall)
         return
 
+    if d.getVar('MANUAL_ALTERNATIVE_LINKS') != None:
+	return
+

Presumably this is the problem case above? Do any of these really want/need the do_install addition?

Quoted 47 lines
meta/classes/update-alternatives.bbclass +40 -0
     if d.getVar('ALTERNATIVE_NAME') == None:
         raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % d.getVar('FILE')
     if d.getVar('ALTERNATIVE_PATH') == None:
@@ -114,3 +129,53 @@ python populate_packages_prepend () {
 		postrm += d.getVar('update_alternatives_postrm', True)
 	d.setVar('pkg_postrm_%s' % pkg, postrm)
 }
+
+python package_do_filedeps_append () {
+	# We need to load the provides for each manually updated alternative
+	# This function sets up the provides only, it's up to the pkg_postinst
+	# to setup the actual links...
+
+	alt_links = ""
+
+	if d.getVar('ALTERNATIVE_PATH', True) and d.getVar('ALTERNATIVE_LINK', True):
+		alt_target = d.getVar('ALTERNATIVE_LINK', True)
+		alt_source = d.getVar('ALTERNATIVE_PATH', True)
+		if alt_source[0] != '/':
+			alt_source = os.path.dirname(alt_target) + '/' + alt_source
+		alt_links += " " + alt_target + ":" + alt_source
+
+	alt_links += " " + (d.getVar('ALTERNATIVE_LINKS', True) or "")
+	alt_links += " " + (d.getVar('MANUAL_ALTERNATIVE_LINKS', True) or "")
+
+	if alt_links and alt_links.strip() != "":
+		pn = d.getVar('PN', True)
+
+		for alt_target in alt_links.split():
+			# Generate the filename we need to set the dependency in
+			if ':' in alt_target:
+				alt_source = alt_target.split(':')[1]
+				alt_target = alt_target.split(':')[0]
+			else:
+				alt_source = alt_target + '.' + pn
+
+			bb.note('%s: Adding alternative provide %s' % (alt_source, alt_target))
+
+			# Add the new dependency into the file rprovide
+			# Since we don't know which split owns this, set it in all of them
+			# this should not cause any issues by doing so...
+			for split_pn in d.getVar('PACKAGES', True).split():
+				# Match the original function skip routine
+				if split_pn.endswith('-dbg') or split_pn.endswith('-doc') or split_pn.find('-locale-') != -1 or split_pn.find('-localedata-') != -1 or split_pn.find('-gconv-') != -1 or split_pn.find('-charmap-') != -1 or split_pn.startswith('kernel-module-'):
+					continue
+
+				ft_alt_source = file_translate(alt_source)

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

Quoted 10 lines
meta/classes/update-alternatives.bbclass +10 -0
+				filerprovides = d.getVar('FILERPROVIDES_%s_%s' % (ft_alt_source, split_pn), True) or ""
+				filerprovides += " " + alt_target
+				d.setVar('FILERPROVIDES_%s_%s' % (ft_alt_source, split_pn), filerprovides)
+
+				# Make sure there is an entry for this item in the FILERPROVIDESFLIST...
+				filerprovidesflist = (d.getVar('FILERPROVIDESFLIST_%s' % split_pn, True) or "").split()
+				if ft_alt_source not in filerprovidesflist:
+					filerprovidesflist.append(ft_alt_source)
+				d.setVar('FILERPROVIDESFLIST_%s' % split_pn, " ".join(filerprovidesflist))
+}

I'm not sure I like this code style. How about:

python package_do_filedeps_append () {
# We need to load the provides for each manually updated alternative # This function sets up the provides only, it's up to the pkg_postinst # to setup the actual links...

alt_links = {}

target = d.getVar('ALTERNATIVE_LINK', True)
source = d.getVar('ALTERNATIVE_PATH', True)
if target and source:
if source[0] != '/':
source = os.path.dirname(target) + '/' + source
alt_links[source] = target

pn = d.getVar('PN', True)
links = ((d.getVar('ALTERNATIVE_LINKS', True) or "") + " " + (d.getVar('MANUAL_ALTERNATIVE_LINKS', True) or "")).split() for target in links:
# Generate the filename we need to set the dependency in
if ':' in target:
source = target.split(':')[1]
target = target.split(':')[0]
else:
source = target + '.' + pn
alt_links[source] = target

pkgdest = d.getVar('PKGDEST', True)
for link in alt_links:
source = file_translate(link)
target = alt_links[link]

for pkg in d.getVar('PACKAGES', True).split():
if not os.path.exists(os.path.join(pkgdest, pkg, target)):
continue

bb.note('%s: Adding alternative provide %s to package %s' % (source, target, pkg))

d.appendVar('FILERPROVIDES_%s_%s' % (source, pkg), " " + target) if not source in (d.getVar('FILERPROVIDESFLIST_%s' % pkg, True) or "").split():
d.appendVar('FILERPROVIDESFLIST_%s' % pkg, " " + source)
}

which as well as being slightly easier to read (IMO), ditches the package endings check since that was only there for performance in the other function and also checks which package contains the target file rather than just adding to them all. I've not tested the code above.

I have to say that changes like this at -rc4 in a release cycle are not a good idea and I'm not sure this patchset will make it into the release as a result.

Cheers,

Richard

author
#3 lore raw

Re: [PATCH 01/17] update-alternatives.bbclass: Ensure alternatives end up in per file deps

Quoted 113 lines · Richard Purdie
Quoted 99 lines · Mark Hatle

Ensure that alternatives end up in per file provides, associated with the source of the alternative.

Add a way to specify MANUAL_ALTERNATIVE_LINKS in order for programs that manage their own alternatives to be more easily added to the per file provides.

Add a function, package_do_filedeps_append to handle the setup of these automatic per file dependencies. The method is based on the code in the busybox package that does similar work. It replaces the brute force RPM method that just adds a "Provides:" for each alternative.

Add a check before moving the item to see if the destination already exists, if it does, assume the package already performed the rename. This is necessary to deal with some packages that have symlinks pointing to renamed items.

---
  meta/classes/package.bbclass             |   16 ++++---
  meta/classes/package_rpm.bbclass         |    4 --
  meta/classes/update-alternatives.bbclass |   69 +++++++++++++++++++++++++++++-
  3 files changed, 77 insertions(+), 12 deletions(-)
meta/classes/package.bbclass +10 -6
index c3f077a..99c945d 100644
@@ -1162,6 +1162,15 @@ python package_do_filedeps() {
  	rpmdeps = d.expand("${RPMDEPS}")
  	r = re.compile(r'[<>=]+ +[^ ]*')
 
+	def file_translate(file):
+		ft = file.replace("@", "@at@")
+		ft = ft.replace(" ", "@space@")
+		ft = ft.replace("\t", "@tab@")
+		ft = ft.replace("[", "@openbrace@")
+		ft = ft.replace("]", "@closebrace@")
+		ft = ft.replace("_", "@underscore@")
+		return ft
+
  	# Quick routine to process the results of the rpmdeps call...
  	def process_deps(pipe, pkg, provides_files, requires_files):
  		provides = {}
@@ -1179,12 +1188,7 @@ python package_do_filedeps() {
  				continue
 
  			file = f.replace(pkgdest + "/" + pkg, "")
-			file = file.replace("@", "@at@")
-			file = file.replace(" ", "@space@")
-			file = file.replace("\t", "@tab@")
-			file = file.replace("[", "@openbrace@")
-			file = file.replace("]", "@closebrace@")
-			file = file.replace("_", "@underscore@")
+			file = file_translate(file)
  			value = line.split(":", 1)[1].strip()
  			value = r.sub(r'(\g<0>)', value)
 
meta/classes/package_rpm.bbclass +0 -4
index ffe3b31..30bb08b 100644
@@ -720,10 +720,6 @@ python write_specfile () {
  		splitrconflicts  = strip_multilib(localdata.getVar('RCONFLICTS', True), d) or ""
  		splitrobsoletes  = []
 
-		# For now we need to manually supplement RPROVIDES with any update-alternatives links
-		if pkg == d.getVar("PN", True):
-			splitrprovides = splitrprovides + " " + (d.getVar('ALTERNATIVE_LINK', True) or '') + " " + (d.getVar('ALTERNATIVE_LINKS', True) or '')
-
  		# Gather special src/first package data
  		if srcname == splitname:
  			srcrdepends    = splitrdepends
meta/classes/update-alternatives.bbclass +9 -1
index 7b0518d..85733f7 100644
@@ -35,10 +35,18 @@
  #
  # If above assumption breaks your requirement, then you still need to use
  # your own update-alternatives command directly.
+#
+# Even if you specify your update-alternatives manually, you need to
+# use MANUAL_ALTERNATIVE_LINKS to specify each of the target linked items.
+# This ensures that package dependencies/provides are set appropriately.
+#
+# MANUAL_ALTERNATIVE_LINKS = "<target>:<source>"
+#
+# If no source is specified, it is assumed to be<target>.${PN}
 
  # defaults
  ALTERNATIVE_PRIORITY = "10"
-ALTERNATIVE_LINK = "${bindir}/${ALTERNATIVE_NAME}"
+ALTERNATIVE_LINK = "${@['${bindir}/' + (d.getVar('ALTERNATIVE_NAME') or ""), ''][d.getVar('ALTERNATIVE_NAME') != None]}"
 
  update_alternatives_postinst() {
  update-alternatives --install ${ALTERNATIVE_LINK} ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} ${ALTERNATIVE_PRIORITY}
@@ -71,7 +79,11 @@ done
  update_alternatives_batch_doinstall() {

meta/classes/update-alternatives.bbclass done · line 88

Quoted 10 lines
meta/classes/update-alternatives.bbclass +5 -1
  	for link in ${ALTERNATIVE_LINKS}
  	do
-		mv ${D}${link} ${D}${link}.${PN}
+		# Only do this if not already done..
+		# There are a few cases where a package will do this manually
+		if [ ! -e ${D}${link}.${PN} ]; then
+			mv ${D}${link} ${D}${link}.${PN}
+		fi
  	done
  }

We have cases where the recipe does this yet calls in here?

Quoted 1 line

I'd rather stop packages doing this manually...

The situation where this is necessary is when your alternative is already a link to another item that is an alternative i.e.

/bin/foo
/bin/bar -> foo

If the system does a "mv" of /bin/foo, then /bin/bar is now broken. Having this in there allows the package to move /bin/foo -> /bin/foo.${PN}, and then setup the new /bin/bar.${PN} -> /bin/foo.${PN}

Quoted 11 lines

meta/classes/update-alternatives.bbclass def update_alternatives_after_parse(d): · line 102

Quoted 8 lines
meta/classes/update-alternatives.bbclass +3 -0
@@ -85,6 +97,9 @@ def update_alternatives_after_parse(d):
          d.setVar('do_install', doinstall)
          return
 
+    if d.getVar('MANUAL_ALTERNATIVE_LINKS') != None:
+	return
+

Presumably this is the problem case above? Do any of these really want/need the do_install addition?

This sections imply checks that if you use update-alternatives.bbclass, that you actually use one of the three methods of control. The first check is for ALTERNATIVE_LINKS, second check MANUAL_ALTERNATIVE_LINKS, and third check on ALTERNATIVE_NAME/PATH.

Quoted 74 lines
Quoted 47 lines
meta/classes/update-alternatives.bbclass +40 -0
      if d.getVar('ALTERNATIVE_NAME') == None:
          raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % d.getVar('FILE')
      if d.getVar('ALTERNATIVE_PATH') == None:
@@ -114,3 +129,53 @@ python populate_packages_prepend () {
  		postrm += d.getVar('update_alternatives_postrm', True)
  	d.setVar('pkg_postrm_%s' % pkg, postrm)
  }
+
+python package_do_filedeps_append () {
+	# We need to load the provides for each manually updated alternative
+	# This function sets up the provides only, it's up to the pkg_postinst
+	# to setup the actual links...
+
+	alt_links = ""
+
+	if d.getVar('ALTERNATIVE_PATH', True) and d.getVar('ALTERNATIVE_LINK', True):
+		alt_target = d.getVar('ALTERNATIVE_LINK', True)
+		alt_source = d.getVar('ALTERNATIVE_PATH', True)
+		if alt_source[0] != '/':
+			alt_source = os.path.dirname(alt_target) + '/' + alt_source
+		alt_links += " " + alt_target + ":" + alt_source
+
+	alt_links += " " + (d.getVar('ALTERNATIVE_LINKS', True) or "")
+	alt_links += " " + (d.getVar('MANUAL_ALTERNATIVE_LINKS', True) or "")
+
+	if alt_links and alt_links.strip() != "":
+		pn = d.getVar('PN', True)
+
+		for alt_target in alt_links.split():
+			# Generate the filename we need to set the dependency in
+			if ':' in alt_target:
+				alt_source = alt_target.split(':')[1]
+				alt_target = alt_target.split(':')[0]
+			else:
+				alt_source = alt_target + '.' + pn
+
+			bb.note('%s: Adding alternative provide %s' % (alt_source, alt_target))
+
+			# Add the new dependency into the file rprovide
+			# Since we don't know which split owns this, set it in all of them
+			# this should not cause any issues by doing so...
+			for split_pn in d.getVar('PACKAGES', True).split():
+				# Match the original function skip routine
+				if split_pn.endswith('-dbg') or split_pn.endswith('-doc') or split_pn.find('-locale-') != -1 or split_pn.find('-localedata-') != -1 or split_pn.find('-gconv-') != -1 or split_pn.find('-charmap-') != -1 or split_pn.startswith('kernel-module-'):
+					continue
+
+				ft_alt_source = file_translate(alt_source)

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

Quoted 10 lines
meta/classes/update-alternatives.bbclass +10 -0
+				filerprovides = d.getVar('FILERPROVIDES_%s_%s' % (ft_alt_source, split_pn), True) or ""
+				filerprovides += " " + alt_target
+				d.setVar('FILERPROVIDES_%s_%s' % (ft_alt_source, split_pn), filerprovides)
+
+				# Make sure there is an entry for this item in the FILERPROVIDESFLIST...
+				filerprovidesflist = (d.getVar('FILERPROVIDESFLIST_%s' % split_pn, True) or "").split()
+				if ft_alt_source not in filerprovidesflist:
+					filerprovidesflist.append(ft_alt_source)
+				d.setVar('FILERPROVIDESFLIST_%s' % split_pn, " ".join(filerprovidesflist))
+}

I'm not sure I like this code style. How about:

python package_do_filedeps_append () {
# We need to load the provides for each manually updated alternative # This function sets up the provides only, it's up to the pkg_postinst # to setup the actual links...

alt_links = {}

target = d.getVar('ALTERNATIVE_LINK', True)
source = d.getVar('ALTERNATIVE_PATH', True)
if target and source:
if source[0] != '/':
source = os.path.dirname(target) + '/' + source
alt_links[source] = target

Quoted 10 lines

pn = d.getVar('PN', True)
links = ((d.getVar('ALTERNATIVE_LINKS', True) or "") + " " + (d.getVar('MANUAL_ALTERNATIVE_LINKS', True) or "")).split() for target in links:
# Generate the filename we need to set the dependency in
if ':' in target:
source = target.split(':')[1]
target = target.split(':')[0]
else:
source = target + '.' + pn
alt_links[source] = target

Ya it doesn't normally occur to me to use dictionary structures like this, since they are costly in other languages.

Quoted 8 lines

pkgdest = d.getVar('PKGDEST', True)
for link in alt_links:
source = file_translate(link)
target = alt_links[link]

for pkg in d.getVar('PACKAGES', True).split():
if not os.path.exists(os.path.join(pkgdest, pkg, target)):
continue

I didn't do the above simply as a short cut. Even if the file is listed, it won't cause a problem with the current implementation. But it would be nice to have it there, as it eliminates the duplicate entries.

Quoted 3 lines
			bb.note('%s: Adding alternative provide %s to package %s' % (source, target, pkg))
	
			d.appendVar('FILERPROVIDES_%s_%s' % (source, pkg), " " + target)

I didn't even know there was an appendVar.. :) There are other places (i.e. busybox) where we should likely be using it as well...

Quoted 4 lines

if not source in (d.getVar('FILERPROVIDESFLIST_%s' % pkg, True) or "").split():
d.appendVar('FILERPROVIDESFLIST_%s' % pkg, " " + source)
}

Quoted 8 lines

which as well as being slightly easier to read (IMO), ditches the package endings check since that was only there for performance in the other function and also checks which package contains the target file rather than just adding to them all. I've not tested the code above.

I have to say that changes like this at -rc4 in a release cycle are not a good idea and I'm not sure this patchset will make it into the release as a result.

That is fine. We should be sure to mention in release notes that some image types may not be optimal without this path, and then work to put this into the next release very soon.

Also a future enhancement to this whole class is to make it work on split packages, and extend the ":" style of the manual links to the automatic links. That should eliminate having to use the manual version except in extreme cases.

--Mark

Quoted 9 lines

Cheers,

Richard

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

author
#4 lore raw

PATCH 2/17 coreutils_*.bb: Use update alternatives and add missing manual alt links

In reply to Mark Hatle

Coreutils was capable of providing many of the necessary binaries for the system, however it never told the package manager what was being provided via the alternatives. Use the MANUAL_ALTERNATIVE_LINKS to do this.

It also should have been using the update-alternatives class as that automatically sets the file rprovides.

coreutils - 8.14 - update-alt

---
 meta/recipes-core/coreutils/coreutils_6.9.bb  |   34 +++++++++-------------
 meta/recipes-core/coreutils/coreutils_8.14.bb |   38 +++++++++++++------------
 2 files changed, 34 insertions(+), 38 deletions(-)
meta/recipes-core/coreutils/coreutils_6.9.bb +14 -20
index 8a47a60..32ea321 100644
@@ -8,11 +8,11 @@ BUGTRACKER = "http://debbugs.gnu.org/coreutils"
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
                     file://src/ls.c;startline=4;endline=16;md5=482a96d4f25010a4e13f8743e0c3685e"
-PR = "r2"
+PR = "r3"
 DEPENDS = "coreutils-native-${PV}"
 DEPENDS_virtclass-native = "gettext-native"
 
-inherit autotools gettext
+inherit update-alternatives autotools gettext
 
 SRC_URI_BASE = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
            file://gnulib_m4.patch \
@@ -30,6 +30,9 @@ SRC_URI_virtclass-native = "${SRC_URI_BASE}"
 SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06"
 SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0"
 
+ALTERNATIVE_PRIORITY = "100"
+ALTERNATIVE_LINKS = ""
+
 # [ gets a special treatment and is not included in this
 bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
                 env expand expr factor fmt fold groups head hostid id install \
@@ -37,23 +40,26 @@ bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
                 pinky pr printenv printf ptx readlink seq sha1sum sha224sum sha256sum \
                 sha384sum sha512sum shred shuf sort split stat sum tac tail tee test \
                 tr tsort tty unexpand uniq unlink users vdir wc who whoami yes"
+ALTERNATIVE_LINKS += "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
 
 # hostname gets a special treatment and is not included in this
 base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
                      mknod mv pwd rm rmdir sleep stty sync touch true uname"
+ALTERNATIVE_LINKS += "${base_bindir}/${@' ${base_bindir}/'.join((d.getVar('base_bindir_progs', True)).split())}"
 
 sbindir_progs= "chroot"
+ALTERNATIVE_LINKS += "${sbindir}/${@' ${sbindir}/'.join((d.getVar('sbindir_progs', True)).split())}"
 
-do_install() {
-	autotools_do_install
-
-	for i in ${bindir_progs}; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}; done
+# rprovides for manually controlled alternatives
+MANUAL_ALTERNATIVE_LINKS += "${bindir}/uptime ${base_bindir}/hostname"
+MANUAL_ALTERNATIVE_LINKS += "${bindir}/[:${bindir}/lbracket.${PN}"
 
+do_install_append() {
 	install -d ${D}${base_bindir}
-	for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${PN}; done
+	for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i; done
 
 	install -d ${D}${sbindir}
-	for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${PN}; done
+	for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i; done
 
 	# [ requires special handling because [.coreutils will cause the sed stuff
 	# in update-alternatives to fail, therefore use lbracket - the name used
@@ -66,12 +72,6 @@ do_install() {
 }
 
 pkg_postinst_${PN} () {
-	for i in ${bindir_progs}; do update-alternatives --install ${bindir}/$i $i $i.${PN} 100; done
-
-	for i in ${base_bindir_progs}; do update-alternatives --install ${base_bindir}/$i $i $i.${PN} 100; done
-
-	for i in ${sbindir_progs}; do update-alternatives --install ${sbindir}/$i $i $i.${PN} 100; done
-
 	# Special cases. uptime and hostname is broken, prefer busybox's version. [ needs to be treated separately.
 	update-alternatives --install ${bindir}/uptime uptime uptime.${PN} 10
 	update-alternatives --install ${base_bindir}/hostname hostname hostname.${PN} 10
@@ -79,12 +79,6 @@ pkg_postinst_${PN} () {
 }
 
 pkg_prerm_${PN} () {
-	for i in ${bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
-
-	for i in ${base_bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
-
-	for i in ${sbindir_progs}; do update-alternatives --remove $i $i.${PN}; done
-
 	# The special cases
 	update-alternatives --remove hostname hostname.${PN}
 	update-alternatives --remove uptime uptime.${PN}
meta/recipes-core/coreutils/coreutils_8.14.bb +20 -18
index 688cec9..9ccb813 100644
@@ -7,11 +7,11 @@ BUGTRACKER = "http://debbugs.gnu.org/coreutils"
 LICENSE = "GPLv3+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504\
                     file://src/ls.c;startline=5;endline=16;md5=e1a509558876db58fb6667ba140137ad"
-PR = "r3"
+PR = "r4"
 DEPENDS = "gmp libcap"
 DEPENDS_virtclass-native = ""
 
-inherit autotools gettext
+inherit update-alternatives autotools gettext
 
 SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \
            file://remove-usr-local-lib-from-m4.patch \
@@ -21,6 +21,9 @@ SRC_URI[sha256sum] = "0d120817c19292edb19e92ae6b8eac9020e03d51e0af9cb116cf82b65d
 
 EXTRA_OECONF_virtclass-native = "--without-gmp"
 
+ALTERNATIVE_PRIORITY = "100"
+ALTERNATIVE_LINKS = ""
+
 # [ df mktemp base64 gets a special treatment and is not included in this
 bindir_progs = "basename chcon cksum comm csplit cut dir dircolors dirname du \
                 env expand expr factor fmt fold groups head hostid id install \
@@ -28,37 +31,42 @@ bindir_progs = "basename chcon cksum comm csplit cut dir dircolors dirname du \
                 pinky pr printenv printf ptx readlink runcon seq sha1sum sha224sum sha256sum \
                 sha384sum sha512sum shred shuf sort split stat stdbuf sum tac tail tee test timeout\
                 tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
+ALTERNATIVE_LINKS += "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
 
 # hostname gets a special treatment and is not included in this
 base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
                      mknod mv pwd rm rmdir sleep stty sync touch true uname"
+ALTERNATIVE_LINKS += "${base_bindir}/${@' ${base_bindir}/'.join((d.getVar('base_bindir_progs', True)).split())}"
 
 sbindir_progs= "chroot"
+ALTERNATIVE_LINKS += "${sbindir}/${@' ${sbindir}/'.join((d.getVar('sbindir_progs', True)).split())}"
 
-do_install_append() {
-	for i in ${bindir_progs} df mktemp base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}; done
+# Manual file provides for manually controlled alternatives
+MANUAL_ALTERNATIVE_LINKS += "${base_bindir}/df:${bindir}/df.${PN}"
+MANUAL_ALTERNATIVE_LINKS += "${base_bindir}/mktemp:${bindir}/mktemp.${PN}"
+MANUAL_ALTERNATIVE_LINKS += "${base_bindir}/base64:${bindir}/base64.${PN}"
+MANUAL_ALTERNATIVE_LINKS += "${bindir}/[:${bindir}/lbracket.${PN}"
 
+do_install_append() {
 	install -d ${D}${base_bindir}
-	for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${PN}; done
+	for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i; done
 
 	install -d ${D}${sbindir}
-	for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${PN}; done
+	for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i; done
+
+	# Process the special items due to mismatch with busybox
+	for i in df mktemp base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}; done
 
 	# [ requires special handling because [.coreutils will cause the sed stuff
 	# in update-alternatives to fail, therefore use lbracket - the name used
 	# for the actual source file.
 	mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${PN}
+
 	install -d ${D}${libdir}/coreutils
 	mv ${D}${libexecdir}/coreutils/libstdbuf.so ${D}${libdir}/coreutils
 }
 
 pkg_postinst_${PN} () {
-	for i in ${bindir_progs}; do update-alternatives --install ${bindir}/$i $i $i.${PN} 100; done
-
-	for i in ${base_bindir_progs}; do update-alternatives --install ${base_bindir}/$i $i $i.${PN} 100; done
-
-	for i in ${sbindir_progs}; do update-alternatives --install ${sbindir}/$i $i $i.${PN} 100; done
-
 	# Special cases. [ needs to be treated separately.
 	update-alternatives --install '${bindir}/[' '[' 'lbracket.${PN}' 100
 	
@@ -69,12 +77,6 @@ pkg_postinst_${PN} () {
 }
 
 pkg_prerm_${PN} () {
-	for i in ${bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
-
-	for i in ${base_bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
-
-	for i in ${sbindir_progs}; do update-alternatives --remove $i $i.${PN}; done
-
 	# The special cases
 	update-alternatives --remove hostname hostname.${PN}
 	update-alternatives --remove uptime uptime.${PN}
Signature · 1 line
1.7.3.4
author
#5 lore raw

PATCH 3/17 coreutils_*.bb: Sync up file path with busybox and minor cleanup

In reply to Mark Hatle

We need to ensure that the filepaths used by coreutils and busybox are the same. Do this for base64, mktemp and df. Also remove references to hostname/uptime in 8.14 version as these were only relevant for the older 6.9 version.

su from the 6.9 version is removed, as it should come from shadow.

(No PR bumps, as the previous patch did that.)

---
 meta/recipes-core/coreutils/coreutils_6.9.bb  |   10 +++++++---
 meta/recipes-core/coreutils/coreutils_8.14.bb |   23 +++--------------------
 2 files changed, 10 insertions(+), 23 deletions(-)
meta/recipes-core/coreutils/coreutils_6.9.bb +7 -3
index 32ea321..597d457 100644
@@ -34,7 +34,7 @@ ALTERNATIVE_PRIORITY = "100"
 ALTERNATIVE_LINKS = ""
 
 # [ gets a special treatment and is not included in this
-bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
+bindir_progs = "basename cksum comm csplit cut dir dircolors dirname du \
                 env expand expr factor fmt fold groups head hostid id install \
                 join link logname md5sum mkfifo nice nl nohup od paste pathchk \
                 pinky pr printenv printf ptx readlink seq sha1sum sha224sum sha256sum \
@@ -43,7 +43,7 @@ bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
 ALTERNATIVE_LINKS += "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
 
 # hostname gets a special treatment and is not included in this
-base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
+base_bindir_progs = "base64 cat chgrp chmod chown cp date dd df echo false kill ln ls mkdir \
                      mknod mv pwd rm rmdir sleep stty sync touch true uname"
 ALTERNATIVE_LINKS += "${base_bindir}/${@' ${base_bindir}/'.join((d.getVar('base_bindir_progs', True)).split())}"
 
@@ -69,12 +69,16 @@ do_install_append() {
 	# hostname and uptime separated. busybox's versions are preferred
 	mv ${D}${bindir}/hostname ${D}${base_bindir}/hostname.${PN}
 	mv ${D}${bindir}/uptime ${D}${bindir}/uptime.${PN}
+
+	# remove su, it should come from shadow or another package
+	rm ${D}${bindir}/su
 }
 
 pkg_postinst_${PN} () {
-	# Special cases. uptime and hostname is broken, prefer busybox's version. [ needs to be treated separately.
+	# Special cases. uptime and hostname is broken, prefer busybox's version.
 	update-alternatives --install ${bindir}/uptime uptime uptime.${PN} 10
 	update-alternatives --install ${base_bindir}/hostname hostname hostname.${PN} 10
+	# [ needs to be treated separately.
 	update-alternatives --install '${bindir}/[' '[' 'lbracket.${PN}' 100
 }
 
meta/recipes-core/coreutils/coreutils_8.14.bb +3 -20
index 9ccb813..9994526 100644
@@ -24,7 +24,7 @@ EXTRA_OECONF_virtclass-native = "--without-gmp"
 ALTERNATIVE_PRIORITY = "100"
 ALTERNATIVE_LINKS = ""
 
-# [ df mktemp base64 gets a special treatment and is not included in this
+# [ gets a special treatment and is not included in this
 bindir_progs = "basename chcon cksum comm csplit cut dir dircolors dirname du \
                 env expand expr factor fmt fold groups head hostid id install \
                 join link logname md5sum mkfifo nice nl nohup nproc od paste pathchk \
@@ -33,18 +33,14 @@ bindir_progs = "basename chcon cksum comm csplit cut dir dircolors dirname du \
                 tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
 ALTERNATIVE_LINKS += "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
 
-# hostname gets a special treatment and is not included in this
-base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
-                     mknod mv pwd rm rmdir sleep stty sync touch true uname"
+base_bindir_progs = "base64 cat chgrp chmod chown cp date dd df echo false kill ln ls mkdir \
+                     mknod mktemp mv pwd rm rmdir sleep stty sync touch true uname"
 ALTERNATIVE_LINKS += "${base_bindir}/${@' ${base_bindir}/'.join((d.getVar('base_bindir_progs', True)).split())}"
 
 sbindir_progs= "chroot"
 ALTERNATIVE_LINKS += "${sbindir}/${@' ${sbindir}/'.join((d.getVar('sbindir_progs', True)).split())}"
 
 # Manual file provides for manually controlled alternatives
-MANUAL_ALTERNATIVE_LINKS += "${base_bindir}/df:${bindir}/df.${PN}"
-MANUAL_ALTERNATIVE_LINKS += "${base_bindir}/mktemp:${bindir}/mktemp.${PN}"
-MANUAL_ALTERNATIVE_LINKS += "${base_bindir}/base64:${bindir}/base64.${PN}"
 MANUAL_ALTERNATIVE_LINKS += "${bindir}/[:${bindir}/lbracket.${PN}"
 
 do_install_append() {
@@ -54,9 +50,6 @@ do_install_append() {
 	install -d ${D}${sbindir}
 	for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i; done
 
-	# Process the special items due to mismatch with busybox
-	for i in df mktemp base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}; done
-
 	# [ requires special handling because [.coreutils will cause the sed stuff
 	# in update-alternatives to fail, therefore use lbracket - the name used
 	# for the actual source file.
@@ -69,21 +62,11 @@ do_install_append() {
 pkg_postinst_${PN} () {
 	# Special cases. [ needs to be treated separately.
 	update-alternatives --install '${bindir}/[' '[' 'lbracket.${PN}' 100
-	
-	# Special cases. base64, mktemp and df need to be treated separately, because busybox have them in base_binding not bindir
-	update-alternatives --install ${base_bindir}/base64 base64 ${bindir}/base64.${PN} 100;
-	update-alternatives --install ${base_bindir}/mktemp mktemp ${bindir}/mktemp.${PN} 100;
-	update-alternatives --install ${base_bindir}/df df ${bindir}/df.${PN} 100;
 }
 
 pkg_prerm_${PN} () {
 	# The special cases
-	update-alternatives --remove hostname hostname.${PN}
-	update-alternatives --remove uptime uptime.${PN}
 	update-alternatives --remove '[' 'lbracket.${PN}'
-	update-alternatives --remove base64 ${bindir}/base64.${PN}
-	update-alternatives --remove mktemp ${bindir}/mktemp.${PN}
-	update-alternatives --remove df ${bindir}.df.${PN}
 }
 
 BBCLASSEXTEND = "native"
Signature · 1 line
1.7.3.4
#6 lore raw

Re: [PATCH 03/17] coreutils_*.bb: Sync up file path with busybox and minor cleanup

Op 17 apr. 2012, om 00:45 heeft Mark Hatle het volgende geschreven:

Quoted 8 lines

We need to ensure that the filepaths used by coreutils and busybox are the same. Do this for base64, mktemp and df. Also remove references to hostname/uptime in 8.14 version as these were only relevant for the older 6.9 version.

su from the 6.9 version is removed, as it should come from shadow.

(No PR bumps, as the previous patch did that.)

It should have a PR bump, bisectability and all.

#7 lore raw

Re: [PATCH 03/17] coreutils_*.bb: Sync up file path with busybox and minor cleanup

In reply to Mark Hatle
Quoted 76 lines · Mark Hatle

We need to ensure that the filepaths used by coreutils and busybox are the same. Do this for base64, mktemp and df. Also remove references to hostname/uptime in 8.14 version as these were only relevant for the older 6.9 version.

su from the 6.9 version is removed, as it should come from shadow.

(No PR bumps, as the previous patch did that.)

---
 meta/recipes-core/coreutils/coreutils_6.9.bb  |   10 +++++++---
 meta/recipes-core/coreutils/coreutils_8.14.bb |   23 +++--------------------
 2 files changed, 10 insertions(+), 23 deletions(-)
meta/recipes-core/coreutils/coreutils_6.9.bb +7 -3
index 32ea321..597d457 100644
@@ -34,7 +34,7 @@ ALTERNATIVE_PRIORITY = "100"
 ALTERNATIVE_LINKS = ""
 
 # [ gets a special treatment and is not included in this
-bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
+bindir_progs = "basename cksum comm csplit cut dir dircolors dirname du \
                 env expand expr factor fmt fold groups head hostid id install \
                 join link logname md5sum mkfifo nice nl nohup od paste pathchk \
                 pinky pr printenv printf ptx readlink seq sha1sum sha224sum sha256sum \
@@ -43,7 +43,7 @@ bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
 ALTERNATIVE_LINKS += "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
 
 # hostname gets a special treatment and is not included in this
-base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
+base_bindir_progs = "base64 cat chgrp chmod chown cp date dd df echo false kill ln ls mkdir \
                      mknod mv pwd rm rmdir sleep stty sync touch true uname"
 ALTERNATIVE_LINKS += "${base_bindir}/${@' ${base_bindir}/'.join((d.getVar('base_bindir_progs', True)).split())}"
 
@@ -69,12 +69,16 @@ do_install_append() {
 	# hostname and uptime separated. busybox's versions are preferred
 	mv ${D}${bindir}/hostname ${D}${base_bindir}/hostname.${PN}
 	mv ${D}${bindir}/uptime ${D}${bindir}/uptime.${PN}
+
+	# remove su, it should come from shadow or another package
+	rm ${D}${bindir}/su
 }
 
 pkg_postinst_${PN} () {
-	# Special cases. uptime and hostname is broken, prefer busybox's version. [ needs to be treated separately.
+	# Special cases. uptime and hostname is broken, prefer busybox's version.
 	update-alternatives --install ${bindir}/uptime uptime uptime.${PN} 10
 	update-alternatives --install ${base_bindir}/hostname hostname hostname.${PN} 10
+	# [ needs to be treated separately.
 	update-alternatives --install '${bindir}/[' '[' 'lbracket.${PN}' 100
 }
 
meta/recipes-core/coreutils/coreutils_8.14.bb +2 -4
index 9ccb813..9994526 100644
@@ -24,7 +24,7 @@ EXTRA_OECONF_virtclass-native = "--without-gmp"
 ALTERNATIVE_PRIORITY = "100"
 ALTERNATIVE_LINKS = ""
 
-# [ df mktemp base64 gets a special treatment and is not included in this
+# [ gets a special treatment and is not included in this
 bindir_progs = "basename chcon cksum comm csplit cut dir dircolors dirname du \
                 env expand expr factor fmt fold groups head hostid id install \
                 join link logname md5sum mkfifo nice nl nohup nproc od paste pathchk \
@@ -33,18 +33,14 @@ bindir_progs = "basename chcon cksum comm csplit cut dir dircolors dirname du \
                 tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
 ALTERNATIVE_LINKS += "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
 
-# hostname gets a special treatment and is not included in this
-base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
-                     mknod mv pwd rm rmdir sleep stty sync touch true uname"
+base_bindir_progs = "base64 cat chgrp chmod chown cp date dd df echo false kill ln ls mkdir \

meta/recipes-core/coreutils/coreutils_8.14.bb bindir_progs = "basename chcon cksum comm csplit cut dir dircolors dirname du \ · line 47

Quoted 10 lines
meta/recipes-core/coreutils/coreutils_8.14.bb +1 -3
+                     mknod mktemp mv pwd rm rmdir sleep stty sync touch true uname"
 ALTERNATIVE_LINKS += "${base_bindir}/${@' ${base_bindir}/'.join((d.getVar('base_bindir_progs', True)).split())}"
 
 sbindir_progs= "chroot"
 ALTERNATIVE_LINKS += "${sbindir}/${@' ${sbindir}/'.join((d.getVar('sbindir_progs', True)).split())}"
 
 # Manual file provides for manually controlled alternatives
-MANUAL_ALTERNATIVE_LINKS += "${base_bindir}/df:${bindir}/df.${PN}"
-MANUAL_ALTERNATIVE_LINKS += "${base_bindir}/mktemp:${bindir}/mktemp.${PN}"
-MANUAL_ALTERNATIVE_LINKS += "${base_bindir}/base64:${bindir}/base64.${PN}"

This was added by [PATCH 02/17] and now it is removed?

IIRC base64 mktemp df are still installed to ${bindir} and only u-a link was using ${base_bindir} to resolve conflict with busybox's u-a:
http://git.openembedded.org/openembedded-core/commit/?id=7f71e866ecdbe0491c26b4eb5b83d8d2573f8eda

Maybe I've overlooked something but will this work with your patch?

Quoted 43 lines
meta/recipes-core/coreutils/coreutils_8.14.bb +0 -13
 MANUAL_ALTERNATIVE_LINKS += "${bindir}/[:${bindir}/lbracket.${PN}"
 
 do_install_append() {
@@ -54,9 +50,6 @@ do_install_append() {
 	install -d ${D}${sbindir}
 	for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i; done
 
-	# Process the special items due to mismatch with busybox
-	for i in df mktemp base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}; done
-
 	# [ requires special handling because [.coreutils will cause the sed stuff
 	# in update-alternatives to fail, therefore use lbracket - the name used
 	# for the actual source file.
@@ -69,21 +62,11 @@ do_install_append() {
 pkg_postinst_${PN} () {
 	# Special cases. [ needs to be treated separately.
 	update-alternatives --install '${bindir}/[' '[' 'lbracket.${PN}' 100
-	
-	# Special cases. base64, mktemp and df need to be treated separately, because busybox have them in base_binding not bindir
-	update-alternatives --install ${base_bindir}/base64 base64 ${bindir}/base64.${PN} 100;
-	update-alternatives --install ${base_bindir}/mktemp mktemp ${bindir}/mktemp.${PN} 100;
-	update-alternatives --install ${base_bindir}/df df ${bindir}/df.${PN} 100;
 }
 
 pkg_prerm_${PN} () {
 	# The special cases
-	update-alternatives --remove hostname hostname.${PN}
-	update-alternatives --remove uptime uptime.${PN}
 	update-alternatives --remove '[' 'lbracket.${PN}'
-	update-alternatives --remove base64 ${bindir}/base64.${PN}
-	update-alternatives --remove mktemp ${bindir}/mktemp.${PN}
-	update-alternatives --remove df ${bindir}.df.${PN}
 }
 
 BBCLASSEXTEND = "native"
Signature · 7 lines
1.7.3.4


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
author
#8 lore raw

PATCH 4/17 grep: Use update-alternatives

In reply to Mark Hatle

Use ALTERNATIVE_LINKS to be sure the links and provide info is setup properly.

---
 meta/recipes-extended/grep/grep_2.5.1a.bb |   25 +++++++++----------------
 meta/recipes-extended/grep/grep_2.9.bb    |   22 ++++++++--------------
 2 files changed, 17 insertions(+), 30 deletions(-)
meta/recipes-extended/grep/grep_2.5.1a.bb +9 -16
index 64064fc..332a4d0 100644
@@ -5,7 +5,7 @@ SECTION = "console/utils"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
 
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "${GNU_MIRROR}/grep/grep-${PV}.tar.bz2 \
            file://uclibc-fix.patch"
@@ -21,23 +21,16 @@ do_configure_prepend () {
 	rm -f ${S}/m4/init.m4
 }
 
+inherit update-alternatives
+
+ALTERNATIVE_LINKS = "${base_bindir}/grep ${base_bindir}/egrep ${base_bindir}/fgrep"
+ALTERNATIVE_PRIORITY = "100"
+
 do_install () {
 	autotools_do_install
 	install -d ${D}${base_bindir}
-	mv ${D}${bindir}/grep ${D}${base_bindir}/grep.${PN}
-	mv ${D}${bindir}/egrep ${D}${base_bindir}/egrep.${PN}
-	mv ${D}${bindir}/fgrep ${D}${base_bindir}/fgrep.${PN}
+	mv ${D}${bindir}/grep ${D}${base_bindir}/grep
+	mv ${D}${bindir}/egrep ${D}${base_bindir}/egrep
+	mv ${D}${bindir}/fgrep ${D}${base_bindir}/fgrep
 	rmdir ${D}${bindir}/
 }
-
-pkg_postinst_${PN} () {
-	update-alternatives --install ${base_bindir}/grep grep grep.${PN} 100
-	update-alternatives --install ${base_bindir}/egrep egrep egrep.${PN} 100
-	update-alternatives --install ${base_bindir}/fgrep fgrep fgrep.${PN} 100
-}
-
-pkg_prerm_${PN} () {
-	update-alternatives --remove grep grep.${PN}
-	update-alternatives --remove egrep egrep.${PN}
-	update-alternatives --remove fgrep fgrep.${PN}
-}
meta/recipes-extended/grep/grep_2.9.bb +8 -14
index 1bc79f2..7710e65 100644
@@ -21,23 +21,17 @@ do_configure_prepend () {
 	rm -f ${S}/m4/init.m4
 }
 
+inherit update-alternatives
+
+ALTERNATIVE_LINKS = "${base_bindir}/grep ${base_bindir}/egrep ${base_bindir}/fgrep"
+ALTERNATIVE_PRIORITY = "100"
+
 do_install () {
 	autotools_do_install
 	install -d ${D}${base_bindir}
-	mv ${D}${bindir}/grep ${D}${base_bindir}/grep.${PN}
-	mv ${D}${bindir}/egrep ${D}${base_bindir}/egrep.${PN}
-	mv ${D}${bindir}/fgrep ${D}${base_bindir}/fgrep.${PN}
+	mv ${D}${bindir}/grep ${D}${base_bindir}/grep
+	mv ${D}${bindir}/egrep ${D}${base_bindir}/egrep
+	mv ${D}${bindir}/fgrep ${D}${base_bindir}/fgrep
 	rmdir ${D}${bindir}/
 }
 
-pkg_postinst_${PN} () {
-	update-alternatives --install ${base_bindir}/grep grep grep.${PN} 100
-	update-alternatives --install ${base_bindir}/egrep egrep egrep.${PN} 100
-	update-alternatives --install ${base_bindir}/fgrep fgrep fgrep.${PN} 100
-}
-
-pkg_prerm_${PN} () {
-	update-alternatives --remove grep grep.${PN}
-	update-alternatives --remove egrep egrep.${PN}
-	update-alternatives --remove fgrep fgrep.${PN}
-}
Signature · 1 line
1.7.3.4
author
#9 lore raw

PATCH 5/17 openssh: Use update-alternatives

In reply to Mark Hatle

Use the MANUAL_ALTERNATIVE_LINKS to ensure the update-alternative references are properly added to the packages provides.

Also fix the RPROVIDES, as they are package split specific!

---
 meta/recipes-connectivity/openssh/openssh_5.9p1.bb |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
meta/recipes-connectivity/openssh/openssh_5.9p1.bb +6 -3
index 749f89e..6ed1276 100644
@@ -7,12 +7,13 @@ SECTION = "console/network"
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://LICENCE;md5=bae9a689be41581503bcf95d8fb42c4e"
 
-PR = "r3"
+PR = "r4"
 
 DEPENDS = "zlib openssl"
 DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 
-RPROVIDES = "ssh sshd"
+RPROVIDES_${PN}-ssh = "ssh"
+RPROVIDES_${PN}-sshd = "sshd"
 
 CONFLICTS_${PN} = "dropbear"
 RCONFLICTS_${PN}-sshd = "dropbear"
@@ -29,7 +30,7 @@ PAM_SRC_URI = "file://sshd"
 SRC_URI[md5sum] = "afe17eee7e98d3b8550cc349834a85d0"
 SRC_URI[sha256sum] = "8d3e8b6b6ff04b525a6dfa6fdeb6a99043ccf6c3310cc32eba84c939b07777d5"
 
-inherit useradd update-rc.d
+inherit useradd update-rc.d update-alternatives
 
 USERADD_PACKAGES = "${PN}-sshd"
 USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
@@ -99,6 +100,8 @@ RDEPENDS_${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen"
 DEPENDS_${PN}-sshd += "update-rc.d"
 RDEPENDS_${PN}-sshd += "update-rc.d ${PN}-keygen"
 
+MANUAL_ALTERNATIVE_LINKS = "${bindir}/scp ${bindir}/ssh"
+
 pkg_postinst_${PN}-scp () {
 	update-alternatives --install ${bindir}/scp scp scp.${PN} 90
 }
Signature · 1 line
1.7.3.4
author
#10 lore raw

PATCH 6/17 hdparm: Use update-alternatives

In reply to Mark Hatle

Switch to using update-alternatives, this ensures that the call to update-alternatives and package provides are correct.

---
 meta/recipes-extended/hdparm/hdparm_9.39.bb |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
meta/recipes-extended/hdparm/hdparm_9.39.bb +6 -10
index ed076cc..42867a9 100644
@@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=910a8a42c962d238619c75fdb78bdb24 \
                     file://wiper/GPLv2.txt;md5=fcb02dc552a041dee27e4b85c7396067 \
                     file://wiper/wiper.sh;beginline=7;endline=31;md5=b7bc642addc152ea307505bf1a296f09"
 
-PR = "r1"
+PR = "r2"
 
 PACKAGES += "wiper"
 
@@ -24,17 +24,13 @@ SRC_URI[sha256sum] = "72d550af4526aa96f0841c79321a0ee39d636cbaf1f294e52193e90c05
 
 EXTRA_OEMAKE += 'STRIP="echo"'
 
+inherit update-alternatives
+
+ALTERNATIVE_LINKS = "${base_sbindir}/hdparm"
+ALTERNATIVE_PRIORITY = "100"
+
 do_install () {
 	install -d ${D}/${base_sbindir} ${D}/${mandir}/man8 ${D}/${bindir}
 	oe_runmake 'DESTDIR=${D}' 'sbindir=${base_sbindir}' install
-	mv ${D}${base_sbindir}/hdparm ${D}${base_sbindir}/hdparm.${PN}
 	cp ${S}/wiper/wiper.sh ${D}/${bindir}
 }
-
-pkg_postinst_${PN} () {
-	update-alternatives --install ${base_sbindir}/hdparm hdparm hdparm.${PN} 100
-}
-
-pkg_prerm_${PN} () {
-	update-alternatives --remove hdparm hdparm.${PN}
-}
Signature · 1 line
1.7.3.4
author
#11 lore raw

PATCH 7/17 iputils: Use update-alternatives

In reply to Mark Hatle

Use MANUAL_ALTERNATIVE_LINKS to ensure that the package provides are being setup properly.

---
 meta/recipes-extended/iputils/iputils_s20101006.bb |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
meta/recipes-extended/iputils/iputils_s20101006.bb +4 -1
index a092192..aadcaf3 100644
@@ -13,7 +13,7 @@ LIC_FILES_CHKSUM = "file://ping.c;beginline=1;endline=35;md5=f9ceb201733e9a6cf8f
 
 DEPENDS = "sysfsutils openssl docbook-utils-native sgmlspl-native"
 
-PR = "r3"
+PR = "r4"
 
 SRC_URI = "http://www.skbuff.net/iputils/${BPN}-${PV}.tar.bz2 \
            file://debian/fix-dead-host-ping-stats.diff \
@@ -47,6 +47,9 @@ do_install () {
 	done
 }
 
+inherit update-alternatives
+MANUAL_ALTERNATIVE_LINKS = "${base_bindir}/ping ${base_bindir}/ping6"
+
 # Busybox also provides ping and ping6, so use update-alternatives
 # Also fixup SUID bit for applications that need it
 pkg_postinst_${PN}-ping () {
Signature · 1 line
1.7.3.4
author
#12 lore raw

PATCH 8/17 net-tools: Use update-alternatives

In reply to Mark Hatle

Switch to using ALTERNATIVE_LINKS to ensure the update-alternatives are setup properly, along with the package provides.

---
 .../net-tools/net-tools_1.60-23.bb                 |   28 ++++++-------------
 1 files changed, 9 insertions(+), 19 deletions(-)
meta/recipes-extended/net-tools/net-tools_1.60-23.bb +9 -19
index c8d2c57..b9a05c6 100644
@@ -5,7 +5,7 @@ BUGTRACKER = "http://bugs.debian.org/net-tools"
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
                     file://ifconfig.c;startline=11;endline=15;md5=da4c7bb79a5d0798faa99ef869721f4a"
-PR = "r0"
+PR = "r1"
 
 SRC_URI = "${DEBIAN_MIRROR}/main/n/net-tools/net-tools_1.60.orig.tar.gz;name=tarball \
            ${DEBIAN_MIRROR}/main/n/net-tools/${BPN}_${PV}.diff.gz;apply=no;name=patch \
@@ -67,26 +67,16 @@ do_compile() {
 	oe_runmake
 }
 
-do_install() {
-	oe_runmake 'BASEDIR=${D}' install
+inherit update-alternatives
 
-	for app in ${D}/${base_sbindir}/* ${D}/${base_bindir}/*; do
-		mv $app $app.${PN}
-	done
-}
+base_sbindir_progs = "arp ifconfig ipmaddr iptunnel mii-tool nameif plipconfig rarp route slattach"
+ALTERNATIVE_LINKS += "${base_sbindir}/${@' ${base_sbindir}/'.join((d.getVar('base_sbindir_progs', True)).split())}"
 
-pkg_postinst_${PN} () {
-	for app in arp ifconfig ipmaddr iptunnel mii-tool nameif plipconfig rarp route slattach ; do
-		update-alternatives --install ${base_sbindir}/$app $app $app.${PN} 100
-	done
+base_bindir_progs  = "dnsdomainname domainname hostname netstat nisdomainname ypdomainname"
+ALTERNATIVE_LINKS += "${base_bindir}/${@' ${base_bindir}/'.join((d.getVar('base_bindir_progs', True)).split())}"
 
-	for app in dnsdomainname domainname hostname netstat nisdomainname ypdomainname ; do
-		update-alternatives --install ${base_bindir}/$app $app $app.${PN} 100
-	done
-}
+ALTERNATIVE_PRIORITY = "100"
 
-pkg_prerm_${PN} () {
-	for app in arp ifconfig ipmaddr iptunnel mii-tool nameif plipconfig rarp route slattach dnsdomainname domainname hostname netstat nisdomainname ypdomainname ; do
-		update-alternatives --remove $app $app.${PN}
-	done
+do_install() {
+	oe_runmake 'BASEDIR=${D}' install
 }
Signature · 1 line
1.7.3.4
author
#13 lore raw

PATCH 9/17 shadow: Use update-alternatives

In reply to Mark Hatle

Switch to using ALTERNATIVE_LINKS to ensure the update-alternatives are setup properly, along with the package provides.

---
 meta/recipes-extended/shadow/shadow_4.1.4.3.bb |   42 +++++++++++------------
 1 files changed, 20 insertions(+), 22 deletions(-)
meta/recipes-extended/shadow/shadow_4.1.4.3.bb +20 -22
index f892eb9..e27ca47 100644
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=08c553a87d4e51bbed50b20e0adcaede \
 
 DEPENDS = "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 RDEPENDS_${PN} = "shadow-securetty ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
-PR = "r8"
+PR = "r9"
 
 SRC_URI = "http://pkg-shadow.alioth.debian.org/releases/${BPN}-${PV}.tar.bz2 \
            file://login_defs_pam.sed \
@@ -84,14 +84,12 @@ do_install_append() {
 	sed -i '/^CREATE_MAIL_SPOOL/ s:^:#:' ${D}${sysconfdir}/default/useradd
 
 	install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir} 
-	for i in passwd chfn newgrp chsh groups ; do
-		mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}
-	done
 
-	mv ${D}${sbindir}/chpasswd ${D}${sbindir}/chpasswd.${PN}
+	# We create the ${PN} versions to avoid link problems
+	mv ${D}${bindir}/newgrp ${D}${bindir}/newgrp.${PN}
 	mv ${D}${sbindir}/vigr ${D}${base_sbindir}/vigr.${PN}
 	mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw.${PN}
-	mv ${D}${bindir}/login ${D}${base_bindir}/login.${PN}
+	mv ${D}${bindir}/login ${D}${base_bindir}/login
 
 	# Handle link properly after rename, otherwise missing files would
 	# lead rpm failed dependencies.
@@ -99,17 +97,23 @@ do_install_append() {
 	ln -sf newgrp.${PN} ${D}${bindir}/sg
 }
 
-pkg_postinst_${PN} () {
-	update-alternatives --install ${bindir}/passwd passwd passwd.${PN} 200
-	update-alternatives --install ${sbindir}/chpasswd chpasswd chpasswd.${PN} 200
-	update-alternatives --install ${bindir}/chfn chfn chfn.${PN} 200
-	update-alternatives --install ${bindir}/newgrp newgrp newgrp.${PN} 200
-	update-alternatives --install ${bindir}/chsh chsh chsh.${PN} 200
-	update-alternatives --install ${bindir}/groups groups groups.${PN} 200
-	update-alternatives --install ${base_bindir}/login login login.${PN} 200
-	update-alternatives --install ${base_sbindir}/vipw vipw vipw.${PN} 200
-	update-alternatives --install ${base_sbindir}/vigr vigr vigr.${PN} 200
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "200"
+
+bindir_progs = "passwd chfn newgrp chsh groups"
+ALTERNATIVE_LINKS += "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
+
+sbindir_progs = "chpasswd"
+ALTERNATIVE_LINKS += "${sbindir}/${@' ${sbindir}/'.join((d.getVar('sbindir_progs', True)).split())}"
+
+base_bindir_progs = "login"
+ALTERNATIVE_LINKS += "${base_bindir}/${@' ${base_bindir}/'.join((d.getVar('base_bindir_progs', True)).split())}"
 
+base_sbindir_progs = "vipw vigr"
+ALTERNATIVE_LINKS += "${base_sbindir}/${@' ${base_sbindir}/'.join((d.getVar('base_sbindir_progs', True)).split())}"
+
+pkg_postinst_${PN} () {
 	if [ "x$D" != "x" ]; then
 	  rootarg="--root=$D"
 	else
@@ -119,9 +123,3 @@ pkg_postinst_${PN} () {
 	pwconv $rootarg
 	grpconv $rootarg
 }
-
-pkg_prerm_${PN} () {
-	for i in passwd chpasswd chfn newgrp chsh login vipw vigr ; do
-		update-alternatives --remove $i $i.${PN}
-	done
-}
Signature · 1 line
1.7.3.4
author
#14 lore raw

PATCH 10/17 findutils: Use update-alternatives

In reply to Mark Hatle

Change to using update-alternatives to ensure that we're consistently using the class, and the package provides are being setup properly.

---
 meta/recipes-extended/findutils/findutils.inc      |    5 +++-
 .../recipes-extended/findutils/findutils_4.2.31.bb |   22 ++++---------------
 meta/recipes-extended/findutils/findutils_4.4.2.bb |   17 +--------------
 3 files changed, 10 insertions(+), 34 deletions(-)
meta/recipes-extended/findutils/findutils.inc +4 -1
index 7a07ad5..64909a1 100644
@@ -12,7 +12,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949"
 
 SRC_URI = "${GNU_MIRROR}/findutils/findutils-${PV}.tar.gz"
 
-inherit autotools gettext
+inherit autotools gettext update-alternatives
+
+ALTERNATIVE_LINKS = "${bindir}/find ${bindir}/xargs"
+ALTERNATIVE_PRIORITY = "100"
 
 # diffutils assumes non-glibc compilation with uclibc and
 # this causes it to generate its own implementations of
meta/recipes-extended/findutils/findutils_4.2.31.bb +5 -17
index bd455a5..0c37836 100644
@@ -8,7 +8,7 @@ SECTION = "console/utils"
 
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "${GNU_MIRROR}/findutils/findutils-${PV}.tar.gz \
            file://gnulib-extension.patch"
@@ -16,7 +16,10 @@ SRC_URI = "${GNU_MIRROR}/findutils/findutils-${PV}.tar.gz \
 SRC_URI[md5sum] = "a0e31a0f18a49709bf5a449867c8049a"
 SRC_URI[sha256sum] = "e0d34b8faca0b3cca0703f6c6b498afbe72f0ba16c35980c10ec9ef7724d6204"
 
-inherit autotools gettext
+inherit autotools gettext update-alternatives
+
+ALTERNATIVE_LINKS = "${bindir}/find ${bindir}/xargs"
+ALTERNATIVE_PRIORITY = "100"
 
 # diffutils assumes non-glibc compilation with uclibc and
 # this causes it to generate its own implementations of
@@ -25,19 +28,4 @@ inherit autotools gettext
 # see diffutils.mk in buildroot)
 EXTRA_OECONF_libc-uclibc = "--without-included-regex"
 
-do_install_append () {
-	if [ -e ${D}${bindir}/find ]; then
-		mv ${D}${bindir}/find ${D}${bindir}/find.${PN}
-		mv ${D}${bindir}/xargs ${D}${bindir}/xargs.${PN}
-	fi
-}
-
-pkg_postinst_${PN} () {
-	for i in find xargs; do update-alternatives --install ${bindir}/$i $i $i.${PN} 100; done
-}
-
-pkg_prerm_${PN} () {
-	for i in find xargs; do update-alternatives --remove $i $i.${PN}; done
-}
-
 BBCLASSEXTEND = "native"
meta/recipes-extended/findutils/findutils_4.4.2.bb +1 -16
index b2898ed..d80511c 100644
@@ -1,6 +1,6 @@
 require findutils.inc
 
-PR = "r2"
+PR = "r3"
 
 SRC_URI += "file://01-27017.patch \
             file://02-28824.patch \
@@ -13,19 +13,4 @@ SRC_URI[sha256sum] = "434f32d171cbc0a5e72cfc5372c6fc4cb0e681f8dce566a0de5b6fccd7
 # http://savannah.gnu.org/bugs/?27299
 CACHED_CONFIGUREVARS += "${@base_contains('DISTRO_FEATURES', 'libc-posix-clang-wchar', 'gl_cv_func_wcwidth_works=yes', '', d)}"
 
-do_install_append () {
-        if [ -e ${D}${bindir}/find ]; then
-            mv ${D}${bindir}/find ${D}${bindir}/find.${PN}
-            mv ${D}${bindir}/xargs ${D}${bindir}/xargs.${PN}
-        fi
-}
-
-pkg_postinst_${PN} () {
-	for i in find xargs; do update-alternatives --install ${bindir}/$i $i $i.${PN} 100; done
-}
-
-pkg_prerm_${PN} () {
-	for i in find xargs; do update-alternatives --remove $i $i.${PN}; done
-}
-
 BBCLASSEXTEND = "native"
Signature · 1 line
1.7.3.4
author
#15 lore raw

PATCH 11/17 gzip: Use update-alternatives class

In reply to Mark Hatle

Switch to using the update-alternatives class. Need this for consistency and to ensure the necessary package provides get set.

---
 meta/recipes-extended/gzip/gzip.inc       |   32 ++++++++--------------------
 meta/recipes-extended/gzip/gzip_1.3.12.bb |   24 +++++++--------------
 meta/recipes-extended/gzip/gzip_1.4.bb    |    2 +-
 3 files changed, 18 insertions(+), 40 deletions(-)
meta/recipes-extended/gzip/gzip.inc +9 -23
index a449449..1d608a6 100644
@@ -12,29 +12,15 @@ SRC_URI = "${GNU_MIRROR}/gzip/${BP}.tar.gz"
 
 inherit autotools
 
-do_install () {
-	autotools_do_install
-	if [ "${PN}" = "${BPN}" ] ; then
-		# Rename and move files into /bin (FHS), which is typical place for gzip
-		install -d ${D}${base_bindir}
-		mv ${D}${bindir}/gunzip ${D}${base_bindir}/gunzip.${PN}
-		mv ${D}${bindir}/gzip ${D}${base_bindir}/gzip.${PN}
-		mv ${D}${bindir}/zcat ${D}${base_bindir}/zcat.${PN}
-	fi
+do_install_append () {
+	# Rename and move files into /bin (FHS), which is typical place for gzip
+	install -d ${D}${base_bindir}
+	mv ${D}${bindir}/gunzip ${D}${base_bindir}/gunzip
+	mv ${D}${bindir}/gzip ${D}${base_bindir}/gzip
+	mv ${D}${bindir}/zcat ${D}${base_bindir}/zcat
 }
 
-pkg_postinst_${PN} () {
-	if [ "${PN}" = "${BPN}" ] ; then
-		update-alternatives --install ${base_bindir}/gunzip gunzip gunzip.${PN} 100
-		update-alternatives --install ${base_bindir}/gzip gzip gzip.${PN} 100
-		update-alternatives --install ${base_bindir}/zcat zcat zcat.${PN} 100
-	fi
-}
+inherit update-alternatives
 
-pkg_prerm_${PN} () {
-	if [ "${PN}" = "${BPN}" ] ; then
-		update-alternatives --remove gunzip gunzip.${PN}
-		update-alternatives --remove gzip gzip.${PN}
-		update-alternatives --remove zcat zcat.${PN}
-	fi
-}
+ALTERNATIVE_LINKS = "${base_bindir}/gunzip ${base_bindir}/gzip ${base_bindir}/zcat"
+ALTERNATIVE_PRIORITY = "100"
meta/recipes-extended/gzip/gzip_1.3.12.bb +8 -16
index 2836942..6d18d47 100644
@@ -16,29 +16,21 @@ SRC_URI = "${GNU_MIRROR}/gzip/gzip-${PV}.tar.gz \
 SRC_URI[md5sum] = "b5bac2d21840ae077e0217bc5e4845b1"
 SRC_URI[sha256sum] = "3f565be05f7f3d1aff117c030eb7c738300510b7d098cedea796ca8e4cd587af"
 
-PR = "r0"
+PR = "r1"
 
 inherit autotools
 
-do_install () {
-	autotools_do_install
+do_install_append () {
 	# move files into /bin (FHS)
 	install -d ${D}${base_bindir}
-	mv ${D}${bindir}/gunzip ${D}${base_bindir}/gunzip.${PN}
-	mv ${D}${bindir}/gzip ${D}${base_bindir}/gzip.${PN}
-	mv ${D}${bindir}/zcat ${D}${base_bindir}/zcat.${PN}
+	mv ${D}${bindir}/gunzip ${D}${base_bindir}/gunzip
+	mv ${D}${bindir}/gzip ${D}${base_bindir}/gzip
+	mv ${D}${bindir}/zcat ${D}${base_bindir}/zcat
 }
 
-pkg_postinst_${PN} () {
-	update-alternatives --install ${base_bindir}/gunzip gunzip gunzip.${PN} 100
-	update-alternatives --install ${base_bindir}/gzip gzip gzip.${PN} 100
-	update-alternatives --install ${base_bindir}/zcat zcat zcat.${PN} 100
-}
+inherit update-alternatives
 
-pkg_prerm_${PN} () {
-	update-alternatives --remove gunzip gunzip.${PN}
-	update-alternatives --remove gzip gzip.${PN}
-	update-alternatives --remove zcat zcat.${PN}
-}
+ALTERNATIVE_LINKS = "${base_bindir}/gunzip ${base_bindir}/gzip ${base_bindir}/zcat"
+ALTERNATIVE_PRIORITY = "100"
 
 BBCLASSEXTEND = "native"
meta/recipes-extended/gzip/gzip_1.4.bb +1 -1
index 8f4a237..54dd50a 100644
@@ -1,6 +1,6 @@
 require gzip.inc
 
-PR = "r1"
+PR = "r2"
 
 NATIVE_PACKAGE_PATH_SUFFIX = "/${PN}"
 
Signature · 1 line
1.7.3.4
author
#16 lore raw

PATCH 12/17 module-init-tools: Update to use update-alternatives class

In reply to Mark Hatle

Use the update-alternatives class and MANUAL_ALTERNATIVE_LINKs to ensure that the produced packages specify the correct package provides.

Also change references from "bin" and "sbin" to base_bindir and base_sbindir.

---
 .../module-init-tools/module-init-tools_3.16.bb    |   35 ++++++++++++--------
 1 files changed, 21 insertions(+), 14 deletions(-)
meta/recipes-kernel/module-init-tools/module-init-tools_3.16.bb +21 -14
index 0248b46..cb6f425 100644
@@ -1,41 +1,48 @@
 require module-init-tools.inc
-PR = "r0"
+PR = "r1"
 
 # autotools set prefix to /usr, however we want them in /bin and /sbin
-bindir = "/bin"
-sbindir = "/sbin"
+bindir = "${base_bindir}"
+sbindir = "${base_sbindir}"
 
-do_install() {
-	autotools_do_install
-	for f in bin/lsmod sbin/insmod sbin/rmmod sbin/modprobe sbin/modinfo sbin/depmod; do
+inherit update-alternatives
+MANUAL_ALTERNATIVE_LINKS  = "${base_bindir}/lsmod:${base_bindir}/lsmod.26"
+MANUAL_ALTERNATIVE_LINKS += "${base_sbindir}/insmod:${base_sbindir}/insmod.26"
+MANUAL_ALTERNATIVE_LINKS += "${base_sbindir}/rmmod:${base_sbindir}/rmmod.26"
+MANUAL_ALTERNATIVE_LINKS += "${base_sbindir}/modprobe:${base_sbindir}/modprobe.26"
+MANUAL_ALTERNATIVE_LINKS += "${base_sbindir}/modinfo:${base_sbindir}/modinfo.26"
+MANUAL_ALTERNATIVE_LINKS += "${base_sbindir}/depmod:${base_sbindir}/depmod.26"
+
+do_install_append() {
+	for f in ${base_bindir}/lsmod ${base_sbindir}/insmod ${base_sbindir}/rmmod ${base_sbindir}/modprobe ${base_sbindir}/modinfo ${base_sbindir}/depmod; do
 		mv ${D}/$f ${D}/$f.26
 	done
 }
 
 pkg_postinst_module-init-tools() {
-	for f in sbin/insmod sbin/modprobe sbin/rmmod sbin/modinfo; do
+	for f in ${base_sbindir}/insmod ${base_sbindir}/modprobe ${base_sbindir}/rmmod ${base_sbindir}/modinfo; do
 		bn=`basename $f`
 		update-alternatives --install /$f $bn /$f.26 60
 	done
-	update-alternatives --install /bin/lsmod bin-lsmod /bin/lsmod.26 60
-	update-alternatives --install /sbin/lsmod lsmod /bin/lsmod.26 60
+	update-alternatives --install ${base_bindir}/lsmod bin-lsmod ${base_bindir}/lsmod.26 60
+	update-alternatives --install ${base_sbindir}lsmod lsmod ${base_bindir}/lsmod.26 60
 }
 
 pkg_prerm_module-init-tools() {
-	for f in sbin/insmod sbin/modprobe sbin/rmmod sbin/modinfo; do
+	for f in ${base_sbindir}/insmod ${base_sbindir}/modprobe ${base_sbindir}/rmmod ${base_sbindir}/modinfo; do
 		bn=`basename $f`
 		update-alternatives --remove $bn /$f.26
 	done
-	update-alternatives --remove bin-lsmod /bin/lsmod.26
-	update-alternatives --remove lsmod /bin/lsmod.26
+	update-alternatives --remove bin-lsmod ${base_bindir}/lsmod.26
+	update-alternatives --remove lsmod ${base_bindir}/lsmod.26
 }
 
 pkg_postinst_module-init-tools-depmod() {
-	update-alternatives --install /sbin/depmod depmod /sbin/depmod.26 60
+	update-alternatives --install ${base_sbindir}depmod depmod ${base_sbindir}depmod.26 60
 }
 
 pkg_prerm_module-init-tools-depmod() {
-	update-alternatives --remove depmod /sbin/depmod.26
+	update-alternatives --remove depmod ${base_sbindir}depmod.26
 }
 
 SRC_URI[md5sum] = "bc44832c6e41707b8447e2847d2019f5"
Signature · 1 line
1.7.3.4
author
#17 lore raw

PATCH 13/17 kbd: Use update-alternatives

In reply to Mark Hatle

Change to use ALTERNATIVE_LINKS from update-alternatives. This ensures the links are created consistently and the package provides are correct.

---
 meta/recipes-core/kbd/kbd_1.15.2.bb |   34 +++++++---------------------------
 1 files changed, 7 insertions(+), 27 deletions(-)
meta/recipes-core/kbd/kbd_1.15.2.bb +7 -27
index eea04a0..99a6a50 100644
@@ -10,7 +10,7 @@ RREPLACES_${PN} = "console-tools"
 RPROVIDES_${PN} = "console-tools"
 RCONFLICTS_${PN} = "console-tools"
 
-PR = "r2"
+PR = "r3"
 
 SRC_URI="${KERNELORG_MIRROR}/linux/utils/kbd/kbd-1.15.2.tar.bz2"
 SRC_URI[md5sum] = "e850eb91e4d3b94b194efe8e953204c5"
@@ -23,29 +23,9 @@ FILES_${PN}-consoletrans = "${datadir}/consoletrans"
 FILES_${PN}-keymaps = "${datadir}/keymaps"
 FILES_${PN}-unimaps = "${datadir}/unimaps"
 
-ALTERNATIVE_NAMES_USRBIN = "chvt deallocvt fgconsole openvt"
-
-do_install_append() {
-  usrbinprogs_a="${ALTERNATIVE_NAMES_USRBIN}"
-  for p in $usrbinprogs_a; do
-    if [ -f "${D}${bindir}/$p" ]; then
-      mv "${D}${bindir}/$p" "${D}${bindir}/$p.${PN}"
-    fi
-  done
-}
-
-pkg_postinst_${PN} () {
-  usrbinprogs_a="${ALTERNATIVE_NAMES_USRBIN}"
-  for p in $usrbinprogs_a; do
-    if [ -f "$D${bindir}/$p" ]; then
-      update-alternatives --install ${bindir}/$p $p $p.${PN} 100
-    fi
-  done
-}
-
-pkg_postrm_${PN} () {
-  usrbinprogs_a="${ALTERNATIVE_NAMES_USRBIN}"
-  for p in $usrbinprogs_a; do
-    update-alternatives --remove $p $p.${PN}
-  done
-}
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+
+bindir_progs = "chvt deallocvt fgconsole openvt"
+ALTERNATIVE_LINKS = "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
Signature · 1 line
1.7.3.4
author
#18 lore raw

PATCH 14/17 console-tools: Use update-alternatives

In reply to Mark Hatle

Use update-alternatives and sync to the way the replace kbd package does things. Using update-alternatives ensures that the proper provides are setup in the packages.

---
 .../console-tools/console-tools_0.3.2.bb           |   27 +++----------------
 1 files changed, 5 insertions(+), 22 deletions(-)
meta/recipes-core/console-tools/console-tools_0.3.2.bb +5 -22
index 5f1d640..6027d4a 100644
@@ -3,7 +3,7 @@ LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING.kbd;md5=9b2d91511d3d80d4d20ac6e6b0137fe9"
 SUMMARY = "Allows you to set-up and manipulate the Linux console."
 DESCRIPTION = "Provides tools that enable the set-up and manipulation of the linux console and console-font files."
-PR = "r4"
+PR = "r5"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/lct/console-tools-${PV}.tar.gz \
            file://codepage.patch \
@@ -30,28 +30,11 @@ do_compile () {
 	oe_runmake 'SUBDIRS=${SUBDIRS}'
 }
 
-inherit autotools gettext
+inherit autotools gettext update-alternatives
 
-do_install () {
-	autotools_do_install
-	mv ${D}${bindir}/chvt ${D}${bindir}/chvt.${PN}
-	mv ${D}${bindir}/deallocvt ${D}${bindir}/deallocvt.${PN}
-	mv ${D}${bindir}/openvt ${D}${bindir}/openvt.${PN}
-	mv ${D}${bindir}/fgconsole ${D}${bindir}/fgconsole.${PN}
-}
-
-pkg_postinst_${PN} () {
-	update-alternatives --install ${bindir}/chvt chvt chvt.${PN} 100
-	update-alternatives --install ${bindir}/deallocvt deallocvt deallocvt.${PN} 100
-	update-alternatives --install ${bindir}/openvt openvt openvt.${PN} 100
-	update-alternatives --install ${bindir}/fgconsole fgconsole fgconsole.${PN} 100
-}
+ALTERNATIVE_PRIORITY = "100"
 
-pkg_prerm_${PN} () {
-	update-alternatives --remove chvt chvt.${PN}
-	update-alternatives --remove deallocvt deallocvt.${PN}
-	update-alternatives --remove openvt openvt.${PN}
-	update-alternatives --remove fgconsole fgconsole.${PN}
-}
+bindir_progs = "chvt deallocvt fgconsole openvt"
+ALTERNATIVE_LINKS = "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
 
 RDEPENDS_${PN} = "bash"
Signature · 1 line
1.7.3.4
author
#19 lore raw

PATCH 15/17 sysvinit: Use update-alternatives in a different way

In reply to Mark Hatle

Change from using a single update-alternative class entry for "init" to using ALTERNATIVE_LINKS for the majority of the items. Then use the manual entries for the outliers like init and pidof.

End result is the same package behavior, plus proper dependencies in the resulting package.

---
 meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb |   44 ++++++-----------------
 1 files changed, 12 insertions(+), 32 deletions(-)
meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb +12 -32
index d3e430c..22ca24f 100644
@@ -5,7 +5,7 @@ SECTION = "base"
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
                     file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4"
-PR = "r6"
+PR = "r7"
 
 RDEPENDS_${PN} = "${PN}-inittab"
 
@@ -27,10 +27,15 @@ B = "${S}/src"
 
 inherit update-alternatives
 
-ALTERNATIVE_NAME = "init"
-ALTERNATIVE_LINK = "${base_sbindir}/init"
-ALTERNATIVE_PATH = "${base_sbindir}/init.sysvinit"
-ALTERNATIVE_PRIORITY = "50"
+ALTERNATIVE_PRIORITY = "200"
+ALTERNATIVE_LINKS  = "${base_bindir}/mountpoint ${base_sbindir}/halt ${base_sbindir}/reboot"
+ALTERNATIVE_LINKS += "${base_sbindir}/runlevel ${base_sbindir}/shutdown ${base_sbindir}/poweroff"
+ALTERNATIVE_LINKS += "${bindir}/last ${bindir}/mesg ${bindir}/wall"
+
+# The following two are setup manually.
+#   init because it has a different priority
+#   pidof because it is in a split package
+MANUAL_ALTERNATIVE_LINKS = "${base_sbindir}/init ${base_bindir}/pidof"
 
 PACKAGES =+ "sysvinit-pidof sysvinit-sulogin"
 FILES_${PN} += "${base_sbindir}/* ${base_bindir}/*"
@@ -66,40 +71,15 @@ do_install () {
 		ln -s ../init.d/stop-bootlogd ${D}${sysconfdir}/rc$level.d/S99stop-bootlogd
 	done
 	mv                 ${D}${base_sbindir}/init               ${D}${base_sbindir}/init.${BPN}
-	mv ${D}${base_bindir}/mountpoint ${D}${base_bindir}/mountpoint.${BPN}
 	mv ${D}${base_bindir}/pidof ${D}${base_bindir}/pidof.${BPN}
-	mv ${D}${base_sbindir}/halt ${D}${base_sbindir}/halt.${BPN}
-	mv ${D}${base_sbindir}/reboot ${D}${base_sbindir}/reboot.${BPN}
-	mv ${D}${base_sbindir}/runlevel ${D}${base_sbindir}/runlevel.${BPN}
-	mv ${D}${base_sbindir}/shutdown ${D}${base_sbindir}/shutdown.${BPN}
-	mv ${D}${base_sbindir}/poweroff ${D}${base_sbindir}/poweroff.${BPN}
-	mv ${D}${bindir}/last ${D}${bindir}/last.${BPN}
-	mv ${D}${bindir}/mesg ${D}${bindir}/mesg.${BPN}
-	mv ${D}${bindir}/wall ${D}${bindir}/wall.${BPN}
 }
 
 pkg_postinst_${PN} () {
-	update-alternatives --install ${base_bindir}/mountpoint mountpoint mountpoint.${BPN} 200
-	update-alternatives --install ${base_sbindir}/halt halt halt.${BPN} 200
-	update-alternatives --install ${base_sbindir}/reboot reboot reboot.${BPN} 200
-	update-alternatives --install ${base_sbindir}/runlevel runlevel runlevel.${BPN} 200
-	update-alternatives --install ${base_sbindir}/shutdown shutdown shutdown.${BPN} 200
-	update-alternatives --install ${base_sbindir}/poweroff poweroff poweroff.${BPN} 200
-	update-alternatives --install ${bindir}/last last last.${BPN} 200
-	update-alternatives --install ${bindir}/mesg mesg mesg.${BPN} 200
-	update-alternatives --install ${bindir}/wall wall wall.${BPN} 200
+	update-alternatives --install ${base_sbindir}/init init init.${BPN} 50
 }
 
 pkg_prerm_${PN} () {
-	update-alternatives --remove mountpoint mountpoint.${BPN}
-	update-alternatives --remove halt halt.${BPN}
-	update-alternatives --remove reboot reboot.${BPN}
-	update-alternatives --remove runlevel runlevel.${BPN}
-	update-alternatives --remove shutdown shutdown.${BPN}
-	update-alternatives --remove poweroff poweroff.${BPN}
-	update-alternatives --remove last last.${BPN}
-	update-alternatives --remove mesg mesg.${BPN}
-	update-alternatives --remove wall wall.${BPN}
+	update-alternatives --remove init init.${BPN}
 }
 
 pkg_postinst_sysvinit-pidof () {
Signature · 1 line
1.7.3.4
author
#20 lore raw

PATCH 16/17 lrzsz: sz, sx and sb were linked incorrectly

In reply to Mark Hatle

The sz, sx and sb links were created incorrectly to lrz, they should point to lsz.

---
 meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb +9 -3
index 414f2f4..7f86157 100644
@@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
 			file://src/lrz.c;beginline=1;endline=10;md5=5276956373ff7d8758837f6399a1045f"
 SECTION = "console/network"
 DEPENDS = ""
-PR = "r3"
+PR = "r4"
 
 SRC_URI = "http://www.ohse.de/uwe/releases/lrzsz-${PV}.tar.gz \
 	   file://autotools.patch \
@@ -28,13 +28,19 @@ do_install() {
 }
 
 pkg_postinst_${PN}() {
-	for util in rz rx rb sz sx sb; do
+	for util in rz rx rb; do
 		update-alternatives --install ${bindir}/$util $util lrz 100
 	done
+	for util in sz sx sb; do
+		update-alternatives --install ${bindir}/$util $util lsz 100
+	done
 }
 
 pkg_postrm_${PN}() {
-	for util in rz rx rb sz sx sb; do
+	for util in rz rx rb; do
 		update-alternatives --remove $util ${bindir}/lrz
 	done
+	for util sz sx sb; do
+		update-alternatives --remove $util ${bindir}/lsz
+	done
 }
Signature · 1 line
1.7.3.4
author
#21 lore raw

FYI -- Re: [PATCH 16/17] lrzsz: sz, sx and sb were linked incorrectly

Just wanted to highlight this patch. It should probably go into oe-core before the freeze, as the existing lrzsz package is completely broken. (None of the send functions are linked properly and will fail to work.)

Since nobody has reported this, I do find it highly suspect this this component is even being used these days.

--Mark

Quoted 43 lines · Mark Hatle

The sz, sx and sb links were created incorrectly to lrz, they should point to lsz.

---
  meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb |   12 +++++++++---
  1 files changed, 9 insertions(+), 3 deletions(-)
meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb +9 -3
index 414f2f4..7f86157 100644
@@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
  			file://src/lrz.c;beginline=1;endline=10;md5=5276956373ff7d8758837f6399a1045f"
  SECTION = "console/network"
  DEPENDS = ""
-PR = "r3"
+PR = "r4"
 
  SRC_URI = "http://www.ohse.de/uwe/releases/lrzsz-${PV}.tar.gz \
  	   file://autotools.patch \
@@ -28,13 +28,19 @@ do_install() {
  }
 
  pkg_postinst_${PN}() {
-	for util in rz rx rb sz sx sb; do
+	for util in rz rx rb; do
  		update-alternatives --install ${bindir}/$util $util lrz 100
  	done
+	for util in sz sx sb; do
+		update-alternatives --install ${bindir}/$util $util lsz 100
+	done
  }
 
  pkg_postrm_${PN}() {
-	for util in rz rx rb sz sx sb; do
+	for util in rz rx rb; do
  		update-alternatives --remove $util ${bindir}/lrz
  	done
+	for util sz sx sb; do
+		update-alternatives --remove $util ${bindir}/lsz
+	done
  }
author
#22 lore raw

PATCH 17/17 lrzsz: Use update-alternatives to set provides

In reply to Mark Hatle

Use the update-alternatives and MANUAL_ALTERNATIVE_LINKS to ensure the package gets the proper provides setup automatically.

---
 meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb +9 -2
index 7f86157..0f858f7 100644
@@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
 			file://src/lrz.c;beginline=1;endline=10;md5=5276956373ff7d8758837f6399a1045f"
 SECTION = "console/network"
 DEPENDS = ""
-PR = "r4"
+PR = "r5"
 
 SRC_URI = "http://www.ohse.de/uwe/releases/lrzsz-${PV}.tar.gz \
 	   file://autotools.patch \
@@ -20,7 +20,14 @@ SRC_URI = "http://www.ohse.de/uwe/releases/lrzsz-${PV}.tar.gz \
 SRC_URI[md5sum] = "b5ce6a74abc9b9eb2af94dffdfd372a4"
 SRC_URI[sha256sum] = "c28b36b14bddb014d9e9c97c52459852f97bd405f89113f30bee45ed92728ff1"
 
-inherit autotools gettext
+inherit autotools gettext update-alternatives
+
+MANUAL_ALTERNATIVE_LINKS = "${bindir}/rz:${bindir}/lrz"
+MANUAL_ALTERNATIVE_LINKS += "${bindir}/rx:${bindir}/lrz"
+MANUAL_ALTERNATIVE_LINKS += "${bindir}/rb:${bindir}/lrz"
+MANUAL_ALTERNATIVE_LINKS += "${bindir}/sz:${bindir}/lsz"
+MANUAL_ALTERNATIVE_LINKS += "${bindir}/sx:${bindir}/lsz"
+MANUAL_ALTERNATIVE_LINKS += "${bindir}/sb:${bindir}/lsz"
 
 do_install() {
 	install -d ${D}${bindir}/
Signature · 1 line
1.7.3.4
#23 lore raw
In reply to Mark Hatle

Op 17 apr. 2012, om 00:45 heeft Mark Hatle het volgende geschreven:

Quoted 4 lines

It was recently noticed that many packages that use update-alternatives were not setting package level provides. So a package that required /usr/bin/env would not be satisfied by coreutils, even though it had a /usr/bin/env alternative.

Related to your patch: the upgrade paths for /usr/bin/watch are still broken because busybox still installs it into /bin/watch. I forget who was supposed to fix that, but it would be nice to get that done before the release.

regards,

Koen

#24 lore raw
Quoted 9 lines · Koen Kooi

Op 17 apr. 2012, om 00:45 heeft Mark Hatle het volgende geschreven:

Quoted 4 lines

It was recently noticed that many packages that use update-alternatives were not setting package level provides. So a package that required /usr/bin/env would not be satisfied by coreutils, even though it had a /usr/bin/env alternative.

Related to your patch: the upgrade paths for /usr/bin/watch are still broken because busybox still installs it into /bin/watch. I forget who was supposed to fix that, but it would be nice to get that done before the release.

Are you sure? Please take a look at fa8b2d2bed63fa4fc2af45f094998b0f9e69d272. Is something wrong with this patch?

Regards,
Andreas

#25 lore raw
In reply to Mark Hatle
Quoted 18 lines · Mark Hatle

It was recently noticed that many packages that use update-alternatives were not setting package level provides. So a package that required /usr/bin/env would not be satisfied by coreutils, even though it had a /usr/bin/env alternative.

The first patch in the series adds the enhanced alternatives capatibilities.

The patches that follow resolve Yocto defect 2289 and use these new capabilities to ensure the produced packages are correct.

(Note, this only affects RPM packages as they have enhanced dependency scanning and resolution compared to deb and ipk.)

These patches were tested by running a core-image-minimal build on both qemux86 and qemumips. I also ran a core-image-sato on qemux86 and built each of the items affected manually. Once build, I verified the install time scriptlets were correct and each package provided the correct "Provides".

Quoted 8 lines

The following changes since commit 03cfc6ea6df9d1fbf5520c9707a725e38d2e377b:

libzypp: add libproxy to DEPENDS (2012-04-16 23:30:41 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib mhatle/upd-alt
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=mhatle/upd-alt

The subset marked below has been merged into OE-Core, I believe that Richard had a concern about the moves and links that some of these other patches contained.

Quoted 9 lines

Mark Hatle (17):
update-alternatives.bbclass: Ensure alternatives end up in per file
deps
coreutils_*.bb: Use update alternatives and add missing manual alt
links
coreutils_*.bb: Sync up file path with busybox and minor cleanup
grep: Use update-alternatives
openssh: Use update-alternatives
hdparm: Use update-alternatives

Merged

Quoted 2 lines

iputils: Use update-alternatives
net-tools: Use update-alternatives

Merged

Quoted 1 line

shadow: Use update-alternatives

Merged

Quoted 1 line

findutils: Use update-alternatives

Merged

Quoted 1 line

gzip: Use update-alternatives class

Merged

Quoted 2 lines

module-init-tools: Update to use update-alternatives class
kbd: Use update-alternatives

Merged

Quoted 1 line

console-tools: Use update-alternatives

Merged

Quoted 2 lines

sysvinit: Use update-alternatives in a different way
lrzsz: sz, sx and sb were linked incorrectly

Merged

Quoted 2 lines

lrzsz: Use update-alternatives to set provides

Thanks
Sau!

Quoted 25 lines
  meta/classes/package.bbclass                       |   16 +++--
  meta/classes/package_rpm.bbclass                   |    4 -
  meta/classes/update-alternatives.bbclass           |   69 +++++++++++++++++++-
  meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb            |   21 +++++-
  meta/recipes-connectivity/openssh/openssh_5.9p1.bb |    9 ++-
  .../console-tools/console-tools_0.3.2.bb           |   27 ++------
  meta/recipes-core/coreutils/coreutils_6.9.bb       |   44 ++++++-------
  meta/recipes-core/coreutils/coreutils_8.14.bb      |   49 +++++---------
  meta/recipes-core/kbd/kbd_1.15.2.bb                |   34 ++--------
  meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb     |   44 ++++---------
  meta/recipes-extended/findutils/findutils.inc      |    5 +-
  .../recipes-extended/findutils/findutils_4.2.31.bb |   22 ++-----
  meta/recipes-extended/findutils/findutils_4.4.2.bb |   17 +-----
  meta/recipes-extended/grep/grep_2.5.1a.bb          |   25 +++-----
  meta/recipes-extended/grep/grep_2.9.bb             |   22 ++----
  meta/recipes-extended/gzip/gzip.inc                |   32 +++-------
  meta/recipes-extended/gzip/gzip_1.3.12.bb          |   24 ++-----
  meta/recipes-extended/gzip/gzip_1.4.bb             |    2 +-
  meta/recipes-extended/hdparm/hdparm_9.39.bb        |   16 ++---
  meta/recipes-extended/iputils/iputils_s20101006.bb |    5 +-
  .../net-tools/net-tools_1.60-23.bb                 |   28 +++------
  meta/recipes-extended/shadow/shadow_4.1.4.3.bb     |   42 ++++++------
  .../module-init-tools/module-init-tools_3.16.bb    |   35 ++++++----
  23 files changed, 267 insertions(+), 325 deletions(-)