Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 28e6f69

Browse files
committed
Fixes #524. Upgraded NuGet dependencies:
GitInfo from 2.0.15 to 2.0.20 Microsoft.NET.Test.Sdk from 15.8.0 to 16.0.1 NUnit from 3.10.1 to 3.11.0 NUnit3TestAdapter from 3.10.0 to 3.13.0 Microsoft.Extensions.Configuration.EnvironmentVariables from 2.1.1 to 2.2.0 Microsoft.Extensions.Configuration.Ini from 2.1.1 to 2.2.0 SharpCompress from 0.22 to 0.23 With the upgrade to the latest SharpCompress, the handrolled tar symlink support in BAM Core has been deleted. All tar extraction operations now go through SharpCompress.
1 parent b3ac77a commit 28e6f69

File tree

6 files changed

+40
-432
lines changed

6 files changed

+40
-432
lines changed

Bam.Core.Test/Bam.Core.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
<OutputPath>..\bin\Release</OutputPath>
2222
</PropertyGroup>
2323
<ItemGroup>
24-
<PackageReference Include="GitInfo" Version="2.0.15">
24+
<PackageReference Include="GitInfo" Version="2.0.20">
2525
<PrivateAssets>all</PrivateAssets>
2626
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2727
</PackageReference>
28-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
29-
<PackageReference Include="NUnit" Version="3.10.1" />
30-
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
28+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
29+
<PackageReference Include="NUnit" Version="3.11.0" />
30+
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
3131
</ItemGroup>
3232
<ItemGroup>
3333
<ProjectReference Include="..\Bam.Core\Bam.Core.csproj" />

Bam.Core/Bam.Core.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
<DocumentationFile>obj\Release\docs\Bam.Core.xml</DocumentationFile>
2525
</PropertyGroup>
2626
<ItemGroup>
27-
<PackageReference Include="GitInfo" Version="2.0.15">
27+
<PackageReference Include="GitInfo" Version="2.0.20">
2828
<PrivateAssets>all</PrivateAssets>
2929
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
3030
</PackageReference>
31-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.1.1" />
32-
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="2.1.1" />
31+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" />
32+
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="2.2.0" />
3333
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
3434
<PackageReference Include="Microsoft.Win32.Registry" Version="4.5.0" />
35-
<PackageReference Include="SharpCompress" Version="0.22.0" />
35+
<PackageReference Include="SharpCompress" Version="0.23.0" />
3636
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
3737
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
3838
</ItemGroup>

Bam.Core/Package/PackageSource.cs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -304,47 +304,41 @@ private System.Threading.Tasks.Task
304304
throw t.Exception;
305305
}
306306
Log.DebugMessage($"Extracting {this.ArchivePath} to {this.ExtractTo}...");
307-
using (var readerStream = System.IO.File.OpenRead(this.ArchivePath))
308-
using (var reader = SharpCompress.Readers.ReaderFactory.Open(readerStream))
307+
308+
var options = new SharpCompress.Common.ExtractionOptions()
309309
{
310-
if (reader.ArchiveType == SharpCompress.Common.ArchiveType.Tar)
310+
ExtractFullPath = true,
311+
Overwrite = true,
312+
WriteSymbolicLink = (sourcePath, targetPath) =>
311313
{
312-
try
313-
{
314-
using (var tar = new TarFile(readerStream))
315-
{
316-
try
317-
{
318-
tar.Export(this.ExtractTo);
319-
}
320-
catch (Exception ex)
321-
{
322-
throw new Exception(ex, $"Unable to extract archive '{this.ArchivePath}' from '{this.RemotePath}'");
323-
}
324-
}
325-
}
326-
catch (TarFile.CompressionMethodUnsupportedException ex)
314+
var link = new Mono.Unix.UnixSymbolicLinkInfo(sourcePath);
315+
if (System.IO.File.Exists(sourcePath))
327316
{
328-
throw new Exception(ex, $"Unable to decompress archive '{this.ArchivePath}' from '{this.RemotePath}'");
317+
link.Delete(); // equivalent to ln -s -f
329318
}
319+
link.CreateSymbolicLinkTo(targetPath);
330320
}
331-
else
321+
};
322+
323+
try
324+
{
325+
using (var readerStream = System.IO.File.OpenRead(this.ArchivePath))
326+
using (var reader = SharpCompress.Readers.ReaderFactory.Open(readerStream))
332327
{
333328
while (reader.MoveToNextEntry())
334329
{
335330
if (reader.Entry.IsDirectory)
336331
{
337332
continue;
338333
}
339-
340-
reader.WriteEntryToDirectory(this.ExtractTo, new SharpCompress.Common.ExtractionOptions()
341-
{
342-
ExtractFullPath = true,
343-
Overwrite = true
344-
});
334+
reader.WriteEntryToDirectory(this.ExtractTo, options);
345335
}
346336
}
347337
}
338+
catch (SharpCompress.Common.ExtractionException e)
339+
{
340+
throw new Exception(e, $"Unable to extract {this.ArchivePath}");
341+
}
348342

349343
// write the MD5 checksum to disk
350344
var checksum = this.GenerateMD5Hash();

0 commit comments

Comments
 (0)