mirror of https://github.com/dotnet/tye.git
committed by
GitHub
27 changed files with 456 additions and 64 deletions
@ -0,0 +1,9 @@ |
|||
diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so
|
|||
--- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900
|
|||
+++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900
|
|||
@@ -2,4 +2,4 @@
|
|||
Use the shared library, but some functions are only in |
|||
the static library, so try that secondarily. */ |
|||
OUTPUT_FORMAT(elf64-littleriscv) |
|||
-GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-riscv64-lp64d.so.1 ) )
|
|||
+GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-riscv64-lp64d.so.1 ) )
|
|||
Binary file not shown.
@ -0,0 +1,130 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
# getNonPortableDistroRid |
|||
# |
|||
# Input: |
|||
# targetOs: (str) |
|||
# targetArch: (str) |
|||
# rootfsDir: (str) |
|||
# |
|||
# Return: |
|||
# non-portable rid |
|||
getNonPortableDistroRid() |
|||
{ |
|||
local targetOs="$1" |
|||
local targetArch="$2" |
|||
local rootfsDir="$3" |
|||
local nonPortableRid="" |
|||
|
|||
if [ "$targetOs" = "linux" ]; then |
|||
if [ -e "${rootfsDir}/etc/os-release" ]; then |
|||
source "${rootfsDir}/etc/os-release" |
|||
|
|||
if [[ "${ID}" == "rhel" || "${ID}" == "rocky" || "${ID}" == "alpine" ]]; then |
|||
# remove the last version digit |
|||
VERSION_ID="${VERSION_ID%.*}" |
|||
fi |
|||
|
|||
if [[ "${VERSION_ID:-}" =~ ^([[:digit:]]|\.)+$ ]]; then |
|||
nonPortableRid="${ID}.${VERSION_ID}-${targetArch}" |
|||
else |
|||
# Rolling release distros either do not set VERSION_ID, set it as blank or |
|||
# set it to non-version looking string (such as TEMPLATE_VERSION_ID on ArchLinux); |
|||
# so omit it here to be consistent with everything else. |
|||
nonPortableRid="${ID}-${targetArch}" |
|||
fi |
|||
|
|||
elif [ -e "${rootfsDir}/android_platform" ]; then |
|||
source "$rootfsDir"/android_platform |
|||
nonPortableRid="$RID" |
|||
fi |
|||
fi |
|||
|
|||
if [ "$targetOs" = "freebsd" ]; then |
|||
# $rootfsDir can be empty. freebsd-version is shell script and it should always work. |
|||
__freebsd_major_version=$($rootfsDir/bin/freebsd-version | { read v; echo "${v%%.*}"; }) |
|||
nonPortableRid="freebsd.$__freebsd_major_version-${targetArch}" |
|||
elif command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then |
|||
__android_sdk_version=$(getprop ro.build.version.sdk) |
|||
nonPortableRid="android.$__android_sdk_version-${targetArch}" |
|||
elif [ "$targetOs" = "illumos" ]; then |
|||
__uname_version=$(uname -v) |
|||
case "$__uname_version" in |
|||
omnios-*) |
|||
__omnios_major_version=$(echo "${__uname_version:8:2}") |
|||
nonPortableRid=omnios."$__omnios_major_version"-"$targetArch" |
|||
;; |
|||
joyent_*) |
|||
__smartos_major_version=$(echo "${__uname_version:7:4}") |
|||
nonPortableRid=smartos."$__smartos_major_version"-"$targetArch" |
|||
;; |
|||
illumos_*) |
|||
nonPortableRid=openindiana-"$targetArch" |
|||
;; |
|||
esac |
|||
elif [ "$targetOs" = "solaris" ]; then |
|||
__uname_version=$(uname -v) |
|||
__solaris_major_version=$(echo "${__uname_version%.*}") |
|||
nonPortableRid=solaris."$__solaris_major_version"-"$targetArch" |
|||
elif [ "$targetOs" = "haiku" ]; then |
|||
__uname_release=$(uname -r) |
|||
nonPortableRid=haiku.r"$__uname_release"-"$targetArch" |
|||
fi |
|||
|
|||
echo "$(echo $nonPortableRid | tr '[:upper:]' '[:lower:]')" |
|||
} |
|||
|
|||
# initDistroRidGlobal |
|||
# |
|||
# Input: |
|||
# os: (str) |
|||
# arch: (str) |
|||
# rootfsDir?: (nullable:string) |
|||
# |
|||
# Return: |
|||
# None |
|||
# |
|||
# Notes: |
|||
# |
|||
# It is important to note that the function does not return anything, but it |
|||
# exports the following variables on success: |
|||
# |
|||
# __DistroRid : Non-portable rid of the target platform. |
|||
# __PortableTargetOS : OS-part of the portable rid that corresponds to the target platform. |
|||
# |
|||
initDistroRidGlobal() |
|||
{ |
|||
local targetOs="$1" |
|||
local targetArch="$2" |
|||
local rootfsDir="" |
|||
if [ "$#" -ge 3 ]; then |
|||
rootfsDir="$3" |
|||
fi |
|||
|
|||
if [ -n "${rootfsDir}" ]; then |
|||
# We may have a cross build. Check for the existence of the rootfsDir |
|||
if [ ! -e "${rootfsDir}" ]; then |
|||
echo "Error rootfsDir has been passed, but the location is not valid." |
|||
exit 1 |
|||
fi |
|||
fi |
|||
|
|||
__DistroRid=$(getNonPortableDistroRid "${targetOs}" "${targetArch}" "${rootfsDir}") |
|||
|
|||
if [ -z "${__PortableTargetOS:-}" ]; then |
|||
__PortableTargetOS="$targetOs" |
|||
|
|||
STRINGS="$(command -v strings || true)" |
|||
if [ -z "$STRINGS" ]; then |
|||
STRINGS="$(command -v llvm-strings || true)" |
|||
fi |
|||
|
|||
# Check for musl-based distros (e.g Alpine Linux, Void Linux). |
|||
if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || |
|||
( [ -n "$STRINGS" ] && "$STRINGS" "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl ); then |
|||
__PortableTargetOS="linux-musl" |
|||
fi |
|||
fi |
|||
|
|||
export __DistroRid __PortableTargetOS |
|||
} |
|||
@ -0,0 +1,80 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
# Use uname to determine what the OS is. |
|||
OSName=$(uname -s | tr '[:upper:]' '[:lower:]') |
|||
|
|||
if command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then |
|||
OSName="android" |
|||
fi |
|||
|
|||
case "$OSName" in |
|||
freebsd|linux|netbsd|openbsd|sunos|android|haiku) |
|||
os="$OSName" ;; |
|||
darwin) |
|||
os=osx ;; |
|||
*) |
|||
echo "Unsupported OS $OSName detected!" |
|||
exit 1 ;; |
|||
esac |
|||
|
|||
# On Solaris, `uname -m` is discouraged, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html |
|||
# and `uname -p` returns processor type (e.g. i386 on amd64). |
|||
# The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html. |
|||
if [ "$os" = "sunos" ]; then |
|||
if uname -o 2>&1 | grep -q illumos; then |
|||
os="illumos" |
|||
else |
|||
os="solaris" |
|||
fi |
|||
CPUName=$(isainfo -n) |
|||
else |
|||
# For the rest of the operating systems, use uname(1) to determine what the CPU is. |
|||
CPUName=$(uname -m) |
|||
fi |
|||
|
|||
case "$CPUName" in |
|||
arm64|aarch64) |
|||
arch=arm64 |
|||
;; |
|||
|
|||
loongarch64) |
|||
arch=loongarch64 |
|||
;; |
|||
|
|||
riscv64) |
|||
arch=riscv64 |
|||
;; |
|||
|
|||
amd64|x86_64) |
|||
arch=x64 |
|||
;; |
|||
|
|||
armv7l|armv8l) |
|||
if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then |
|||
arch=armel |
|||
else |
|||
arch=arm |
|||
fi |
|||
;; |
|||
|
|||
armv6l) |
|||
arch=armv6 |
|||
;; |
|||
|
|||
i[3-6]86) |
|||
echo "Unsupported CPU $CPUName detected, build might not succeed!" |
|||
arch=x86 |
|||
;; |
|||
|
|||
s390x) |
|||
arch=s390x |
|||
;; |
|||
|
|||
ppc64le) |
|||
arch=ppc64le |
|||
;; |
|||
*) |
|||
echo "Unknown CPU $CPUName detected!" |
|||
exit 1 |
|||
;; |
|||
esac |
|||
@ -0,0 +1,75 @@ |
|||
<# |
|||
.SYNOPSIS |
|||
Install and run the 'Microsoft.DotNet.VersionTools.Cli' tool with the 'trim-artifacts-version' command to trim the version from the NuGet assets file name. |
|||
|
|||
.PARAMETER InputPath |
|||
Full path to directory where artifact packages are stored |
|||
|
|||
.PARAMETER Recursive |
|||
Search for NuGet packages recursively |
|||
|
|||
#> |
|||
|
|||
Param( |
|||
[string] $InputPath, |
|||
[bool] $Recursive = $true |
|||
) |
|||
|
|||
$CliToolName = "Microsoft.DotNet.VersionTools.Cli" |
|||
|
|||
function Install-VersionTools-Cli { |
|||
param( |
|||
[Parameter(Mandatory=$true)][string]$Version |
|||
) |
|||
|
|||
Write-Host "Installing the package '$CliToolName' with a version of '$version' ..." |
|||
$feed = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" |
|||
|
|||
$argumentList = @("tool", "install", "--local", "$CliToolName", "--add-source $feed", "--no-cache", "--version $Version", "--create-manifest-if-needed") |
|||
Start-Process "$dotnet" -Verbose -ArgumentList $argumentList -NoNewWindow -Wait |
|||
} |
|||
|
|||
# ------------------------------------------------------------------- |
|||
|
|||
if (!(Test-Path $InputPath)) { |
|||
Write-Host "Input Path '$InputPath' does not exist" |
|||
ExitWithExitCode 1 |
|||
} |
|||
|
|||
$ErrorActionPreference = 'Stop' |
|||
Set-StrictMode -Version 2.0 |
|||
|
|||
$disableConfigureToolsetImport = $true |
|||
$global:LASTEXITCODE = 0 |
|||
|
|||
# `tools.ps1` checks $ci to perform some actions. Since the SDL |
|||
# scripts don't necessarily execute in the same agent that run the |
|||
# build.ps1/sh script this variable isn't automatically set. |
|||
$ci = $true |
|||
. $PSScriptRoot\..\tools.ps1 |
|||
|
|||
try { |
|||
$dotnetRoot = InitializeDotNetCli -install:$true |
|||
$dotnet = "$dotnetRoot\dotnet.exe" |
|||
|
|||
$toolsetVersion = Read-ArcadeSdkVersion |
|||
Install-VersionTools-Cli -Version $toolsetVersion |
|||
|
|||
$cliToolFound = (& "$dotnet" tool list --local | Where-Object {$_.Split(' ')[0] -eq $CliToolName}) |
|||
if ($null -eq $cliToolFound) { |
|||
Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "The '$CliToolName' tool is not installed." |
|||
ExitWithExitCode 1 |
|||
} |
|||
|
|||
Exec-BlockVerbosely { |
|||
& "$dotnet" $CliToolName trim-assets-version ` |
|||
--assets-path $InputPath ` |
|||
--recursive $Recursive |
|||
Exit-IfNZEC "Sdl" |
|||
} |
|||
} |
|||
catch { |
|||
Write-Host $_ |
|||
Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ |
|||
ExitWithExitCode 1 |
|||
} |
|||
Loading…
Reference in new issue