From e7ef33c50a80f2382e62a039060894efd189ecc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Mon, 25 Jul 2016 22:48:51 +0200 Subject: [PATCH] git: fix gitweb.cgi breakage due to missing CGI.pm CGI.pm was removed from Perl core in v5.22, breaking the gitweb.cgi script and thus NixOS' services.lighttpd.gitweb. Nixpkgs switched to Perl 5.22 with a85ba820a409c84d97ca0 ("perl: Make 5.22 the default"). Fix it by bringing in the Perl CGI module (and dependency HTMLParser). The closure size of "nix-build -A git" increase by 1 MiB, to 201 MiB. --- .../version-management/git-and-tools/default.nix | 1 + .../version-management/git-and-tools/git/default.nix | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix index 54b51f010f47..9296ad80ca24 100644 --- a/pkgs/applications/version-management/git-and-tools/default.nix +++ b/pkgs/applications/version-management/git-and-tools/default.nix @@ -15,6 +15,7 @@ let perlPackages.MIMEBase64 perlPackages.AuthenSASL perlPackages.DigestHMAC ]; + gitwebPerlLibs = with perlPackages; [ CGI HTMLParser ]; }; in diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix index fa40f1a49a27..badce5b00f83 100644 --- a/pkgs/applications/version-management/git-and-tools/git/default.nix +++ b/pkgs/applications/version-management/git-and-tools/git/default.nix @@ -2,7 +2,7 @@ , gnugrep, gzip, openssh , asciidoc, texinfo, xmlto, docbook2x, docbook_xsl, docbook_xml_dtd_45 , libxslt, tcl, tk, makeWrapper, libiconv -, svnSupport, subversionClient, perlLibs, smtpPerlLibs +, svnSupport, subversionClient, perlLibs, smtpPerlLibs, gitwebPerlLibs , guiSupport , withManual ? true , pythonSupport ? true @@ -102,6 +102,11 @@ stdenv.mkDerivation { # gitweb.cgi, need to patch so that it's found sed -i -e "s|'compressor' => \['gzip'|'compressor' => ['${gzip}/bin/gzip'|" \ $out/share/gitweb/gitweb.cgi + # Give access to CGI.pm and friends (was removed from perl core in 5.22) + for p in ${stdenv.lib.concatStringsSep " " gitwebPerlLibs}; do + sed -i -e "/use CGI /i use lib \"$p/lib/perl5/site_perl\";" \ + "$out/share/gitweb/gitweb.cgi" + done # Also put git-http-backend into $PATH, so that we can use smart # HTTP(s) transports for pushing