gitRepo: Add import to ssl module to avoid runtime error (#125373)

Co-authored-by: Ricardo M. Correia <rcorreia@wizy.org>

authored by

Otavio Salvador
Ricardo M. Correia
and committed by
GitHub
8f166b95 e6e137c1

+34 -3
+6 -3
pkgs/applications/version-management/git-repo/default.nix
··· 1 { lib, stdenv, fetchFromGitHub, makeWrapper, nix-update-script 2 - , python3, git, gnupg, less 3 }: 4 5 stdenv.mkDerivation rec { ··· 10 owner = "android"; 11 repo = "tools_repo"; 12 rev = "v${version}"; 13 - sha256 = "sha256-3FSkWpHda1jVhy/633B+ippWcbKd83IlQcJYS9Qx5wQ="; 14 }; 15 16 nativeBuildInputs = [ makeWrapper ]; 17 buildInputs = [ python3 ]; ··· 34 # Important runtime dependencies 35 postFixup = '' 36 wrapProgram $out/bin/repo --prefix PATH ":" \ 37 - "${lib.makeBinPath [ git gnupg less ]}" 38 ''; 39 40 passthru = {
··· 1 { lib, stdenv, fetchFromGitHub, makeWrapper, nix-update-script 2 + , python3, git, gnupg, less, openssh 3 }: 4 5 stdenv.mkDerivation rec { ··· 10 owner = "android"; 11 repo = "tools_repo"; 12 rev = "v${version}"; 13 + sha256 = "sha256-SuHp6C5ueUErvRiWDQNEmCybFIa7Iu7C/FtnHys9XqU="; 14 }; 15 + 16 + # Fix 'NameError: name 'ssl' is not defined' 17 + patches = [ ./import-ssl-module.patch ]; 18 19 nativeBuildInputs = [ makeWrapper ]; 20 buildInputs = [ python3 ]; ··· 37 # Important runtime dependencies 38 postFixup = '' 39 wrapProgram $out/bin/repo --prefix PATH ":" \ 40 + "${lib.makeBinPath [ git gnupg less openssh ]}" 41 ''; 42 43 passthru = {
+28
pkgs/applications/version-management/git-repo/import-ssl-module.patch
···
··· 1 + Fix runtime error due missing import 2 + 3 + Traceback (most recent call last): 4 + File "/nix/store/4qqhr7g9ri3n7v6ik9ahlpvyp18wcn4p-git-repo-2.15.3/bin/.repo-wrapped", line 1339, in <module> 5 + main(sys.argv[1:]) 6 + File "/nix/store/4qqhr7g9ri3n7v6ik9ahlpvyp18wcn4p-git-repo-2.15.3/bin/.repo-wrapped", line 1304, in main 7 + _Init(args, gitc_init=(cmd == 'gitc-init')) 8 + File "/nix/store/4qqhr7g9ri3n7v6ik9ahlpvyp18wcn4p-git-repo-2.15.3/bin/.repo-wrapped", line 607, in _Init 9 + _Clone(url, dst, opt.clone_bundle, opt.quiet, opt.verbose) 10 + File "/nix/store/4qqhr7g9ri3n7v6ik9ahlpvyp18wcn4p-git-repo-2.15.3/bin/.repo-wrapped", line 912, in _Clone 11 + if clone_bundle and _DownloadBundle(url, cwd, quiet, verbose): 12 + File "/nix/store/4qqhr7g9ri3n7v6ik9ahlpvyp18wcn4p-git-repo-2.15.3/bin/.repo-wrapped", line 860, in _DownloadBundle 13 + r = urllib.request.urlopen(url, context=ssl.create_default_context()) 14 + NameError: name 'ssl' is not defined 15 + builder for '/nix/store/4hvds8fv8xmzlm86yg9cf1lj6hrya7sg-amdvlk-src.drv' failed with exit code 1 16 + 17 + diff --git a/repo b/repo 18 + index 8b05def..f394b3e 100755 19 + --- a/repo 20 + +++ b/repo 21 + @@ -236,6 +236,7 @@ import optparse 22 + import re 23 + import shutil 24 + import stat 25 + +import ssl 26 + 27 + if sys.version_info[0] == 3: 28 + import urllib.request