mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1763991: Implement move-file update-action r=jewilde
Differential Revision: https://phabricator.services.mozilla.com/D143629
This commit is contained in:
parent
1f6c848ef2
commit
cac3a77d97
6
python/mozbuild/mozbuild/vendor/moz_yaml.py
vendored
6
python/mozbuild/mozbuild/vendor/moz_yaml.py
vendored
@ -236,6 +236,7 @@ vendoring:
|
||||
# Actions to take after updating. Applied in order.
|
||||
# The action subfield is required. It must be one of:
|
||||
# - copy-file
|
||||
# - move-file
|
||||
# - move-dir
|
||||
# - replace-in-file
|
||||
# - replace-in-file-regex
|
||||
@ -243,7 +244,7 @@ vendoring:
|
||||
# - run-script
|
||||
# Unless otherwise noted, all subfields of action are required.
|
||||
#
|
||||
# If the action is copy-file or move-dir:
|
||||
# If the action is copy-file, move-file, or move-dir:
|
||||
# from is the source file
|
||||
# to is the destination
|
||||
#
|
||||
@ -444,6 +445,7 @@ def _schema_1():
|
||||
Required("action"): In(
|
||||
[
|
||||
"copy-file",
|
||||
"move-file",
|
||||
"move-dir",
|
||||
"replace-in-file",
|
||||
"replace-in-file-regex",
|
||||
@ -563,7 +565,7 @@ class UpdateActions(object):
|
||||
for v in values:
|
||||
if "action" not in v:
|
||||
raise Invalid("All file-update entries must specify a valid action")
|
||||
if v["action"] in ["copy-file", "move-dir"]:
|
||||
if v["action"] in ["copy-file", "move-file", "movie-dir"]:
|
||||
if "from" not in v or "to" not in v or len(v.keys()) != 3:
|
||||
raise Invalid(
|
||||
"%s action must (only) specify 'from' and 'to' keys"
|
||||
|
@ -403,6 +403,15 @@ class VendorManifest(MozbuildObject):
|
||||
contents = f.read()
|
||||
with open(dst, "w") as f:
|
||||
f.write(contents)
|
||||
elif update["action"] == "move-file":
|
||||
src = self.get_full_path(update["from"])
|
||||
dst = self.get_full_path(update["to"])
|
||||
|
||||
self.logInfo(
|
||||
{"s": src, "d": dst}, "action: move-file src: {s} dst: {d}"
|
||||
)
|
||||
|
||||
shutil.move(src, dst)
|
||||
elif update["action"] == "move-dir":
|
||||
src = self.get_full_path(update["from"])
|
||||
dst = self.get_full_path(update["to"])
|
||||
|
Loading…
Reference in New Issue
Block a user