tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Skipping certain files during distfile extraction
Hi,
when the portability check fails for a shell program, one approach is to
patch it, the other is to ignore it.
There's a third way, which is to not extract that file at all. Currently
that would involve setting two variables:
EXTRACT_OPTS+= -x
EXTRACT_ELEMENTS+= contrib/*.sh
The attached patch offers a new variable called EXTRACT_SKIP that makes
such tasks simpler:
EXTRACT_SKIP= contrib/*.sh
The latter variant is clearly more expressive. To understand the former
variant, one has to know that the option -x means to invert.
Curiously, none of the pkgsrc packages use that option at all right now.
It looks useful to me though.
One use case that I didn't explicitly mention in the documentation is to
use EXTRACT_SKIP instead of CHECK_PORTABILITY_SKIP if the file is not
needed at all. It's a somewhat special case of the "programs that are
not used".
Opinions?
Index: mk/extract/extract.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/extract/extract.mk,v
retrieving revision 1.41
diff -u -r1.41 extract.mk
--- mk/extract/extract.mk 20 Mar 2020 15:00:45 -0000 1.41
+++ mk/extract/extract.mk 20 Mar 2020 18:00:15 -0000
@@ -32,6 +32,16 @@
# when using EXTRACT_CMD_DEFAULT. By default, this is empty, which
# causes all files within the archive to be extracted.
#
+# EXTRACT_SKIP is a list of filename patterns that are skipped when
+# extracting the distfiles. Typical use cases are:
+#
+# * A package includes a bundled subproject that is not needed for
+# pkgsrc since it is already provided by a different package.
+# * A package contains programs that are only needed for internal
+# project management and that are not used during the build.
+#
+# Examples: contrib *.sh
+#
# The following are read-only variables that may be used within a package
# Makefile:
#
@@ -199,6 +209,15 @@
_EXTRACT_TAR=
.endif
+.if !empty(EXTRACT_SKIP)
+. if empty(EXTRACT_ELEMENTS)
+EXTRACT_OPTS+= -x
+EXTRACT_ELEMENTS= ${EXTRACT_SKIP:@pattern@${pattern:Q}@}
+. else
+PKG_FAIL_REASON+= "[extract.mk] EXTRACT_SKIP cannot be combined with EXTRACT_ELEMENTS."
+. endif
+.endif
+
.if !empty(_EXTRACT_TAR)
EXTRACT_OPTS+= -t ${_EXTRACT_TAR}
.endif
Home |
Main Index |
Thread Index |
Old Index