swiftlang / swift-sdk-generator

Generate Swift SDKs for cross-compilation
Apache License 2.0
182 stars 15 forks source link

incomplete Artifacts downloads corrupt the cache #109

Open toffaletti opened 5 months ago

toffaletti commented 5 months ago

I had a download of the host_llvm toolchain hang and never make progress. The next time I tried to run swift-sdk-generator it seemed to think the incomplete file was valid even though it was missing about 100Mb. Removing the file from the Artifacts directory didn't help, I had to blow away the entire Artifacts directory including the cache.db files. It seems like it had created an entry in the cache.db for the incomplete file. There were two entries in the db when I looked (the host_swift download completed successfully), but I couldn't decipher which was which.

toffaletti commented 3 months ago

for anyone else suffering through this, I found you can work around it by downloading the files via another tool that can handle timeouts, retries, etc. and then move the files into the Artifacts directory overwriting the incomplete downloads.

swift archives are from swift.org

llvm downloaded archives are from GitHub releases (these seem to frequently need retries for me) https://github.com/swiftlang/swift-sdk-generator/blob/1a5e7c86e728a0a40ccf0b7b192b11ca3a4ad4aa/Sources/SwiftSDKGenerator/Artifacts/DownloadableArtifacts.swift#L68