Enable copy_bom to find dependences directories which ends with '/'

This commit is contained in:
Jianfeng Jiang 2023-10-09 16:49:00 +08:00 committed by volcano
parent ceb4a9871a
commit 038e001bbc
3 changed files with 10 additions and 6 deletions

@ -47,7 +47,7 @@ The second part in the line indicates where to find shared libraries. All paths
# known limitations
- The use of wildcard(like *) in files or directories is not supported. It may result in `copy_bom` behaving incorrectly.
- The use of wildcard(like *) in files or directories is not supported. It may result in `copy_bom` behaving incorrectly. To achieve a similar purpose, directly add `/` after the directory name to copy all contents in the directory while not copying the directory itself.
- If we create symbolic link in bom file, it will always delete the old link and create a new one. It will change the modification time of the symbolic link.
- Environmental variables pointing to an empty value may fail to resolve.

@ -36,3 +36,11 @@ targets:
mkdirs:
- python-occlum
- python-occlum/bin
- target: /etc
copy:
- dirs:
# If there's a '/' as the postfix in directory name, copy the contents in
# directories, not including the directory itself.
# cp -r /etc/opt/ /etc
- /etc/opt/

@ -461,11 +461,7 @@ impl BomManagement {
// get all files in copydirs. filter directories and symlinks
let mut files_in_copied_dirs = Vec::new();
for (src, dest) in dirs_to_copy {
let dirname = PathBuf::from(src)
.file_name()
.unwrap()
.to_string_lossy()
.to_string();
let dirname = src.split('/').last().unwrap();
let dest_dir = PathBuf::from(dest)
.join(dirname)
.to_string_lossy()