From 31c21544652ae11bfb8a31d1f166d3cbc9c74db4 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 16 Sep 2022 18:29:05 +0200 Subject: [PATCH 1/5] common-updater-scripts: Use custom fake temporary hash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some update scripts (e.g. sublime4) already use all-zeroes hashes for resetting a version when updating multiple sources. When `update-source-version "${attrPath}" 0 "${lib.fakeSha256}"` was executed, u-s-v would not be able to detect that the hash changed and would fail with the following message: Failed to replace temporary source hash of '…' to the final source hash! The update script worked when we tested it because change detection itself was broken until recently: https://github.com/NixOS/nixpkgs/pull/190554 --- pkgs/common-updater/scripts/update-source-version | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/common-updater/scripts/update-source-version b/pkgs/common-updater/scripts/update-source-version index 480fb7b2265c..12a63fa92605 100755 --- a/pkgs/common-updater/scripts/update-source-version +++ b/pkgs/common-updater/scripts/update-source-version @@ -177,15 +177,15 @@ elif [[ "$oldHashAlgo" = "null" ]]; then fi case "$oldHashAlgo" in - # Lengths of hex-encoded hashes - sha256) hashLength=64 ;; - sha512) hashLength=128 ;; + # Choose a temporary hash for given algorithm. + # Not using all-zeroes hash, since that is sometimes + # used for clean-up when updating multi-source packages. + # Created by hashing “update-source-version” string. + sha256) tempHash=AzH1rZFqEH8sovZZfJykvsEmCedEZWigQFHWHl6/PdE= ;; + sha512) tempHash=KFj9Fvco4AuCgLJIGRnVzyssRf7VGP2oi5CkH6ADvj75ow3am3h8pxefOgQlO+i33Q/BBnG/ST/F7B/0BvWHxw== ;; *) die "Unhandled hash algorithm '$oldHashAlgo' in '$attr'!" ;; esac -# Make a temporary all-zeroes hash of $hashLength characters -tempHash=$(printf '%0*d' "$hashLength" 0) - if [[ -n "$sri" ]]; then # SRI hashes only support base64 # SRI hashes need to declare the hash type as part of the hash From 98315b4307e237b042154e2eeb95ebd10378a2a4 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 16 Sep 2022 17:47:49 +0200 Subject: [PATCH 2/5] sublime4: Avoid absolute exec paths in desktop file When user installed a new version of ST (or just a different derivation), GNOME Shell would lose the association of the windows with the icon. Since the package needs to be installed in order for the desktop file to be available, having the path absolute is useless any way. --- pkgs/applications/editors/sublime/4/common.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/editors/sublime/4/common.nix b/pkgs/applications/editors/sublime/4/common.nix index 41dc020e4ecf..ebf6cc2c53e1 100644 --- a/pkgs/applications/editors/sublime/4/common.nix +++ b/pkgs/applications/editors/sublime/4/common.nix @@ -116,7 +116,7 @@ in stdenv.mkDerivation (rec { makeWrapper "''$${primaryBinary}/${primaryBinary}" "$out/bin/${primaryBinary}" '' + builtins.concatStringsSep "" (map (binaryAlias: "ln -s $out/bin/${primaryBinary} $out/bin/${binaryAlias}\n") primaryBinaryAliases) + '' mkdir -p "$out/share/applications" - substitute "''$${primaryBinary}/${primaryBinary}.desktop" "$out/share/applications/${primaryBinary}.desktop" --replace "/opt/${primaryBinary}/${primaryBinary}" "$out/bin/${primaryBinary}" + substitute "''$${primaryBinary}/${primaryBinary}.desktop" "$out/share/applications/${primaryBinary}.desktop" --replace "/opt/${primaryBinary}/${primaryBinary}" "${primaryBinary}" for directory in ''$${primaryBinary}/Icon/*; do size=$(basename $directory) mkdir -p "$out/share/icons/hicolor/$size/apps" From 2901fd1b0cfea9a39d253147335a1c61f07a88ef Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 16 Sep 2022 17:57:45 +0200 Subject: [PATCH 3/5] sublime-merge: Avoid absolute exec paths in desktop file When user installed a new version of SM (or just a different derivation), GNOME Shell would lose the association of the windows with the icon. Since the package needs to be installed in order for the desktop file to be available, having the path absolute is useless any way. Same change as the one for sublime4 in the parent commit. --- pkgs/applications/version-management/sublime-merge/common.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/version-management/sublime-merge/common.nix b/pkgs/applications/version-management/sublime-merge/common.nix index 8cb447445c69..998b1793c187 100644 --- a/pkgs/applications/version-management/sublime-merge/common.nix +++ b/pkgs/applications/version-management/sublime-merge/common.nix @@ -98,7 +98,7 @@ in stdenv.mkDerivation (rec { makeWrapper "''$${primaryBinary}/${primaryBinary}" "$out/bin/${primaryBinary}" '' + builtins.concatStringsSep "" (map (binaryAlias: "ln -s $out/bin/${primaryBinary} $out/bin/${binaryAlias}\n") primaryBinaryAliases) + '' mkdir -p "$out/share/applications" - substitute "''$${primaryBinary}/${primaryBinary}.desktop" "$out/share/applications/${primaryBinary}.desktop" --replace "/opt/${primaryBinary}/${primaryBinary}" "$out/bin/${primaryBinary}" + substitute "''$${primaryBinary}/${primaryBinary}.desktop" "$out/share/applications/${primaryBinary}.desktop" --replace "/opt/${primaryBinary}/${primaryBinary}" "${primaryBinary}" for directory in ''$${primaryBinary}/Icon/*; do size=$(basename $directory) mkdir -p "$out/share/icons/hicolor/$size/apps" From fe6ae94c85ba371335e89f2e57fcb68c3ee51201 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 16 Sep 2022 16:37:00 +0000 Subject: [PATCH 4/5] =?UTF-8?q?sublime4-dev:=204134=20=E2=86=92=204136?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/applications/editors/sublime/4/packages.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/editors/sublime/4/packages.nix b/pkgs/applications/editors/sublime/4/packages.nix index 9569f4ebf647..0742ee42b215 100644 --- a/pkgs/applications/editors/sublime/4/packages.nix +++ b/pkgs/applications/editors/sublime/4/packages.nix @@ -11,9 +11,9 @@ in } {}; sublime4-dev = common { - buildVersion = "4134"; + buildVersion = "4136"; dev = true; - x64sha256 = "rd3EG8e13FsPKihSM9qjUMRsEA6joMwVqhj1NZlwIaE="; - aarch64sha256 = "gdfEDd2E1sew08sVmcmw21zyil8JuJJMpG2T/9Pi81E="; + x64sha256 = "6cSaF8seS3XpXpoaROO5tpVuwJzE+z1kzwxNlOUadj0="; + aarch64sha256 = "Mtib8i29FCFutRXmWPQSp9h/FcLD7+wv+tGAjwf9d3w="; } {}; } From 1cef395ff05a7d8ba987b246f3450cfec885b9f3 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 16 Sep 2022 16:37:52 +0000 Subject: [PATCH 5/5] =?UTF-8?q?sublime-merge:=202074=20=E2=86=92=202077?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../applications/version-management/sublime-merge/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/sublime-merge/default.nix b/pkgs/applications/version-management/sublime-merge/default.nix index 777bd86916cc..5cbb4fe1ba9f 100644 --- a/pkgs/applications/version-management/sublime-merge/default.nix +++ b/pkgs/applications/version-management/sublime-merge/default.nix @@ -4,8 +4,8 @@ let common = opts: callPackage (import ./common.nix opts); in { sublime-merge = common { - buildVersion = "2074"; - x64sha256 = "REo59Lpi0fmAOp0XJa4Iln3VKxR5kRiMpz2zfqz1MQs="; + buildVersion = "2077"; + x64sha256 = "6xgh/oSatTYHCnQEXiZAoHs3yI1iimLMtzCosBKBVp8="; } {}; sublime-merge-dev = common {