*/*: Discontinue Gentoo SuperH port
[gentoo.git] / dev-vcs / git / git-2.26.0.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 GENTOO_DEPEND_ON_PERL=no
7
8 # bug #329479: git-remote-testgit is not multiple-version aware
9 PYTHON_COMPAT=( python{2_7,3_{6,7}} )
10
11 inherit toolchain-funcs elisp-common l10n perl-module bash-completion-r1 python-single-r1 systemd
12
13 PLOCALES="bg ca de es fr is it ko pt_PT ru sv vi zh_CN"
14 if [[ ${PV} == *9999 ]]; then
15         inherit git-r3
16         EGIT_REPO_URI="git://git.kernel.org/pub/scm/git/git.git"
17         # Please ensure that all _four_ 9999 ebuilds get updated; they track the 4 upstream branches.
18         # See https://git-scm.com/docs/gitworkflows#_graduation
19         # In order of stability:
20         # 9999-r0: maint
21         # 9999-r1: master
22         # 9999-r2: next
23         # 9999-r3: pu
24         case "${PVR}" in
25                 9999) EGIT_BRANCH=maint ;;
26                 9999-r1) EGIT_BRANCH=master ;;
27                 9999-r2) EGIT_BRANCH=next;;
28                 9999-r3) EGIT_BRANCH=pu ;;
29         esac
30 fi
31
32 MY_PV="${PV/_rc/.rc}"
33 MY_P="${PN}-${MY_PV}"
34
35 DOC_VER="${MY_PV}"
36
37 DESCRIPTION="stupid content tracker: distributed VCS designed for speed and efficiency"
38 HOMEPAGE="https://www.git-scm.com/"
39 if [[ ${PV} != *9999 ]]; then
40         SRC_URI_SUFFIX="xz"
41         SRC_URI_KORG="https://www.kernel.org/pub/software/scm/git"
42         [[ "${PV/rc}" != "${PV}" ]] && SRC_URI_KORG+='/testing'
43         SRC_URI="${SRC_URI_KORG}/${MY_P}.tar.${SRC_URI_SUFFIX}
44                         ${SRC_URI_KORG}/${PN}-manpages-${DOC_VER}.tar.${SRC_URI_SUFFIX}
45                         doc? (
46                         ${SRC_URI_KORG}/${PN}-htmldocs-${DOC_VER}.tar.${SRC_URI_SUFFIX}
47                         )"
48         [[ "${PV}" == *_rc* ]] || \
49         KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
50 fi
51
52 LICENSE="GPL-2"
53 SLOT="0"
54 IUSE="+blksha1 +curl cgi doc emacs gnome-keyring +gpg highlight +iconv libressl mediawiki mediawiki-experimental +nls +pcre +pcre-jit perforce +perl +ppcsha1 tk +threads +webdav xinetd cvs subversion test"
55
56 # Common to both DEPEND and RDEPEND
57 DEPEND="
58         gnome-keyring? ( app-crypt/libsecret )
59         !libressl? ( dev-libs/openssl:0= )
60         libressl? ( dev-libs/libressl:= )
61         sys-libs/zlib
62         pcre? (
63                 pcre-jit? ( dev-libs/libpcre2[jit(+)] )
64                 !pcre-jit? ( dev-libs/libpcre )
65         )
66         perl? ( dev-lang/perl:=[-build(-)] )
67         tk? ( dev-lang/tk:0= )
68         curl? (
69                 net-misc/curl
70                 webdav? ( dev-libs/expat )
71         )
72         emacs? ( >=app-editors/emacs-23.1:* )
73         iconv? ( virtual/libiconv )
74 "
75
76 RDEPEND="${DEPEND}
77         gpg? ( app-crypt/gnupg )
78         perl? (
79                 dev-perl/Error
80                 dev-perl/MailTools
81                 dev-perl/Authen-SASL
82                 cgi? (
83                         dev-perl/CGI
84                         highlight? ( app-text/highlight )
85                 )
86                 cvs? (
87                         >=dev-vcs/cvsps-2.1:0
88                         dev-perl/DBI
89                         dev-perl/DBD-SQLite
90                 )
91                 mediawiki? (
92                         dev-perl/DateTime-Format-ISO8601
93                         dev-perl/HTML-Tree
94                         dev-perl/MediaWiki-API
95                 )
96                 subversion? (
97                         dev-vcs/subversion[-dso,perl]
98                         dev-perl/libwww-perl
99                         dev-perl/TermReadKey
100                 )
101         )
102         perforce? ( ${PYTHON_DEPS} )
103 "
104
105 # This is how info docs are created with Git:
106 #   .txt/asciidoc --(asciidoc)---------> .xml/docbook
107 #   .xml/docbook  --(docbook2texi.pl)--> .texi
108 #   .texi         --(makeinfo)---------> .info
109 BDEPEND="
110         doc? (
111                 app-text/asciidoc
112                 app-text/docbook2X
113                 app-text/xmlto
114                 sys-apps/texinfo
115         )
116         nls? ( sys-devel/gettext )
117         test? ( app-crypt/gnupg )
118 "
119
120 # Live ebuild builds man pages and HTML docs, additionally
121 if [[ ${PV} == *9999 ]]; then
122         BDEPEND="${BDEPEND}
123                 app-text/asciidoc"
124 fi
125
126 SITEFILE="50${PN}-gentoo.el"
127 S="${WORKDIR}/${MY_P}"
128
129 REQUIRED_USE="
130         cgi? ( perl )
131         cvs? ( perl )
132         mediawiki? ( perl )
133         mediawiki-experimental? ( mediawiki )
134         subversion? ( perl )
135         webdav? ( curl )
136         pcre-jit? ( pcre )
137         perforce? ( ${PYTHON_REQUIRED_USE} )
138 "
139
140 RESTRICT="!test? ( test )"
141
142 PATCHES=(
143         # bug #350330 - automagic CVS when we don't want it is bad.
144         "${FILESDIR}"/git-2.22.0_rc0-optional-cvs.patch
145
146         "${FILESDIR}"/git-2.2.0-svn-fe-linking.patch
147
148         # Make submodule output quiet
149         "${FILESDIR}"/git-2.21.0-quiet-submodules-testcase.patch
150 )
151
152 pkg_setup() {
153         if use subversion && has_version "dev-vcs/subversion[dso]"; then
154                 ewarn "Per Gentoo bugs #223747, #238586, when subversion is built"
155                 ewarn "with USE=dso, there may be weird crashes in git-svn. You"
156                 ewarn "have been warned."
157         fi
158         if use perforce ; then
159                 python-single-r1_pkg_setup
160         fi
161 }
162
163 # This is needed because for some obscure reasons future calls to make don't
164 # pick up these exports if we export them in src_unpack()
165 exportmakeopts() {
166         local extlibs myopts
167
168         myopts=(
169                 ASCIIDOC_NO_ROFF=YesPlease
170                 $(usex cvs '' NO_CVS=YesPlease)
171                 $(usex elibc_musl NO_REGEX=YesPlease '')
172                 $(usex iconv '' NO_ICONV=YesPlease)
173                 $(usex nls '' NO_GETTEXT=YesPlease)
174                 $(usex perl 'INSTALLDIRS=vendor NO_PERL_CPAN_FALLBACKS=YesPlease' NO_PERL=YesPlease)
175                 $(usex perforce '' NO_PYTHON=YesPlease)
176                 $(usex subversion '' NO_SVN_TESTS=YesPlease)
177                 $(usex threads '' NO_PTHREAD=YesPlease)
178                 $(usex tk '' NO_TCLTK=YesPlease)
179         )
180
181         if use blksha1 ; then
182                 myopts+=( BLK_SHA1=YesPlease )
183         elif use ppcsha1 ; then
184                 myopts+=( PPC_SHA1=YesPlease )
185         fi
186
187         if use curl ; then
188                 use webdav || myopts+=( NO_EXPAT=YesPlease )
189         else
190                 myopts+=( NO_CURL=YesPlease )
191         fi
192
193         # broken assumptions, because of static build system ...
194         myopts+=(
195                 NO_FINK=YesPlease
196                 NO_DARWIN_PORTS=YesPlease
197                 INSTALL=install
198                 TAR=tar
199                 SHELL_PATH="${EPREFIX}/bin/sh"
200                 SANE_TOOL_PATH=
201                 OLD_ICONV=
202                 NO_EXTERNAL_GREP=
203         )
204
205         # For svn-fe
206         extlibs=( -lz -lssl ${S}/xdiff/lib.a $(usex threads -lpthread '') )
207
208         # can't define this to null, since the entire makefile depends on it
209         sed -i -e '/\/usr\/local/s/BASIC_/#BASIC_/' Makefile || die
210
211         if use pcre; then
212                 if use pcre-jit; then
213                         myopts+=( USE_LIBPCRE2=YesPlease )
214                         extlibs+=( -lpcre2-8 )
215                 else
216                         myopts+=(
217                                 USE_LIBPCRE1=YesPlease
218                                 NO_LIBPCRE1_JIT=YesPlease
219                         )
220                         extlibs+=( -lpcre )
221                 fi
222         fi
223 # Disabled until ~m68k-mint can be keyworded again
224 #       if [[ ${CHOST} == *-mint* ]] ; then
225 #               myopts+=(
226 #                       NO_MMAP=YesPlease
227 #                       NO_IPV6=YesPlease
228 #                       NO_STRLCPY=YesPlease
229 #                       NO_MEMMEM=YesPlease
230 #                       NO_MKDTEMP=YesPlease
231 #                       NO_MKSTEMPS=YesPlease
232 #               )
233 #       fi
234         if [[ ${CHOST} == ia64-*-hpux* ]]; then
235                 myopts+=( NO_NSEC=YesPlease )
236         fi
237         if [[ ${CHOST} == *-*-aix* ]]; then
238                 myopts+=( NO_FNMATCH_CASEFOLD=YesPlease )
239         fi
240         if [[ ${CHOST} == *-solaris* ]]; then
241                 myopts+=(
242                         NEEDS_LIBICONV=YesPlease
243                         HAVE_CLOCK_MONOTONIC=1
244                 )
245                 if grep -q getdelim "${EROOT}"/usr/include/stdio.h ; then
246                         myopts+=( HAVE_GETDELIM=1 )
247                 fi
248         fi
249
250         if has_version '>=app-text/asciidoc-8.0' ; then
251                 myopts+=( ASCIIDOC8=YesPlease )
252         fi
253
254         # Bug 290465:
255         # builtin-fetch-pack.c:816: error: 'struct stat' has no member named 'st_mtim'
256         if [[ "${CHOST}" == *-uclibc* ]] ; then
257                 myopts+=( NO_NSEC=YesPlease )
258                 use iconv && myopts+=( NEEDS_LIBICONV=YesPlease )
259         fi
260
261         export MY_MAKEOPTS="${myopts[@]}"
262         export EXTLIBS="${extlibs[@]}"
263 }
264
265 src_unpack() {
266         if [[ ${PV} != *9999 ]]; then
267                 unpack ${MY_P}.tar.${SRC_URI_SUFFIX}
268                 cd "${S}" || die
269                 unpack ${PN}-manpages-${DOC_VER}.tar.${SRC_URI_SUFFIX}
270                 if use doc ; then
271                         pushd "${S}"/Documentation &>/dev/null || die
272                         unpack ${PN}-htmldocs-${DOC_VER}.tar.${SRC_URI_SUFFIX}
273                         popd &>/dev/null || die
274                 fi
275         else
276                 git-r3_src_unpack
277                 #cp "${FILESDIR}"/GIT-VERSION-GEN .
278         fi
279
280 }
281
282 src_prepare() {
283         # add experimental patches to improve mediawiki support
284         # see patches for origin
285         if use mediawiki-experimental ; then
286                 PATCHES+=(
287                         "${FILESDIR}"/git-2.7.0-mediawiki-namespaces.patch
288                         "${FILESDIR}"/git-2.7.0-mediawiki-subpages.patch
289                         "${FILESDIR}"/git-2.7.0-mediawiki-500pages.patch
290                 )
291         fi
292
293         default
294
295         sed -i \
296                 -e 's:^\(CFLAGS[[:space:]]*=\).*$:\1 $(OPTCFLAGS) -Wall:' \
297                 -e 's:^\(LDFLAGS[[:space:]]*=\).*$:\1 $(OPTLDFLAGS):' \
298                 -e 's:^\(CC[[:space:]]* =\).*$:\1$(OPTCC):' \
299                 -e 's:^\(AR[[:space:]]* =\).*$:\1$(OPTAR):' \
300                 -e "s:\(PYTHON_PATH[[:space:]]\+=[[:space:]]\+\)\(.*\)$:\1${EPREFIX}\2:" \
301                 -e "s:\(PERL_PATH[[:space:]]\+=[[:space:]]\+\)\(.*\)$:\1${EPREFIX}\2:" \
302                 Makefile contrib/svn-fe/Makefile || die
303
304         # Fix docbook2texi command
305         sed -r -i 's/DOCBOOK2X_TEXI[[:space:]]*=[[:space:]]*docbook2x-texi/DOCBOOK2X_TEXI = docbook2texi.pl/' \
306                 Documentation/Makefile || die
307 }
308
309 git_emake() {
310         # bug #320647: PYTHON_PATH
311         local PYTHON_PATH=""
312         use perforce && PYTHON_PATH="${PYTHON}"
313         emake ${MY_MAKEOPTS} \
314                 prefix="${EPREFIX}"/usr \
315                 htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
316                 perllibdir="$(use perl && perl_get_raw_vendorlib)" \
317                 sysconfdir="${EPREFIX}"/etc \
318                 DESTDIR="${D}" \
319                 GIT_TEST_OPTS="--no-color" \
320                 OPTAR="$(tc-getAR)" \
321                 OPTCC="$(tc-getCC)" \
322                 OPTCFLAGS="${CFLAGS}" \
323                 OPTLDFLAGS="${LDFLAGS}" \
324                 PERL_PATH="${EPREFIX}/usr/bin/perl" \
325                 PERL_MM_OPT="" \
326                 PYTHON_PATH="${PYTHON_PATH}" \
327                 V=1 \
328                 "$@"
329 }
330
331 src_configure() {
332         exportmakeopts
333 }
334
335 src_compile() {
336         git_emake || die "emake failed"
337
338         if use emacs ; then
339                 elisp-compile contrib/emacs/git{,-blame}.el
340         fi
341
342         if use perl && use cgi ; then
343                 git_emake \
344                         gitweb \
345                         || die "emake gitweb (cgi) failed"
346         fi
347
348         if [[ ${CHOST} == *-darwin* ]]; then
349                 pushd contrib/credential/osxkeychain &>/dev/null || die
350                 git_emake CC=$(tc-getCC) CFLAGS="${CFLAGS}" \
351                         || die "emake credential-osxkeychain"
352                 popd &>/dev/null || die
353         fi
354
355         pushd Documentation &>/dev/null || die
356         if [[ ${PV} == *9999 ]] ; then
357                 git_emake man \
358                         || die "emake man failed"
359                 if use doc ; then
360                         git_emake info html \
361                                 || die "emake info html failed"
362                 fi
363         else
364                 if use doc ; then
365                         git_emake info \
366                                 || die "emake info html failed"
367                 fi
368         fi
369         popd &>/dev/null || die
370
371         if use subversion ; then
372                 pushd contrib/svn-fe &>/dev/null || die
373                 # by defining EXTLIBS we override the detection for libintl and
374                 # libiconv, bug #516168
375                 local nlsiconv=()
376                 use nls && use !elibc_glibc && nlsiconv+=( -lintl )
377                 use iconv && use !elibc_glibc && nlsiconv+=( -liconv )
378                 git_emake EXTLIBS="${EXTLIBS} ${nlsiconv[@]}" \
379                         || die "emake svn-fe failed"
380                 if use doc ; then
381                         # svn-fe.1 requires the full USE=doc dependency stack
382                         git_emake svn-fe.1 \
383                                 || die "emake svn-fe.1 failed"
384                         git_emake svn-fe.html \
385                                 || die "svn-fe.html failed"
386                 fi
387                 popd &>/dev/null || die
388         fi
389
390         if use gnome-keyring ; then
391                 pushd contrib/credential/libsecret &>/dev/null || die
392                 git_emake || die "emake git-credential-libsecret failed"
393                 popd &>/dev/null || die
394         fi
395
396         pushd contrib/subtree &>/dev/null || die
397         git_emake git-subtree
398         # git-subtree.1 requires the full USE=doc dependency stack
399         use doc && git_emake git-subtree.html git-subtree.1
400         popd &>/dev/null || die
401
402         pushd contrib/diff-highlight &>/dev/null || die
403         git_emake
404         popd &>/dev/null || die
405
406         if use mediawiki ; then
407                 pushd contrib/mw-to-git &>/dev/null || die
408                 git_emake
409                 popd &>/dev/null || die
410
411         fi
412 }
413
414 src_install() {
415         git_emake install || die "make install failed"
416
417         if [[ ${CHOST} == *-darwin* ]]; then
418                 dobin contrib/credential/osxkeychain/git-credential-osxkeychain
419         fi
420
421         # Depending on the tarball and manual rebuild of the documentation, the
422         # manpages may exist in either OR both of these directories.
423         find man?/*.[157] >/dev/null 2>&1 && doman man?/*.[157]
424         find Documentation/*.[157] >/dev/null 2>&1 && doman Documentation/*.[157]
425         dodoc README* Documentation/{SubmittingPatches,CodingGuidelines}
426         use doc && dodir /usr/share/doc/${PF}/html
427         local d
428         for d in / /howto/ /technical/ ; do
429                 docinto ${d}
430                 dodoc Documentation${d}*.txt
431                 if use doc ; then
432                         docinto ${d}/html
433                         dodoc Documentation${d}*.html
434                 fi
435         done
436         docinto /
437         # Upstream does not ship this pre-built :-(
438         use doc && doinfo Documentation/{git,gitman}.info
439
440         newbashcomp contrib/completion/git-completion.bash ${PN}
441         bashcomp_alias git gitk
442         # Not really a bash-completion file (bug #477920)
443         # but still needed uncompressed (bug #507480)
444         insinto /usr/share/${PN}
445         doins contrib/completion/git-prompt.sh
446
447         if use emacs ; then
448                 elisp-install ${PN} contrib/emacs/git.{el,elc}
449                 elisp-install ${PN} contrib/emacs/git-blame.{el,elc}
450                 #elisp-install ${PN}/compat contrib/emacs/vc-git.{el,elc}
451                 # don't add automatically to the load-path, so the sitefile
452                 # can do a conditional loading
453                 touch "${ED}${SITELISP}/${PN}/compat/.nosearch"
454                 elisp-site-file-install "${FILESDIR}"/${SITEFILE}
455         fi
456
457         #dobin contrib/fast-import/git-p4 # Moved upstream
458         #dodoc contrib/fast-import/git-p4.txt # Moved upstream
459         newbin contrib/fast-import/import-tars.perl import-tars
460         exeinto /usr/libexec/git-core/
461         newexe contrib/git-resurrect.sh git-resurrect
462
463         # git-subtree
464         pushd contrib/subtree &>/dev/null || die
465         git_emake install || die "Failed to emake install for git-subtree"
466         if use doc ; then
467                 # Do not move git subtree install-man outside USE=doc!
468                 git_emake install-man install-html || die "Failed to emake install-html install-man for git-subtree"
469         fi
470         newdoc README README.git-subtree
471         dodoc git-subtree.txt
472         popd &>/dev/null || die
473
474         if use mediawiki ; then
475                 pushd contrib/mw-to-git &>/dev/null || die
476                 git_emake install
477                 popd &>/dev/null || die
478         fi
479
480         # diff-highlight
481         dobin contrib/diff-highlight/diff-highlight
482         newdoc contrib/diff-highlight/README README.diff-highlight
483
484         # git-jump
485         exeinto /usr/libexec/git-core/
486         doexe contrib/git-jump/git-jump
487         newdoc contrib/git-jump/README git-jump.txt
488
489         # git-contacts
490         exeinto /usr/libexec/git-core/
491         doexe contrib/contacts/git-contacts
492         dodoc contrib/contacts/git-contacts.txt
493
494         if use gnome-keyring ; then
495                 pushd contrib/credential/libsecret &>/dev/null || die
496                 dobin git-credential-libsecret
497                 popd &>/dev/null || die
498         fi
499
500         if use subversion ; then
501                 pushd contrib/svn-fe &>/dev/null || die
502                 dobin svn-fe
503                 dodoc svn-fe.txt
504                 if use doc ; then
505                         # Do not move svn-fe.1 outside USE=doc!
506                         doman svn-fe.1
507                         docinto html
508                         dodoc svn-fe.html
509                 fi
510                 popd &>/dev/null || die
511         fi
512
513         dodir /usr/share/${PN}/contrib
514         # The following are excluded:
515         # completion - installed above
516         # diff-highlight - done above
517         # emacs - installed above
518         # examples - these are stuff that is not used in Git anymore actually
519         # git-jump - done above
520         # gitview - installed above
521         # p4import - excluded because fast-import has a better one
522         # patches - stuff the Git guys made to go upstream to other places
523         # persistent-https - TODO
524         # mw-to-git - TODO
525         # subtree - build  seperately
526         # svnimport - use git-svn
527         # thunderbird-patch-inline - fixes thunderbird
528         local contrib_objects=(
529                 buildsystems
530                 fast-import
531                 hg-to-git
532                 hooks
533                 remotes2config.sh
534                 rerere-train.sh
535                 stats
536                 workdir
537         )
538         local i
539         for i in "${contrib_objects[@]}" ; do
540                 cp -rf \
541                         "${S}"/contrib/${i} \
542                         "${ED}"/usr/share/${PN}/contrib \
543                         || die "Failed contrib ${i}"
544         done
545
546         if use perl && use cgi ; then
547                 # We used to install in /usr/share/${PN}/gitweb
548                 # but upstream installs in /usr/share/gitweb
549                 # so we will install a symlink and use their location for compat with other
550                 # distros
551                 dosym ../gitweb /usr/share/${PN}/gitweb
552
553                 # INSTALL discusses configuration issues, not just installation
554                 docinto /
555                 newdoc  "${S}"/gitweb/INSTALL INSTALL.gitweb
556                 newdoc  "${S}"/gitweb/README README.gitweb
557
558                 for d in "${ED}"/usr/lib{,64}/perl5/ ; do
559                         if test -d "${d}" ; then find "${d}" \
560                                 -name .packlist \
561                                 -delete || die
562                         fi
563                 done
564         else
565                 rm -rf "${ED}"/usr/share/gitweb
566         fi
567
568         if ! use subversion ; then
569                 rm -f "${ED}"/usr/libexec/git-core/git-svn \
570                         "${ED}"/usr/share/man/man1/git-svn.1*
571         fi
572
573         if use xinetd ; then
574                 insinto /etc/xinetd.d
575                 newins "${FILESDIR}"/git-daemon.xinetd git-daemon
576         fi
577
578         if use !prefix ; then
579                 newinitd "${FILESDIR}"/git-daemon-r1.initd git-daemon
580                 newconfd "${FILESDIR}"/git-daemon.confd git-daemon
581                 systemd_newunit "${FILESDIR}/git-daemon_at-r1.service" "git-daemon@.service"
582                 systemd_dounit "${FILESDIR}/git-daemon.socket"
583         fi
584
585         perl_delete_localpod
586
587         # Remove disabled linguas
588         # we could remove sources in src_prepare, but install does not
589         # handle missing locale dir well
590         rm_loc() {
591                 if [[ -e "${ED}/usr/share/locale/${1}" ]]; then
592                         rm -r "${ED}/usr/share/locale/${1}" || die
593                 fi
594         }
595         l10n_for_each_disabled_locale_do rm_loc
596 }
597
598 src_test() {
599         local disabled=()
600         local tests_cvs=(
601                 t9200-git-cvsexportcommit.sh
602                 t9400-git-cvsserver-server.sh
603                 t9401-git-cvsserver-crlf.sh
604                 t9402-git-cvsserver-refs.sh
605                 t9600-cvsimport.sh
606                 t9601-cvsimport-vendor-branch.sh
607                 t9602-cvsimport-branches-tags.sh
608                 t9603-cvsimport-patchsets.sh
609                 t9604-cvsimport-timestamps.sh
610         )
611         local tests_perl=(
612                 t3701-add-interactive.sh
613                 t5502-quickfetch.sh
614                 t5512-ls-remote.sh
615                 t5520-pull.sh
616                 t7106-reset-unborn-branch.sh
617                 t7501-commit.sh
618         )
619         # Bug #225601 - t0004 is not suitable for root perm
620         # Bug #219839 - t1004 is not suitable for root perm
621         # t0001-init.sh - check for init notices EPERM*  fails
622         local tests_nonroot=(
623                 t0001-init.sh
624                 t0004-unwritable.sh
625                 t0070-fundamental.sh
626                 t1004-read-tree-m-u-wf.sh
627                 t3700-add.sh
628                 t7300-clean.sh
629         )
630         # t9100 still fails with symlinks in SVN 1.7
631         local test_svn=( t9100-git-svn-basic.sh )
632
633         # Unzip is used only for the testcase code, not by any normal parts of Git.
634         if ! has_version app-arch/unzip ; then
635                 einfo "Disabling tar-tree tests"
636                 disabled+=( t5000-tar-tree.sh )
637         fi
638
639         local cvs=0
640         use cvs && let cvs=${cvs}+1
641         if [[ ${EUID} -eq 0 ]]; then
642                 if [[ ${cvs} -eq 1 ]]; then
643                         ewarn "Skipping CVS tests because CVS does not work as root!"
644                         ewarn "You should retest with FEATURES=userpriv!"
645                         disabled+=( ${tests_cvs[@]} )
646                 fi
647                 einfo "Skipping other tests that require being non-root"
648                 disabled+=( ${tests_nonroot[@]} )
649         else
650                 [[ ${cvs} -gt 0 ]] && \
651                         has_version dev-vcs/cvs && \
652                         let cvs=${cvs}+1
653                 [[ ${cvs} -gt 1 ]] && \
654                         has_version "dev-vcs/cvs[server]" && \
655                         let cvs=${cvs}+1
656                 if [[ ${cvs} -lt 3 ]]; then
657                         einfo "Disabling CVS tests (needs dev-vcs/cvs[USE=server])"
658                         disabled+=( ${tests_cvs[@]} )
659                 fi
660         fi
661
662         if ! use perl ; then
663                 einfo "Disabling tests that need Perl"
664                 disabled+=( ${tests_perl[@]} )
665         fi
666
667         einfo "Disabling tests that fail with SVN 1.7"
668         disabled+=( ${test_svn[@]} )
669
670         # Reset all previously disabled tests
671         pushd t &>/dev/null || die
672         local i
673         for i in *.sh.DISABLED ; do
674                 [[ -f "${i}" ]] && mv -f "${i}" "${i%.DISABLED}"
675         done
676         einfo "Disabled tests:"
677         for i in ${disabled[@]} ; do
678                 [[ -f "${i}" ]] && mv -f "${i}" "${i}.DISABLED" && einfo "Disabled ${i}"
679         done
680
681         # Avoid the test system removing the results because we want them ourselves
682         sed -e '/^[[:space:]]*$(MAKE) clean/s,^,#,g' \
683                 -i Makefile || die
684
685         # Clean old results first, must always run
686         nonfatal git_emake clean
687         popd &>/dev/null || die
688
689         # Now run the tests, keep going if we hit an error, and don't terminate on
690         # failure
691         local rc
692         einfo "Start test run"
693         #MAKEOPTS=-j1
694         nonfatal git_emake --keep-going test
695         rc=$?
696
697         # Display nice results, now print the results
698         pushd t &>/dev/null || die
699         nonfatal git_emake aggregate-results
700
701         # And bail if there was a problem
702         [[ ${rc} -eq 0 ]] || die "tests failed. Please file a bug."
703 }
704
705 showpkgdeps() {
706         local pkg=$1
707         shift
708         elog "  $(printf "%-17s:" ${pkg}) ${@}"
709 }
710
711 pkg_postinst() {
712         use emacs && elisp-site-regen
713         elog "Please read /usr/share/bash-completion/completions/git for Git bash command"
714         elog "completion."
715         elog "Please read /usr/share/git/git-prompt.sh for Git bash prompt"
716         elog "Note that the prompt bash code is now in that separate script"
717         elog "These additional scripts need some dependencies:"
718         echo
719         showpkgdeps git-quiltimport "dev-util/quilt"
720         showpkgdeps git-instaweb \
721                 "|| ( www-servers/lighttpd www-servers/apache www-servers/nginx )"
722         echo
723         use mediawiki-experimental && ewarn "Using experimental git-mediawiki patches. The stability of cloned wiki filesystems is not guaranteed."
724 }
725
726 pkg_postrm() {
727         use emacs && elisp-site-regen
728 }