From d1418bb3e1f38a4edbb2297e6df3ad0f2c7e0277 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 12 Dec 2024 12:22:55 +0100 Subject: [PATCH 1/3] Implemented assertions to avoid sleep during build --- ReleaseBuilder/Build/Command.cs | 3 ++ ReleaseBuilder/KeepAliveAssertion.cs | 78 ++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 ReleaseBuilder/KeepAliveAssertion.cs diff --git a/ReleaseBuilder/Build/Command.cs b/ReleaseBuilder/Build/Command.cs index 627dcd7d5..d8b2e0626 100644 --- a/ReleaseBuilder/Build/Command.cs +++ b/ReleaseBuilder/Build/Command.cs @@ -472,6 +472,9 @@ public static partial class Command throw new Exception($"The following packages cannot be built without Docker: {string.Join(", ", unsupportedBuilds.Select(x => x.PackageTargetString))}"); } + // Prevent the system from going to sleep during the build + using var _ = new KeepAliveAssertion(); + if (rtcfg.UseGithubUpload && !input.GitStashPush) { Console.WriteLine("Github upload requested, but pushing the tag is disabled"); diff --git a/ReleaseBuilder/KeepAliveAssertion.cs b/ReleaseBuilder/KeepAliveAssertion.cs new file mode 100644 index 000000000..3bda14c09 --- /dev/null +++ b/ReleaseBuilder/KeepAliveAssertion.cs @@ -0,0 +1,78 @@ +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace ReleaseBuilder; + +/// +/// A class that prevents the system from sleeping during build +/// +public class KeepAliveAssertion : IDisposable +{ + /// + /// The previous state of the system, on Windows + /// + private NativeMethods.EXECUTION_STATE _previousState; + /// + /// The process that keeps the system awake, on Linux and MacOS + /// + private Process? _keepAliveProcess; + + /// + /// Creates a new instance of the class + /// + public KeepAliveAssertion() + { + if (OperatingSystem.IsWindows()) + { + _previousState = NativeMethods.SetThreadExecutionState(NativeMethods.EXECUTION_STATE.ES_CONTINUOUS | NativeMethods.EXECUTION_STATE.ES_SYSTEM_REQUIRED | NativeMethods.EXECUTION_STATE.ES_AWAYMODE_REQUIRED); + } + else if (OperatingSystem.IsLinux()) + { + _keepAliveProcess = Process.Start("xset", "s off -dpms"); + } + else if (OperatingSystem.IsMacOS()) + { + // Keep the display awake until this process exits + var selfProcessId = Process.GetCurrentProcess().Id; + _keepAliveProcess = Process.Start("caffeinate", ["-d", "-w", selfProcessId.ToString()]); + } + } + + /// + /// A class that contains Windows native methods + /// + [SupportedOSPlatform("windows")] + private class NativeMethods + { + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags); // returns the previous state + + [Flags] + public enum EXECUTION_STATE : uint + { + ES_AWAYMODE_REQUIRED = 0x00000040, + ES_CONTINUOUS = 0x80000000, + ES_SYSTEM_REQUIRED = 0x00000001 + } + } + + /// + public void Dispose() + { + if (OperatingSystem.IsWindows()) + { + NativeMethods.SetThreadExecutionState(_previousState); + } + else if (OperatingSystem.IsLinux()) + { + _keepAliveProcess?.Kill(); + _keepAliveProcess?.Dispose(); + } + else if (OperatingSystem.IsMacOS()) + { + _keepAliveProcess?.Kill(); + _keepAliveProcess?.Dispose(); + } + } +} From d2955d4c98a7b7fc55cac16efcac700d83d9d945 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 12 Dec 2024 15:24:36 +0100 Subject: [PATCH 2/3] Push current branch --- ReleaseBuilder/Build/Command.GitPush.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReleaseBuilder/Build/Command.GitPush.cs b/ReleaseBuilder/Build/Command.GitPush.cs index 3ba8e30b8..432c3bced 100644 --- a/ReleaseBuilder/Build/Command.GitPush.cs +++ b/ReleaseBuilder/Build/Command.GitPush.cs @@ -40,7 +40,7 @@ public static partial class Command }, workingDirectory: baseDir); // Then push the release - await ProcessHelper.Execute(new[] { "git", "push" }, workingDirectory: baseDir); + await ProcessHelper.Execute(new[] { "git", "push", "-u", "origin", "head" }, workingDirectory: baseDir); await ProcessHelper.Execute(new[] { "git", "push", "--tags" }, workingDirectory: baseDir); } } From 4ce419aba68dbce0dcd01716f3e9ec0f63b508ea Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 12 Dec 2024 15:26:11 +0100 Subject: [PATCH 3/3] Version bump to v2.1.0.102-2.1.0.102_canary_2024-12-12 You can download this build from: Binaries: https://updates.duplicati.com/canary/?version=2.1.0.102 Signature file: https://updates.duplicati.com/canary/duplicati-2.1.0.102_canary_2024-12-12.signatures.zip --- ReleaseBuilder/build_version.txt | 2 +- changelog.txt | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ReleaseBuilder/build_version.txt b/ReleaseBuilder/build_version.txt index bbe27ff9e..6dd8adf6a 100644 --- a/ReleaseBuilder/build_version.txt +++ b/ReleaseBuilder/build_version.txt @@ -1 +1 @@ -2.1.0.101 \ No newline at end of file +2.1.0.102 \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 9a572bf18..fd54c4fc9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,20 @@ +2024-12-12 - 2.1.0.102_canary_2024-12-12 +========== +This release is a canary release intended to be used for testing. + +**Note that this build is using .NET8, unlike the 2.0.8.1 build** + +**Note that this build has a redesigned restore flow** +Should issues arise, the previous restore engine can be enabled with `--restore-legacy=true`. + +## Detailed list of changes: +- Upgraded FluentFTP to fix a crash on socket timeout +- Removed named channels to fix a rare exception +- Rewrote the restore process to be multithreaded and target optimal disk I/O write performance +- Added missing documentation to the iDrive e2 backend +- Added activity timeout on backend transfers +- Added support for generating a "forever token" + 2024-12-06 - 2.1.0.101_canary_2024-12-06 ========== This release is a canary release intended to be used for testing.