Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix install w/ .cylcignore #5066

Merged
merged 4 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Maintenance release.
[#5045](https://github.com/cylc/cylc-flow/pull/5045) -
Fix issue where unsatisfied xtriggers could be wiped on reload.

[#5066](https://github.com/cylc/cylc-flow/pull/5066) - Fix bug where
.cylcignore only found if `cylc install` is run in source directory.

[#5031](https://github.com/cylc/cylc-flow/pull/5031) - Fix bug where
specifying multiple datetime offsets (e.g. `final cycle point = +P1M-P1D`)
would not obey the given order.
Expand Down
5 changes: 3 additions & 2 deletions cylc/flow/workflow_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,8 +1477,9 @@ def get_rsync_rund_cmd(src, dst, reinstall=False, dry_run=False):
if (Path(src).joinpath(exclude).exists() or
Path(dst).joinpath(exclude).exists()):
rsync_cmd.append(f"--exclude={exclude}")
if Path(src).joinpath('.cylcignore').exists():
rsync_cmd.append("--exclude-from=.cylcignore")
cylcignore_file = Path(src).joinpath('.cylcignore')
if cylcignore_file.exists():
rsync_cmd.append(f"--exclude-from={cylcignore_file}")
rsync_cmd.append(f"{src}/")
rsync_cmd.append(f"{dst}/")

Expand Down
44 changes: 29 additions & 15 deletions tests/functional/cylc-install/03-file-transfer.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
if ! command -v 'tree' >'/dev/null'; then
skip_all '"tree" command not available'
fi
set_test_number 6
set_test_number 9

# Need to override any symlink dirs set in global.cylc:
create_test_global_config "" "
Expand Down Expand Up @@ -69,24 +69,36 @@ __OUT__
popd || exit 1
purge_rnd_workflow


# Test cylc install copies files to run dir successfully, exluding files from .cylcignore file.
TEST_NAME="${TEST_NAME_BASE}-cylcignore-file"
make_rnd_workflow
pushd "${RND_WORKFLOW_SOURCE}" || exit 1
mkdir .git .svn dir1 dir2 extradir1 extradir2
touch .git/file1 .svn/file1 dir1/file1 dir2/file1 extradir1/file1 extradir2/file1 file1 file2 .cylcignore
cat > .cylcignore <<__END__
# Test cylc install copies files to run dir successfully, exluding files from
# .cylcignore file.
# Should work if we run "cylc install" from source dir or not (see GH #5066)
for RUN_IN_SRC_DIR in true false; do
TEST_NAME="${TEST_NAME_BASE}-cylcignore-${RUN_IN_SRC_DIR}"
make_rnd_workflow
pushd "${RND_WORKFLOW_SOURCE}" || exit 1
mkdir .git .svn dir1 dir2 extradir1 extradir2
touch .git/file1 .svn/file1 dir1/file1 dir2/file1 extradir1/file1 extradir2/file1 file1 file2 .cylcignore
cat > .cylcignore <<__END__
dir*
extradir*
file2
__END__

run_ok "${TEST_NAME}" cylc install --no-run-name
if ${RUN_IN_SRC_DIR}; then
run_ok "${TEST_NAME}" cylc install --no-run-name
CWD="${PWD}"
else
DTMP=$(mktemp -d)
pushd "${DTMP}" || exit 1
run_ok "${TEST_NAME}" cylc install --no-run-name "${RND_WORKFLOW_SOURCE}"
CWD="${PWD}"
popd || exit 1
fi

tree -a -v -I '*.log|03-file-transfer*' --charset=ascii --noreport "${RND_WORKFLOW_RUNDIR}/" > 'cylc-ignore-tree.out'
OUT="cylc-ignore-tree-${RUN_IN_SRC_DIR}.out"
tree -a -v -I '*.log|03-file-transfer*' --charset=ascii --noreport "${RND_WORKFLOW_RUNDIR}/" > "$OUT"

cmp_ok 'cylc-ignore-tree.out' <<__OUT__
cmp_ok "$OUT" <<__OUT__
${RND_WORKFLOW_RUNDIR}/
|-- _cylc-install
| \`-- source -> ${RND_WORKFLOW_SOURCE}
Expand All @@ -96,8 +108,10 @@ ${RND_WORKFLOW_RUNDIR}/
\`-- install
__OUT__

contains_ok "${TEST_NAME}.stdout" <<__OUT__
contains_ok "${CWD}/${TEST_NAME}.stdout" <<__OUT__
INSTALLED $RND_WORKFLOW_NAME from ${RND_WORKFLOW_SOURCE}
__OUT__
popd || exit 1
purge_rnd_workflow

popd || exit 1
purge_rnd_workflow
done