+++ /dev/null
-#!/bin/bash
-
-#Usage message
-function usage {
- echo 'ARM Emulator Cross Build Script'
- echo 'This script cross builds core-setup source'
- echo ''
- echo 'Typical usage:'
- echo ' core-setup source is at ~/core-setup'
- echo '$ cd ~/core-setup'
- echo '$ ./scripts/arm32_ci_script.sh'
- echo ' --buildConfig=Release'
- echo ' --armel'
- echo ' --verbose'
- echo ''
- echo 'Required Arguments:'
- echo ' --buildConfig=<config> : The value of config should be either Debug or Release'
- echo ' Any other value is not accepted'
- echo 'Optional Arguments:'
- echo ' --mode=<mode> : docker (default) or emulator'
- echo ' --arm : Build as arm (default)'
- echo ' --armel : Build as armel'
- echo ' --linuxCodeName=<name> : Code name for Linux: For arm, trusty (default) and xenial. For armel, tizen'
- echo ' --skipRootFS : Skip building rootfs'
- echo ' --emulatorPath=<path> : Path of the emulator folder (without ending /)'
- echo ' <path>/platform/rootfs-t30.ext4 should exist'
- echo ' --mountPath=<path> : The desired path for mounting the emulator rootfs (without ending /)'
- echo ' This path is created if not already present'
- echo ' -v --verbose : Build made verbose'
- echo ' -h --help : Prints this usage message and exits'
- echo ''
- echo 'Any other argument triggers an error and this usage message is displayed'
- exit 1
-}
-
-#Display error message and exit
-function exit_with_error {
- set +x
-
- local errorMessage="$1"
- local printUsage=$2
-
- echo "ERROR: $errorMessage"
- if [ "$printUsage" == "true" ]; then
- echo ''
- usage
- fi
- exit 1
-}
-
-#Exit if input string is empty
-function exit_if_empty {
- local inputString="$1"
- local errorMessage="$2"
- local printUsage=$3
-
- if [ -z "$inputString" ]; then
- exit_with_error "$errorMessage" $printUsage
- fi
-}
-
-#Exit if the input path does not exist
-function exit_if_path_absent {
- local path="$1"
- local errorMessage="$2"
- local printUsage=$3
-
- if [ ! -f "$path" -a ! -d "$path" ]; then
- exit_with_error "$errorMessage" $printUsage
- fi
-}
-
-#Check if the git changes were reverted completely
-function check_git_head {
- local currentGitHead=`git rev-parse --verify HEAD`
-
- if [[ "$__initialGitHead" != "$currentGitHead" ]]; then
- exit_with_error "Some changes made to the code history were not completely reverted. Intial Git HEAD: $__initialGitHead, current Git HEAD: $currentGitHead" false
- fi
-}
-
-function unmount_rootfs {
- local rootfsFolder="$1"
-
- #Check if there are any open files in this directory.
- if [ -d $rootfsFolder ]; then
- #If we find information about the file
- if sudo lsof +D $rootfsFolder; then
- (set +x; echo 'See above for lsof information. Continuing with the build.')
- fi
- fi
-
- if mountpoint -q -- "$rootfsFolder"; then
- sudo umount "$rootfsFolder"
- fi
-}
-
-#Unmount the emulator file systems
-function unmount_emulator {
- (set +x; echo 'Unmounting emulator...')
-
- #Unmount all the mounted emulator file systems
- unmount_rootfs "$__ARMRootfsMountPath/proc"
- unmount_rootfs "$__ARMRootfsMountPath/dev/pts"
- unmount_rootfs "$__ARMRootfsMountPath/dev"
- unmount_rootfs "$__ARMRootfsMountPath/run/shm"
- unmount_rootfs "$__ARMRootfsMountPath/sys"
- unmount_rootfs "$__ARMRootfsMountPath"
-}
-
-#Clean the changes made to the environment by the script
-function clean_env {
- #Check for revert of git changes
- check_git_head
-}
-
-#Trap Ctrl-C and handle it
-function handle_ctrl_c {
- set +x
-
- echo 'ERROR: Ctrl-C handled. Script aborted before complete execution.'
-
- exit 1
-}
-trap handle_ctrl_c INT
-
-#Trap Exit and handle it
-function handle_exit {
- set +x
-
- echo 'The script is exited. Cleaning environment..'
-
- clean_env
- }
-trap handle_exit EXIT
-
-#Mount with checking to be already existed
-function mount_with_checking {
- set +x
- local options="$1"
- local from="$2"
- local rootfsFolder="$3"
-
- if mountpoint -q -- "$rootfsFolder"; then
- (set +x; echo "$rootfsFolder is already mounted.")
- else {
- (set -x; sudo mount $options "$from" "$rootfsFolder")
- }
- fi
-}
-
-#Mount emulator to the target mount path
-function mount_emulator {
- #Check if the mount path exists and create if neccessary
- if [ ! -d "$__ARMRootfsMountPath" ]; then
- sudo mkdir -p "$__ARMRootfsMountPath"
- fi
-
- set +x
- mount_with_checking "" "$__ARMEmulPath/platform/$__ARMRootfsImageBase" "$__ARMRootfsMountPath"
- mount_with_checking "-t proc" "/proc" "$__ARMRootfsMountPath/proc"
- mount_with_checking "-o bind" "/dev/" "$__ARMRootfsMountPath/dev"
- mount_with_checking "-o bind" "/dev/pts" "$__ARMRootfsMountPath/dev/pts"
- mount_with_checking "-t tmpfs" "shm" "$__ARMRootfsMountPath/run/shm"
- mount_with_checking "-o bind" "/sys" "$__ARMRootfsMountPath/sys"
-}
-
-# Cross builds core-setup using Docker image
-function cross_build_core_setup_with_docker {
- __currentWorkingDirectory=`pwd`
-
- # Check build configuration and choose Docker image
- if [ "$__buildArch" == "arm" ]; then
- # TODO: For arm, we are going to embed RootFS inside Docker image.
- case $__linuxCodeName in
- trusty)
- __dockerImage=" microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20172211042239"
- __runtimeOS="ubuntu.14.04"
- ;;
- xenial)
- __dockerImage=" microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-ef0ac75-20175511035548"
- __runtimeOS="ubuntu.16.04"
- ;;
- *)
- exit_with_error "ERROR: $__linuxCodeName is not a supported linux name for $__buildArch" false
- ;;
- esac
- elif [ "$__buildArch" == "armel" ]; then
- # For armel Tizen, we are going to construct RootFS on the fly.
- case $__linuxCodeName in
- tizen)
- __dockerImage=" tizendotnet/dotnet-buildtools-prereqs:ubuntu-16.04-cross-e435274-20180426002255-tizen-rootfs-5.0m1"
- __runtimeOS="tizen.5.0.0"
- ;;
- *)
- echo "ERROR: $__linuxCodeName is not a supported linux name for $__buildArch"
- exit_with_error "ERROR: $__linuxCodeName is not a supported linux name for $__buildArch" false
- ;;
- esac
- else
- exit_with_error "ERROR: unknown buildArch $__buildArch" false
- fi
- __dockerCmd="sudo docker run --privileged -i --rm -v $__currentWorkingDirectory:/opt/core-setup -w /opt/core-setup $__dockerImage"
-
- if [ $__skipRootFS == 0 ]; then
- # Build rootfs
- __buildRootfsCmd="./eng/common/cross/build-rootfs.sh $__buildArch $__linuxCodeName --skipunmount"
-
- (set +x; echo "Build RootFS for $__buildArch $__linuxCodeName")
- $__dockerCmd $__buildRootfsCmd
- sudo chown -R $(id -u -n) cross/rootfs
- __rootfsDir="/opt/core-setup/eng/common/cross/rootfs/$__buildArch"
- fi
-
- # Cross building core-setup with rootfs in Docker
- __buildCmd="./build.sh --configuration $__buildConfig --env-vars DISABLE_CROSSGEN=1,TARGETPLATFORM=$__buildArch,OUTPUTRID=$__runtimeOS-$__buildArch,CROSS=1,ROOTFS_DIR=$__rootfsDir"
- $__dockerCmd $__buildCmd
-}
-
-#Define script variables
-__ciMode="docker"
-__ARMEmulPath="/opt/linux-arm-emulator"
-__ARMRootfsImageBase="rootfs-u1404.ext4"
-__ARMRootfsMountPath="/opt/linux-arm-emulator-root"
-__buildConfig="Release"
-__verboseFlag=
-__buildArch="arm"
-__linuxCodeName="trusty"
-__skipRootFS=0
-__rootfsDir=
-__initialGitHead=`git rev-parse --verify HEAD`
-
-#Parse command line arguments
-for arg in "$@"
-do
- case $arg in
- --emulatorPath=*)
- __ARMEmulPath=${arg#*=}
- ;;
- --mountPath=*)
- __ARMRootfsMountPath=${arg#*=}
- ;;
- --buildConfig=*)
- __buildConfig="$(echo ${arg#*=} | awk '{print tolower($0)}')"
- if [[ "$__buildConfig" == "release" ]]; then
- __buildConfig="Release"
- else
- if [[ "$__buildConfig" == "debug" ]]; then
- __buildConfig="Debug"
- else
- exit_with_error "--buildConfig can be only Debug or Release" true
- fi
- fi
- ;;
- --mode=*)
- __ciMode=${arg#*=}
- ;;
- --arm)
- __ARMRootfsImageBase="rootfs-u1404.ext4"
- __buildArch="arm"
- __skipRootFS=1
- __rootfsDir="/crossrootfs/arm"
- ;;
- --armel)
- __ARMRootfsImageBase="rootfs-t30.ext4"
- __buildArch="armel"
- __skipRootFS=1
- __rootfsDir="/crossrootfs/armel.tizen.build"
- __linuxCodeName="tizen"
- ;;
- --linuxCodeName=*)
- __linuxCodeName=${arg#*=}
- ;;
- --skipRootFS)
- __skipRootFS=1
- ;;
- -v|--verbose)
- __verboseFlag="verbose"
- ;;
- -h|--help)
- usage
- ;;
- *)
- exit_with_error "$arg not a recognized argument" true
- ;;
- esac
-done
-
-if [[ $__linuxCodeName == "tizen" ]]; then
- # This case does not support CI build yet.
- # Will be enabled ASAP.
- exit 0
-fi
-
-#Check if there are any uncommited changes in the source directory as git adds and removes patches
-if [[ $(git status -s) != "" ]]; then
- echo 'ERROR: There are some uncommited changes. To avoid losing these changes commit them and try again.'
- echo ''
- git status
- exit 1
-fi
-
-exit_if_empty "$__buildConfig" "--buildConfig is a mandatory argument, not provided" true
-if [ "$__ciMode" == "emulator" ]; then
- #Check if the compulsory arguments have been presented to the script and if the input paths exist
- exit_if_empty "$__ARMEmulPath" "--emulatorPath is a mandatory argument, not provided" true
- exit_if_empty "$__ARMRootfsMountPath" "--mountPath is a mandatory argument, not provided" true
- exit_if_path_absent "$__ARMEmulPath/platform/$__ARMRootfsImageBase" "Path specified in --emulatorPath does not have the rootfs" false
-
- __ARMRootfsMountPath="${__ARMRootfsMountPath}_${__buildArch}"
-fi
-
-set -x
-set -e
-
-## Begin cross build
-(set +x; echo "Git HEAD @ $__initialGitHead")
-
-#Complete the cross build
-(set +x; echo 'Building core-setup...')
-if [ "$__ciMode" == "docker" ]; then
- cross_build_core_setup_with_docker
-else
- exit_with_error "Not supported emulator mode"
-fi
-
-#Clean the environment
-(set +x; echo 'Cleaning environment...')
-clean_env
-
-(set +x; echo 'Build complete')
+++ /dev/null
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-#
-
-. $PSScriptRoot\_utility.ps1
-
-# Copy things from environment variables that were sent by the build scripts
-$Rid = $env:Rid
-$Tfm = $env:Tfm
-$OutputDir = $env:OutputDir
-$Stage1Dir = $env:Stage1Dir
-$Stage1CompilationDir = $env:Stage1CompilationDir
-$Stage2Dir = $env:Stage2Dir
-$Stage2CompilationDir = $env:Stage2CompilationDir
-$PackageDir = $env:PackageDir
-$TestBinRoot = $env:TestBinRoot
-$TestPackageDir = $env:TestPackageDir
-
-$env:Channel = "$env:RELEASE_SUFFIX"
-
-# Set reasonable defaults for unset variables
-setEnvIfDefault "DOTNET_INSTALL_DIR" "$RepoRoot\.dotnet_stage0\win7-x64"
-setEnvIfDefault "DOTNET_CLI_VERSION" "0.1.0.0"
-setPathAndHomeIfDefault "$Stage2Dir"
-setVarIfDefault "CONFIGURATION" "Debug"
+++ /dev/null
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-#
-
-COMMONSOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- COMMONDIR="$( cd -P "$( dirname "$COMMONSOURCE" )" && pwd )"
- COMMONSOURCE="$(readlink "$COMMONSOURCE")"
- [[ $COMMONSOURCE != /* ]] && COMMONSOURCE="$COMMONDIR/$COMMONSOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-COMMONDIR="$( cd -P "$( dirname "$COMMONSOURCE" )" && pwd )"
-
-source "$COMMONDIR/_prettyprint.sh"
-
-[ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$RID
-[ -z "$DOTNET_CLI_VERSION" ] && export DOTNET_CLI_VERSION=0.1.0.0
-[ -z "$DOTNET_ON_PATH" ] && export DOTNET_ON_PATH=$STAGE2_DIR && export PATH=$STAGE2_DIR/bin:$PATH
-[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug
-
-#TODO this is a workaround for a nuget bug on ubuntu. Remove
-export DISABLE_PARALLEL=""
-[[ "$RID" =~ "ubuntu" -o "$RID" =~ "ubuntu.16.04" ]] && export DISABLE_PARALLEL=""
-
-unset COMMONSOURCE
-unset COMMONDIR
+++ /dev/null
-#!/usr/bin/env bash
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-#
-
-# Detect build servers
-if [[ ! -z "$JENKINS_URL" || ! -z "$BUILD_BUILDID" ]]; then
- # Jenkins or VSO build, disable colors because they make things gross.
- NO_COLOR=1
-fi
-
-if [ "$NO_COLOR" != "1" ]; then
- # ANSI Colors
- RCol='\e[0m' # Text Reset
-
- # Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds
- Bla='\e[0;30m'; BBla='\e[1;30m'; UBla='\e[4;30m'; IBla='\e[0;90m'; BIBla='\e[1;90m'; On_Bla='\e[40m'; On_IBla='\e[0;100m';
- Red='\e[0;31m'; BRed='\e[1;31m'; URed='\e[4;31m'; IRed='\e[0;91m'; BIRed='\e[1;91m'; On_Red='\e[41m'; On_IRed='\e[0;101m';
- Gre='\e[0;32m'; BGre='\e[1;32m'; UGre='\e[4;32m'; IGre='\e[0;92m'; BIGre='\e[1;92m'; On_Gre='\e[42m'; On_IGre='\e[0;102m';
- Yel='\e[0;33m'; BYel='\e[1;33m'; UYel='\e[4;33m'; IYel='\e[0;93m'; BIYel='\e[1;93m'; On_Yel='\e[43m'; On_IYel='\e[0;103m';
- Blu='\e[0;34m'; BBlu='\e[1;34m'; UBlu='\e[4;34m'; IBlu='\e[0;94m'; BIBlu='\e[1;94m'; On_Blu='\e[44m'; On_IBlu='\e[0;104m';
- Pur='\e[0;35m'; BPur='\e[1;35m'; UPur='\e[4;35m'; IPur='\e[0;95m'; BIPur='\e[1;95m'; On_Pur='\e[45m'; On_IPur='\e[0;105m';
- Cya='\e[0;36m'; BCya='\e[1;36m'; UCya='\e[4;36m'; ICya='\e[0;96m'; BICya='\e[1;96m'; On_Cya='\e[46m'; On_ICya='\e[0;106m';
- Whi='\e[0;37m'; BWhi='\e[1;37m'; UWhi='\e[4;37m'; IWhi='\e[0;97m'; BIWhi='\e[1;97m'; On_Whi='\e[47m'; On_IWhi='\e[0;107m';
-fi
-
-cecho()
-{
- local text=$1
- printf "%b\n" "$text"
-}
-
-header()
-{
- local text=$1
- cecho "${BGre}*** $text ***${RCol}"
-}
-
-info()
-{
- local text=$1
- cecho "${Gre}info :${RCol} $text"
-}
-
-warning()
-{
- local text=$1
- cecho "${Yel}warn :${RCol} $text" 1>&2
-}
-
-error()
-{
- local text=$1
- cecho "${Red}error:${RCol} $text" 1>&2
-}
-
-die()
-{
- local text=$1
- error "$text"
- exit 1
-}
+++ /dev/null
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-#
-
-function header([string]$message)
-{
- Write-Host -ForegroundColor Green "*** $message ***"
-}
-
-function info([string]$message)
-{
- Write-Host -ForegroundColor Yellow "*** $message ***"
-}
-
-function error([string]$message)
-{
- Write-Host -ForegroundColor Red "$message"
-}
-
-function setEnvIfDefault([string]$envVarName, [string]$value)
-{
- If ([Environment]::GetEnvironmentVariable($envVarName) -eq $null)
- {
- [Environment]::SetEnvironmentVariable($envVarName, $value)
- }
-}
-
-function setVarIfDefault([string]$varName, [string]$value)
-{
- If (-not (Get-Variable -name $varName -ErrorAction SilentlyContinue))
- {
- Set-Variable -name $varName -value $value -scope 1
- }
-}
-
-function setPathAndHomeIfDefault([string]$rootPath)
-{
- If ($env:DOTNET_ON_PATH -eq $null)
- {
- setPathAndHome $rootPath
- }
-}
-
-function setPathAndHome([string]$rootPath)
-{
- $env:DOTNET_ON_PATH=$rootPath
- $env:PATH="$rootPath\bin;$env:PATH"
-}
-
-function _([string]$command)
-{
- & "$command"
- if (!$?) {
- error "Command Failed: '& $command'"
- Exit 1
- }
-}
-
-function _([string]$command, $arguments)
-{
- & "$command" @arguments
- if (!$?) {
- error "Command Failed: '& $command'"
- Exit 1
- }
-}
-
-function _cmd([string]$command)
-{
- cmd /c "$command"
- if (!$?) {
- error "Command Failed: 'cmd /c $command'"
- Exit 1
- }
-}
+++ /dev/null
-#!/usr/bin/env bash
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-# WARNING: This utility is not used by infra and very likely to be out of date.
-
-# This is a simple dev utility to easily perform clean builds for Debian and RPM
-# package development. It emulates the official build, first producing a
-# portable build using some other image, then using Deb/RPM build images to
-# package up the bits.
-#
-# Run this script from the root of the repository.
-
-set -uex
-
-skipPortable=
-makeDeb=
-makeRpm=
-
-while [[ $# > 0 ]]; do
- opt="$(echo "$1" | awk '{print tolower($0)}')"
- case "$opt" in
- --skip-portable)
- skipPortable=true
- ;;
- --deb)
- makeDeb=true
- ;;
- --rpm)
- makeRpm=true
- ;;
- *)
- echo "Invalid argument: $1"
- exit 1
- ;;
- esac
- shift
-done
-
-containerized() {
- image=$1
- shift
- docker run -it --rm \
- -u="$(id -u):$(id -g)" \
- -e HOME=/work/.container-home \
- -v "$(pwd):/work:z" \
- -w "/work" \
- "$image" \
- "$@"
-}
-
-package() {
- name=$1
- shift
- image=$1
- shift
- type=$1
- shift
- queryCommand=$1
- shift
-
- containerized "$image" bash -c "
- ./build.sh \
- --ci \
- --subset installer
- /p:OfficialBuildId=20190101.1 \
- /p:UsePrebuiltPortableBinariesForInstallers=true \
- /p:SharedFrameworkPublishDir=/work/artifacts/obj/linux-x64.Release/sharedFrameworkPublish/ \
- /p:InstallerSourceOSPlatformConfig=linux-x64.Release \
- /p:GenerateProjectInstallers=true \
- /p:Configuration=Release \
- /p:TargetOS=Linux \
- /p:PortableBuild=false \
- /p:TargetArchitecture=x64 \
- /bl:artifacts/msbuild.$name.installers.binlog"
-
- containerized "$image" \
- find artifacts/packages/Release/ \
- -iname "*.$type" \
- -exec printf "\n{}\n========\n" \; \
- -exec $queryCommand '{}' \; \
- > "info-$type.txt"
-}
-
-[ "$skipPortable" ] || containerized microsoft/dotnet-buildtools-prereqs:centos-7-b46d863-20180719033416 \
- ./build.sh \
- -c Release \
- /p:PortableBuild=true \
- /p:TargetArchitecture=x64 \
- /bl:artifacts/msbuild.portable.binlog
-
-ubuntu=microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-debpkg-e5cf912-20175003025046
-rhel=microsoft/dotnet-buildtools-prereqs:rhel-7-rpmpkg-c982313-20174116044113
-
-[ "$makeRpm" ] && package rhel $rhel rpm "rpm -qpiR"
-[ "$makeDeb" ] && package ubuntu $ubuntu deb "dpkg-deb -I"
+++ /dev/null
-#!/usr/bin/env bash
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-# WARNING: This utility is not used by infra and very likely to be out of date.
-
-# This is a simple dev utility to easily perform clean builds for Debian and RPM
-# package development. It emulates the official build, first producing a
-# portable build using some other image, then using Deb/RPM build images to
-# package up the bits.
-#
-# Run this script from the root of the repository.
-
-set -uex
-
-skipPortable=
-
-while [[ $# > 0 ]]; do
- opt="$(echo "$1" | awk '{print tolower($0)}')"
- case "$opt" in
- --skip-portable)
- skipPortable=true
- ;;
- *)
- echo "Invalid argument: $1"
- exit 1
- ;;
- esac
- shift
-done
-
-containerized() {
- image=$1
- shift
- docker run -it --rm \
- -u="$(id -u):$(id -g)" \
- -e HOME=/work/.container-home \
- -v "$(pwd):/work:z" \
- -w "/work" \
- "$image" \
- "$@"
-}
-
-package() {
- name=$1
- shift
- image=$1
- shift
- type=$1
- shift
- queryCommand=$1
- shift
-
- containerized "$image" \
- Tools/msbuild.sh \
- build.proj \
- /t:BuildTraversalBuildDependencies \
- /p:ConfigurationGroup=Release \
- /p:TargetOS=Linux \
- /p:PortableBuild=false \
- /p:TargetArchitecture=x64 \
- "/bl:bin/msbuild.$name.traversaldependencies.binlog"
-
- containerized "$image" \
- Tools/msbuild.sh \
- src/pkg/packaging/dir.proj \
- /p:UsePrebuiltPortableBinariesForInstallers=true \
- /p:SharedFrameworkPublishDir=/work/bin/obj/linux-x64.Release/sharedFrameworkPublish/ \
- /p:InstallerSourceOSPlatformConfig=linux-x64.Release \
- /p:GenerateProjectInstallers=true \
- /p:ConfigurationGroup=Release \
- /p:TargetOS=Linux \
- /p:PortableBuild=false \
- /p:TargetArchitecture=x64 \
- "/bl:bin/msbuild.$name.installers.binlog"
-
- containerized "$image" \
- find bin/*Release/ \
- -iname "*.$type" \
- -exec printf "\n{}\n========\n" \; \
- -exec $queryCommand '{}' \; \
- > "info-$type.txt"
-}
-
-[ "$skipPortable" ] || containerized microsoft/dotnet-buildtools-prereqs:centos-7-b46d863-20180719033416 \
- ./build.sh \
- -skiptests=true \
- -ConfigurationGroup=Release \
- -PortableBuild=true \
- -strip-symbols \
- -TargetArchitecture=x64 \
- -- \
- /bl:bin/msbuild.portable.binlog
-
-ubuntu=microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-debpkg-e5cf912-20175003025046
-rhel=microsoft/dotnet-buildtools-prereqs:rhel-7-rpmpkg-c982313-20174116044113
-
-package ubuntu $ubuntu deb "dpkg-deb -I"
-package rhel $rhel rpm "rpm -qpiR"
+++ /dev/null
-#!/usr/bin/env bash
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-#
-
-set -e
-
-command="$1"
-shift
-echo "docker $command -u=$(id -u):$(id -g) $@"
-docker "$command" -u="$(id -u):$(id -g)" "$@"
+++ /dev/null
-#!/usr/bin/env bash
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-#
-
-set -e
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-cd "$DIR/.."
-
-while [[ $# > 0 ]]; do
- key=$1
-
- case $key in
- -t|--tag)
- DOCKER_TAG=$2
- shift
- ;;
- -d|--dockerfile)
- DOCKERFILE=$2
- shift
- ;;
- -h|-?|--help)
- echo "Usage: $0 [-d|--dockerfile <Dockerfile>] [-t|--tag <Tag>] <Command>"
- echo ""
- echo "Options:"
- echo " <Dockerfile> The path to the folder that contains a Dockerfile to use to create the build container"
- echo " <Tag> The name of docker image tag"
- exit 0
- ;;
- *)
- break # the first non-switch we get ends parsing
- ;;
- esac
-
- shift
-done
-
-# Executes a command and retries if it fails.
-# NOTE: This function is the exact copy from init-docker.sh.
-# Reason for not invoking init.docker.sh directly is since that script
-# also performs cleanup, which we do not want in this case.
-execute() {
- local count=0
- local retries=5
- local waitFactor=6
- until "$@"; do
- local exit=$?
- count=$(( $count + 1 ))
- if [ $count -lt $retries ]; then
- local wait=$(( waitFactor ** (( count - 1 )) ))
- echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
- sleep $wait
- else
- say_err "Retry $count/$retries exited $exit, no more retries left."
- return $exit
- fi
- done
-
- return 0
-}
-
-# Build the docker container (will be fast if it is already built)
-echo "Building Docker Container using Dockerfile: $DOCKERFILE"
-
-# Get the name of Docker image.
-image=$(grep -i "^FROM " "$DOCKERFILE/Dockerfile" | awk '{ print $2 }')
-
-# Explicitly pull the base image with retry logic.
-# This eliminates intermittent failures during docker build caused by failing to retrieve the base image.
-if [ ! -z "$image" ]; then
- echo "Pulling Docker image $image"
- execute docker pull $image
-fi
-
-docker build --build-arg USER_ID=$(id -u) -t $DOCKER_TAG $DOCKERFILE
+++ /dev/null
-#!/usr/bin/env bash
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-#
-
-set -e
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-"$DIR/docker-as-current-user.sh" run "$@"
+++ /dev/null
-#!/usr/bin/env bash
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-#
-
-set -e
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-cd "$DIR/.."
-
-INTERACTIVE="-i"
-
-while [[ $# > 0 ]]; do
- key=$1
-
- case $key in
- --non-interactive)
- INTERACTIVE=
- ;;
- -i|--image)
- DOCKER_IMAGENAME=$2
- shift
- ;;
- -d|--dockerfile)
- DOCKERFILE=$2
- shift
- ;;
- -h|-?|--help)
- echo "Usage: $0 [-d|--dockerfile <Dockerfile>] [-i|--image <ImageName>] <Command>"
- echo ""
- echo "Options:"
- echo " <Dockerfile> The path to the folder that contains a Dockerfile to use to create the build container"
- echo " <ImageName> The name of an existing Dockerfile folder under scripts/docker to use as the Dockerfile"
- echo " <Command> The command to run once inside the container (/opt/code is mapped to the repo root; defaults to nothing, which runs the default shell)"
- exit 0
- ;;
- *)
- break # the first non-switch we get ends parsing
- ;;
- esac
-
- shift
-done
-
-if [ -z "$DOCKERFILE" ]; then
- if [ -z "$DOCKER_IMAGENAME" ]; then
- if [ "$(uname)" == "Darwin" ]; then
- echo "Defaulting to 'ubuntu' image for Darwin"
- export DOCKERFILE=scripts/docker/ubuntu
- else
- if [ -e /etc/os-release ]; then
- source /etc/os-release
-
- if [ -d "scripts/docker/$ID.$VERSION_ID" ]; then
- echo "Using '$ID.$VERSION_ID' image"
- export DOCKERFILE="scripts/docker/$ID.$VERSION_ID"
- else
- echo "Unknown Linux Distro. Using 'ubuntu.14.04' image"
- export DOCKERFILE="scripts/docker/ubuntu.14.04"
- fi
- else
- echo "Unknown Linux Distro. Using 'ubuntu.14.04' image"
- export DOCKERFILE="scripts/docker/ubuntu.14.04"
- fi
- fi
- else
- echo "Using requested image: $DOCKER_IMAGENAME"
- export DOCKERFILE="scripts/docker/$DOCKER_IMAGENAME"
- fi
-fi
-
-[ -z "$DOTNET_BUILD_CONTAINER_TAG" ] && DOTNET_BUILD_CONTAINER_TAG="dotnet-coresetup-build"
-[ -z "$DOTNET_BUILD_CONTAINER_NAME" ] && DOTNET_BUILD_CONTAINER_NAME="dotnet-coresetup-build-container"
-[ -z "$DOCKER_HOST_SHARE_DIR" ] && DOCKER_HOST_SHARE_DIR="$(pwd)"
-
-# Make container names CI-specific if we're running in CI
-# Jenkins
-[ ! -z "$BUILD_TAG" ] && DOTNET_BUILD_CONTAINER_NAME="$BUILD_TAG"
-# VSO
-[ ! -z "$BUILD_BUILDID" ] && DOTNET_BUILD_CONTAINER_NAME="${BUILD_BUILDID}-${BUILD_BUILDNUMBER}"
-
-#Build the docker image
-"$DIR/dockerbuild.sh" -t $DOTNET_BUILD_CONTAINER_TAG -d $DOCKERFILE
-
-# Run the build in the container
-echo "Launching build in Docker Container"
-echo "Running command: $BUILD_COMMAND"
-echo "Using code from: $DOCKER_HOST_SHARE_DIR"
-[ -z "$INTERACTIVE" ] || echo "Running Interactive"
-
-docker run $INTERACTIVE -t --rm --sig-proxy=true \
- --name $DOTNET_BUILD_CONTAINER_NAME \
- -v $DOCKER_HOST_SHARE_DIR:/opt/code \
- -e NUGET_FEED_URL \
- -e NUGET_SYMBOLS_FEED_URL \
- -e NUGET_API_KEY \
- -e GITHUB_PASSWORD \
- $DOTNET_BUILD_CONTAINER_TAG \
- $BUILD_COMMAND "$@"
-
-# Remove the container if it stuck around, ignore failure here
-set +e
-docker rm -f $DOTNET_BUILD_CONTAINER_NAME
-
-# This won't be hit if a failure happened above, but forces ignoring the rm failure, which we don't care about
-exit 0
+++ /dev/null
-#!/bin/bash
-#
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-#
-
-# This is a VERY basic script for Create/Delete operations on repos and packages
-
-cmd=$5
-urls=urls.txt
-defaultPackageFile=new_package.json
-defaultRepoFile=new_repo.json
-repositoryId=$3
-server=$4
-user=$1
-pass=$2
-protocol=https
-port=443
-baseurl="$protocol://$user:$pass@$server:$port"
-
-echo $baseurl
-
-function BailIf
-{
- if [ $1 -ne 0 ]; then
- echo "Failure occurred communicating with $server"
- exit 1
- fi
-}
-
-# List packages, using $1 as a regex to filter results
-function ListPackages
-{
- curl -k "$baseurl/v1/packages" | sed 's/{/\n{/g' | egrep "$1" | sed 's/,/,\n/g' | sed 's/^"/\t"/g'
- echo ""
-}
-
-# Create a new Repo using the specified JSON file
-function AddRepo
-{
- repoFile=$1
- if [ -z $repoFile ]; then
- echo "Error: Must specify a JSON-formatted file. Reference $defaultRepoFile.template"
- exit 1
- fi
- if [ ! -f $repoFile ]; then
- echo "Error: Cannot create repo - $repoFile does not exist"
- exit 1
- fi
- packageUrl=$(grep "url" $repoFile | head -n 1 | awk '{print $2}' | tr -d ',')
- echo "Creating new repo on $server [$packageUrl]"
- curl -i -k "$baseurl/v1/repositories" --data @./$repoFile -H "Content-Type: application/json"
- BailIf $?
- echo ""
-}
-
-# Upload a single package using the specified JSON file
-function AddPackage
-{
- packageFile=$1
- if [ -z $packageFile ]; then
- echo "Error: Must specify a JSON-formatted file. Reference $defaultPackageFile.template"
- exit 1
- fi
- if [ ! -f $packageFile ]; then
- echo "Error: Cannot add package - $packageFile does not exist"
- exit 1
- fi
- packageUrl=$(grep "sourceUrl" $packageFile | head -n 1 | awk '{print $2}')
- echo "Adding package to $server [$packageUrl]"
- #Workaround no curl on image
- wget --header "Content-Type: application/json" --post-file $packageFile --no-check-certificate "$baseurl/v1/packages"
- BailIf $?
- echo ""
-}
-
-# Upload a single package by dynamically creating a JSON file using a provided URL
-function AddPackageByUrl
-{
- # Parse URL
- url=$(echo "$1")
- if [ -z $url ]; then
- return
- fi
- escapedUrl=$(echo "$url" | sed 's/\//\\\//g')
- set -- "$1"
- oldIFS=$IFS
- IFS="/"; declare -a splitUrl=($*)
- index=${#splitUrl[@]}
- let "index -= 1"
- filename=${splitUrl[$index]}
- set -- "$filename"
- IFS="_"; declare -a splitFile=($*)
- IFS=$oldIFS
- pkgName=${splitFile[0]}
- pkgVer=${splitFile[1]}
- if [ -z $pkgName ] || [ -z $pkgVer ]; then
- echo "ERROR parsing $url"
- return
- fi
- # Create Package .json file
- cp $defaultPackageFile.template $defaultPackageFile
- sed -i "s/PACKAGENAME/$pkgName/g" $defaultPackageFile
- sed -i "s/PACKAGEVERSION/$pkgVer/g" $defaultPackageFile
- sed -i "s/PACKAGEURL/$escapedUrl/g" $defaultPackageFile
- sed -i "s/REPOSITORYID/$repositoryId/g" $defaultPackageFile
- # Test that URL is ok
- wget -q --spider "$url"
- if [[ $? -eq 0 ]]; then
- echo "Ready to upload $pkgName [$pkgVer]"
- else
- echo "ERROR testing URL $url"
- return
- fi
- # Perform Upload
- AddPackage $defaultPackageFile
- # Cleanup
- # rm $defaultPackageFile
-}
-
-# Upload multiple packages by reading urls line-by-line from the specified file
-function AddPackages
-{
- urlFile=$1
- if [ -z $urlFile ]; then
- echo "Error: Must specify a flat text file containing one or more URLs"
- exit 1
- fi
- if [ ! -f $urlFile ]; then
- echo "Error: Cannot add packages. File $urlFile does not exist"
- exit 1
- fi
- for url in $(cat $urlFile); do
- AddPackageByUrl "$url"
- sleep 5
- done
-}
-
-# Delete the specified repo
-function DeleteRepo
-{
- repoId=$1
- if [ -z $repoId ]; then
- echo "Error: Please specify repository ID. Run -listrepos for a list of IDs"
- exit 1
- fi
- curl -I -k -X DELETE "$baseurl/v1/repositories/$repoId"
- BailIf $?
-}
-
-# Delete the specified package
-function DeletePackage
-{
- packageId=$1
- if [ -z $packageId ]; then
- echo "Error: Please specify package ID. Run -listpkgs for a list of IDs"
- exit 1
- fi
- echo Removing pkgId $packageId from repo $repositoryId
- curl -I -k -X DELETE "$baseurl/v1/packages/$packageId"
- BailIf $?
-}
-
-if [[ "$1" == "-listrepos" ]]; then
- echo "Fetching repo list from $server..."
- curl -k "$baseurl/v1/repositories" | sed 's/,/,\n/g' | sed 's/^"/\t"/g'
- echo ""
-elif [[ "$5" == "-listpkgs" ]]; then
- echo "Fetching package list from $server"
- ListPackages $6
-elif [[ "$5" == "-addrepo" ]]; then
- AddRepo $6
-elif [[ "$5" == "-addpkg" ]]; then
- AddPackage $6
-elif [[ "$5" == "-addpkgs" ]]; then
- AddPackages $6
-elif [[ "$5" == "-delrepo" ]]; then
- DeleteRepo $6
-elif [[ "$5" == "-delpkg" ]]; then
- DeletePackage $6
-else
- echo "USAGE: ./repotool.sh [username] [password] [repository id] [server] -OPTION"
- echo "-listrepos: Gather a list of repos"
- echo "-listpkgs: Gather a list of packages"
- echo "-addrepo [FILENAME] : Create a new repo using the specified JSON file"
- echo "-addpkg [FILENAME] : Add package to repo using the specified JSON file"
- echo "-addpkgs [FILENAME] : Add packages to repo using urls contained in FILENAME"
- echo "-delrepo REPOID : Delete the specified repo by ID"
- echo "-delpkg PKGID : Delete the specified package by ID"
-fi