@@ -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)
@@ -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
@@ -35,6 +35,14 @@
#
# 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"
@@ -71,7 +79,11 @@ done
update_alternatives_batch_doinstall() {
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
}
@@ -85,6 +97,9 @@ def update_alternatives_after_parse(d):
d.setVar('do_install', doinstall)
return
+ if d.getVar('MANUAL_ALTERNATIVE_LINKS') != None:
+ return
+
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,45 @@ 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 = {}
+
+ 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[target] = source
+
+ 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[target] = source
+
+ pkgdest = d.getVar('PKGDEST', True)
+ for target in alt_links:
+ link = alt_links[target]
+ source = file_translate(link)
+
+ for pkg in d.getVar('PACKAGES', True).split():
+ if not os.path.lexists('%s/%s/%s' % (pkgdest, pkg, link)):
+ bb.note('%s: NOT Adding alternative provide %s to package %s' % (link, target, pkg))
+ continue
+
+ bb.note('%s: Adding alternative provide %s to package %s' % (link, 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)
+}