diff options
author | Joel Hendrix <jhendrix@microsoft.com> | 2016-04-11 20:49:25 +0300 |
---|---|---|
committer | Joel Hendrix <jhendrix@microsoft.com> | 2016-04-11 23:58:33 +0300 |
commit | 1cb613ac4ff5a686f14d3e00f91ce533d137231b (patch) | |
tree | 7b4161e3c9db6b2756a73e238ba5d7eedd3ae261 /build-packages.sh | |
parent | 4e78021c808755dd578fda51eee35d7fc4c99c60 (diff) |
Add support for filtering building of packages based on Linux variants.
When building native Linux packages we need the ability to build the
packages specific to the distro on which we're building. I have
overloaded the OSGroup property to specify the runtime ID to which a
package build belongs so the other distros get filtered out.
Diffstat (limited to 'build-packages.sh')
-rwxr-xr-x | build-packages.sh | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/build-packages.sh b/build-packages.sh index 0fc13c0b8a..2d6150963d 100755 --- a/build-packages.sh +++ b/build-packages.sh @@ -11,8 +11,41 @@ working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" build_packages_log=$working_tree_root/build-packages.log binclashlog=$working_tree_root/binclash.log binclashloggerdll=$working_tree_root/Tools/Microsoft.DotNet.Build.Tasks.dll +RuntimeOS=ubuntu.$VERSION_ID -options="/m /nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=$build_packages_log /l:BinClashLogger,$binclashloggerdll;LogFile=$binclashlog" +# Use uname to determine what the OS is. +OSName=$(uname -s) +case $OSName in + Darwin) + # Darwin version can be three sets of digits (e.g. 10.10.3), we want just the first two + DarwinVersion=$(sw_vers -productVersion | awk 'match($0, /[0-9]{2}\.[0-9]{2}/) { print substr($0, RSTART, RLENGTH) }') + RuntimeOS=osx.$DarwinVersion + ;; + + FreeBSD|NetBSD) + # TODO this doesn't seem correct + RuntimeOS=osx.10.10 + ;; + + Linux) + source /etc/os-release + if [ "$ID" == "rhel" ]; then + RuntimeOS=rhel.$VERSION_ID + elif [ "$ID" == "debian" ]; then + RuntimeOS=debian.$VERSION_ID + elif [ "$ID" == "ubuntu" ]; then + RuntimeOS=ubuntu.$VERSION_ID + else + echo "Unsupported Linux distribution '$ID' detected. Configuring as if for Ubuntu." + fi + ;; + + *) + echo "Unsupported OS '$OSName' detected. Configuring as if for Ubuntu." + ;; +esac + +options="/m /nologo /v:minimal /clp:Summary /flp:v=diagnostic;Append;LogFile=$build_packages_log /l:BinClashLogger,$binclashloggerdll;LogFile=$binclashlog /p:FilterToOSGroup=$RuntimeOS" allargs="$@" echo -e "Running build-packages.sh $allargs" > $build_packages_log |