diff --git a/devel/git/Makefile b/devel/git/Makefile index b67a43ae469b..19b313cbc33c 100644 --- a/devel/git/Makefile +++ b/devel/git/Makefile @@ -1,371 +1,372 @@ PORTNAME= git DISTVERSION= 2.37.2 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= KERNEL_ORG/software/scm/git DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \ ${PORTNAME}-manpages-${DISTVERSION}${EXTRACT_SUFX} # We manually extract the htmldocs. EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} \ ${PORTNAME}-manpages-${DISTVERSION}${EXTRACT_SUFX} # these patches are required for gitlab (gitaly) # without the patches repositories got broken PATCH_SITES= https://gitlab.com/gitlab-org/gitaly/-/raw/master/_support/git-patches/v2.37.1.gl1/ PATCHFILES= 0001-refs-extract-packed_refs_delete_refs-to-allow-contro.patch \ 0002-refs-allow-passing-flags-when-beginning-transactions.patch \ 0003-refs-allow-skipping-the-reference-transaction-hook.patch \ 0004-refs-demonstrate-excessive-execution-of-the-referenc.patch \ 0005-refs-do-not-execute-reference-transaction-hook-on-pa.patch \ 0006-refs-skip-hooks-when-deleting-uncovered-packed-refs.patch PATCH_DIST_STRIP= -p1 MAINTAINER= garga@FreeBSD.org COMMENT?= Distributed source code management tool ${COMMENT_${FLAVOR}} LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/COPYING SUBPORT?= core .if ${SUBPORT} != core PKGNAMESUFFIX= -${SUBPORT} .endif .if ${SUBPORT} == core FLAVORS= default lite tiny default_CONFLICTS_INSTALL= git-lite git-tiny lite_CONFLICTS_INSTALL= git git-tiny lite_DESCR= ${.CURDIR}/pkg-descr-lite lite_PKGNAMESUFFIX= -lite tiny_CONFLICTS_INSTALL= git git-lite tiny_DESCR= ${.CURDIR}/pkg-descr-tiny tiny_PKGNAMESUFFIX= -tiny .endif USES= autoreconf cpe gmake iconv shebangfix tar:xz CPE_VENDOR= git-scm .if ${SUBPORT} == core USES+= ssl COMMENT_lite= (lite flavor) COMMENT_tiny= (tiny flavor) USERS= git_daemon GROUPS= git_daemon .endif SUB_FILES= pkg-message gitweb.conf GNU_CONFIGURE= yes CPPFLAGS+= -isystem${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib MAKE_ARGS= DEVELOPER= NO_TCLTK=yes MAKE_ENV+= V=1 .if ${SUBPORT} == core USE_RC_SUBR= git_daemon .endif SHEBANG_FILES= *.perl */*.perl */*/*.perl */*.pl */*/*.pl */*/*/*.pl \ t/*/*/pre t/*/*/post t/Git-SVN/Utils/*.t \ git-p4.py \ contrib/hg-to-git/hg-to-git.py \ contrib/hooks/update-paranoid \ contrib/fast-import/import-zips.py \ contrib/remote-helpers/git-remote-bzr \ contrib/remote-helpers/git-remote-hg \ contrib/credential/netrc/git-credential-netrc.perl \ contrib/buildsystems/generate contrib/contacts/git-contacts \ templates/hooks--fsmonitor-watchman.sample TEST_TARGET= test CONFIGURE_ARGS= --enable-pthreads=-pthread ac_cv_header_libcharset_h=no .if ${SUBPORT} == core OPTIONS_DEFINE= CONTRIB CURL GITWEB HTMLDOCS ICONV NLS PCRE2 PERL SEND_EMAIL \ SUBTREE OPTIONS_DEFAULT=CONTRIB CURL GITWEB ICONV PCRE2 PERL SEND_EMAIL SUBTREE . if ${FLAVOR:U} == lite OPTIONS_EXCLUDE+= GITWEB CONTRIB PERL . elif ${FLAVOR:U} == tiny OPTIONS_EXCLUDE:= ${OPTIONS_DEFINE:NCURL} OPTIONS_SLAVE= CURL . endif OPTIONS_SUB= yes . if !empty(FLAVOR) && ${FLAVOR:U} != default OPTIONS_FILE= ${PORT_DBDIR}/${OPTIONS_NAME}/${FLAVOR}-options . endif CONTRIB_DESC= Install contributed scripts CURL_DESC= Install curl support (provides HTTPS transport) GITWEB_DESC= Install gitweb HTMLDOCS_DESC= Install additional documentation PCRE2_DESC= Use Perl Compatible Regular Expressions (v2) SEND_EMAIL_DESC=Enable the git-send-email(1) script SUBTREE_DESC= Install git-subtree NLS_USES= gettext NLS_MAKE_ARGS_OFF= NO_GETTEXT=yes PERL_USES= perl5 PERL_CONFIGURE_WITH= perl=${PERL} PERL_BUILD_DEPENDS= p5-Error>=0:lang/p5-Error PERL_RUN_DEPENDS= p5-Error>=0:lang/p5-Error PERL_MAKE_ARGS_OFF= NO_PERL=1 GITWEB_IMPLIES= PERL GITWEB_RUN_DEPENDS= p5-CGI>=0:www/p5-CGI PCRE2_LIB_DEPENDS= libpcre2-8.so:devel/pcre2 PCRE2_CONFIGURE_WITH= libpcre SEND_EMAIL_IMPLIES= PERL SEND_EMAIL_RUN_DEPENDS= p5-Authen-SASL>=0:security/p5-Authen-SASL \ p5-IO-Socket-SSL>=0:security/p5-IO-Socket-SSL ICONV_MAKE_ARGS_OFF= NO_ICONV=1 CURL_MAKE_ENV= CURLDIR=${LOCALBASE} CURL_BUILD_DEPENDS= curl:ftp/curl CURL_RUN_DEPENDS= curl:ftp/curl CURL_LIB_DEPENDS= libexpat.so:textproc/expat2 CURL_MAKE_ARGS_OFF= NO_CURL=1 NO_EXPAT=1 HTMLDOCS_DISTFILES= ${PORTNAME}-htmldocs-${DISTVERSION}${EXTRACT_SUFX} SUBTREE_BUILD_DEPENDS= asciidoctor:textproc/rubygem-asciidoctor\ xmlto:textproc/xmlto .else NO_ARCH= yes MAKE_ENV+= V=1 MAKE_ARGS= NO_GETTEXT=yes . if ${SUBPORT} != gui MAKE_ARGS+= NO_TCLTK=yes . endif RUN_DEPENDS+= git=${PKGVERSION}:devel/git . if ${SUBPORT} == cvs RUN_DEPENDS+= cvsps:devel/cvsps . elif ${SUBPORT} == gui USES+= tk MAKE_ARGS+= TCL_PATH=${TCLSH} TCLTK_PATH=${WISH} . elif ${SUBPORT} == svn RUN_DEPENDS+= p5-Term-ReadKey>=0:devel/p5-Term-ReadKey . if ${WITH_SUBVERSION_VER:U} == LTS RUN_DEPENDS+= p5-subversion-lts>=0:devel/p5-subversion . else RUN_DEPENDS+= p5-subversion>=0:devel/p5-subversion . endif . endif .endif .include # This is intentionally not exposed as an option. .if defined(STRIP) && ${STRIP} != "" ALL_TARGET= all strip .endif .if ${SUBPORT} == p4 || ${PORT_OPTIONS:MCONTRIB} USES+= python CONFIGURE_ARGS+= --with-python=${PYTHON_CMD} .else CONFIGURE_ARGS+= --without-python .endif .if ${SUBPORT} != gui RMMAN1+= git-citool.1 \ git-gui.1 \ gitk.1 .endif .if ${SUBPORT} != p4 RMMAN1+= git-p4.1 .endif .if ${SUBPORT} != svn RMMAN1+= git-svn.1 .endif .if ${SUBPORT} != cvs RMMAN1+= git-cvsimport.1 \ git-cvsexportcommit.1 \ git-cvsserver.1 RMMAN7+= gitcvs-migration.7 .endif post-extract-HTMLDOCS-on: @${MKDIR} ${WRKDIR}/htmldocs @cd ${WRKDIR}/htmldocs && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} \ ${DISTDIR}/${PORTNAME}-htmldocs-${DISTVERSION}${EXTRACT_SUFX} \ ${EXTRACT_AFTER_ARGS} post-patch: .for FILE in ${RMMAN1} @${RM} ${WRKDIR}/man1/${FILE} .endfor .for FILE in ${RMMAN7} @${RM} ${WRKDIR}/man7/${FILE} .endfor @${REINPLACE_CMD} -e "s,%%SITE_PERL%%,${SITE_PERL},g" ${WRKSRC}/Makefile .if ${SUBPORT} != cvs @${REINPLACE_CMD} -e '/git-cvsexportcommit.perl/d; \ /git-cvsimport.perl/d; \ /git-cvsserver.perl/d; \ /documented,gitcvs-migration/d; \ s/git-cvsserver//' \ ${WRKSRC}/Makefile .endif .if ${SUBPORT} != p4 @${REINPLACE_CMD} -e '/^SCRIPT_PYTHON += git-p4.py$$/d' \ ${WRKSRC}/Makefile .endif .if ${SUBPORT} != svn @${REINPLACE_CMD} -e '/git-svn.perl/d' ${WRKSRC}/Makefile .endif .if ${SUBPORT} == gui @${REINPLACE_CMD} -e "/exec wish/s,wish,${WISH}," \ ${WRKSRC}/gitk-git/gitk \ ${WRKSRC}/git-gui/git-gui--askpass .endif post-patch-CONTRIB-on: @${REINPLACE_CMD} -e "s,/usr/bin/perl,${PERL}," \ ${WRKSRC}/contrib/diff-highlight/Makefile post-patch-GITWEB-off: @${REINPLACE_CMD} -e '/$$(MAKE) -C gitweb install/d' \ ${WRKSRC}/Makefile @${REINPLACE_CMD} -e "s,/usr/bin/perl,${PERL}," \ ${WRKSRC}/t/lib-gitweb.sh .if ${SUBPORT} == p4 || ${PORT_OPTIONS:MCONTRIB} post-build: @${FIND} ${WRKSRC} -name "*.bak" -delete .endif .if ${SUBPORT} == core post-build-CONTRIB-on: ${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${WRKSRC}/contrib/diff-highlight ${RM} ${WRKSRC}/contrib/diff-highlight/shebang.perl post-install: (cd ${WRKDIR}/man1/ && \ ${COPYTREE_SHARE} . ${STAGEDIR}${MANPREFIX}/man/man1) (cd ${WRKDIR}/man5/ && \ ${COPYTREE_SHARE} . ${STAGEDIR}${MANPREFIX}/man/man5) (cd ${WRKDIR}/man7/ && \ ${COPYTREE_SHARE} . ${STAGEDIR}${MANPREFIX}/man/man7) ${MKDIR} ${STAGEDIR}${PREFIX}/share/emacs/site-lisp/git ${INSTALL_DATA} ${WRKSRC}/contrib/emacs/git.el \ ${STAGEDIR}${PREFIX}/share/emacs/site-lisp/git/ ${INSTALL_DATA} ${WRKSRC}/contrib/emacs/git-blame.el \ ${STAGEDIR}${PREFIX}/share/emacs/site-lisp/git/ @${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d ${INSTALL_SCRIPT} ${WRKSRC}/contrib/completion/git-completion.bash \ ${STAGEDIR}${PREFIX}/etc/bash_completion.d/ post-install-HTMLDOCS-on: # Manually remove the index.html symlink before installing, and then # recreate it after. This is necessary because the distfile is # extracted with --no-same-owner. If the distfile is extracted as a # non-root user then the symlink will have the incorrect owner. ${RM} ${WRKDIR}/htmldocs/index.html ${MKDIR} ${STAGEDIR}${DOCSDIR} (cd ${WRKDIR}/htmldocs/ && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}) ${LN} -s git.html ${STAGEDIR}${DOCSDIR}/index.html post-install-SUBTREE-on: cd ${WRKSRC}/contrib/subtree && ${SETENV} ${MAKE_ENV} \ ${MAKE_CMD} ${MAKE_FLAGS} Makefile USE_ASCIIDOCTOR=1 \ ${MAKE_ARGS} install install-doc post-install-CONTRIB-on: @${ECHO_MSG} "===> Installing contributed scripts" ${MKDIR} ${STAGEDIR}${PREFIX}/share/git-core/contrib ${RM} ${WRKSRC}/contrib/credential/netrc/test.netrc.gpg ${CP} -R ${WRKSRC}/contrib/* ${STAGEDIR}${PREFIX}/share/git-core/contrib post-install-GITWEB-on: ${MKDIR} ${STAGEDIR}${ETCDIR} ${INSTALL_DATA} ${WRKDIR}/gitweb.conf \ ${STAGEDIR}${ETCDIR}/gitweb.conf.sample .elif ${SUBPORT} == gui do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/libexec/git-core \ ${STAGEDIR}${PREFIX}/share/git-gui/lib/msgs \ ${STAGEDIR}${PREFIX}/share/gitk/lib/msgs ${INSTALL_SCRIPT} ${WRKSRC}/gitk-git/gitk \ ${STAGEDIR}${PREFIX}/bin ${INSTALL_SCRIPT} ${WRKSRC}/git-gui/git-gui \ ${STAGEDIR}${PREFIX}/libexec/git-core/ ${LN} ${STAGEDIR}${PREFIX}/libexec/git-core/git-gui \ ${STAGEDIR}${PREFIX}/libexec/git-core/git-citool ${INSTALL_SCRIPT} ${WRKSRC}/git-gui/git-gui--askpass \ ${STAGEDIR}${PREFIX}/libexec/git-core/ ${INSTALL_DATA} ${WRKSRC}/git-gui/lib/tclIndex \ ${STAGEDIR}${PREFIX}/share/git-gui/lib/ ${INSTALL_DATA} ${WRKSRC}/git-gui/lib/*.ico \ ${STAGEDIR}${PREFIX}/share/git-gui/lib/ ${INSTALL_DATA} ${WRKSRC}/git-gui/lib/*.js \ ${STAGEDIR}${PREFIX}/share/git-gui/lib/ ${INSTALL_DATA} ${WRKSRC}/git-gui/lib/*.tcl \ ${STAGEDIR}${PREFIX}/share/git-gui/lib/ ${INSTALL_DATA} ${WRKSRC}/git-gui/po/*.msg \ ${STAGEDIR}${PREFIX}/share/git-gui/lib/msgs/ ${INSTALL_DATA} ${WRKSRC}/gitk-git/po/*.msg \ ${STAGEDIR}${PREFIX}/share/gitk/lib/msgs/ ${INSTALL_DATA} ${WRKDIR}/man1/git-citool.1 \ ${STAGEDIR}${MANPREFIX}/man/man1/ ${INSTALL_DATA} ${WRKDIR}/man1/git-gui.1 \ ${STAGEDIR}${MANPREFIX}/man/man1/ ${INSTALL_DATA} ${WRKDIR}/man1/gitk.1 \ ${STAGEDIR}${MANPREFIX}/man/man1/ .elif ${SUBPORT} == cvs do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/libexec/git-core ${INSTALL_SCRIPT} ${WRKSRC}/git-cvsserver ${STAGEDIR}${PREFIX}/bin ${INSTALL_SCRIPT} ${WRKSRC}/git-cvsexportcommit \ ${STAGEDIR}${PREFIX}/libexec/git-core/ ${INSTALL_SCRIPT} ${WRKSRC}/git-cvsimport \ ${STAGEDIR}${PREFIX}/libexec/git-core/ ${INSTALL_SCRIPT} ${WRKSRC}/git-cvsserver \ ${STAGEDIR}${PREFIX}/libexec/git-core/ ${INSTALL_DATA} ${WRKDIR}/man1/git-cvsimport.1 \ ${STAGEDIR}${MANPREFIX}/man/man1/ ${INSTALL_DATA} ${WRKDIR}/man1/git-cvsexportcommit.1 \ ${STAGEDIR}${MANPREFIX}/man/man1/ ${INSTALL_DATA} ${WRKDIR}/man1/git-cvsserver.1 \ ${STAGEDIR}${MANPREFIX}/man/man1/ ${INSTALL_DATA} ${WRKDIR}/man7/gitcvs-migration.7 \ ${STAGEDIR}${MANPREFIX}/man/man7/ .elif ${SUBPORT} == p4 do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/libexec/git-core ${INSTALL_SCRIPT} ${WRKSRC}/git-p4.py \ ${STAGEDIR}${PREFIX}/libexec/git-core/git-p4 ${INSTALL_DATA} ${WRKDIR}/man1/git-p4.1 \ ${STAGEDIR}${MANPREFIX}/man/man1/ .elif ${SUBPORT} == svn do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/libexec/git-core ${INSTALL_SCRIPT} ${WRKSRC}/git-svn \ ${STAGEDIR}${PREFIX}/libexec/git-core/ ${INSTALL_DATA} ${WRKDIR}/man1/git-svn.1 \ ${STAGEDIR}${MANPREFIX}/man/man1/ .endif .include diff --git a/devel/git/files/patch-fix-maintenance.diff b/devel/git/files/patch-fix-maintenance.diff new file mode 100644 index 000000000000..c1ac6dec2452 --- /dev/null +++ b/devel/git/files/patch-fix-maintenance.diff @@ -0,0 +1,112 @@ +[PATCH v2] gc: use temporary file for editing crontab + +While cron is specified by POSIX, there are a wide variety of +implementations in use. On FreeBSD, the cron implementation requires a +file name argument: if the user wants to edit standard input, they must +specify "-". However, this notation is not specified by POSIX, allowing +the possibility that making such a change may break other, less common +implementations. + +Since POSIX tells us that cron must accept a file name argument, let's +solve this problem by specifying a temporary file instead. This will +ensure that we work with the vast majority of implementations. + +Note that because delete_tempfile closes the file for us, we should not +call fclose here on the handle, since doing so will introduce a double +free. + +Reported-by: Renato Botelho +Signed-off-by: brian m. carlson + +diff --git builtin/gc.c builtin/gc.c +index eeff2b760e..0d9e6dabef 100644 +--- builtin/gc.c ++++ builtin/gc.c +@@ -2065,6 +2065,7 @@ static int crontab_update_schedule(int run_maintenance, int fd) + struct child_process crontab_edit = CHILD_PROCESS_INIT; + FILE *cron_list, *cron_in; + struct strbuf line = STRBUF_INIT; ++ struct tempfile *tmpedit = NULL; + + get_schedule_cmd(&cmd, NULL); + strvec_split(&crontab_list.args, cmd); +@@ -2079,6 +2080,17 @@ static int crontab_update_schedule(int run_maintenance, int fd) + /* Ignore exit code, as an empty crontab will return error. */ + finish_command(&crontab_list); + ++ tmpedit = mks_tempfile_t(".git_cron_edit_tmpXXXXXX"); ++ if (!tmpedit) { ++ result = error(_("failed to create crontab temporary file")); ++ goto out; ++ } ++ cron_in = fdopen_tempfile(tmpedit, "w"); ++ if (!cron_in) { ++ result = error(_("failed to open temporary file")); ++ goto out; ++ } ++ + /* + * Read from the .lock file, filtering out the old + * schedule while appending the new schedule. +@@ -2086,19 +2098,6 @@ static int crontab_update_schedule(int run_maintenance, int fd) + cron_list = fdopen(fd, "r"); + rewind(cron_list); + +- strvec_split(&crontab_edit.args, cmd); +- crontab_edit.in = -1; +- crontab_edit.git_cmd = 0; +- +- if (start_command(&crontab_edit)) +- return error(_("failed to run 'crontab'; your system might not support 'cron'")); +- +- cron_in = fdopen(crontab_edit.in, "w"); +- if (!cron_in) { +- result = error(_("failed to open stdin of 'crontab'")); +- goto done_editing; +- } +- + while (!strbuf_getline_lf(&line, cron_list)) { + if (!in_old_region && !strcmp(line.buf, BEGIN_LINE)) + in_old_region = 1; +@@ -2132,14 +2131,22 @@ static int crontab_update_schedule(int run_maintenance, int fd) + } + + fflush(cron_in); +- fclose(cron_in); +- close(crontab_edit.in); + +-done_editing: ++ strvec_split(&crontab_edit.args, cmd); ++ strvec_push(&crontab_edit.args, get_tempfile_path(tmpedit)); ++ crontab_edit.git_cmd = 0; ++ ++ if (start_command(&crontab_edit)) { ++ result = error(_("failed to run 'crontab'; your system might not support 'cron'")); ++ goto out; ++ } ++ + if (finish_command(&crontab_edit)) + result = error(_("'crontab' died")); + else + fclose(cron_list); ++out: ++ delete_tempfile(&tmpedit); + return result; + } + +diff --git t/helper/test-crontab.c t/helper/test-crontab.c +index e7c0137a47..2942543046 100644 +--- t/helper/test-crontab.c ++++ t/helper/test-crontab.c +@@ -17,8 +17,8 @@ int cmd__crontab(int argc, const char **argv) + if (!from) + return 0; + to = stdout; +- } else if (argc == 2) { +- from = stdin; ++ } else if (argc == 3) { ++ from = fopen(argv[2], "r"); + to = fopen(argv[1], "w"); + } else + return error("unknown arguments"); +