gnu: Add 'git-minimal'.
authorLudovic Courtès <ludo@gnu.org>
Mon, 26 Nov 2018 09:35:41 +0000 (10:35 +0100)
committerLudovic Courtès <ludo@gnu.org>
Mon, 26 Nov 2018 10:10:19 +0000 (11:10 +0100)
* gnu/packages/version-control.scm (git-minimal): New variable.

gnu/packages/version-control.scm

index ecd5789..cec3e5f 100644 (file)
@@ -457,6 +457,70 @@ everything from small to very large projects with speed and efficiency.")
    (license license:gpl2)
    (home-page "https://git-scm.com/")))
 
+(define-public git-minimal
+  ;; The size of the closure of 'git-minimal' is two thirds that of 'git'.
+  ;; Its test suite runs slightly faster and most importantly it doesn't
+  ;; depend on packages that are expensive to build such as Subversion.
+  (package
+    (inherit git)
+    (name "git-minimal")
+    (arguments
+     (substitute-keyword-arguments (package-arguments git)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'patch-makefiles
+             (lambda _
+               (substitute* "Makefile"
+                 (("/usr/bin/perl") (which "perl")))
+               #t))
+           (delete 'build-subtree)
+           (delete 'split)
+           (delete 'install-man-pages)
+           (delete 'install-subtree)
+           (delete 'install-credential-netrc)
+           (add-before 'check 'delete-svn-test
+             (lambda _
+               ;; This test cannot run since we are not building 'git-svn'.
+               (delete-file "t/t9020-remote-svn.sh")
+               #t))
+           (add-after 'install 'remove-unusable-perl-commands
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out     (assoc-ref outputs "out"))
+                      (bin     (string-append out "/bin"))
+                      (libexec (string-append out "/libexec")))
+                 (for-each (lambda (file)
+                             (delete-file (string-append libexec
+                                                         "/git-core/" file)))
+                           '("git-svn" "git-cvsimport" "git-archimport"
+                             "git-cvsserver" "git-request-pull"
+                             "git-add--interactive" "git-cvsexportcommit"
+                             "git-instaweb" "git-send-email"))
+                 (delete-file (string-append bin "/git-cvsserver"))
+
+                 ;; These templates typically depend on Perl.  Remove them.
+                 (delete-file-recursively
+                  (string-append out "/share/git-core/templates/hooks"))
+
+                 ;; Gitweb depends on Perl as well.
+                 (delete-file-recursively
+                  (string-append out "/share/gitweb"))
+                 #t)))))
+       ((#:configure-flags flags)
+        ''())
+       ((#:disallowed-references lst '())
+        `(,perl ,@lst))))
+    (outputs '("out"))
+    (native-inputs
+     `(("native-perl" ,perl)
+       ("gettext" ,gettext-minimal)))
+    (inputs
+     `(("curl" ,curl)                             ;for HTTP(S) access
+       ("expat" ,expat)                           ;for 'git push' over HTTP(S)
+       ("openssl" ,openssl)
+       ("perl" ,perl)
+       ("zlib" ,zlib)
+       ("bash-for-tests" ,bash)))))
+
 (define-public libgit2
   (package
     (name "libgit2")