Skip to content
Open
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
45 changes: 45 additions & 0 deletions .github/workflows/upsync-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build Upsync Linux

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup .NET 9
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'

- name: Publish Upsync
run: |
dotnet publish -p:PublishSingleFile=true --self-contained -c Release src/tools/upsync/upsync.csproj

- name: Copy MicRooCerAut2011_2011_03_22
run: |
echo "-----BEGIN CERTIFICATE-----" > out/upsync/Release/net9.0/linux-x64/publish/MicRooCerAut2011_2011_03_22.crt && curl -s https://www.microsoft.com/pki/certs/MicRooCerAut2011_2011_03_22.crt | openssl base64 >> out/upsync/Release/net9.0/linux-x64/publish/MicRooCerAut2011_2011_03_22.crt && echo "-----END CERTIFICATE-----" >> out/upsync/Release/net9.0/linux-x64/publish/MicRooCerAut2011_2011_03_22.crt

- name: Create requirement.sh
run: |
echo "sudo apt-get install -y cabextract && cp MicRooCerAut2011_2011_03_22.crt /usr/local/share/ca-certificates/MicRooCerAut2011_2011_03_22.crt && sudo update-ca-certificates" > out/upsync/Release/net9.0/linux-x64/publish/requirement.sh

- name: Create ZIP of the artifact
run: |
zip -jr out/upsync-linux.zip out/upsync/Release/net9.0/linux-x64/publish/*

- name: Upload build logs to release
uses: softprops/action-gh-release@v1
with:
tag_name: linux-${{ github.sha }}
files: out/upsync-linux.zip
39 changes: 39 additions & 0 deletions .github/workflows/upsync-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Upsync Windows

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup .NET 9
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'

- name: Publish Upsync
run: |
dotnet publish -p:PublishSingleFile=true --self-contained -c Release src/tools/upsync/upsync.csproj


- name: Create ZIP of the artifact (Windows)
run: |
powershell Compress-Archive -Path out/upsync/Release/net9.0/win-x64/publish/* -DestinationPath out/upsync-windows.zip

- name: Upload artifact to GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: windows-${{ github.sha }}
files: out/upsync-windows.zip

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>Microsoft.PackageGraph.MicrosoftUpdate.Endpoints</RootNamespace>
<AssemblyName>package-graph-endpoints-microsoft-update</AssemblyName>
<PackageId>Microsoft.PackageGraph.MicrosoftUpdate.Endpoints</PackageId>
Expand Down
26 changes: 21 additions & 5 deletions src/microsoft-update-partition/CabinetUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,17 @@ static byte[] RecompressUnicodeDataLinux(byte[] compressedData)
// We use temporary files to write the in-memory cabinet,
// Then run cabextract on it with --pipe output
var cabTempFile = Path.GetTempFileName();

var xmlTempFile = Path.GetTempFileName();

var inMemoryStream = new MemoryStream();
try
{
File.WriteAllBytes(cabTempFile, compressedData);

var startInfo = new ProcessStartInfo("cabextract", $"--pipe \"{cabTempFile}\"")
var startInfo = new ProcessStartInfo
{
FileName = "cabextract",
Arguments = $"--pipe \"{cabTempFile}\"",
UseShellExecute = false,
// The decompressed text is Unicode
StandardOutputEncoding = Encoding.Unicode,
Expand All @@ -108,12 +111,20 @@ static byte[] RecompressUnicodeDataLinux(byte[] compressedData)
var expandProcess = Process.Start(startInfo);

// Read the decompressed data from the pipe
var text = expandProcess.StandardOutput.ReadToEnd();
expandProcess.WaitForExit();
if (expandProcess != null)
{
using (StreamWriter writer = new StreamWriter(xmlTempFile))
{
expandProcess.StandardOutput.BaseStream.CopyTo(writer.BaseStream);
}

expandProcess.WaitForExit();
}

// Recompress the XML with GZIP as UTF8
using var decompressor = File.OpenRead(xmlTempFile);
using var recompressor = new GZipStream(inMemoryStream, CompressionLevel.Fastest, true);
recompressor.Write(Encoding.UTF8.GetBytes(text));
decompressor.CopyTo(recompressor);

}
catch (Exception)
Expand All @@ -126,6 +137,11 @@ static byte[] RecompressUnicodeDataLinux(byte[] compressedData)
File.Delete(cabTempFile);
}

if (File.Exists(xmlTempFile))
{
File.Delete(xmlTempFile);
}

if (inMemoryStream != null)
{
return inMemoryStream.ToArray();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>Microsoft.PackageGraph.MicrosoftUpdate</RootNamespace>
<PackageId>Microsoft.PackageGraph.MicrosoftUpdate</PackageId>
<Authors>Cristian Petruta</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ private async Task<AuthPlugInInfo[]> GetAuthenticationInfo()
{
GetAuthConfigResponse authConfigResponse;

var httpBinding = new System.ServiceModel.BasicHttpBinding();
var httpBinding = new System.ServiceModel.BasicHttpBinding()
{
ReceiveTimeout = new TimeSpan(0, 3, 0),
SendTimeout = new TimeSpan(0, 3, 0),
OpenTimeout = new TimeSpan(0, 3, 0)
};
var upstreamEndpoint = new System.ServiceModel.EndpointAddress(UpstreamEndpoint.ServerSyncURI);
if (upstreamEndpoint.Uri.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>Microsoft.PackageGraph.MicrosoftUpdate.Source</RootNamespace>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<AssemblyName>package-graph-microsoftupdate-source</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyName>microsoft-update-webservices</AssemblyName>
<RootNamespace>Microsoft.UpdateServices.WebServices</RootNamespace>
<PackageId>Microsoft.PackageGraph.MicrosoftUpdate.WebServices</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>..\..\out\samples</BaseOutputPath>
Expand Down
2 changes: 1 addition & 1 deletion src/tools/upsync/upsync.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>Microsoft.PackageGraph.Utilitites.Upsync</RootNamespace>
<AssemblyName>upsync</AssemblyName>
<Company>upsync</Company>
Expand Down