duplicati: 2.1.0.5 -> 2.2.0.1, build from source, add update script (#467649)

This commit is contained in:
Sandro
2025-12-21 20:56:43 +00:00
committed by GitHub
4 changed files with 1683 additions and 52 deletions
+1547
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,32 @@
diff --git a/Duplicati/UnitTest/Issue6504.cs b/Duplicati/UnitTest/Issue6504.cs
index 1234567..abcdefg 100644
--- a/Duplicati/UnitTest/Issue6504.cs
+++ b/Duplicati/UnitTest/Issue6504.cs
@@ -93,7 +93,7 @@ namespace Duplicati.UnitTest;
// Force the error by making sure the duplicate blocks are from both dblock files
- using (var db = SQLiteLoader.LoadConnection(DBFILE))
+ using (var db = SQLiteLoader.LoadConnection(DBFILE, 0))
using (var cmd = db.CreateCommand())
{
cmd.CommandText = @"SELECT BlockId,VolumeID FROM DuplicateBlock";
@@ -110,14 +110,14 @@ namespace Duplicati.UnitTest;
var otherVolumeId = blocks.First(x => x.VolumeID != duplicateVolumeId && x.ID != blockToChange.BlockId).VolumeID;
cmd.CommandText = "UPDATE DuplicateBlock SET VolumeID=@VolumeID WHERE BlockID=@BlockID";
- cmd.Parameters.AddWithValue("@VolumeID", otherVolumeId);
- cmd.Parameters.AddWithValue("@BlockID", blockToChange.BlockId);
+ ((System.Data.SQLite.SQLiteParameterCollection)cmd.Parameters).AddWithValue("@VolumeID", otherVolumeId);
+ ((System.Data.SQLite.SQLiteParameterCollection)cmd.Parameters).AddWithValue("@BlockID", blockToChange.BlockId);
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "UPDATE Block SET VolumeID=@VolumeID WHERE ID=@BlockID";
- cmd.Parameters.AddWithValue("@VolumeID", duplicateVolumeId);
- cmd.Parameters.AddWithValue("@BlockID", blockToChange.BlockId);
+ ((System.Data.SQLite.SQLiteParameterCollection)cmd.Parameters).AddWithValue("@VolumeID", duplicateVolumeId);
+ ((System.Data.SQLite.SQLiteParameterCollection)cmd.Parameters).AddWithValue("@BlockID", blockToChange.BlockId);
cmd.ExecuteNonQuery();
}
}
+72 -52
View File
@@ -1,73 +1,93 @@
{
lib,
stdenv,
fetchzip,
buildDotnetModule,
fetchFromGitHub,
autoPatchelfHook,
gcc-unwrapped,
zlib,
lttng-ust_2_12,
dotnetCorePackages,
icu,
openssl,
makeBinaryWrapper,
krb5,
}:
let
_supportedPlatforms = {
"armv7l-linux" = "linux-arm7";
"x86_64-linux" = "linux-x64";
"aarch64-linux" = "linux-arm64";
};
_platform = _supportedPlatforms."${stdenv.hostPlatform.system}";
# nix --extra-experimental-features nix-command hash convert --to sri "sha256:`nix-prefetch-url --unpack https://updates.duplicati.com/stable/duplicati-2.1.0.5_stable_2025-03-04-linux-arm64-cli.zip`"
_fileHashForSystem = {
"armv7l-linux" = "sha256-FQQ07M0rwvxNkHPW6iK5WBTKgFrZ4LOP4vgINfmtq4k=";
"x86_64-linux" = "sha256-1QspF/A3hOtqd8bVbSqClJIHUN9gBrd18J5qvZJLkQE=";
"aarch64-linux" = "sha256-mSNInaCkNf1MBZK2M42SjJnYRtB5SyGMvSGSn5oH1Cs=";
};
in
stdenv.mkDerivation (finalAttrs: {
# TODO build duplicati from source https://github.com/duplicati/duplicati/blob/master/.github/workflows/build-packages.yml
buildDotnetModule rec {
pname = "duplicati";
version = "2.1.0.5";
version = "2.2.0.1";
channel = "stable";
buildDate = "2025-03-04";
buildDate = "2025-11-09";
src = fetchzip {
url =
with finalAttrs;
"https://updates.duplicati.com/stable/duplicati-${version}_${channel}_${buildDate}-${_platform}-cli.zip";
hash = _fileHashForSystem."${stdenv.hostPlatform.system}";
src = fetchFromGitHub {
owner = "duplicati";
repo = "duplicati";
tag = "v${version}_${channel}_${buildDate}";
hash = "sha256-fARK2nAqE9aN2PQSC62yIcYr3e/kBT3BVTBxLwMqk24=";
stripRoot = true;
};
nativeBuildInputs = [
autoPatchelfHook
makeBinaryWrapper
];
patches = [ ./fix-unit-tests.patch ];
nugetDeps = ./deps.json;
dotnet-sdk = dotnetCorePackages.sdk_8_0;
dotnet-runtime = dotnetCorePackages.aspnetcore_8_0;
enableParallelBuilding = false;
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
buildInputs = [
gcc-unwrapped
zlib
lttng-ust_2_12
icu
openssl
krb5
];
installPhase = ''
runHook preInstall
autoPatchelfIgnoreMissingDeps = lib.optionals (!stdenv.hostPlatform.isMusl) [
"libc.musl-x86_64.so.1"
"libc.musl-aarch64.so.1"
"libc.musl-armv7.so.1"
];
mkdir -p $out/{bin,share}
cp -r * "$out/share/"
for file in $out/share/duplicati-*; do
makeBinaryWrapper "$file" "$out/bin/$(basename $file)" \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [
icu
openssl
]
}
done
executables = [
"Duplicati.Agent"
"Duplicati.CommandLine"
"Duplicati.CommandLine.AutoUpdater"
"Duplicati.CommandLine.BackendTester"
"Duplicati.CommandLine.BackendTool"
"Duplicati.CommandLine.DatabaseTool"
"Duplicati.CommandLine.RecoveryTool"
"Duplicati.CommandLine.SecretTool"
"Duplicati.CommandLine.ServerUtil"
"Duplicati.CommandLine.SharpAESCrypt"
"Duplicati.CommandLine.Snapshots"
"Duplicati.CommandLine.SourceTool"
"Duplicati.CommandLine.SyncTool"
"Duplicati.GUI.TrayIcon"
"Duplicati.Server"
"Duplicati.Service"
];
runHook postInstall
postFixup = ''
mv $out/bin/Duplicati.Agent $out/bin/duplicati-agent
mv $out/bin/Duplicati.GUI.TrayIcon $out/bin/duplicati
mv $out/bin/Duplicati.Server $out/bin/duplicati-server
cp $out/bin/duplicati-server $out/lib/duplicati/duplicati-server
mv $out/bin/Duplicati.Service $out/bin/duplicati-service
mv $out/bin/Duplicati.CommandLine $out/bin/duplicati-cli
mv $out/bin/Duplicati.CommandLine.SyncTool $out/bin/duplicati-sync-tool
mv $out/bin/Duplicati.CommandLine.SourceTool $out/bin/duplicati-source-tool
mv $out/bin/Duplicati.CommandLine.DatabaseTool $out/bin/duplicati-database-tool
mv $out/bin/Duplicati.CommandLine.SharpAESCrypt $out/bin/duplicati-aescrypt
mv $out/bin/Duplicati.CommandLine.AutoUpdater $out/bin/duplicati-autoupdater
mv $out/bin/Duplicati.CommandLine.BackendTester $out/bin/duplicati-backend-tester
mv $out/bin/Duplicati.CommandLine.BackendTool $out/bin/duplicati-backend-tool
mv $out/bin/Duplicati.CommandLine.RecoveryTool $out/bin/duplicati-recovery-tool
mv $out/bin/Duplicati.CommandLine.SecretTool $out/bin/duplicati-secret-tool
mv $out/bin/Duplicati.CommandLine.ServerUtil $out/bin/duplicati-server-util
mv $out/bin/Duplicati.CommandLine.Snapshots $out/bin/duplicati-snapshots
'';
passthru.updateScript = ./update.sh;
meta = {
description = "Free backup client that securely stores encrypted, incremental, compressed backups on cloud storage services and remote file servers";
homepage = "https://www.duplicati.com/";
@@ -75,8 +95,8 @@ stdenv.mkDerivation (finalAttrs: {
maintainers = with lib.maintainers; [
nyanloutre
bot-wxt1221
puiyq
];
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
platforms = builtins.attrNames _supportedPlatforms;
# platforms inherited from dotnet-sdk.
};
})
}
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq nix-prefetch-github
set -euo pipefail
OWNNER="duplicati"
REPO="duplicati"
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
TARGET="$SCRIPT_DIR/package.nix"
TAG=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/$OWNNER/$REPO/tags" |
jq -r '.[].name' |
grep -E '^v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+_stable_' |
sort -Vr |
head -n1)
VERSION=$(echo "$TAG" | cut -d_ -f1 | sed 's/^v//')
CHANNEL=$(echo "$TAG" | cut -d_ -f2)
DATE=$(echo "$TAG" | cut -d_ -f3)
HASH=$(nix-prefetch-github $OWNNER $REPO --rev "$TAG" |
jq -r '.hash')
sed -i \
-e "/version = \"/c\ version = \"$VERSION\";" \
-e "/channel = \"/c\ channel = \"$CHANNEL\";" \
-e "/buildDate = \"/c\ buildDate = \"$DATE\";" \
-e "/hash = \"/c\ hash = \"$HASH\";" \
"$TARGET"
. "$(nix-build . -A duplicati.fetch-deps --no-out-link)"