Skip to content

Commit f7a8d34

Browse files
authored
Merge pull request #557 from nerdvegas/issue_541-rez-cp
2.26.2 Package Copy Fixes For Non-Varianted Packages
2 parents 9199b82 + 53fa12b commit f7a8d34

File tree

5 files changed

+85
-7
lines changed

5 files changed

+85
-7
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11

2+
## 2.26.2 [[#XXX](https://github.com/nerdvegas/rez/pull/XXX)] Package Copy Fixes For Non-Varianted Packages
3+
4+
#### Addressed Issues
5+
6+
* [#556](https://github.com/nerdvegas/rez/issues/556) rez-cp briefly copies original package definition in non-varianted packages
7+
* [#555](https://github.com/nerdvegas/rez/issues/555) rez-cp inconsistent symlinking when --shallow=true
8+
* [#554](https://github.com/nerdvegas/rez/issues/554) rez-cp doesn't keep file metadata in some cases
9+
10+
#### Notes
11+
12+
There were various minor issues related to copying non-varianted packages.
13+
214
## 2.26.1 [[#552](https://github.com/nerdvegas/rez/pull/552)] Bugfix in Package Copy
315

416
#### Addressed Issues

RELEASE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Releasing New Rez Versions
2+
3+
If you are a collaborator and have push access to master, these are the steps to
4+
follow to release a new version:
5+
6+
1. Make sure that the version in `utils/_version.py` is updated appropriately.
7+
Rez uses [semantic versioning](https://semver.org/).
8+
1. Before pushing your branch, update `CHANGELOG.md` to describe the changes. Follow
9+
the existing structure. The PR for the merge appears in square brackets in the
10+
title (eg `[#552]`); since this PR doesn't exist yet, just leave `[#XXX]` as a
11+
placeholder.
12+
2. Push your changes, and create a PR to master. In that PR's description, copy
13+
the markdown you added to the changelog for this release. Change only the title
14+
- just put the version number there.
15+
3. Once approved, merge to master.
16+
4. In master, go back to `CHANGELOG.md` and update the PR number appropriately.
17+
5. Run tag.sh. This tags the git repo with the version in `utils/_version.py`.
18+
6. Do a `git push` to push changelog update, and a `git push --tags` to push the
19+
new tag.
20+
7. Goto [https://github.com/nerdvegas/rez/releases] and create a new release. Use
21+
the changelog markdown as the starting point, and format appropriately (look
22+
at existing release notes to see what to do).
23+
24+
## Example Changelog Entry
25+
26+
```
27+
## 1.2.3 [[#000](https://github.com/nerdvegas/rez/pull/456)] Release Title Here
28+
29+
#### Addressed Issues
30+
31+
* [#000](https://github.com/nerdvegas/rez/issues/000) some thing is broken
32+
* [#001](https://github.com/nerdvegas/rez/issues/001) some other thing is broken
33+
34+
#### Merged PRs
35+
36+
* [#002](https://github.com/nerdvegas/rez/pull/002) fixed the floober
37+
* [#003](https://github.com/nerdvegas/rez/pull/003) added missing flaaber
38+
39+
#### Notes
40+
41+
Notes about the new release go here. These should add any info that isn't
42+
necessarily obvious from the linked issues.
43+
44+
#### COMPATIBILITY ISSUE!
45+
46+
Put any notes here in the unfortunate case where some form of backwards
47+
incompatibility is unavoidable. This is rare.
48+
```

src/rez/package_copy.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
import os.path
33
import time
44

5+
from rez.config import config
56
from rez.exceptions import PackageCopyError
67
from rez.package_repository import package_repository_manager
8+
from rez.serialise import FileFormat
79
from rez.utils.sourcecode import IncludeModuleManager
810
from rez.utils.logging_ import print_info
911
from rez.utils.filesystem import replacing_symlink, replacing_copy, \
@@ -257,15 +259,31 @@ def _copy_variant_payload(src_variant, dest_pkg_repo, shallow=False,
257259
else:
258260
safe_makedirs(variant_install_path)
259261

260-
# copy all files, and symlink/copy all dirs within the null variant
262+
# Symlink/copy all files and dirs within the null variant, except
263+
# for the package definition itself.
264+
#
261265
for name in os.listdir(variant_root):
266+
is_pkg_defn = False
267+
268+
# skip package definition file
269+
name_ = os.path.splitext(name)[0]
270+
if name_ in config.plugins.package_repository.filesystem.package_filenames:
271+
for fmt in (FileFormat.py, FileFormat.yaml):
272+
filename = name_ + '.' + fmt.extension
273+
if name == filename:
274+
is_pkg_defn = True
275+
break
276+
277+
if is_pkg_defn:
278+
continue
279+
262280
src_path = os.path.join(variant_root, name)
263281
dest_path = os.path.join(variant_install_path, name)
264282

265-
if os.path.isdir(src_path) and not os.path.islink(src_path):
266-
maybe_symlink(src_path, dest_path)
267-
else:
283+
if os.path.islink(src_path):
268284
copy_func(src_path, dest_path)
285+
else:
286+
maybe_symlink(src_path, dest_path)
269287

270288

271289
def _copy_package_include_modules(src_package, dest_pkg_repo, overrides=None):

src/rez/utils/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
# Update this value to version up Rez. Do not place anything else in this file.
4-
_rez_version = "2.26.1"
4+
_rez_version = "2.26.2"
55

66
try:
77
from rez.vendor.version.version import Version

src/rez/utils/filesystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def replacing_copy(src, dest, follow_symlinks=False):
144144
shutil.copytree(src, tmp_dest, symlinks=(not follow_symlinks))
145145
else:
146146
# copy a file
147-
shutil.copy(src, tmp_dest)
147+
shutil.copy2(src, tmp_dest)
148148

149149
replace_file_or_dir(dest, tmp_dest)
150150

@@ -177,7 +177,7 @@ def replace_file_or_dir(dest, source):
177177

178178

179179
def additive_copytree(src, dst, symlinks=False, ignore=None):
180-
"""Version of `copytree` that can overwrite an existing directory.
180+
"""Version of `copytree` that merges into an existing directory.
181181
"""
182182
if not os.path.exists(dst):
183183
os.makedirs(dst)

0 commit comments

Comments
 (0)