Page MenuHomeSoftware Heritage

replay: Fix handling of directory symlink in external
ClosedPublic

Authored by anlambert on Mar 21 2022, 5:19 PM.

Details

Summary

As we use distutils.dir_util.copy_tree to copy an external exported
in a cache directory to the reconstructed filesystem of the subversion
repository, we need to ensure sub-directories of the external will
exist in the destination path to avoid copy errors.

However, if a sub-directory is a symlink, we must not create the
directory in the destination path as copy_tree will fail attempting
to recreate the symlink.

Fixes SWH-LOADER-SVN-71

Diff Detail

Repository
rDLDSVN Subversion (SVN) loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D7402 (id=26744)

Rebasing onto af821525c5...

Current branch diff-target is up to date.
Changes applied before test
commit c1580bf66f9a193551081ce3112acf08456ee2a7
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon Mar 21 17:12:39 2022 +0100

    replay: Fix handling of directory symlink in external
    
    As we use distutils.dir_util.copy_tree to copy an external exported
    in a cache directory to the reconstructed filesystem of the subversion
    repository, we need to ensure sub-directories of the external will
    exist in the destination path to avoid copy errors.
    
    However, if a sub-directory is a symlink, we must not create the
    directory in the destination path as copy_tree will fail attempting
    to recreate the symlink.

See https://jenkins.softwareheritage.org/job/DLDSVN/job/tests-on-diff/308/ for more details.

This revision is now accepted and ready to land.Mar 22 2022, 10:26 AM