fetchzip and friends: Set "name" to "source" by default

This makes them produce the same store paths as builtins.fetchgit,
builtins.fetchTarball etc. See
https://github.com/NixOS/nix/commit/65b5f177b5fbb1b0778ede047a13a3cee9c59cfe.

+7 -27
-19
pkgs/build-support/fetchgit/gitrepotoname.nix
··· 1 - { lib }: 2 - 3 - let 4 - inherit (lib) removeSuffix hasPrefix removePrefix splitString stringToCharacters concatMapStrings last elem; 5 - 6 - allowedChars = stringToCharacters "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-._?="; 7 - sanitizeStoreName = s: 8 - let 9 - s' = concatMapStrings (c: if elem c allowedChars then c else "") (stringToCharacters s); 10 - s'' = if hasPrefix "." s' then "_${removePrefix "." s'}" else s'; 11 - in 12 - s''; 13 - in 14 - urlOrRepo: rev: 15 - let 16 - repo' = last (splitString ":" (baseNameOf (removeSuffix ".git" (removeSuffix "/" urlOrRepo)))); 17 - rev' = baseNameOf rev; 18 - in 19 - "${sanitizeStoreName repo'}-${sanitizeStoreName rev'}-src"
···
+2 -1
pkgs/build-support/fetchzip/default.nix
··· 11 stripRoot ? true 12 , url 13 , extraPostFetch ? "" 14 , ... } @ args: 15 16 lib.overrideDerivation (fetchurl ({ 17 - name = args.name or (baseNameOf url); 18 19 recursiveHash = true; 20
··· 11 stripRoot ? true 12 , url 13 , extraPostFetch ? "" 14 + , name ? "source" 15 , ... } @ args: 16 17 lib.overrideDerivation (fetchurl ({ 18 + inherit name; 19 20 recursiveHash = true; 21
+5 -7
pkgs/top-level/all-packages.nix
··· 195 196 fetchzip = callPackage ../build-support/fetchzip { }; 197 198 - gitRepoToName = callPackage ../build-support/fetchgit/gitrepotoname.nix { }; 199 - 200 fetchFromGitHub = { 201 - owner, repo, rev, name ? gitRepoToName repo rev, 202 fetchSubmodules ? false, private ? false, 203 githubBase ? "github.com", varPrefix ? null, 204 ... # For hash agility ··· 231 in fetcher fetcherArgs // { meta.homepage = baseUrl; inherit rev; }; 232 233 fetchFromBitbucket = { 234 - owner, repo, rev, name ? gitRepoToName repo rev, 235 ... # For hash agility 236 }@args: fetchzip ({ 237 inherit name; ··· 242 243 # cgit example, snapshot support is optional in cgit 244 fetchFromSavannah = { 245 - repo, rev, name ? gitRepoToName repo rev, 246 ... # For hash agility 247 }@args: fetchzip ({ 248 inherit name; ··· 252 253 # gitlab example 254 fetchFromGitLab = { 255 - owner, repo, rev, name ? gitRepoToName repo rev, 256 ... # For hash agility 257 }@args: fetchzip ({ 258 inherit name; ··· 262 263 # gitweb example, snapshot support is optional in gitweb 264 fetchFromRepoOrCz = { 265 - repo, rev, name ? gitRepoToName repo rev, 266 ... # For hash agility 267 }@args: fetchzip ({ 268 inherit name;
··· 195 196 fetchzip = callPackage ../build-support/fetchzip { }; 197 198 fetchFromGitHub = { 199 + owner, repo, rev, name ? "source", 200 fetchSubmodules ? false, private ? false, 201 githubBase ? "github.com", varPrefix ? null, 202 ... # For hash agility ··· 229 in fetcher fetcherArgs // { meta.homepage = baseUrl; inherit rev; }; 230 231 fetchFromBitbucket = { 232 + owner, repo, rev, name ? "source", 233 ... # For hash agility 234 }@args: fetchzip ({ 235 inherit name; ··· 240 241 # cgit example, snapshot support is optional in cgit 242 fetchFromSavannah = { 243 + repo, rev, name ? "source", 244 ... # For hash agility 245 }@args: fetchzip ({ 246 inherit name; ··· 250 251 # gitlab example 252 fetchFromGitLab = { 253 + owner, repo, rev, name ? "source", 254 ... # For hash agility 255 }@args: fetchzip ({ 256 inherit name; ··· 260 261 # gitweb example, snapshot support is optional in gitweb 262 fetchFromRepoOrCz = { 263 + repo, rev, name ? "source", 264 ... # For hash agility 265 }@args: fetchzip ({ 266 inherit name;