Merge pull request #176253 from trofi/fetchzip-forced-UTF-8

fetchzip: force UTF-8 compatible locale to unpack non-ASCII symbols
This commit is contained in:
Sergei Trofimovich 2022-06-15 18:32:41 +00:00 committed by GitHub
commit 206b2cfd22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 14 deletions

View file

@ -41,15 +41,15 @@ let
"8.12.0".sha256 = "18dc7k0piv6v064zgdadpw6mkkxk7j663hb3svgj5236fihjr0cz"; "8.12.0".sha256 = "18dc7k0piv6v064zgdadpw6mkkxk7j663hb3svgj5236fihjr0cz";
"8.12.1".sha256 = "1rkcyjjrzcqw9xk93hsq0vvji4f8r5iq0f739mghk60bghkpnb7q"; "8.12.1".sha256 = "1rkcyjjrzcqw9xk93hsq0vvji4f8r5iq0f739mghk60bghkpnb7q";
"8.12.2".sha256 = "18gscfm039pqhq4msq01nraig5dm9ab98bjca94zldf8jvdv0x2n"; "8.12.2".sha256 = "18gscfm039pqhq4msq01nraig5dm9ab98bjca94zldf8jvdv0x2n";
"8.13.0".sha256 = "0sjbqmz6qcvnz0hv87xha80qbhvmmyd675wyc5z4rgr34j2l1ymd"; "8.13.0".sha256 = "1l2c63vskp8kiyxiyi5rpgbmnv67ysn3y4lybd6nj0li5llibifi";
"8.13.1".sha256 = "0xx2ns84mlip9bg2mkahy3pmc5zfcgrjxsviq9yijbzy1r95wf0n"; "8.13.1".sha256 = "15drjcqhsgwqnv02bbidyhk316ypyhz1pxfz2gwsalci9svhkz0v";
"8.13.2".sha256 = "1884vbmwmqwn9ngibax6dhnqh4cc02l0s2ajc6jb1xgr0i60whjk"; "8.13.2".sha256 = "14d4alp35hngvga9m7cfp5d1nl62xdj0nm4811f2jjblk86gxxk4";
"8.14.0".sha256 = "04y2z0qyvag66zanfyc3f9agvmzbn4lsr0p1l7ck6yjhqx7vbm17"; "8.14.0".sha256 = "0yxjx9kq9bfpk31dc1c6a0pz0827fz7jmrcwwd4n7dc07yi0arq8";
"8.14.1".sha256 = "0sx78pgx0qw8v7v2r32zzy3l161zipzq95iacda628girim7psnl"; "8.14.1".sha256 = "0xdqiabgm4lrm6d7lw544zd8xwb1cdcavsxvwwlqq6yid2rl2yli";
"8.15.0".sha256 = "sha256:1ma76wfrpfsl72yh10w1ys2a0vi0mdc2jc79kdc8nrmxkhpw1nxx"; "8.15.0".sha256 = "sha256:0q7jl3bn0d1v9cwdkxykw4frccww6wbh1p8hdrfqw489mkxmh5jh";
"8.15.1".sha256 = "sha256:1dsa04jzkx5pw69pmxn0l55q4w88lg6fvz7clbga0bazzsfnsgd6"; "8.15.1".sha256 = "sha256:1janvmnk3czimp0j5qmnfwx6509vhpjc2q7lcza1bc6dm6kn8n42";
"8.15.2".sha256 = "sha256:0gn8dz69scxnxaq6ycb3x34bjfk9wlp1y2xn8w69kg9fm4b6gkc7"; "8.15.2".sha256 = "sha256:0qibbvzrhsvs6w3zpkhyclndp29jnr6bs9i5skjlpp431jdjjfqd";
"8.16+rc1".sha256 = "sha256-dU+E0Mz7MVntbQIeG9I59ANBaHaXXSrjCRdoqZ5TO60="; "8.16+rc1".sha256 = "sha256-hmZQ6rFIOZJwnAh23nKScJ3Nn+xqDRn5q2Tn82igpYE=";
}; };
releaseRev = v: "V${v}"; releaseRev = v: "V${v}";
fetched = import ../../../../build-support/coq/meta-fetch/default.nix fetched = import ../../../../build-support/coq/meta-fetch/default.nix

View file

@ -5,7 +5,7 @@
# (e.g. due to minor changes in the compression algorithm, or changes # (e.g. due to minor changes in the compression algorithm, or changes
# in timestamps). # in timestamps).
{ lib, fetchurl, unzip }: { lib, fetchurl, unzip, glibcLocalesUtf8 }:
{ # Optionally move the contents of the unpacked tree up one level. { # Optionally move the contents of the unpacked tree up one level.
stripRoot ? true stripRoot ? true
@ -35,7 +35,10 @@ in {
downloadToTemp = true; downloadToTemp = true;
nativeBuildInputs = [ unzip ] ++ nativeBuildInputs; # Have to pull in glibcLocalesUtf8 for unzip in setup-hook.sh to handle
# UTF-8 aware locale:
# https://github.com/NixOS/nixpkgs/issues/176225#issuecomment-1146617263
nativeBuildInputs = [ unzip glibcLocalesUtf8 ] ++ nativeBuildInputs;
postFetch = postFetch =
'' ''

View file

@ -8,7 +8,7 @@ stdenvNoCC.mkDerivation rec {
name = "${pname}-${version}"; name = "${pname}-${version}";
url = url =
"http://language.moe.gov.tw/001/Upload/Files/site_content/M0001/MoeLI-3.0.zip"; "http://language.moe.gov.tw/001/Upload/Files/site_content/M0001/MoeLI-3.0.zip";
sha256 = "0vpmm2qb429npng0aqkafwgs7cjibq8a3f7bbn9hysbm2lndwxwd"; sha256 = "0b4kjdk0h0hx446swi0wzawia0mf16qh9b6v4h4nqg8qx0p2sd3c";
}; };
installPhase = '' installPhase = ''

View file

@ -1,5 +1,11 @@
unpackCmdHooks+=(_tryUnzip) unpackCmdHooks+=(_tryUnzip)
_tryUnzip() { _tryUnzip() {
if ! [[ "$curSrc" =~ \.zip$ ]]; then return 1; fi if ! [[ "$curSrc" =~ \.zip$ ]]; then return 1; fi
unzip -qq "$curSrc"
# UTF-8 locale is needed for unzip on glibc to handle UTF-8 symbols:
# https://github.com/NixOS/nixpkgs/issues/176225#issuecomment-1146617263
# Otherwise unzip unpacks escaped file names as if '-U' options was in effect.
#
# Pick en_US.UTF-8 as most possible to be present on glibc, musl and darwin.
LANG=en_US.UTF-8 unzip -qq "$curSrc"
} }

View file

@ -17599,7 +17599,14 @@ with pkgs;
relibc = callPackage ../development/libraries/relibc { }; relibc = callPackage ../development/libraries/relibc { };
# Only supported on Linux # Only supported on Linux
glibcLocales = if stdenv.hostPlatform.isLinux then callPackage ../development/libraries/glibc/locales.nix { } else null; glibcLocales =
if stdenv.hostPlatform.isLinux
then callPackage ../development/libraries/glibc/locales.nix { }
else null;
glibcLocalesUtf8 =
if stdenv.hostPlatform.isLinux
then callPackage ../development/libraries/glibc/locales.nix { allLocales = false; }
else null;
glibcInfo = callPackage ../development/libraries/glibc/info.nix { }; glibcInfo = callPackage ../development/libraries/glibc/info.nix { };