Page MenuHomeFreeBSD

D28946.id85213.diff
No OneTemporary

D28946.id85213.diff

Index: Mk/Scripts/do-depends.sh
===================================================================
--- Mk/Scripts/do-depends.sh
+++ Mk/Scripts/do-depends.sh
@@ -92,6 +92,24 @@
echo " - found (${libfile})"
}
+dep_err()
+{
+ echo -e "Error: $1" >&2
+ echo "Culprit is: $2" >&2
+}
+
+
+
+# Find an applicable NORUNTIME file
+noruntime_file=
+for overlay in ${dp_OVERLAYS} ${PORTSDIR}; do
+ noruntime_file="${overlay}/NORUNTIME"
+ if [ -f "${noruntime_file}" ]; then
+ break
+ fi
+done
+
+runtime_deps_regex=
anynotfound=0
err=0
for _line in ${dp_RAWDEPENDS} ; do
@@ -113,13 +131,13 @@
last=${3:-}
if [ -z "${pattern}" ]; then
- echo "Error: there is an empty port dependency in ${dp_DEPTYPE}" >&2
+ dep_err "Empty port dependency in ${dp_DEPTYPE}" ${_line}
err=1
continue
fi
if [ -z "${origin}" ]; then
- echo "Error: a dependency has an empty origin in ${dp_DEPTYPE}" >&2
+ dep_err "Dependency with empty origin in ${dp_DEPTYPE}" ${_line}
err=1
continue
fi
@@ -132,6 +150,17 @@
;;
esac
+ # Take note of runtime dependencies to check them at once
+ case ${dp_DEPTYPE} in
+ LIB_DEPENDS|RUN_DEPENDS)
+ # Not quoting ${origin} as an ERE, seems unnecessary
+ if [ -z "${runtime_deps_regex}" ]; then
+ runtime_deps_regex="${origin}"
+ else
+ runtime_deps_regex="${runtime_deps_regex}|${origin}"
+ fi;;
+ esac
+
case "${origin}" in
/*) ;;
*)
@@ -170,7 +199,7 @@
case ${pattern} in
lib*.so*) fct=find_lib ;;
*)
- echo "Error: pattern ${pattern} in LIB_DEPENDS is not valid"
+ dep_err "Pattern ${pattern} in LIB_DEPENDS is not valid" ${_line}
err=1
continue
;;
@@ -189,7 +218,7 @@
[ ${pattern} = "/nonexistent" ] || anynotfound=1
if [ ! -f "${origin}/Makefile" ]; then
- echo "Error a dependency refers to a non existing origin: ${origin} in ${dp_DEPTYPE}" >&2
+ dep_err "Dependency refers to a nonexistant origin in ${dp_DEPTYPE}" ${_line}
err=1
continue
fi
@@ -200,6 +229,22 @@
[ "${fct}" = "false" ] || ${fct} "${pattern}"
echo "===> Returning to build of ${dp_PKGNAME}"
done
+
+# Check if runtime dependencies are forbidden by NORUNTIME
+if [ -n "${noruntime_file}" -a -n "${runtime_deps_regex}" ]; then
+ cur_date=$(date -u +%F)
+ OLD_IFS=$IFS
+ IFS='|'
+ awk -F\| '$0 !~ "^[[:space:]]*#" && $1 ~ "'"${runtime_deps_regex}"'"' \
+ "${noruntime_file}" |
+ while read origin exp_date reason; do
+ if [ "${exp_date}" \< "${cur_date}" ]; then
+ dep_err "Dependency forbidden at runtime, reason: ${reason}" ${origin}
+ err=1
+ fi
+ done
+ IFS=${OLD_IFS}
+fi
if [ $err -eq 1 ]; then
echo "Errors with dependencies."
Index: Mk/bsd.port.mk
===================================================================
--- Mk/bsd.port.mk
+++ Mk/bsd.port.mk
@@ -1587,26 +1587,6 @@
_POSTMKINCLUDED= yes
-.if defined(BUNDLE_LIBS)
-PKG_NOTES+= no_provide_shlib
-PKG_NOTE_no_provide_shlib= yes
-.endif
-
-.if defined(DEPRECATED)
-PKG_NOTES+= deprecated
-PKG_NOTE_deprecated=${DEPRECATED}
-.endif
-
-.if defined(EXPIRATION_DATE)
-PKG_NOTES+= expiration_date
-PKG_NOTE_expiration_date= ${EXPIRATION_DATE}
-.endif
-
-.if !empty(FLAVOR)
-PKG_NOTES+= flavor
-PKG_NOTE_flavor= ${FLAVOR}
-.endif
-
TEST_ARGS?= ${MAKE_ARGS}
TEST_ENV?= ${MAKE_ENV}
@@ -2008,6 +1988,64 @@
ERROR+= "Unknown USES=${f:C/\:.*//}"
.endif
.endfor
+
+
+# Check for forbidden runtime dependencies
+# Keep this code after all USES/USE updating {LIB,RUN}_DEPENDS.
+
+# If DEPRECATED is set and no EXPIRATION_DATE is present, we won't override, so
+# don't bother running the machinery.
+.if !defined(DEPRECATED) || defined(EXPIRATION_DATE)
+_noruntime_file=
+.for _f in ${OVERLAYS:C,$,/NORUNTIME,} ${PORTSDIR}/NORUNTIME
+.if exists(${_f}) && empty(_noruntime_file)
+_noruntime_file=${_f}
+.endif
+.endfor
+
+.if !empty(_noruntime_file)
+_runtime_orgs=
+.for _typ in LIB RUN
+_runtime_orgs+= ${${_typ}_DEPENDS:C,[^:]*:([^:]*),\1,}
+.endfor
+.if !empty(_runtime_orgs)
+_first_noruntime_dep!= awk -F\| '$$0 !~ "^[[:space:]]*\#" && $$1 ~ "${_runtime_orgs:ts|}"' \
+ ${_noruntime_file} | sort -t \| -d -k 2 | head -n 1
+.if !empty(_first_noruntime_dep)
+_exp_date!= echo '${_first_noruntime_dep}' | awk -F\| '{ print $$2; }'
+_exp_date_sooner!= [ "${EXPIRATION_DATE}" \> "${_exp_date}" ] && echo t || echo
+.if !defined(EXPIRATION_DATE) || !empty(_exp_date_sooner)
+_org!= echo '${_first_noruntime_dep}' | awk -F\| '{ print $$1; }'
+_reason!= echo '${_first_noruntime_dep}' | awk -F\| '{ print $$3; }'
+EXPIRATION_DATE:= ${_exp_date}
+DEPRECATED:= Dependency ${_org} to be forbidden at runtime for reason: ${_reason}
+.endif
+.endif # !empty(_first_noruntime_dep)
+.endif # !empty(_runtime_orgs)
+.endif # !empty(_noruntime_file)
+.endif # !defined(DEPRECATED) || defined(EXPIRATION_DATE)
+
+
+.if defined(BUNDLE_LIBS)
+PKG_NOTES+= no_provide_shlib
+PKG_NOTE_no_provide_shlib= yes
+.endif
+
+.if defined(DEPRECATED)
+PKG_NOTES+= deprecated
+PKG_NOTE_deprecated=${DEPRECATED}
+.endif
+
+.if defined(EXPIRATION_DATE)
+PKG_NOTES+= expiration_date
+PKG_NOTE_expiration_date= ${EXPIRATION_DATE}
+.endif
+
+.if !empty(FLAVOR)
+PKG_NOTES+= flavor
+PKG_NOTE_flavor= ${FLAVOR}
+.endif
+
.if defined(PORTNAME)
.include "${PORTSDIR}/Mk/bsd.sanity.mk"
Index: NORUNTIME
===================================================================
--- /dev/null
+++ NORUNTIME
@@ -0,0 +1,23 @@
+#
+# NORUNTIME -- A list of ports that cannot be used as run-time dependencies
+#
+# $FreeBSD$
+#
+# Each entry consists of a single line containing the following three fields in
+# the order named, separated with the pipe (`|') character:
+#
+# Port: The origin of the port that can't be used at runtime
+# Date: From when the restriction will be enforced (YYYY-MM-DD, UTC)
+# Why: The reason for restricting dependencies on it
+#
+# Pipe characters are forbidden in these fields.
+#
+# Keep this list sorted in chronological order. New entries must be added at
+# the tail. Reason for the restriction should start with a capital letter and
+# not end with a dot.
+#
+# If the restriction is lifted, make sure to delete the relevant line.
+#
+# Port|Date|Why
+lang/python2|2021-03-03|EOL upstream
+lang/python27|2021-03-04|EOL upstream

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 28, 3:30 PM (18 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26287133
Default Alt Text
D28946.id85213.diff (6 KB)

Event Timeline