Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 40 additions & 10 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ if ($IsLinux) {
$IsUbuntu14 = $IsUbuntu -and $LinuxInfo.VERSION_ID -match '14.04'
$IsUbuntu16 = $IsUbuntu -and $LinuxInfo.VERSION_ID -match '16.04'
$IsCentOS = $LinuxInfo.ID -match 'centos' -and $LinuxInfo.VERSION_ID -match '7'
$IsFedora = $LinuxInfo.ID -match 'fedora' -and $LinuxInfo.VERSION_ID -ge 24
$IsRedHatFamily = $IsCentOS -or $IsFedora

# Workaround for temporary LD_LIBRARY_PATH hack for Fedora 24
if (Test-Path ENV:\LD_LIBRARY_PATH) {
Remove-Item -Force ENV:\LD_LIBRARY_PATH
Get-ChildItem ENV:
}
}

#
Expand Down Expand Up @@ -75,6 +83,7 @@ function Start-PSBuild {
"ubuntu.16.04-x64",
"debian.8-x64",
"centos.7-x64",
"fedora.24-x64",
"win7-x64",
"win7-x86",
"win81-x64",
Expand Down Expand Up @@ -439,6 +448,7 @@ function New-PSOptions {
"ubuntu.16.04-x64",
"debian.8-x64",
"centos.7-x64",
"fedora.24-x64",
"win7-x86",
"win7-x64",
"win81-x64",
Expand Down Expand Up @@ -944,6 +954,15 @@ function Install-Dotnet {
}
}

function Get-RedHatPackageManager {
if ($IsRedHatFamily -and $IsCentOS) {
"yum"
} elseif ($IsRedHatFamily -and $IsFedora) {
"dnf"
} else {
throw "Error determining package manager for this distribution."
}
}

function Start-PSBootstrap {
[CmdletBinding(
Expand Down Expand Up @@ -1000,7 +1019,7 @@ function Start-PSBootstrap {
Invoke-Expression "$sudo apt-get update"
Invoke-Expression "$sudo apt-get install -y -qq $Deps"
}
} elseif ($IsCentOS) {
} elseif ($IsRedHatFamily) {
# Build tools
$Deps += "which", "curl", "gcc-c++", "cmake", "make"

Expand All @@ -1010,9 +1029,11 @@ function Start-PSBootstrap {
# Packaging tools
if ($Package) { $Deps += "ruby-devel", "rpm-build", "groff" }

$PackageManager = Get-RedHatPackageManager

# Install dependencies
Start-NativeExecution {
Invoke-Expression "$sudo yum install -y -q $Deps"
Invoke-Expression "$sudo $PackageManager install -y -q $Deps"
}
} elseif ($IsOSX) {
precheck 'brew' "Bootstrap dependency 'brew' not found, must install Homebrew! See http://brew.sh/"
Expand Down Expand Up @@ -1127,7 +1148,7 @@ function Start-PSPackage {
[ValidatePattern("^powershell")]
[string]$Name = "powershell",

# Ubuntu, CentOS, and OS X, and Windows packages are supported
# Ubuntu, CentOS, Fedora, OS X, and Windows packages are supported
[ValidateSet("deb", "osxpkg", "rpm", "msi", "appx", "zip")]
[string[]]$Type,

Expand Down Expand Up @@ -1181,7 +1202,7 @@ function Start-PSPackage {
$Type = if ($IsLinux) {
if ($LinuxInfo.ID -match "ubuntu") {
"deb"
} elseif ($LinuxInfo.ID -match "centos") {
} elseif ($IsRedHatFamily) {
"rpm"
} else {
throw "Building packages for $($LinuxInfo.PRETTY_NAME) is unsupported!"
Expand Down Expand Up @@ -1286,8 +1307,8 @@ function New-UnixPackage {
}
}
"rpm" {
if (!$IsCentOS) {
throw ($ErrorMessage -f "CentOS")
if (!$IsRedHatFamily) {
throw ($ErrorMessage -f "Redhat Family")
}
}
"osxpkg" {
Expand Down Expand Up @@ -1351,7 +1372,7 @@ It consists of a cross-platform command-line shell and associated scripting lang

New-Item -Force -ItemType SymbolicLink -Path "/tmp/$Name" -Target "$Destination/$Name" >$null

if ($IsCentos) {
if ($IsRedHatFamily) {
$AfterInstallScript = [io.path]::GetTempFileName()
$AfterRemoveScript = [io.path]::GetTempFileName()
@'
Expand Down Expand Up @@ -1468,7 +1489,7 @@ esac
} elseif ($IsUbuntu16) {
$Dependencies += "libicu55"
}
} elseif ($IsCentOS) {
} elseif ($IsRedHatFamily) {
$Dependencies = @(
"glibc",
"libcurl",
Expand All @@ -1491,9 +1512,15 @@ esac
$Iteration += "ubuntu1.16.04.1"
}

# We currently only support CentOS 7
# We currently only support CentOS 7 and Fedora 24+
# https://fedoraproject.org/wiki/Packaging:DistTag
$rpm_dist = "el7.centos"
if ($IsCentOS) {
$rpm_dist = "el7.centos"
} elseif ($IsFedora) {
$version_id = $LinuxInfo.VERSION_ID
$rpm_dist = "fedora.$version_id"
}


$Arguments = @(
"--force", "--verbose",
Expand Down Expand Up @@ -2413,6 +2440,7 @@ function Start-CrossGen {
"ubuntu.16.04-x64",
"debian.8-x64",
"centos.7-x64",
"fedora.24-x64",
"win7-x86",
"win7-x64",
"win81-x64",
Expand Down Expand Up @@ -2483,6 +2511,8 @@ function Start-CrossGen {
"ubuntu.14.04-x64"
} elseif ($IsCentOS) {
"rhel.7-x64"
} elseif ($IsFedora) {
"fedora.24-x64"
}
} elseif ($IsOSX) {
"osx.10.10-x64"
Expand Down
17 changes: 17 additions & 0 deletions docker/nightly/fedora24/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM microsoft/powershell:fedora24
MAINTAINER Andrew Schwartzmeyer <andschwa@microsoft.com>
LABEL Readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md"
LABEL Description="This Dockerfile will install and build the latest release of PS."

ARG fork=PowerShell
ARG branch=master
SHELL ["powershell", "-command"]
RUN git clone --recursive https://github.com/$env:fork/PowerShell.git -b $env:branch; \
Set-Location PowerShell; \
Import-Module ./build.psm1; \
Start-PSBootstrap -Package -NoSudo; \
Start-PSBuild -Crossgen -PSModuleRestore; \
Start-PSPackage;

SHELL ["/bin/sh", "-c"]
RUN dnf install -y PowerShell/powershell*.rpm
64 changes: 64 additions & 0 deletions docker/release/fedora24/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
FROM fedora:24
MAINTAINER Andrew Schwartzmeyer <andschwa@microsoft.com>

# This release Dockerfile uses the CentOS 7 build for the purposes of enabling
# nightlies

ARG POWERSHELL_VERSION=6.0.0-alpha.13
ARG POWERSHELL_RELEASE=v6.0.0-alpha.13
ARG POWERSHELL_PACKAGE=powershell-6.0.0_alpha.13-1.el7.centos.x86_64.rpm

# The CentOS 7 release relies on an older version of libicu, so we'll be downloading it
# from the University of Kent (GB) mirror service.
ARG LIBICU50_SOURCE=https://www.mirrorservice.org/sites/mirror.centos.org/7.2.1511/os/x86_64/Packages
ARG LIBICU50_PACKAGE=libicu-50.1.2-15.el7.x86_64.rpm
ARG LIBICU50_PACKAGE_MD5=c3c1ebaabc8d1619377d535698784953

# Install the English language pack first

RUN dnf install -y glibc glibc-langpack-en glibc-locale-source

ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG

# Disable Delta RPMS
RUN echo "deltarpm=False" >> /etc/dnf/dnf.conf

# Install dependencies and clean up
RUN dnf install -y \
libcurl \
ca-certificates \
libgcc \
libicu \
openssl \
libstdc++ \
ncurses-base \
libunwind \
uuid \
zlib \
which \
curl \
git \
cpio \
&& dnf update -y \
&& dnf clean all

# Install PowerShell package
RUN curl -SLO https://github.com/PowerShell/PowerShell/releases/download/$POWERSHELL_RELEASE/$POWERSHELL_PACKAGE \
&& dnf install -y $POWERSHELL_PACKAGE \
&& rm $POWERSHELL_PACKAGE

# Once the next release of PowerShell is done, this libicu50 & LD_LIBRARY_PATH hackery can be dropped.
RUN curl -SLO ${LIBICU50_SOURCE}/${LIBICU50_PACKAGE} \
&& md5sum $LIBICU50_PACKAGE | grep $LIBICU50_PACKAGE_MD5 \
&& cd /opt/microsoft/powershell/$POWERSHELL_VERSION \
&& rpm2cpio /$LIBICU50_PACKAGE | cpio -idmv \
&& rm /$LIBICU50_PACKAGE

# Append the old library to LD_LIBRARY_PATH

ENV LD_LIBRARY_PATH /opt/microsoft/powershell/$POWERSHELL_VERSION/usr/lib64

# Use array to avoid Docker prepending /bin/sh -c
ENTRYPOINT [ "powershell" ]
1 change: 1 addition & 0 deletions src/ResGen/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"ubuntu.14.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },
"fedora.24-x64": { },
"win7-x86": { },
"win7-x64": { },
"win81-x64": { },
Expand Down
1 change: 1 addition & 0 deletions src/TypeCatalogGen/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"ubuntu.16.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },
"fedora.24-x64": { },
"win7-x86": { },
"win7-x64": { },
"win81-x64": { },
Expand Down
1 change: 1 addition & 0 deletions src/TypeCatalogParser/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"ubuntu.14.04-x64": { },
"ubuntu.16.04-x64": { },
"centos.7-x64": { },
"fedora.24-x64": { },
"win7-x86": { },
"win7-x64": { },
"win10-x64": { },
Expand Down
1 change: 1 addition & 0 deletions src/powershell-unix/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"ubuntu.16.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },
"fedora.24-x64": { },
"osx.10.11-x64": { }
}
}
1 change: 1 addition & 0 deletions test/PSReadLine/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"ubuntu.14.04-x64": { },
"ubuntu.16.04-x64": { },
"centos.7-x64": { },
"fedora.24-x64": { },
"win7-x86": { },
"win7-x64": { },
"win10-x64": { },
Expand Down
1 change: 1 addition & 0 deletions test/csharp/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"ubuntu.16.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },
"fedora.24-x64": { },
"win7-x86": { },
"win7-x64": { },
"win81-x64": { },
Expand Down
1 change: 1 addition & 0 deletions test/tools/CreateChildProcess/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"ubuntu.14.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },
"fedora.24-x64": { },
"win7-x86": { },
"win7-x64": { },
"win81-x64": { },
Expand Down
1 change: 1 addition & 0 deletions test/tools/EchoArgs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"ubuntu.14.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },
"fedora.24-x64": { },
"win7-x86": { },
"win7-x64": { },
"win81-x64": { },
Expand Down