8000 Creates a single package for Windows by adityapatwardhan · Pull Request #4540 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Creates a single package for Windows #4540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 28, 2017

Conversation

adityapatwardhan
Copy link
Member
@adityapatwardhan adityapatwardhan commented Aug 10, 2017

The updates to build.psm1 and packaging.psm1 create a single package (per bitness), which works on all the Windows OS versions, namely Windows 7 / Windows Server 2008 R2, Windows 8.1 / Windows Server 2012 R2, Windows 10 / Windows Server 2016.

I am in process of testing the packages on the various OS versions, hence please DO NOT MERGE. I will update this PR when testing is complete.

[daxian edited] This PR has been approved by @TravisEz13 and @iSazonov, so I merged it.

Fixes #4315 and #2608

build.psm1 Outdated
# set output options
$OptionsArguments = @{
CrossGen=$CrossGen
Output=$Output
FullCLR=$FullCLR
Runtime=$Runtime
Runtime=$RuntimeRID
Copy link
Collaborator
@iSazonov iSazonov Aug 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by the reuse of the name Runtime - Now in Start-PSBuild it is used as "Generic" runtime. Here as "minimal level" runtime. I believe we should rename first or second.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is consistent with dotnet's portable runtime concept. unfortunately, they have defined the portable runtimeid for windows to be win7-x86 and win7-x64

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iSazonov we have to use win7-* to make sure the package works on all supported Windows OS versions. It would be weird for cmdline usage to specify win7-x86 or win7-x64, hence I changed it to win-x64 and win-x86. The script changes it to win7-*.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that the variable name "Runtime" accept different values 'win-x64' -> 'win7-x64' , 'win-x86' -> 'win7-x86' - Can we use win7-* with Start-PSBuild?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adityapatwardhan I think I agree, How about we make the RID you use win7-* and translate the suffix to win-* in the packaging module?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My feedback here was that it's better for transparency's sake that we use the same RIDs as dotnet-cli as opposed to doing black magic over their unfortunate naming. Anyone poking into RID documentation will just be confused if we try to normalize away the 7.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had the same opinion as @TravisEz13 on the package naming, though. 👍

build.psm1 Outdated
@@ -616,8 +620,6 @@ function New-PSOptions {
"fedora.24-x64",
"win7-x86",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the RIDs in New-PSOption should be consistent with Start-PSBuild

@adityapatwardhan
Copy link
Member Author

@joeyaiello @TravisEz13 @iSazonov Thanks for the feedback. To summarize, keep the value for -Runtime as win7-x86 and win7-x64 and remove other win* values. During packaging change the package name to win-x86 and win-x64. I will update PR soon.

@adityapatwardhan
Copy link
Member Author

@TravisEz13 @iSazonov @joeyaiello I have updated the PR. Please have a look.

build.psm1 Outdated
@@ -696,19 +690,12 @@ function New-PSOptions {
}

if (-not $Runtime) {
$RuntimeFromDotNet = dotnet --info | ForEach-Object {
$Runtime = dotnet --info | ForEach-Object {
if ($_ -match "RID") {
$_ -split "\s+" | Select-Object -Last 1
Copy link
Collaborator
@iSazonov iSazonov Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet --info returns win10-64 for me - we need to add a convertion here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have 2 options, first do the conversion here. Other is to make runtime parameter mandatory. I prefer the first one. So if user does not specify -runtime we auto-select win7-x86/x64 on windows. On Linux/Mac, we don't change anything. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an Issue to make a single package for Linux too and seems the same problem too. So I believe we should use the same logic for both.
If we continue to use dotnet --info we could move the logic in separate function for Windows and Linux.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, Linux will require two packages because of packaging format differences (RPM vs DEB).

Copy link
Member Author
@adityapatwardhan adityapatwardhan Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TravisEz13 which of the two options you prefer?

  1. Do the conversion from Win10-x64 -> Win7-x64 in build.psm1
  2. Make -Runtime a mandatory parameter.

build.psm1 Outdated
@@ -293,8 +293,6 @@ function Start-PSBuild {
"fedora.24-x64",
"win7-x64",
"win7-x86",
"win81-x64",
"win10-x64",
Copy link
Member
@daxian-dbw daxian-dbw Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though win81-x64 and win10-x64 are removed from this list, when running Start-PSBuild we will still see the publish folder path is netcoreapp2.0\win10-x64\ on a win10 machines and netcoreapp2.0\win81-x64\ on a win81 machine. However, we are not allowed to specify win10-x64 or win81-x64 for the -Runtime parameter here. The user experience seems broken to me.

My opinion is to keep Start-PSBuild and New-PSOptions unchanged, and only make some changes to the packaging scripts. After all, we only care about win7-* RID when doing the universal packaging for windows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this suggestion. I will make the updates.

@@ -160,20 +160,14 @@ On Windows, the `-Runtime` parameter should be specified for `Start-PSBuild` to
# Install dependencies
Start-PSBootstrap -Package

# Build for v6.0.0-beta.1 release targeting Windows 10 and Server 2016
Start-PSBuild -Clean -CrossGen -PSModuleRestore -Runtime win10-x64 -Configuration Release -ReleaseTag v6.0.0-beta.1
# Build for v6.0.0-beta.1 release targeting Windows
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows, the -Runtime parameter should be specified for Start-PSBuild to indicate what version of OS the build is targeting.

This sentence needs to be updated to explain that -Runtime needs to be win7-* to build windows universal package.

Build for v6.0.0-beta.1 release targeting Windows

Here we still should mention that targeting Windows 7.

67E6
} else {
New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two new lines here. Maybe one would be sufficient.

# the parameter '-WindowsDownLevel' must be specified.
Start-PSPackage -Type msi -ReleaseTag v6.0.0-beta.1 <# -WindowsDownLevel win81-x64 #>
Start-PSPackage -Type zip -ReleaseTag v6.0.0-beta.1 <# -WindowsDownLevel win81-x64 #>
# Create packages for v6.0.0-beta.1 release targeting Windows.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be updated to Create Windows universal packages for v6.0.0-beta.1 release

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet uses the term portable instead of universal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe portable is used for cross platform, this is universal across all windows versions.

.spelling Outdated
@@ -353,6 +353,7 @@ Ronn
Toolset
v6
WiX
Runtimewin7-x64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo?

@@ -22,11 +22,6 @@ function Start-PSPackage {
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg")]
[string[]]$Type,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add
[ValidateScript({!$Environment.IsWindows})]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot add this, as it is valid for Windows and Non-windows.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closed.

'win7-x64' {$NameSuffix = 'win7-win2008r2-x64'}
Default {$NameSuffix = $Runtime}
}
$NameSuffix = $Runtime -replace 'win\d+', 'win'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move to Line 37?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@adityapatwardhan
Copy link
Member Author

@daxian-dbw @TravisEz13 @iSazonov @joeyaiello Please have a look. All feedback is addressed.

@iSazonov
Copy link
Collaborator

No new ideas yet :-)

@@ -22,11 +22,6 @@ function Start-PSPackage {
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg")]
[string[]]$Type,

# Generate windows downlevel package
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we package x86 now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I forgot that we are doing cross compilation so the actual RID will still be *-x64.
@adityapatwardhan and I just talked and agreed that we should bring back the WindowsRutnime parameter here. And that parameter probably should be made mandatory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you make it mandatory? What happens when you are producing a deb, pkg, etc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis is correct, we cannot make it mandatory.

Changes to packaging.psm1 to create a single package to work on all
versions of Windows. The runtime used is win7-x86/x64. The package that
is created has a name suffix win-x64 or win-x86 to signify it works on
any version on Windows.
@adityapatwardhan adityapatwardhan changed the title [DO NOT MERGE] Creates a single package for Windows Creates a single package for Windows Aug 18, 2017
@daxian-dbw daxian-dbw dismissed their stale review August 22, 2017 00:23

New commits were pushed

@daxian-dbw
Copy link
Member

We will have the beta-6 release on this Thursday (8/24), and we don't have enough time to stabilize this change. Travis and I chatted offline and agreed that we should hold off this change till after this release.

@adityapatwardhan
Copy link
Member Author
adityapatwardhan commented Aug 22, 2017 via email

@daxian-dbw
Copy link
Member
daxian-dbw commented Aug 24, 2017

There is some logic in the MSI package that seems to check the Windows C Runtime and VS Studio 2015 C++ redistributables are present and return error message if not (see (54e892a)). It seems this logic is enabled in downlevel MSI package (@mirichmo please correct me if I'm wrong).

I bring this up because this caused an issue that causes Win81 packages fail to install on Server2012R2. I'm not sure if this will have any impact when running win7 MSI packages on Win10/Server2016.

@mirichmo
Copy link
Member

I filed #4665 to cover the installer issue. The check needs to be more generic to cover the scenario where the dependencies are installed via Windows Update

@daxian-dbw daxian-dbw merged commit fd047a8 into PowerShell:master Aug 28, 2017
@daxian-dbw
Copy link
Member

@TravisEz13 I have merged this PR. Do you think any other scripts need to be changed accordingly? (e.g. powershell/psrelease ??)

@TravisEz13
Copy link
Member

@daxian-dbw I'll look at the builds tomorrow and see if everything went correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0