mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #19713 - tigercosmos:r1, r=jdm
auto clean cache in build bot <!-- Please describe your changes on the following line: --> auto clean cache in build bot once this merged, servo/saltfs#321 should be closed --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #19712 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19713) <!-- Reviewable:end -->
This commit is contained in:
commit
d11886e9a1
3 changed files with 30 additions and 6 deletions
|
@ -169,10 +169,7 @@ class MachCommands(CommandBase):
|
|||
@CommandArgument('--keep',
|
||||
default='1',
|
||||
help='Keep up to this many most recent dependencies')
|
||||
@CommandArgument('--custom-path', '-c',
|
||||
action='store_true',
|
||||
help='Get Cargo path from CARGO_HOME environment variable')
|
||||
def clean_cargo_cache(self, force=False, show_size=False, keep=None, custom_path=False):
|
||||
def clean_cargo_cache(self, force=False, show_size=False, keep=None):
|
||||
def get_size(path):
|
||||
if os.path.isfile(path):
|
||||
return os.path.getsize(path) / (1024 * 1024.0)
|
||||
|
@ -189,7 +186,7 @@ class MachCommands(CommandBase):
|
|||
'git': {},
|
||||
}
|
||||
import toml
|
||||
if os.environ.get("CARGO_HOME", "") and custom_path:
|
||||
if os.environ.get("CARGO_HOME", ""):
|
||||
cargo_dir = os.environ.get("CARGO_HOME")
|
||||
else:
|
||||
cargo_dir = path.join(self.context.topdir, ".cargo")
|
||||
|
@ -317,7 +314,10 @@ class MachCommands(CommandBase):
|
|||
print("Removing `{}`{} package from {}".format(*print_msg))
|
||||
for crate_path in crate_paths:
|
||||
if os.path.exists(crate_path):
|
||||
delete(crate_path)
|
||||
try:
|
||||
delete(crate_path)
|
||||
except:
|
||||
print("Delete %s failed!" % crate_path)
|
||||
else:
|
||||
print("Would remove `{}`{} package from {}".format(*print_msg))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue