[PATCH cygport 2/4] pkg_dist: add support for dependencies with version relations

Ken Brown kbrown@cornell.edu
Mon Jun 25 15:10:00 GMT 2018


This uses a new [PKG_]DEPENDS variable, whose contents are propagated
into the 'depends:' field of the generated .hint file along with the
contents of [PKG_]REQUIRES.
---
 lib/pkg_pkg.cygpart | 63 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 56 insertions(+), 7 deletions(-)

diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 91a0865..ef3acc3 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -515,7 +515,7 @@ __pkg_dist() {
 	local distsubdir;
 	local obssubdir obspkg;
 	local pkg_category_var pkg_requires_var pkg_summary_var;
-	local pkg_bin_requires pkg_depends;
+	local pkg_bin_requires pkg_depends pkg_depends_var;
 	local pkg_description_var pkg_message_var pkg_obsoletes_var;
 	local pkg_tag=${1};
 
@@ -611,7 +611,7 @@ __pkg_dist() {
 #    ignored; you must use PKG_REQUIRES instead.
 #  * Any newlines in this variable must be escaped.
 #  SEE ALSO
-#  PKG_REQUIRES
+#  PKG_REQUIRES, DEPENDS
 #****
 #****v* Packaging/PKG_REQUIRES
 #  DESCRIPTION
@@ -631,6 +631,45 @@ __pkg_dist() {
 #    needed for commands called by scripts or in code with fork(), libraries
 #    which are accessed by dlopen(), or data used by your package at runtime.
 #  * Any newlines in this variable must be escaped.
+#  SEE ALSO
+#  PKG_DEPENDS
+#****
+#****v* Packaging/DEPENDS
+#  DESCRIPTION
+#  A single-line string containing a comma-separated list of packages,
+#  possibly with version relations, on which this package
+#  depends. This will be added to the depends: field of the
+#  auto-generated .hint file.
+#  NOTES
+#  * Do not confuse DEPENDS with DEPEND, which is an obsolete alias
+#    for BUILD_DEPENDS.
+#  * Dependencies without version relations can be listed either in
+#    DEPENDS or in REQUIRES.
+#  * If there is more than one package in PKG_NAMES, this variable will be
+#    ignored; you must use PKG_DEPENDS instead.
+#  * Any newlines in this variable must be escaped.
+#  SEE ALSO
+#  PKG_DEPENDS, REQUIRES
+#****
+#****v* Packaging/PKG_DEPENDS
+#  DESCRIPTION
+#  A single-line string containing a comma-separated list of packages,
+#  possibly with version relations, on which this package
+#  depends. This will be added to the depends: field of the
+#  auto-generated .hint file.
+#
+#  Note that the PKG_DEPENDS name is descriptive rather than literal,
+#  where "PKG" should be substituted with the name of the binary package
+#  whose contents it describes.  When a package contains a character which
+#  cannot be used in a shell variable name (namely '+', '-', and '.'),
+#  that character must be substituted with an underscore ('_'), e.g.
+#  libfoo-devel will use libfoo_devel_DEPENDS.
+#  NOTES
+#  * Dependencies without version relations can be listed either in
+#    PKG_DEPENDS or in PKG_REQUIRES.
+#  * Any newlines in this variable must be escaped.
+#  SEE ALSO
+#  PKG_REQUIRES
 #****
 #****v* Packaging/OBSOLETES
 #  DESCRIPTION
@@ -662,6 +701,7 @@ __pkg_dist() {
 	do
 		pkg_category_var=${pkg_name[${n}]//[-+\.]/_}_CATEGORY;
 		pkg_requires_var=${pkg_name[${n}]//[-+\.]/_}_REQUIRES;
+		pkg_depends_var=${pkg_name[${n}]//[-+\.]/_}_DEPENDS;
 		pkg_summary_var=${pkg_name[${n}]//[-+\.]/_}_SUMMARY;
 		pkg_description_var=${pkg_name[${n}]//[-+\.]/_}_DESCRIPTION;
 		pkg_message_var=${pkg_name[${n}]//[-+\.]/_}_MESSAGE;
@@ -673,12 +713,22 @@ __pkg_dist() {
 			*)      distsubdir=${pkg_name[${n}]} ;;
 		esac
 
-		# allow REQUIRES and OBSOLETES only for single packages
+		# allow REQUIRES, DEPENDS, and OBSOLETES only for single packages
 		if [ -z "${distsubdir}${!pkg_requires_var}" -a -n "${REQUIRES+yes}" ]
 		then
 			declare ${pkg_requires_var}="${REQUIRES}"
 		fi
 		declare ${pkg_requires_var}="$(echo ${!pkg_requires_var} | sed -e 's/ /, /g')"
+		if [ -z "${distsubdir}${!pkg_depends_var}" -a -n "${DEPENDS+yes}" ]
+		then
+			declare ${pkg_depends_var}="${DEPENDS}"
+		fi
+		if [ -n "${!pkg_depends_var}" -a -n "${!pkg_requires_var}" ]
+		then
+		    pkg_depends="${!pkg_depends_var}, ${!pkg_requires_var}"
+		else
+		    pkg_depends="${!pkg_depends_var}${!pkg_requires_var}"
+		fi
 		if [ -z "${distsubdir}${!pkg_obsoletes_var}" -a -n "${OBSOLETES+yes}" ]
 		then
 			declare ${pkg_obsoletes_var}="${OBSOLETES}"
@@ -694,15 +744,14 @@ __pkg_dist() {
 				pkg_bin_requires=$(__list_deps $(sort -fu ${T}/.${pkg_name[${n}]}.lst | sed -e '\|/$|d;s| |^_^|g') \
 						   | sort -fu | sed -e "/^${pkg_name[${n}]}-[0-9].*$/d;s/-[0-9].*$//g" \
 						   | sed -e ':a;N;$!ba;s/\n/, /g')
-				if [ -n  "${pkg_bin_requires}" -a -n "${!pkg_requires_var}" ]
+				if [ -n  "${pkg_bin_requires}" -a -n "${pkg_depends}" ]
 				then
-				    pkg_depends="${pkg_bin_requires}, ${!pkg_requires_var}"
+				    pkg_depends="${pkg_bin_requires}, ${pkg_depends}"
 				else
-				    pkg_depends="${pkg_bin_requires}${!pkg_requires_var}"
+				    pkg_depends="${pkg_bin_requires}${pkg_depends}"
 				fi
 				__step "${pkg_name[${n}]} requires: ${pkg_depends}"
 			else
-				pkg_depends="${!pkg_requires_var}"
 				inform "ADD ${distsubdir:-${PN}} DLL DEPENDENCIES TO ${PN}${distsubdir:+/}${distsubdir}/${pkg_name[${n}]}-${PVR}.hint"
 			fi
 
-- 
2.17.0



More information about the Cygwin-apps mailing list