tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Split git perl stuff into separate package



devel/git-base includes a few Perl scripts and libraries, so it brings
in a runtime dependency on lang/perl5.

However, these scripts aren't necessary for most git usage -- they're
somewhat obscure things like `git archimport' or `git instaweb'.  Most
normal use of git -- including `git add --interactive', which used to
be in Perl -- doesn't require Perl, and can be disabled in the git
build by setting NO_PERL.

The attached patch splits out the Perl scripts (and shell scripts that
unconditionally run perl as a subprocess) into a separate package
devel/git-perlscripts, and adds devel/git-perlscripts to devel/git,
just like we currently already have with the Tcl/Tk stuff and
documentation too.

This way there's no change to the experience if you install devel/git,
but you don't need to build perl just to get devel/git-base -- or wait
for perl to rebuild every time you update to get a new git.

OK?
From 0cd1cf960ad6417f25e379b855ce7b3cf0fcf3b1 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
Date: Thu, 8 Jun 2023 14:17:39 +0000
Subject: [PATCH] git: Split Perl-dependent scripts into new git-perlscripts
 package.

This way:
- devel/git still installs everything it used to.
- devel/git-base can be built without Perl.
---
 devel/Makefile                        |  1 +
 devel/git-base/DESCR                  |  3 +-
 devel/git-base/Makefile               | 33 ++++++++++++---------
 devel/git-base/PLIST                  | 27 -----------------
 devel/git-base/distinfo               |  2 +-
 devel/git-base/patches/patch-Makefile | 23 ++++++++++-----
 devel/git-perlscripts/DESCR           | 10 +++++++
 devel/git-perlscripts/Makefile        | 42 +++++++++++++++++++++++++++
 devel/git-perlscripts/PLIST           | 28 ++++++++++++++++++
 devel/git/Makefile                    |  1 +
 devel/git/Makefile.common             |  1 +
 11 files changed, 121 insertions(+), 50 deletions(-)
 create mode 100644 devel/git-perlscripts/DESCR
 create mode 100644 devel/git-perlscripts/Makefile
 create mode 100644 devel/git-perlscripts/PLIST

diff --git a/devel/Makefile b/devel/Makefile
index c1f6d2ba2cf0..f2ba4702a97f 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -417,6 +417,7 @@ SUBDIR+=	git-docs
 SUBDIR+=	git-filter-repo
 SUBDIR+=	git-gitk
 SUBDIR+=	git-lfs
+SUBDIR+=	git-perlscripts
 SUBDIR+=	git-remote-hg
 SUBDIR+=	git-svn
 SUBDIR+=	gitolite
diff --git a/devel/git-base/DESCR b/devel/git-base/DESCR
index 48778b139ee9..b19d38b0d9c1 100644
--- a/devel/git-base/DESCR
+++ b/devel/git-base/DESCR
@@ -8,4 +8,5 @@ and ClearCase with features like cheap local branching, convenient
 staging areas, and multiple workflows.
 
 This package contains only the git program (and subcommands).  It does
-not contain man pages or the tk-based repository browser.
+not contain man pages or the tk-based repository browser or the git
+subcommands that rely on Perl.
diff --git a/devel/git-base/Makefile b/devel/git-base/Makefile
index 16fedfbae037..d9f389169f0b 100644
--- a/devel/git-base/Makefile
+++ b/devel/git-base/Makefile
@@ -1,5 +1,6 @@
 # $NetBSD: Makefile,v 1.104 2023/04/26 08:44:38 adam Exp $
 
+PKGREVISION=	1
 .include "../../devel/git/Makefile.common"
 
 PKGNAME=	git-base-${GIT_VERSION}
@@ -8,17 +9,8 @@ COMMENT=	GIT Tree History Storage Tool (base package)
 CONFLICTS+=	scmgit-base-[0-9]*
 SUPERSEDES+=	scmgit-base-[0-9]*
 
-DEPENDS+=	p5-Error>=0.17015:../../devel/p5-Error
-DEPENDS+=	p5-Email-Valid>=0.190:../../mail/p5-Email-Valid
-DEPENDS+=	p5-MailTools>=2.11:../../mail/p5-MailTools
-DEPENDS+=	p5-Net-SMTP-SSL>=1.01:../../mail/p5-Net-SMTP-SSL
-DEPENDS+=	p5-Authen-SASL>=1.0:../../security/p5-Authen-SASL
-
 USE_LANGUAGES=		c99
-USE_TOOLS+=		perl:run sh:run msgfmt bash:test
-
-REPLACE_PERL+=		*.perl */*.perl */*/*.perl
-REPLACE_PERL+=		contrib/hooks/update-paranoid
+USE_TOOLS+=		sh:run msgfmt bash:test
 
 CFLAGS+=		-DHAVE_DEV_TTY
 CFLAGS.NetBSD+=		-D_NETBSD_SOURCE
@@ -27,7 +19,7 @@ CONFIGURE_ARGS+=	--with-curl=${BUILDLINK_PREFIX.curl}
 CONFIGURE_ARGS+=	--with-expat=${BUILDLINK_PREFIX.expat}
 CONFIGURE_ARGS+=	--with-iconv=${BUILDLINK_PREFIX.iconv}
 CONFIGURE_ARGS+=	--with-libpcre2=${BUILDLINK_PREFIX.pcre2}
-CONFIGURE_ARGS+=	--with-perl=${PERL5:Q}
+CONFIGURE_ARGS+=	--with-perl=/nonexistent/perl
 CONFIGURE_ARGS+=	--with-zlib=${BUILDLINK_PREFIX.zlib}
 CONFIGURE_ARGS+=	--without-python # only needed for git-p4
 CONFIGURE_ARGS+=	--without-tcltk
@@ -66,8 +58,8 @@ CONFIGURE_ENV+=		HOME=${PREFIX}
 CONFIGURE_ENV+=		gitexecdir=${GITCOREDIR}
 
 MAKE_FLAGS+=		INSTALL=${INSTALL:Q}
-MAKE_ENV+=		PERLLIBDIR=${PERL5_INSTALLVENDORLIB}
 MAKE_ENV+=		NO_GITWEB=1
+MAKE_ENV+=		NO_PERL=1
 
 GIT_TEMPLATE_INSTDIR=	${EGDIR}/${GIT_TEMPLATEDIR}
 MAKE_ENV+=		GIT_TEMPLATE_INSTDIR=${GIT_TEMPLATE_INSTDIR}
@@ -117,6 +109,21 @@ post-install:
 		${DESTDIR}${PREFIX}/share/zsh/site-functions/_git
 	${INSTALL_DATA} ${WRKSRC}/contrib/completion/git-prompt.sh \
 		${DESTDIR}${EGDIR}
+	# Delete files that are stubs saying git was built without
+	# support for perl -- this way you can install git-perlscripts
+	# with no conflicts, and git can depend on both git-base and
+	# git-perlscripts.
+	cd ${DESTDIR}${PREFIX} && \
+	rm -f \
+		libexec/git-core/git-archimport \
+		libexec/git-core/git-cvsexportcommit \
+		libexec/git-core/git-cvsimport \
+		libexec/git-core/git-cvsserver \
+		libexec/git-core/git-instaweb \
+		libexec/git-core/git-request-pull \
+		libexec/git-core/git-send-email \
+		libexec/git-core/git-svn \
+		# end of perl list
 
 .include "options.mk"
 
@@ -125,8 +132,6 @@ post-install:
 BUILDLINK_API_DEPENDS.pcre2+=	pcre2>=10.34
 .include "../../devel/pcre2/buildlink3.mk"
 .include "../../devel/zlib/buildlink3.mk"
-.include "../../lang/perl5/buildlink3.mk"
-.include "../../lang/perl5/vars.mk"
 .include "../../textproc/expat/buildlink3.mk"
 .include "../../www/curl/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/devel/git-base/PLIST b/devel/git-base/PLIST
index d0d7395456bf..cb48f2e96db2 100644
--- a/devel/git-base/PLIST
+++ b/devel/git-base/PLIST
@@ -6,31 +6,11 @@ bin/git-shell
 bin/git-upload-archive
 bin/git-upload-pack
 bin/scalar
-${PERL5_SUB_INSTALLVENDORLIB}/FromCPAN/Error.pm
-${PERL5_SUB_INSTALLVENDORLIB}/FromCPAN/Mail/Address.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/I18N.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/IndexInfo.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/LoadCPAN.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/LoadCPAN/Error.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/LoadCPAN/Mail/Address.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/Packet.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Editor.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Fetcher.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/GlobSpec.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Log.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Memoize/YAML.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Migration.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Prompt.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Ra.pm
-${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Utils.pm
 libexec/git-core/git
 libexec/git-core/git-add
 libexec/git-core/git-am
 libexec/git-core/git-annotate
 libexec/git-core/git-apply
-libexec/git-core/git-archimport
 libexec/git-core/git-archive
 libexec/git-core/git-bisect
 libexec/git-core/git-blame
@@ -59,9 +39,6 @@ libexec/git-core/git-credential
 libexec/git-core/git-credential-cache
 libexec/git-core/git-credential-cache--daemon
 libexec/git-core/git-credential-store
-libexec/git-core/git-cvsexportcommit
-libexec/git-core/git-cvsimport
-libexec/git-core/git-cvsserver
 libexec/git-core/git-daemon
 libexec/git-core/git-describe
 libexec/git-core/git-diagnose
@@ -96,7 +73,6 @@ libexec/git-core/git-imap-send
 libexec/git-core/git-index-pack
 libexec/git-core/git-init
 libexec/git-core/git-init-db
-libexec/git-core/git-instaweb
 libexec/git-core/git-interpret-trailers
 libexec/git-core/git-log
 libexec/git-core/git-ls-files
@@ -147,7 +123,6 @@ libexec/git-core/git-remote-http
 libexec/git-core/git-remote-https
 libexec/git-core/git-repack
 libexec/git-core/git-replace
-libexec/git-core/git-request-pull
 libexec/git-core/git-rerere
 libexec/git-core/git-reset
 libexec/git-core/git-restore
@@ -155,7 +130,6 @@ libexec/git-core/git-rev-list
 libexec/git-core/git-rev-parse
 libexec/git-core/git-revert
 libexec/git-core/git-rm
-libexec/git-core/git-send-email
 libexec/git-core/git-send-pack
 libexec/git-core/git-sh-i18n
 libexec/git-core/git-sh-i18n--envsubst
@@ -173,7 +147,6 @@ libexec/git-core/git-status
 libexec/git-core/git-stripspace
 libexec/git-core/git-submodule
 libexec/git-core/git-submodule--helper
-libexec/git-core/git-svn
 libexec/git-core/git-switch
 libexec/git-core/git-symbolic-ref
 libexec/git-core/git-tag
diff --git a/devel/git-base/distinfo b/devel/git-base/distinfo
index 72611ad9fb21..6eda797d684c 100644
--- a/devel/git-base/distinfo
+++ b/devel/git-base/distinfo
@@ -4,7 +4,7 @@ BLAKE2s (git-2.41.0.tar.xz) = 9386094f11cc329ebb801be45dad6f2de9c8d192e21ba2fbe3
 SHA512 (git-2.41.0.tar.xz) = a215bc6d89afbddd56adac901c24ea2b7f98a37bf6a6a2756893947012ffaa850e76247a3445a5ab13ab5a462f39986fec33eed086148aba5eb554dc1799fee0
 Size (git-2.41.0.tar.xz) = 7273624 bytes
 SHA1 (patch-Documentation_Makefile) = 6025adac0fbb4b403f3954e6dac9d690dfb22daa
-SHA1 (patch-Makefile) = 683a2fdf69c3cb5814fcc59360be2eba91cb88a7
+SHA1 (patch-Makefile) = bf8cf3ed8168241265b258a29d62210dc59a5f72
 SHA1 (patch-config.mak.uname) = 5316873147acf5b6ef29e426946280bb6441c886
 SHA1 (patch-contrib_completion_git-completion.zsh) = 695c78c8be7cc2a3792d1c428ebc5739b049852e
 SHA1 (patch-git-gui_Makefile) = d00f4da74a437f3a58f0926f2407c974a8efc2c7
diff --git a/devel/git-base/patches/patch-Makefile b/devel/git-base/patches/patch-Makefile
index c123b6beff09..8fa1505783b7 100644
--- a/devel/git-base/patches/patch-Makefile
+++ b/devel/git-base/patches/patch-Makefile
@@ -2,12 +2,13 @@ $NetBSD: patch-Makefile,v 1.6 2022/10/07 10:10:05 adam Exp $
 
 Do not override compiler/linker flags.
 Provide proper path for Perl module.
+New target for building Perl libraries.
 Do not install git-p4 (requires Python).
 Fix tar operations.
 
---- Makefile.orig	2022-10-02 23:02:46.000000000 +0000
+--- Makefile.orig	2023-06-01 07:03:05.000000000 +0000
 +++ Makefile
-@@ -549,7 +549,7 @@ mergetoolsdir = $(gitexecdir)/mergetools
+@@ -612,7 +612,7 @@ mergetoolsdir = $(gitexecdir)/mergetools
  sharedir = $(prefix)/share
  gitwebdir = $(sharedir)/gitweb
  gitwebstaticdir = $(gitwebdir)/static
@@ -16,7 +17,7 @@ Fix tar operations.
  localedir = $(sharedir)/locale
  template_dir = share/git-core/templates
  htmldir = $(prefix)/share/doc/git-doc
-@@ -570,13 +570,9 @@ perllibdir_relative = $(patsubst $(prefi
+@@ -633,13 +633,9 @@ perllibdir_relative = $(patsubst $(prefi
  export prefix bindir sharedir sysconfdir perllibdir localedir
  
  # Set our default programs
@@ -30,7 +31,7 @@ Fix tar operations.
  TCL_PATH = tclsh
  TCLTK_PATH = wish
  XGETTEXT = xgettext
-@@ -683,7 +679,6 @@ clean-python-script:
+@@ -744,7 +740,6 @@ clean-python-script:
  
  SCRIPTS = $(SCRIPT_SH_GEN) \
  	  $(SCRIPT_PERL_GEN) \
@@ -38,7 +39,7 @@ Fix tar operations.
  	  git-instaweb
  
  ETAGS_TARGET = TAGS
-@@ -2191,8 +2186,8 @@ ifdef DEFAULT_HELP_FORMAT
+@@ -2304,8 +2299,8 @@ ifdef DEFAULT_HELP_FORMAT
  BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
  endif
  
@@ -49,7 +50,15 @@ Fix tar operations.
  
  export DIFF TAR INSTALL DESTDIR SHELL_PATH
  
-@@ -3261,12 +3256,12 @@ endif
+@@ -3018,6 +3013,7 @@ endif
+ NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
+ endif
+ 
++build-perl-libs: $(LIB_PERL_GEN) $(LIB_CPAN_GEN)
+ perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+ 	$(call mkdir_p_parent_template)
+ 	$(QUIET_GEN) \
+@@ -3457,12 +3453,12 @@ endif
  ifndef NO_GETTEXT
  	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
  	(cd po/build/locale && $(TAR) cf - .) | \
@@ -64,7 +73,7 @@ Fix tar operations.
  endif
  ifndef NO_TCLTK
  	$(MAKE) -C gitk-git install
-@@ -3333,7 +3328,7 @@ install-man: install-man-perl
+@@ -3529,7 +3525,7 @@ install-man: install-man-perl
  install-man-perl: man-perl
  	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
  	(cd perl/build/man/man3 && $(TAR) cf - .) | \
diff --git a/devel/git-perlscripts/DESCR b/devel/git-perlscripts/DESCR
new file mode 100644
index 000000000000..27b67095633c
--- /dev/null
+++ b/devel/git-perlscripts/DESCR
@@ -0,0 +1,10 @@
+Git is a free and open source distributed version control system
+designed to handle everything from small to very large projects with
+speed and efficiency.
+
+Git is easy to learn and has a tiny footprint with lightning fast
+performance. It outclasses SCM tools like Subversion, CVS, Perforce,
+and ClearCase with features like cheap local branching, convenient
+staging areas, and multiple workflows.
+
+This package contains only the git subcommands that rely on Perl.
diff --git a/devel/git-perlscripts/Makefile b/devel/git-perlscripts/Makefile
new file mode 100644
index 000000000000..147de05a94a8
--- /dev/null
+++ b/devel/git-perlscripts/Makefile
@@ -0,0 +1,42 @@
+# $NetBSD$
+
+.include "../../devel/git/Makefile.common"
+
+PKGNAME=	git-perlscripts-${GIT_VERSION}
+COMMENT=	Git commands that rely on Perl
+
+CONFLICTS+=	git-base<2.41.0nb1
+
+DEPENDS+=	p5-Error>=0.17015:../../devel/p5-Error
+DEPENDS+=	p5-Email-Valid>=0.190:../../mail/p5-Email-Valid
+DEPENDS+=	p5-MailTools>=2.11:../../mail/p5-MailTools
+DEPENDS+=	p5-Net-SMTP-SSL>=1.01:../../mail/p5-Net-SMTP-SSL
+DEPENDS+=	p5-Authen-SASL>=1.0:../../security/p5-Authen-SASL
+
+USE_TOOLS+=	pax
+USE_TOOLS+=	perl:run
+
+REPLACE_PERL+=		*.perl */*.perl */*/*.perl
+REPLACE_PERL+=		contrib/hooks/update-paranoid
+
+CONFIGURE_ARGS+=	--with-perl=${PERL5:Q}
+
+BUILD_TARGET=		build-perl-script build-perl-libs
+BUILD_TARGET+=		git-instaweb git-request-pull # sh scripts call perl
+INSTALL_TARGET=		install-perl-script
+
+MAKE_FLAGS+=		INSTALL=${INSTALL:Q}
+MAKE_ENV+=		PERLLIBDIR=${PERL5_INSTALLVENDORLIB:Q}
+
+INSTALLATION_DIRS+=	libexec/git-core
+INSTALLATION_DIRS+=	${PERL5_INSTALLVENDORLIB}
+
+post-install:
+	${INSTALL:Q} ${WRKSRC:Q}/git-instaweb ${DESTDIR:Q}${PREFIX:Q}/libexec/git-core
+	${INSTALL:Q} ${WRKSRC:Q}/git-request-pull ${DESTDIR:Q}${PREFIX:Q}/libexec/git-core
+	cd ${WRKSRC:Q}/perl/build/lib && \
+	${PAX} -rw -pp . ${DESTDIR:Q}${PERL5_INSTALLVENDORLIB:Q}
+
+.include "../../lang/perl5/buildlink3.mk"
+.include "../../lang/perl5/vars.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/devel/git-perlscripts/PLIST b/devel/git-perlscripts/PLIST
new file mode 100644
index 000000000000..dc736c87db14
--- /dev/null
+++ b/devel/git-perlscripts/PLIST
@@ -0,0 +1,28 @@
+@comment $NetBSD$
+${PERL5_SUB_INSTALLVENDORLIB}/FromCPAN/Error.pm
+${PERL5_SUB_INSTALLVENDORLIB}/FromCPAN/Mail/Address.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/I18N.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/IndexInfo.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/LoadCPAN.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/LoadCPAN/Error.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/LoadCPAN/Mail/Address.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/Packet.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Editor.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Fetcher.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/GlobSpec.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Log.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Memoize/YAML.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Migration.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Prompt.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Ra.pm
+${PERL5_SUB_INSTALLVENDORLIB}/Git/SVN/Utils.pm
+libexec/git-core/git-archimport
+libexec/git-core/git-cvsexportcommit
+libexec/git-core/git-cvsimport
+libexec/git-core/git-cvsserver
+libexec/git-core/git-instaweb
+libexec/git-core/git-request-pull
+libexec/git-core/git-send-email
+libexec/git-core/git-svn
diff --git a/devel/git/Makefile b/devel/git/Makefile
index 7501317cd249..88c42d3e3304 100644
--- a/devel/git/Makefile
+++ b/devel/git/Makefile
@@ -19,5 +19,6 @@ META_PACKAGE=	yes
 DEPENDS+=	git-base>=${GIT_VERSION}:../../devel/git-base
 DEPENDS+=	git-contrib>=${GIT_VERSION}:../../devel/git-contrib
 DEPENDS+=	git-docs>=${GIT_VERSION}:../../devel/git-docs
+DEPENDS+=	git-perlscripts>=${GIT_VERSION}:../../devel/git-perlscripts
 
 .include "../../mk/bsd.pkg.mk"
diff --git a/devel/git/Makefile.common b/devel/git/Makefile.common
index 53af6f04be0b..2c04bc8dd090 100644
--- a/devel/git/Makefile.common
+++ b/devel/git/Makefile.common
@@ -5,6 +5,7 @@
 # used by devel/git-credential-osxkeychain/Makefile
 # used by devel/git-docs/Makefile
 # used by devel/git-gitk/Makefile
+# used by devel/git-perlscripts/Makefile
 # used by www/gitweb/Makefile
 
 .include "../../devel/git/Makefile.version"


Home | Main Index | Thread Index | Old Index