fresh-cat-90827
02/14/2022, 10:05 AMProcess
. There was a file produced. I need to rename that file.
files = await Get(DigestEntries, Digest, result.output_digest) # result is from "await Get(ProcessResult, Process(...))"
for file in files:
print(f"Path: {file.path}")
print(f"Path: {file.file_digest}")
get
stdout: "Path: file.data"
stdout: "\n"
stdout: "Path: FileDigest('a5958f492644f5abe6f784fb1840b70e279143cbbc5d3a0770d7554a8b80d982', 796)"
Reading https://www.pantsbuild.org/docs/rules-api-file-system#digestentries. Do I need to write the FileDigest
on disk (to produce a brand new file) with Workspace.write_digest()
or is there a mechanism to update the filename in place?curved-television-6568
02/14/2022, 11:27 AMcurved-television-6568
02/14/2022, 11:28 AMfresh-cat-90827
02/14/2022, 11:28 AMmv origin dest
command would do 🙂curved-television-6568
02/14/2022, 11:29 AMcurved-television-6568
02/14/2022, 11:29 AMmv origin/file dest/file
curved-television-6568
02/14/2022, 11:29 AMAddPrefix
and RemovePrefix
does the moving…curved-television-6568
02/14/2022, 11:30 AMcurved-television-6568
02/14/2022, 11:31 AMfast-nail-55400
02/14/2022, 12:34 PMFileEntry
to CreateDigest
to make a new digest.fast-nail-55400
02/14/2022, 12:35 PMFileEntry
with the new name but with the digest set to the FileDigest
from the previous FileEntry
. Then pass to await Get(Digest, CreateDigest(…))
fast-nail-55400
02/14/2022, 12:36 PMAddPrefix
/ RemovePrefix
but you can pretty much do whatever you want with it.fast-nail-55400
02/14/2022, 12:38 PMAddPrefix
/ RemovePrefix
had been too high level for my needs)fast-nail-55400
02/14/2022, 12:39 PMWould perhaps make sense to have a more powerful digest mutation intrinsic where you can more freely alter the contents of a digest..
CreateDigest
with the list of FileEntry
🙂fast-nail-55400
02/14/2022, 12:42 PMcurved-television-6568
02/14/2022, 12:42 PMFileEntry
and the FileContent
.fast-nail-55400
02/14/2022, 12:43 PMFileContent
was the original API but it brings the file into memory which is a problem in the JVM backends when manipulating large jar filescurved-television-6568
02/14/2022, 12:44 PMFileEntry
makes a ton of sense when working with the files, rather than the contents.fresh-cat-90827
02/14/2022, 12:46 PMfresh-cat-90827
02/14/2022, 9:32 PM