Commit 332c86df authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

libdca.recipe: Fix symlink creation code

Fixes CI error:
Traceback (most recent call last):
  File "/builds/nirbheek/cerbero/cerbero/build/oven.py", line 461, in _cook_recipe_step
    ret = stepfunc()
  File "/builds/nirbheek/cerbero/cerbero/build/recipe.py", line 93, in wrapped
    stepfunc()
  File "/builds/nirbheek/cerbero/recipes/libdca.recipe", line 34, in post_install
    os.symlink(src, os.path.join(self.config.prefix, dest))

FileExistsError: [Errno 17] File exists: 'lib/libdts.a' -> '/builds/nirbheek/cerbero/cerbero-build/dist/mingw_x86_64/libdca.a'
Part-of: <!618>
parent 102f0638
Pipeline #208212 passed with stages
in 71 minutes and 32 seconds
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python # -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from pathlib import Path
class Recipe(recipe.Recipe): class Recipe(recipe.Recipe):
name = 'libdca' name = 'libdca'
...@@ -25,11 +26,13 @@ class Recipe(recipe.Recipe): ...@@ -25,11 +26,13 @@ class Recipe(recipe.Recipe):
# Create relative symlinks to prevent breakage during packaging # Create relative symlinks to prevent breakage during packaging
if self.config.platform != Platform.WINDOWS: if self.config.platform != Platform.WINDOWS:
dangling = [ dangling = [
('lib/libdts.a', 'libdca.a'), ('libdca.a', 'lib/libdts.a'),
('share/man/man1/extract_dts.1', 'extract_dca.1'), ('extract_dca.1', 'share/man/man1/extract_dts.1'),
('share/man/man1/dtsdec.1', 'dcadec.a'), ('dcadec.1', 'share/man/man1/dtsdec.1'),
] ]
prefix = Path(self.config.prefix)
for src, dest in dangling: for src, dest in dangling:
os.remove(os.path.join(self.config.prefix, src)) dest = prefix / dest
os.symlink(src, os.path.join(self.config.prefix, dest)) dest.unlink()
dest.symlink_to(src)
super().post_install() super().post_install()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment