fetchgit{,hub,lab}: passthru `rev` based on `tag` (#369506)

authored by Atemu and committed by GitHub c74c7dfd 4f8d7631

+9 -7
+1
pkgs/build-support/fetchgit/default.nix
··· 120 121 passthru = { 122 gitRepoUrl = url; 123 }; 124 } 125 ))
··· 120 121 passthru = { 122 gitRepoUrl = url; 123 + inherit tag; 124 }; 125 } 126 ))
+4 -2
pkgs/build-support/fetchgithub/default.nix
··· 59 60 gitRepoUrl = "${baseUrl}.git"; 61 62 fetcherArgs = (if useFetchGit 63 then { 64 inherit tag rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl; 65 } // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; } 66 else { 67 - url = "${baseUrl}/archive/${if tag != null then "refs/tags/${tag}" else rev}.tar.gz"; 68 69 passthru = { 70 inherit gitRepoUrl; ··· 73 ) // privateAttrs // passthruAttrs // { inherit name; }; 74 in 75 76 - fetcher fetcherArgs // { meta = newMeta; inherit rev owner repo tag; } 77 )
··· 59 60 gitRepoUrl = "${baseUrl}.git"; 61 62 + revWithTag = if tag != null then "refs/tags/${tag}" else rev; 63 + 64 fetcherArgs = (if useFetchGit 65 then { 66 inherit tag rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl; 67 } // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; } 68 else { 69 + url = "${baseUrl}/archive/${revWithTag}.tar.gz"; 70 71 passthru = { 72 inherit gitRepoUrl; ··· 75 ) // privateAttrs // passthruAttrs // { inherit name; }; 76 in 77 78 + fetcher fetcherArgs // { meta = newMeta; inherit owner repo tag; rev = revWithTag; } 79 )
+4 -5
pkgs/build-support/fetchgitlab/default.nix
··· 37 repo 38 ] 39 ); 40 escapedSlug = lib.replaceStrings [ "." "/" ] [ "%2E" "%2F" ] slug; 41 - escapedRev = lib.replaceStrings [ "+" "%" "/" ] [ "%2B" "%25" "%2F" ] ( 42 - if tag != null then "refs/tags/" + tag else rev 43 - ); 44 passthruAttrs = removeAttrs args [ 45 "protocol" 46 "domain" ··· 77 } 78 else 79 { 80 - url = "${protocol}://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${escapedRev}"; 81 82 passthru = { 83 inherit gitRepoUrl; ··· 95 meta.homepage = "${protocol}://${domain}/${slug}/"; 96 inherit 97 tag 98 - rev 99 owner 100 repo 101 ; 102 } 103 )
··· 37 repo 38 ] 39 ); 40 + revWithTag = if tag != null then "refs/tags/" + tag else rev; 41 escapedSlug = lib.replaceStrings [ "." "/" ] [ "%2E" "%2F" ] slug; 42 + escapedRevWithTag = lib.replaceStrings [ "+" "%" "/" ] [ "%2B" "%25" "%2F" ] revWithTag; 43 passthruAttrs = removeAttrs args [ 44 "protocol" 45 "domain" ··· 76 } 77 else 78 { 79 + url = "${protocol}://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${escapedRevWithTag}"; 80 81 passthru = { 82 inherit gitRepoUrl; ··· 94 meta.homepage = "${protocol}://${domain}/${slug}/"; 95 inherit 96 tag 97 owner 98 repo 99 ; 100 + rev = revWithTag; 101 } 102 )