1*4882a593Smuzhiyun# This class is used to help the alternatives system which is useful when 2*4882a593Smuzhiyun# multiple sources provide the same command. You can use update-alternatives 3*4882a593Smuzhiyun# command directly in your recipe, but in most cases this class simplifies 4*4882a593Smuzhiyun# that job. 5*4882a593Smuzhiyun# 6*4882a593Smuzhiyun# To use this class a number of variables should be defined: 7*4882a593Smuzhiyun# 8*4882a593Smuzhiyun# List all of the alternatives needed by a package: 9*4882a593Smuzhiyun# ALTERNATIVE:<pkg> = "name1 name2 name3 ..." 10*4882a593Smuzhiyun# 11*4882a593Smuzhiyun# i.e. ALTERNATIVE:busybox = "sh sed test bracket" 12*4882a593Smuzhiyun# 13*4882a593Smuzhiyun# The pathname of the link 14*4882a593Smuzhiyun# ALTERNATIVE_LINK_NAME[name] = "target" 15*4882a593Smuzhiyun# 16*4882a593Smuzhiyun# This is the name of the binary once it's been installed onto the runtime. 17*4882a593Smuzhiyun# This name is global to all split packages in this recipe, and should match 18*4882a593Smuzhiyun# other recipes with the same functionality. 19*4882a593Smuzhiyun# i.e. ALTERNATIVE_LINK_NAME[bracket] = "/usr/bin/[" 20*4882a593Smuzhiyun# 21*4882a593Smuzhiyun# NOTE: If ALTERNATIVE_LINK_NAME is not defined, it defaults to ${bindir}/name 22*4882a593Smuzhiyun# 23*4882a593Smuzhiyun# The default link to create for all targets 24*4882a593Smuzhiyun# ALTERNATIVE_TARGET = "target" 25*4882a593Smuzhiyun# 26*4882a593Smuzhiyun# This is useful in a multicall binary case 27*4882a593Smuzhiyun# i.e. ALTERNATIVE_TARGET = "/bin/busybox" 28*4882a593Smuzhiyun# 29*4882a593Smuzhiyun# A non-default link to create for a target 30*4882a593Smuzhiyun# ALTERNATIVE_TARGET[name] = "target" 31*4882a593Smuzhiyun# 32*4882a593Smuzhiyun# This is the name of the binary as it's been installed by do_install 33*4882a593Smuzhiyun# i.e. ALTERNATIVE_TARGET[sh] = "/bin/bash" 34*4882a593Smuzhiyun# 35*4882a593Smuzhiyun# A package specific link for a target 36*4882a593Smuzhiyun# ALTERNATIVE_TARGET_<pkg>[name] = "target" 37*4882a593Smuzhiyun# 38*4882a593Smuzhiyun# This is useful when a recipe provides multiple alternatives for the 39*4882a593Smuzhiyun# same item. 40*4882a593Smuzhiyun# 41*4882a593Smuzhiyun# NOTE: If ALTERNATIVE_TARGET is not defined, it will inherit the value 42*4882a593Smuzhiyun# from ALTERNATIVE_LINK_NAME. 43*4882a593Smuzhiyun# 44*4882a593Smuzhiyun# NOTE: If the ALTERNATIVE_LINK_NAME and ALTERNATIVE_TARGET are the same, 45*4882a593Smuzhiyun# ALTERNATIVE_TARGET will have '.{BPN}' appended to it. If the file 46*4882a593Smuzhiyun# referenced has not been renamed, it will also be renamed. (This avoids 47*4882a593Smuzhiyun# the need to rename alternative files in the do_install step, but still 48*4882a593Smuzhiyun# supports it if necessary for some reason.) 49*4882a593Smuzhiyun# 50*4882a593Smuzhiyun# The default priority for any alternatives 51*4882a593Smuzhiyun# ALTERNATIVE_PRIORITY = "priority" 52*4882a593Smuzhiyun# 53*4882a593Smuzhiyun# i.e. default is ALTERNATIVE_PRIORITY = "10" 54*4882a593Smuzhiyun# 55*4882a593Smuzhiyun# The non-default priority for a specific target 56*4882a593Smuzhiyun# ALTERNATIVE_PRIORITY[name] = "priority" 57*4882a593Smuzhiyun# 58*4882a593Smuzhiyun# The package priority for a specific target 59*4882a593Smuzhiyun# ALTERNATIVE_PRIORITY_<pkg>[name] = "priority" 60*4882a593Smuzhiyun 61*4882a593SmuzhiyunALTERNATIVE_PRIORITY = "10" 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun# We need special processing for vardeps because it can not work on 64*4882a593Smuzhiyun# modified flag values. So we aggregate the flags into a new variable 65*4882a593Smuzhiyun# and include that variable in the set. 66*4882a593SmuzhiyunUPDALTVARS = "ALTERNATIVE ALTERNATIVE_LINK_NAME ALTERNATIVE_TARGET ALTERNATIVE_PRIORITY" 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunPACKAGE_WRITE_DEPS += "virtual/update-alternatives-native" 69*4882a593Smuzhiyun 70*4882a593Smuzhiyundef gen_updatealternativesvardeps(d): 71*4882a593Smuzhiyun pkgs = (d.getVar("PACKAGES") or "").split() 72*4882a593Smuzhiyun vars = (d.getVar("UPDALTVARS") or "").split() 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun # First compute them for non_pkg versions 75*4882a593Smuzhiyun for v in vars: 76*4882a593Smuzhiyun for flag in sorted((d.getVarFlags(v) or {}).keys()): 77*4882a593Smuzhiyun if flag == "doc" or flag == "vardeps" or flag == "vardepsexp": 78*4882a593Smuzhiyun continue 79*4882a593Smuzhiyun d.appendVar('%s_VARDEPS' % (v), ' %s:%s' % (flag, d.getVarFlag(v, flag, False))) 80*4882a593Smuzhiyun 81*4882a593Smuzhiyun for p in pkgs: 82*4882a593Smuzhiyun for v in vars: 83*4882a593Smuzhiyun for flag in sorted((d.getVarFlags("%s_%s" % (v,p)) or {}).keys()): 84*4882a593Smuzhiyun if flag == "doc" or flag == "vardeps" or flag == "vardepsexp": 85*4882a593Smuzhiyun continue 86*4882a593Smuzhiyun d.appendVar('%s_VARDEPS_%s' % (v,p), ' %s:%s' % (flag, d.getVarFlag('%s_%s' % (v,p), flag, False))) 87*4882a593Smuzhiyun 88*4882a593Smuzhiyundef ua_extend_depends(d): 89*4882a593Smuzhiyun if not 'virtual/update-alternatives' in d.getVar('PROVIDES'): 90*4882a593Smuzhiyun d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives') 91*4882a593Smuzhiyun 92*4882a593Smuzhiyundef update_alternatives_enabled(d): 93*4882a593Smuzhiyun # Update Alternatives only works on target packages... 94*4882a593Smuzhiyun if bb.data.inherits_class('native', d) or \ 95*4882a593Smuzhiyun bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or \ 96*4882a593Smuzhiyun bb.data.inherits_class('cross-canadian', d): 97*4882a593Smuzhiyun return False 98*4882a593Smuzhiyun 99*4882a593Smuzhiyun # Disable when targeting mingw32 (no target support) 100*4882a593Smuzhiyun if d.getVar("TARGET_OS") == "mingw32": 101*4882a593Smuzhiyun return False 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun return True 104*4882a593Smuzhiyun 105*4882a593Smuzhiyunpython __anonymous() { 106*4882a593Smuzhiyun if not update_alternatives_enabled(d): 107*4882a593Smuzhiyun return 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun # compute special vardeps 110*4882a593Smuzhiyun gen_updatealternativesvardeps(d) 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun # extend the depends to include virtual/update-alternatives 113*4882a593Smuzhiyun ua_extend_depends(d) 114*4882a593Smuzhiyun} 115*4882a593Smuzhiyun 116*4882a593Smuzhiyundef gen_updatealternativesvars(d): 117*4882a593Smuzhiyun ret = [] 118*4882a593Smuzhiyun pkgs = (d.getVar("PACKAGES") or "").split() 119*4882a593Smuzhiyun vars = (d.getVar("UPDALTVARS") or "").split() 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun for v in vars: 122*4882a593Smuzhiyun ret.append(v + "_VARDEPS") 123*4882a593Smuzhiyun 124*4882a593Smuzhiyun for p in pkgs: 125*4882a593Smuzhiyun for v in vars: 126*4882a593Smuzhiyun ret.append(v + ":" + p) 127*4882a593Smuzhiyun ret.append(v + "_VARDEPS_" + p) 128*4882a593Smuzhiyun return " ".join(ret) 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun# Now the new stuff, we use a custom function to generate the right values 131*4882a593Smuzhiyunpopulate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}" 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun# We need to do the rename after the image creation step, but before 134*4882a593Smuzhiyun# the split and strip steps.. PACKAGE_PREPROCESS_FUNCS is the right 135*4882a593Smuzhiyun# place for that. 136*4882a593SmuzhiyunPACKAGE_PREPROCESS_FUNCS += "apply_update_alternative_renames" 137*4882a593Smuzhiyunpython apply_update_alternative_renames () { 138*4882a593Smuzhiyun if not update_alternatives_enabled(d): 139*4882a593Smuzhiyun return 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun import re 142*4882a593Smuzhiyun 143*4882a593Smuzhiyun def update_files(alt_target, alt_target_rename, pkg, d): 144*4882a593Smuzhiyun f = d.getVar('FILES:' + pkg) 145*4882a593Smuzhiyun if f: 146*4882a593Smuzhiyun f = re.sub(r'(^|\s)%s(\s|$)' % re.escape (alt_target), r'\1%s\2' % alt_target_rename, f) 147*4882a593Smuzhiyun d.setVar('FILES:' + pkg, f) 148*4882a593Smuzhiyun 149*4882a593Smuzhiyun # Check for deprecated usage... 150*4882a593Smuzhiyun pn = d.getVar('BPN') 151*4882a593Smuzhiyun if d.getVar('ALTERNATIVE_LINKS') != None: 152*4882a593Smuzhiyun bb.fatal('%s: Use of ALTERNATIVE_LINKS/ALTERNATIVE_PATH/ALTERNATIVE_NAME is no longer supported, please convert to the updated syntax, see update-alternatives.bbclass for more info.' % pn) 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun # Do actual update alternatives processing 155*4882a593Smuzhiyun pkgdest = d.getVar('PKGD') 156*4882a593Smuzhiyun for pkg in (d.getVar('PACKAGES') or "").split(): 157*4882a593Smuzhiyun # If the src == dest, we know we need to rename the dest by appending ${BPN} 158*4882a593Smuzhiyun link_rename = [] 159*4882a593Smuzhiyun for alt_name in (d.getVar('ALTERNATIVE:%s' % pkg) or "").split(): 160*4882a593Smuzhiyun alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name) 161*4882a593Smuzhiyun if not alt_link: 162*4882a593Smuzhiyun alt_link = "%s/%s" % (d.getVar('bindir'), alt_name) 163*4882a593Smuzhiyun d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link) 164*4882a593Smuzhiyun if alt_link.startswith(os.path.join(d.getVar('sysconfdir'), 'init.d')): 165*4882a593Smuzhiyun # Managing init scripts does not work (bug #10433), foremost 166*4882a593Smuzhiyun # because of a race with update-rc.d 167*4882a593Smuzhiyun bb.fatal("Using update-alternatives for managing SysV init scripts is not supported") 168*4882a593Smuzhiyun 169*4882a593Smuzhiyun alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name) 170*4882a593Smuzhiyun alt_target = alt_target or d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or d.getVar('ALTERNATIVE_TARGET') or alt_link 171*4882a593Smuzhiyun # Sometimes alt_target is specified as relative to the link name. 172*4882a593Smuzhiyun alt_target = os.path.join(os.path.dirname(alt_link), alt_target) 173*4882a593Smuzhiyun 174*4882a593Smuzhiyun # If the link and target are the same name, we need to rename the target. 175*4882a593Smuzhiyun if alt_link == alt_target: 176*4882a593Smuzhiyun src = '%s/%s' % (pkgdest, alt_target) 177*4882a593Smuzhiyun alt_target_rename = '%s.%s' % (alt_target, pn) 178*4882a593Smuzhiyun dest = '%s/%s' % (pkgdest, alt_target_rename) 179*4882a593Smuzhiyun if os.path.lexists(dest): 180*4882a593Smuzhiyun bb.note('%s: Already renamed: %s' % (pn, alt_target_rename)) 181*4882a593Smuzhiyun elif os.path.lexists(src): 182*4882a593Smuzhiyun if os.path.islink(src): 183*4882a593Smuzhiyun # Delay rename of links 184*4882a593Smuzhiyun link_rename.append((alt_target, alt_target_rename)) 185*4882a593Smuzhiyun else: 186*4882a593Smuzhiyun bb.note('%s: Rename %s -> %s' % (pn, alt_target, alt_target_rename)) 187*4882a593Smuzhiyun bb.utils.rename(src, dest) 188*4882a593Smuzhiyun update_files(alt_target, alt_target_rename, pkg, d) 189*4882a593Smuzhiyun else: 190*4882a593Smuzhiyun bb.warn("%s: alternative target (%s or %s) does not exist, skipping..." % (pn, alt_target, alt_target_rename)) 191*4882a593Smuzhiyun continue 192*4882a593Smuzhiyun d.setVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name, alt_target_rename) 193*4882a593Smuzhiyun 194*4882a593Smuzhiyun # Process delayed link names 195*4882a593Smuzhiyun # Do these after other renames so we can correct broken links 196*4882a593Smuzhiyun for (alt_target, alt_target_rename) in link_rename: 197*4882a593Smuzhiyun src = '%s/%s' % (pkgdest, alt_target) 198*4882a593Smuzhiyun dest = '%s/%s' % (pkgdest, alt_target_rename) 199*4882a593Smuzhiyun link_target = oe.path.realpath(src, pkgdest, True) 200*4882a593Smuzhiyun 201*4882a593Smuzhiyun if os.path.lexists(link_target): 202*4882a593Smuzhiyun # Ok, the link_target exists, we can rename 203*4882a593Smuzhiyun bb.note('%s: Rename (link) %s -> %s' % (pn, alt_target, alt_target_rename)) 204*4882a593Smuzhiyun bb.utils.rename(src, dest) 205*4882a593Smuzhiyun else: 206*4882a593Smuzhiyun # Try to resolve the broken link to link.${BPN} 207*4882a593Smuzhiyun link_maybe = '%s.%s' % (os.readlink(src), pn) 208*4882a593Smuzhiyun if os.path.lexists(os.path.join(os.path.dirname(src), link_maybe)): 209*4882a593Smuzhiyun # Ok, the renamed link target exists.. create a new link, and remove the original 210*4882a593Smuzhiyun bb.note('%s: Creating new link %s -> %s' % (pn, alt_target_rename, link_maybe)) 211*4882a593Smuzhiyun os.symlink(link_maybe, dest) 212*4882a593Smuzhiyun os.unlink(src) 213*4882a593Smuzhiyun else: 214*4882a593Smuzhiyun bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target)) 215*4882a593Smuzhiyun continue 216*4882a593Smuzhiyun update_files(alt_target, alt_target_rename, pkg, d) 217*4882a593Smuzhiyun} 218*4882a593Smuzhiyun 219*4882a593Smuzhiyundef update_alternatives_alt_targets(d, pkg): 220*4882a593Smuzhiyun """ 221*4882a593Smuzhiyun Returns the update-alternatives metadata for a package. 222*4882a593Smuzhiyun 223*4882a593Smuzhiyun The returned format is a list of tuples where the tuple contains: 224*4882a593Smuzhiyun alt_name: The binary name 225*4882a593Smuzhiyun alt_link: The path for the binary (Shared by different packages) 226*4882a593Smuzhiyun alt_target: The path for the renamed binary (Unique per package) 227*4882a593Smuzhiyun alt_priority: The priority of the alt_target 228*4882a593Smuzhiyun 229*4882a593Smuzhiyun All the alt_targets will be installed into the sysroot. The alt_link is 230*4882a593Smuzhiyun a symlink pointing to the alt_target with the highest priority. 231*4882a593Smuzhiyun """ 232*4882a593Smuzhiyun 233*4882a593Smuzhiyun pn = d.getVar('BPN') 234*4882a593Smuzhiyun pkgdest = d.getVar('PKGD') 235*4882a593Smuzhiyun updates = list() 236*4882a593Smuzhiyun for alt_name in (d.getVar('ALTERNATIVE:%s' % pkg) or "").split(): 237*4882a593Smuzhiyun alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name) 238*4882a593Smuzhiyun alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or \ 239*4882a593Smuzhiyun d.getVarFlag('ALTERNATIVE_TARGET', alt_name) or \ 240*4882a593Smuzhiyun d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or \ 241*4882a593Smuzhiyun d.getVar('ALTERNATIVE_TARGET') or \ 242*4882a593Smuzhiyun alt_link 243*4882a593Smuzhiyun alt_priority = d.getVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg, alt_name) or \ 244*4882a593Smuzhiyun d.getVarFlag('ALTERNATIVE_PRIORITY', alt_name) or \ 245*4882a593Smuzhiyun d.getVar('ALTERNATIVE_PRIORITY_%s' % pkg) or \ 246*4882a593Smuzhiyun d.getVar('ALTERNATIVE_PRIORITY') 247*4882a593Smuzhiyun 248*4882a593Smuzhiyun # This shouldn't trigger, as it should have been resolved earlier! 249*4882a593Smuzhiyun if alt_link == alt_target: 250*4882a593Smuzhiyun bb.note('alt_link == alt_target: %s == %s -- correcting, this should not happen!' % (alt_link, alt_target)) 251*4882a593Smuzhiyun alt_target = '%s.%s' % (alt_target, pn) 252*4882a593Smuzhiyun 253*4882a593Smuzhiyun if not os.path.lexists('%s/%s' % (pkgdest, alt_target)): 254*4882a593Smuzhiyun bb.warn('%s: NOT adding alternative provide %s: %s does not exist' % (pn, alt_link, alt_target)) 255*4882a593Smuzhiyun continue 256*4882a593Smuzhiyun 257*4882a593Smuzhiyun alt_target = os.path.normpath(alt_target) 258*4882a593Smuzhiyun updates.append( (alt_name, alt_link, alt_target, alt_priority) ) 259*4882a593Smuzhiyun 260*4882a593Smuzhiyun return updates 261*4882a593Smuzhiyun 262*4882a593SmuzhiyunPACKAGESPLITFUNCS:prepend = "populate_packages_updatealternatives " 263*4882a593Smuzhiyun 264*4882a593Smuzhiyunpython populate_packages_updatealternatives () { 265*4882a593Smuzhiyun if not update_alternatives_enabled(d): 266*4882a593Smuzhiyun return 267*4882a593Smuzhiyun 268*4882a593Smuzhiyun # Do actual update alternatives processing 269*4882a593Smuzhiyun for pkg in (d.getVar('PACKAGES') or "").split(): 270*4882a593Smuzhiyun # Create post install/removal scripts 271*4882a593Smuzhiyun alt_setup_links = "" 272*4882a593Smuzhiyun alt_remove_links = "" 273*4882a593Smuzhiyun updates = update_alternatives_alt_targets(d, pkg) 274*4882a593Smuzhiyun for alt_name, alt_link, alt_target, alt_priority in updates: 275*4882a593Smuzhiyun alt_setup_links += '\tupdate-alternatives --install %s %s %s %s\n' % (alt_link, alt_name, alt_target, alt_priority) 276*4882a593Smuzhiyun alt_remove_links += '\tupdate-alternatives --remove %s %s\n' % (alt_name, alt_target) 277*4882a593Smuzhiyun 278*4882a593Smuzhiyun if alt_setup_links: 279*4882a593Smuzhiyun # RDEPENDS setup 280*4882a593Smuzhiyun provider = d.getVar('VIRTUAL-RUNTIME_update-alternatives') 281*4882a593Smuzhiyun if provider: 282*4882a593Smuzhiyun #bb.note('adding runtime requirement for update-alternatives for %s' % pkg) 283*4882a593Smuzhiyun d.appendVar('RDEPENDS:%s' % pkg, ' ' + d.getVar('MLPREFIX', False) + provider) 284*4882a593Smuzhiyun 285*4882a593Smuzhiyun bb.note('adding update-alternatives calls to postinst/prerm for %s' % pkg) 286*4882a593Smuzhiyun bb.note('%s' % alt_setup_links) 287*4882a593Smuzhiyun postinst = d.getVar('pkg_postinst:%s' % pkg) 288*4882a593Smuzhiyun if postinst: 289*4882a593Smuzhiyun postinst = alt_setup_links + postinst 290*4882a593Smuzhiyun else: 291*4882a593Smuzhiyun postinst = '#!/bin/sh\n' + alt_setup_links 292*4882a593Smuzhiyun d.setVar('pkg_postinst:%s' % pkg, postinst) 293*4882a593Smuzhiyun 294*4882a593Smuzhiyun bb.note('%s' % alt_remove_links) 295*4882a593Smuzhiyun prerm = d.getVar('pkg_prerm:%s' % pkg) or '#!/bin/sh\n' 296*4882a593Smuzhiyun prerm += alt_remove_links 297*4882a593Smuzhiyun d.setVar('pkg_prerm:%s' % pkg, prerm) 298*4882a593Smuzhiyun} 299*4882a593Smuzhiyun 300*4882a593Smuzhiyunpython package_do_filedeps:append () { 301*4882a593Smuzhiyun if update_alternatives_enabled(d): 302*4882a593Smuzhiyun apply_update_alternative_provides(d) 303*4882a593Smuzhiyun} 304*4882a593Smuzhiyun 305*4882a593Smuzhiyundef apply_update_alternative_provides(d): 306*4882a593Smuzhiyun pn = d.getVar('BPN') 307*4882a593Smuzhiyun pkgdest = d.getVar('PKGDEST') 308*4882a593Smuzhiyun 309*4882a593Smuzhiyun for pkg in d.getVar('PACKAGES').split(): 310*4882a593Smuzhiyun for alt_name in (d.getVar('ALTERNATIVE:%s' % pkg) or "").split(): 311*4882a593Smuzhiyun alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name) 312*4882a593Smuzhiyun alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name) 313*4882a593Smuzhiyun alt_target = alt_target or d.getVar('ALTERNATIVE_TARGET_%s' % pkg) or d.getVar('ALTERNATIVE_TARGET') or alt_link 314*4882a593Smuzhiyun 315*4882a593Smuzhiyun if alt_link == alt_target: 316*4882a593Smuzhiyun bb.warn('%s: alt_link == alt_target: %s == %s' % (pn, alt_link, alt_target)) 317*4882a593Smuzhiyun alt_target = '%s.%s' % (alt_target, pn) 318*4882a593Smuzhiyun 319*4882a593Smuzhiyun if not os.path.lexists('%s/%s/%s' % (pkgdest, pkg, alt_target)): 320*4882a593Smuzhiyun continue 321*4882a593Smuzhiyun 322*4882a593Smuzhiyun # Add file provide 323*4882a593Smuzhiyun trans_target = oe.package.file_translate(alt_target) 324*4882a593Smuzhiyun d.appendVar('FILERPROVIDES:%s:%s' % (trans_target, pkg), " " + alt_link) 325*4882a593Smuzhiyun if not trans_target in (d.getVar('FILERPROVIDESFLIST:%s' % pkg) or ""): 326*4882a593Smuzhiyun d.appendVar('FILERPROVIDESFLIST:%s' % pkg, " " + trans_target) 327*4882a593Smuzhiyun 328