Skip to content

Commit

Permalink
swupdate-common.bbclass: Handle empty IMAGE_LINK_NAME
Browse files Browse the repository at this point in the history
When IMAGE_LINK_NAME is empty or when IMAGE_LINK_NAME is equal to
IMAGE_NAME, this results in an error like:
  Exception: FileExistsError: [Errno 17] File exists:
  'my-image-swu-sd-tdpzu9.swu' -> 'my-image-swu-sd-tdpzu9.swu'

To solve this, check if IMAGE_LINK_NAME is valid before attempting to
create the symlink.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Stefano Babic <sbabic@denx.de>
  • Loading branch information
sbabic committed Jul 5, 2022
1 parent 649f9d9 commit ee77800
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions classes/swupdate-common.bbclass
Expand Up @@ -289,11 +289,14 @@ def swupdate_create_cpio(d, swudeploydir, list_for_cpio):
s = d.getVar('S', True)
os.chdir(s)
updateimage = d.getVar('IMAGE_NAME', True) + '.swu'
updateimage_link = d.getVar('IMAGE_LINK_NAME', True) + '.swu'
line = 'for i in ' + ' '.join(list_for_cpio) + '; do echo $i;done | cpio -ov -H crc > ' + os.path.join(swudeploydir, updateimage)
os.system(line)
os.chdir(swudeploydir)
os.symlink(updateimage, updateimage_link)
updateimage_link = d.getVar('IMAGE_LINK_NAME', True)
if updateimage_link:
updateimage_link += '.swu'
if updateimage_link != updateimage:
os.symlink(updateimage, updateimage_link)

python do_swuimage () {
import shutil
Expand Down

0 comments on commit ee77800

Please sign in to comment.