Skip to content

Commit

Permalink
Merge pull request #557 from nerdvegas/issue_541-rez-cp
Browse files Browse the repository at this point in the history
2.26.2 Package Copy Fixes For Non-Varianted Packages
  • Loading branch information
nerdvegas authored Jan 12, 2019
2 parents 9199b82 + 53fa12b commit f7a8d34
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 7 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
48 changes: 48 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -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.
```
26 changes: 22 additions & 4 deletions src/rez/package_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/rez/utils/_version.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/rez/utils/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f7a8d34

Please sign in to comment.