[PR jw/#169] lib.util.copy(): Require recursive for directories
Merge pull request "lib.util.copy(): Require recursive for directories" Upstream-repo: ssh://git@code.janware.com/janware/jw-pkg Source-branch: jan/feature/20261107-lib-util-copy-require-recursive-for-directories Target-branch: master Reviewed-on: #169
This commit is contained in:
commit
bed3e90169
1 changed files with 19 additions and 1 deletions
|
|
@ -259,7 +259,13 @@ async def copy(
|
|||
ret += '/' + basename
|
||||
src_root = '' if ctx.src.chroot else ctx.src.root
|
||||
s_st = await ctx.src.stat(src_root)
|
||||
if recursive and s_st.is_dir and not s_st.is_gettable:
|
||||
if s_st.is_dir and not s_st.is_gettable:
|
||||
# -- A directory is not a single fetchable object,
|
||||
# and cp copies directories only with -r
|
||||
if not recursive:
|
||||
raise Exception(
|
||||
f'Copying directory "{src}" requires recursive=True'
|
||||
)
|
||||
return await __copy_tree(src_root, ret)
|
||||
|
||||
result = await ctx.src.get(src_root, throw = True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue