The automatically generated dependencies sometimes have unwanted
components.  This patch allows to suppress these on a per-package basis,
rather than requiring to patch the generated hint files after the fact.

>From 009dbf010418afb873a75bdb204d77fdf1f83ac7 Mon Sep 17 00:00:00 2001
From: Achim Gratz <strom...@stromeko.de>
Date: Wed, 3 Jun 2020 13:41:18 +0200
Subject: [PATCH] pkg_pkg: allow suppression of spurious package dependencies

Allow suppression of spurious automatic package dependencies by
introducing a new variable PKG_REQUIRES_SUPPRESS, containing a
single-line string of space-separated package list.  Any of the
packages listed are automatically determined to be a requirement are
suppressed so that they do not show up in the generated hint file(s).
---
 lib/pkg_pkg.cygpart | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 7189f36..9603c1d 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -1,3 +1,4 @@
+# -*- mode: sh; sh-shell: bash -*-
 ################################################################################
 #
 # pkg_pkg.cygpart - cygport packaging functions
@@ -787,6 +788,7 @@ __pkg_dist() {
 	do
 		pkg_category_var=${pkg_name[${n}]//[-+\.]/_}_CATEGORY;
 		pkg_requires_var=${pkg_name[${n}]//[-+\.]/_}_REQUIRES;
+		pkg_requires_suppress_var=${pkg_name[${n}]//[-+\.]/_}_REQUIRES_SUPPRESS;
 		pkg_summary_var=${pkg_name[${n}]//[-+\.]/_}_SUMMARY;
 		pkg_description_var=${pkg_name[${n}]//[-+\.]/_}_DESCRIPTION;
 		pkg_message_var=${pkg_name[${n}]//[-+\.]/_}_MESSAGE;
@@ -806,6 +808,10 @@ __pkg_dist() {
 		then
 			declare ${pkg_requires_var}="${REQUIRES}"
 		fi
+		if [ -z "${distsubdir}${!pkg_requires_suppress_var}" -a -n "${REQUIRES_SUPPRESS+yes}" ]
+		then
+			declare ${pkg_requires_var}="${REQUIRES_SUPPRESS}"
+		fi
 		if [ -z "${distsubdir}${!pkg_obsoletes_var}" -a -n "${OBSOLETES+yes}" ]
 		then
 			declare ${pkg_obsoletes_var}="${OBSOLETES}"
@@ -827,9 +833,11 @@ __pkg_dist() {
 		then
 			if [ "${CBUILD##*-}" = "cygwin" ]
 			then
-				pkg_bin_requires=$(__list_deps $(sort -fu ${T}/.${pkg_name[${n}]}.lst | sed -e '\|/$|d;s| |^_^|g') \
-						   | sed -e "/^${pkg_name[${n}]}-[0-9].*$/d;s/-[0-9].*$//g" \
-						   | sort -fu | sed -e ':a;N;$!ba;s/\n/ /g' )
+			    pkg_bin_requires=$( echo ${!pkg_requires_suppress_var} ${!pkg_requires_suppress_var} \
+						$(__list_deps $(sort -fu ${T}/.${pkg_name[${n}]}.lst | sed -e '\|/$|d;s| |^_^|g') \
+						      | sed -e "/^${pkg_name[${n}]}-[0-9].*$/d;s/-[0-9].*$//g" \
+						      | sort -fu | sed -e ':a;N;$!ba;s/\n/ /g' ) \
+						    | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ' )
 				__step "${pkg_name[${n}]} requires: ${pkg_bin_requires} ${!pkg_requires_var}"
 			else
 				pkg_bin_requires=
-- 
2.26.2


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra

Reply via email to