Skip to content

Commit ee155a4

Browse files
committed
Fixed behavior of UpdateSHA
1 parent 580ae1a commit ee155a4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/SciSharp.TensorFlow.Redist/SciSharp.TensorFlow.Redist.nupkgproj

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,27 +102,26 @@
102102
ItemName="FilesWithHashes" />
103103
</GetFileHash>
104104

105-
<Message Importance="High"
106-
Text="%(FilesWithHashes.Identity): %(FilesWithHashes.FileHash)" />
105+
<WriteLinesToFile File="%(FilesWithHashes.Identity).sha" Lines="%(FilesWithHashes.FileHash)" Overwrite="true"/>
106+
107+
<!-- If specified we'll update the checked in SHAs with the downloaded ones. -->
108+
<Copy Condition="'$(UpdateSHA)' == 'true'"
109+
SourceFiles="@(TensorFlowArchive->'%(DownloadShaFile)')"
110+
DestinationFiles="@(TensorFlowArchive->'%(LocalShaFile)')" />
107111

108112
<ItemGroup>
109113
<TensorFlowArchive>
110114
<DownloadSha>@(FilesWithHashes->'%(FileHash)')</DownloadSha>
111-
<LocalSha>$([System.IO.File]::ReadAllText('%(LocalShaFile)'))</LocalSha>
115+
<LocalSha>$([System.IO.File]::ReadAllText('%(LocalShaFile)').Replace("%0A", ""))</LocalSha>
112116
</TensorFlowArchive>
113117
</ItemGroup>
114118

115-
<!-- If specified we'll update the checked in SHAs with the downloaded ones. -->
116-
<!--<WriteLinesToFile Condition="'$(UpdateSHA)' == 'true'"
117-
File="@(TensorFlowArchive->'%(LocalShaFile)')"
118-
Lines="@(TensorFlowArchive->'%(LocalShaFile)')" />-->
119-
120119
<Error Condition="!Exists('%(TensorFlowArchive.LocalShaFile)')" Text="SHA file '%(TensorFlowArchive.LocalShaFile)' does not exist. Build with /p:UpdateSHA=true to save it." />
121120

122121
<Message Importance="High" Text="@TensorFlowArchive->'%(TensorFlowArchive.DownloadFile) - %(TensorFlowArchive.LocalSha) - %(TensorFlowArchive.DownloadSha)"/>
123122

124123
<!-- Validate that the downloaded SHAs match the expected checked in SHAs -->
125-
<Error Condition="'%(TensorFlowArchive.LocalSha)' != '%(TensorFlowArchive.DownloadSha)'" Text="Downloaded file '%(TensorFlowArchive.DownloadFile)' has unexpected SHA.%0A expected: %(_downloadedTensorFlowArchive.LocalSha)%0A actual: %(_downloadedTensorFlowArchive.DownloadSha)%0ABuild with /p:UpdateSHA=true if you intentionally changed the URL and wish to update the SHAs, otherwise this could indicate an incomplete download or intercerpted URL and should be examined." />
124+
<Error Condition="'%(TensorFlowArchive.LocalSha)' != '%(TensorFlowArchive.DownloadSha)'" Text="Downloaded file '%(TensorFlowArchive.DownloadFile)' has unexpected SHA.%0A expected: %(TensorFlowArchive.LocalSha)%0A --actual: %(TensorFlowArchive.DownloadSha)%0ABuild with /p:UpdateSHA=true if you intentionally changed the URL and wish to update the SHAs, otherwise this could indicate an incomplete download or intercerpted URL and should be examined." />
126125

127126

128127
<!-- The archives are valid, lets extract them, ensuring an empty directory -->

0 commit comments

Comments
 (0)