diff options
author | yuuko <yuuko@partyvan.io> | 2024-08-29 21:51:04 -0700 |
---|---|---|
committer | yuuko <yuuko@partyvan.io> | 2024-08-29 21:51:04 -0700 |
commit | 56449e59d7aabd1c06fb67a51a1e129b55cb9270 (patch) | |
tree | 19f3faf805e9b6461a5940d1a050d13e5271ef55 /srcds-pkgs/depotdownloader-json |
break out of system config
Diffstat (limited to 'srcds-pkgs/depotdownloader-json')
3 files changed, 85 insertions, 0 deletions
diff --git a/srcds-pkgs/depotdownloader-json/0001-emit-json-in-.DepotDownload.patch b/srcds-pkgs/depotdownloader-json/0001-emit-json-in-.DepotDownload.patch new file mode 100644 index 0000000..6a58ac6 --- /dev/null +++ b/srcds-pkgs/depotdownloader-json/0001-emit-json-in-.DepotDownload.patch @@ -0,0 +1,51 @@ +From 5ca2011ef9c6463c6e5953101792b663b6546373 Mon Sep 17 00:00:00 2001 +From: yuuko <yuuko@kurofuku.me> +Date: Fri, 31 Mar 2023 16:03:32 -0700 +Subject: [PATCH] emit json in .DepotDownload + +--- + DepotDownloader/ContentDownloader.cs | 1 + + DepotDownloader/ProtoManifest.cs | 8 ++++++++ + 2 files changed, 9 insertions(+) + +diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs +index 7cee83f7..3bf79aa5 100644 +--- a/DepotDownloader/ContentDownloader.cs ++++ b/DepotDownloader/ContentDownloader.cs +@@ -929,6 +929,7 @@ namespace DepotDownloader + + newProtoManifest = new ProtoManifest(depotManifest, depot.manifestId); + newProtoManifest.SaveToFile(newManifestFileName, out checksum); ++ newProtoManifest.SaveToJSON(newManifestFileName.Replace(".bin", ".json")); + File.WriteAllBytes(newManifestFileName + ".sha", checksum); + + Console.WriteLine(" Done!"); +diff --git a/DepotDownloader/ProtoManifest.cs b/DepotDownloader/ProtoManifest.cs +index 70389a05..c5e12cfc 100644 +--- a/DepotDownloader/ProtoManifest.cs ++++ b/DepotDownloader/ProtoManifest.cs +@@ -2,6 +2,8 @@ + using System.Collections.Generic; + using System.IO; + using System.IO.Compression; ++using System.Text; ++using System.Text.Json; + using ProtoBuf; + using SteamKit2; + +@@ -142,6 +144,12 @@ namespace DepotDownloader + } + } + ++ public void SaveToJSON(string filename) ++ { ++ var jsonBytes = new UTF8Encoding(true).GetBytes(JsonSerializer.Serialize(this)); ++ File.Open(filename, FileMode.Create).Write(jsonBytes, 0, jsonBytes.Length); ++ } ++ + public void SaveToFile(string filename, out byte[] checksum) + { + using (var ms = new MemoryStream()) +-- +2.38.4 + diff --git a/srcds-pkgs/depotdownloader-json/0002-ProtoManifest-sort-files-in-constructor.patch b/srcds-pkgs/depotdownloader-json/0002-ProtoManifest-sort-files-in-constructor.patch new file mode 100644 index 0000000..ac4fe97 --- /dev/null +++ b/srcds-pkgs/depotdownloader-json/0002-ProtoManifest-sort-files-in-constructor.patch @@ -0,0 +1,24 @@ +From 7c067e609efabd54039905dc35edf91afb6c5dad Mon Sep 17 00:00:00 2001 +From: yuuko <yuuko@kurofuku.me> +Date: Wed, 1 Nov 2023 06:46:57 -0700 +Subject: [PATCH] ProtoManifest: sort files in constructor + +--- + DepotDownloader/ProtoManifest.cs | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/DepotDownloader/ProtoManifest.cs b/DepotDownloader/ProtoManifest.cs +index c5e12cfc..5f66595c 100644 +--- a/DepotDownloader/ProtoManifest.cs ++++ b/DepotDownloader/ProtoManifest.cs +@@ -21,6 +21,7 @@ namespace DepotDownloader + public ProtoManifest(DepotManifest sourceManifest, ulong id) : this() + { + sourceManifest.Files.ForEach(f => Files.Add(new FileData(f))); ++ Files.Sort((f1,f2) => f1.FileName.CompareTo(f2.FileName)); + ID = id; + CreationTime = sourceManifest.CreationTime; + } +-- +2.42.0 + diff --git a/srcds-pkgs/depotdownloader-json/default.nix b/srcds-pkgs/depotdownloader-json/default.nix new file mode 100644 index 0000000..c09422d --- /dev/null +++ b/srcds-pkgs/depotdownloader-json/default.nix @@ -0,0 +1,10 @@ +{ depotdownloader }: +depotdownloader.overrideAttrs({ patches ? [], version, ... }: { + patches = assert builtins.elem version [ "2.4.7" "2.5.0" ]; patches ++ [ + # with this, nix has access to the hashes in the manifest + ./0001-emit-json-in-.DepotDownload.patch + # the manifest can arrive out of order across requests to the same build! + # luckily that singular reproducibility snag is patched in 1 line. + ./0002-ProtoManifest-sort-files-in-constructor.patch + ]; +}) |