mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-10 11:41:23 +00:00
Merge helpers function from node, boost, python. (#2)
* setup boost helpers * add ci for pull requests * pester for ci * resolving issue with pester 5 * remove Output flag * check tests with 4 version * try common tests variant * added requires * move to 5 version * try to add assert module * fix scope * use new regex for python * fix regex in tests * Pester 4.10.1 * EnableExit * fix synopsys * fix creating tar archive Co-authored-by: Dmitry Shibanov <v-dmshib@microsoft.com> Co-authored-by: Maxim Lobanov <v-malob@microsoft.com>
This commit is contained in:
41
nix-helpers.psm1
Normal file
41
nix-helpers.psm1
Normal file
@@ -0,0 +1,41 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Unpack *.tar file
|
||||
#>
|
||||
function Extract-TarArchive {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$ArchivePath,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$OutputDirectory
|
||||
)
|
||||
|
||||
Write-Debug "Extract $ArchivePath to $OutputDirectory"
|
||||
tar -C $OutputDirectory -xzf $ArchivePath --strip 1
|
||||
}
|
||||
|
||||
function Create-TarArchive {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$SourceFolder,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$ArchivePath,
|
||||
[string]$CompressionType = "gz",
|
||||
[switch]$DereferenceSymlinks
|
||||
)
|
||||
|
||||
$arguments = @(
|
||||
"-c", "--$CompressionType"
|
||||
)
|
||||
|
||||
if ($DereferenceSymlinks) {
|
||||
$arguments += "-h"
|
||||
}
|
||||
|
||||
$arguments += @("-f", $ArchivePath, ".")
|
||||
|
||||
Push-Location $SourceFolder
|
||||
Write-Debug "tar $arguments"
|
||||
tar @arguments
|
||||
Pop-Location
|
||||
}
|
||||
Reference in New Issue
Block a user