Merge pull request #2015 from ellismg/fix-2004

Fix permissions when packaging artifacts
This commit is contained in:
Matt Ellis 2016-03-24 17:23:00 -07:00
commit 5bf6088a47

View file

@ -61,6 +61,8 @@ namespace Microsoft.DotNet.Cli.Build
Directory.CreateDirectory(cliSdkRoot);
Utils.CopyDirectoryRecursively(Path.Combine(Dirs.Stage2, "sdk"), cliSdkRoot, true);
FixPermissions(cliSdkRoot);
c.BuildContext["CLISDKRoot"] = cliSdkRoot;
return c.Success();
}
@ -81,6 +83,7 @@ namespace Microsoft.DotNet.Cli.Build
var destFile = file.Replace(Dirs.Stage2, sharedHostRoot);
File.Copy(file, destFile, true);
}
FixPermissions(sharedHostRoot);
c.BuildContext["SharedHostPublishRoot"] = sharedHostRoot;
return c.Success();
@ -97,6 +100,8 @@ namespace Microsoft.DotNet.Cli.Build
Directory.CreateDirectory(sharedFxRoot);
Utils.CopyDirectoryRecursively(Path.Combine(Dirs.Stage2, "shared"), sharedFxRoot, true);
FixPermissions(sharedFxRoot);
c.BuildContext["SharedFrameworkPublishRoot"] = sharedFxRoot;
return c.Success();
}
@ -242,5 +247,17 @@ namespace Microsoft.DotNet.Cli.Build
.Execute()
.EnsureSuccessful();
}
private static void FixPermissions(string directory)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Reset everything to user readable/writeable and group and world readable.
FS.ChmodAll(directory, "*", "644");
// Now make things that should be executable, executable.
FS.FixModeFlags(directory);
}
}
}
}