From dc1ca8048c63d76181268e17d369726742e97887 Mon Sep 17 00:00:00 2001 From: ajohns Date: Sat, 12 Jan 2019 10:28:14 +1100 Subject: [PATCH 1/2] -switched from copy() to copy2() to keep file metadata during package copy -when doing pkg copy with shallow=true, symlink files as well as dirs -avoid copying the pkg defn file during package copy --- src/rez/package_copy.py | 26 ++++++++++++++++++++++---- src/rez/utils/_version.py | 2 +- src/rez/utils/filesystem.py | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/rez/package_copy.py b/src/rez/package_copy.py index 398681bbe..3715b9814 100644 --- a/src/rez/package_copy.py +++ b/src/rez/package_copy.py @@ -2,8 +2,10 @@ import os.path import time +from rez.config import config from rez.exceptions import PackageCopyError from rez.package_repository import package_repository_manager +from rez.serialise import FileFormat from rez.utils.sourcecode import IncludeModuleManager from rez.utils.logging_ import print_info from rez.utils.filesystem import replacing_symlink, replacing_copy, \ @@ -257,15 +259,31 @@ def _copy_variant_payload(src_variant, dest_pkg_repo, shallow=False, else: safe_makedirs(variant_install_path) - # copy all files, and symlink/copy all dirs within the null variant + # Symlink/copy all files and dirs within the null variant, except + # for the package definition itself. + # for name in os.listdir(variant_root): + is_pkg_defn = False + + # skip package definition file + name_ = os.path.splitext(name)[0] + if name_ in config.plugins.package_repository.filesystem.package_filenames: + for fmt in (FileFormat.py, FileFormat.yaml): + filename = name_ + '.' + fmt.extension + if name == filename: + is_pkg_defn = True + break + + if is_pkg_defn: + continue + src_path = os.path.join(variant_root, name) dest_path = os.path.join(variant_install_path, name) - if os.path.isdir(src_path) and not os.path.islink(src_path): - maybe_symlink(src_path, dest_path) - else: + if os.path.islink(src_path): copy_func(src_path, dest_path) + else: + maybe_symlink(src_path, dest_path) def _copy_package_include_modules(src_package, dest_pkg_repo, overrides=None): diff --git a/src/rez/utils/_version.py b/src/rez/utils/_version.py index f8e15f764..28d06005d 100644 --- a/src/rez/utils/_version.py +++ b/src/rez/utils/_version.py @@ -1,7 +1,7 @@ # Update this value to version up Rez. Do not place anything else in this file. -_rez_version = "2.26.1" +_rez_version = "2.26.2" try: from rez.vendor.version.version import Version diff --git a/src/rez/utils/filesystem.py b/src/rez/utils/filesystem.py index dae1d0d4d..e15bf556e 100644 --- a/src/rez/utils/filesystem.py +++ b/src/rez/utils/filesystem.py @@ -144,7 +144,7 @@ def replacing_copy(src, dest, follow_symlinks=False): shutil.copytree(src, tmp_dest, symlinks=(not follow_symlinks)) else: # copy a file - shutil.copy(src, tmp_dest) + shutil.copy2(src, tmp_dest) replace_file_or_dir(dest, tmp_dest) @@ -177,7 +177,7 @@ def replace_file_or_dir(dest, source): def additive_copytree(src, dst, symlinks=False, ignore=None): - """Version of `copytree` that can overwrite an existing directory. + """Version of `copytree` that merges into an existing directory. """ if not os.path.exists(dst): os.makedirs(dst) From 53fa12b0afe5872a491f4fa136fdf5c97b537c1e Mon Sep 17 00:00:00 2001 From: ajohns Date: Sat, 12 Jan 2019 11:29:03 +1100 Subject: [PATCH 2/2] -added release guide, see README.md -added changelog --- CHANGELOG.md | 12 ++++++++++++ RELEASE.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 RELEASE.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b98554e2..5c1de05ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,16 @@ +## 2.26.2 [[#XXX](https://github.com/nerdvegas/rez/pull/XXX)] Package Copy Fixes For Non-Varianted Packages + +#### Addressed Issues + +* [#556](https://github.com/nerdvegas/rez/issues/556) rez-cp briefly copies original package definition in non-varianted packages +* [#555](https://github.com/nerdvegas/rez/issues/555) rez-cp inconsistent symlinking when --shallow=true +* [#554](https://github.com/nerdvegas/rez/issues/554) rez-cp doesn't keep file metadata in some cases + +#### Notes + +There were various minor issues related to copying non-varianted packages. + ## 2.26.1 [[#552](https://github.com/nerdvegas/rez/pull/552)] Bugfix in Package Copy #### Addressed Issues diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 000000000..19a2cc4e6 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,48 @@ +# Releasing New Rez Versions + +If you are a collaborator and have push access to master, these are the steps to +follow to release a new version: + +1. Make sure that the version in `utils/_version.py` is updated appropriately. + Rez uses [semantic versioning](https://semver.org/). +1. Before pushing your branch, update `CHANGELOG.md` to describe the changes. Follow + the existing structure. The PR for the merge appears in square brackets in the + title (eg `[#552]`); since this PR doesn't exist yet, just leave `[#XXX]` as a + placeholder. +2. Push your changes, and create a PR to master. In that PR's description, copy + the markdown you added to the changelog for this release. Change only the title + - just put the version number there. +3. Once approved, merge to master. +4. In master, go back to `CHANGELOG.md` and update the PR number appropriately. +5. Run tag.sh. This tags the git repo with the version in `utils/_version.py`. +6. Do a `git push` to push changelog update, and a `git push --tags` to push the + new tag. +7. Goto [https://github.com/nerdvegas/rez/releases] and create a new release. Use + the changelog markdown as the starting point, and format appropriately (look + at existing release notes to see what to do). + +## Example Changelog Entry + +``` +## 1.2.3 [[#000](https://github.com/nerdvegas/rez/pull/456)] Release Title Here + +#### Addressed Issues + +* [#000](https://github.com/nerdvegas/rez/issues/000) some thing is broken +* [#001](https://github.com/nerdvegas/rez/issues/001) some other thing is broken + +#### Merged PRs + +* [#002](https://github.com/nerdvegas/rez/pull/002) fixed the floober +* [#003](https://github.com/nerdvegas/rez/pull/003) added missing flaaber + +#### Notes + +Notes about the new release go here. These should add any info that isn't +necessarily obvious from the linked issues. + +#### COMPATIBILITY ISSUE! + +Put any notes here in the unfortunate case where some form of backwards +incompatibility is unavoidable. This is rare. +```