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