Gentoo Archives: gentoo-commits

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