Skip to content
Merged
Changes from 2 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
20 changes: 19 additions & 1 deletion src/rez/cli/pkg-cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ def setup_parser(parser, completions=False):
group.add_argument(
"--daemon", action="store_true", help=SUPPRESS
)
parser.add_argument(
"--pkg-cache-mode",
choices=["sync", "async"],
default=None,
help="If provided, override the rezconfig's package_cache_async key. "
"If 'sync', the process will block until packages are cached. "
"If 'async', the process will not block while packages are cached."
)
parser.add_argument(
"-c", "--columns", nargs='+', choices=column_choices,
default=["status", "package", "variant_uri", "cache_path"],
Expand Down Expand Up @@ -70,7 +78,17 @@ def add_variant(pkgcache, uri, opts):
print("No such variant: %s" % uri, file=sys.stderr)
sys.exit(1)

destpath, status = pkgcache.add_variant(variant, force=opts.force)
if opts.pkg_cache_mode == "async":
cache_mode = True
elif opts.pkg_cache_mode == "sync":
cache_mode = False
else:
cache_mode = not config.package_cache_async

destpath, status = pkgcache.add_variant(
variant, force=opts.force,
wait_for_copying=cache_mode
)

if status == PackageCache.VARIANT_FOUND:
print_info("Already exists: %s", destpath)
Expand Down
Loading