Skip to content
  • Nirbheek Chauhan's avatar
    gitlab: Fix cannot overwrite directory error when symlinking · b0f5da22
    Nirbheek Chauhan authored
    GitLab doesn't wipe images entirely before reusing them across jobs.
    It relies on the build scripts to not write outside the workdir.
    However, we create symlinks outside of the workdir, which breaks in
    weird ways.
    
    Specifically, when ../../gstreamer/cerbero exists, `ln -sf` creates
    ../../gstreamer/cerbero/cerbero, which is wrong, but doesn't cause an
    error. However, when the image is reused again after this,
    ../../gstreamer/cerbero/cerbero already exists, so `ln -sf` yields:
    
    ln: ../../gstreamer/cerbero/cerbero: cannot overwrite directory
    
    This is fixed in master after overhauling the scripts to never write
    outside of workdir, but for 1.16 we need to hack it by not symlinking
    if the target dir already exists.
    
    Originally commited to the 1.16 branch in
    !370
    
    The proper fix will be backported from master, but let's fix this
    error in the meantime so it doesn't roadblock the 1.18 stable releases
    
    Part-of: <!374>
    b0f5da22