[PATCH cygport 2/2] Add provides: and conflicts: hints

Jon Turney jon.turney@dronecode.org.uk
Sat Feb 8 13:47:00 GMT 2020


Add the ability to specify provides: and conflicts: hints in the
cygport.
---
 lib/pkg_pkg.cygpart                           | 74 ++++++++++++++++++-
 .../libmultiple1/libmultiple1-3.14-1.hint     |  2 +
 testsuite/hints/multiple/multiple.cygport     |  2 +
 .../dist/single/single-2.3.4-1.hint           |  2 +
 testsuite/hints/single/single.cygport         |  2 +
 5 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 2566190..753de9e 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -648,12 +648,56 @@ __pkg_dist() {
 #  package replaces.  An empty package will be created for each listed
 #  obsoletion which will cause PKG to be installed in its place.
 #
-#  Note that the PKG_REQUIRES name is descriptive rather than literal,
+#  Note that the PKG_OBSOLETES 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_OBSOLETES.
+#****
+#****v* Packaging/PROVIDES
+#  DESCRIPTION
+#  A single-line string containing a list of names which this package also
+#  provides.
+#  NOTE
+#  If there is more than one package in PKG_NAMES, this variable will be
+#  ignored; you must use PKG_PROVIDES instead.
+#  SEE ALSO
+#  PKG_PROVIDES
+#****
+#****v* Packaging/PKG_PROVIDES
+#  DESCRIPTION
+#  A single-line string containing a list of names which this package also
+#  provides.
+#
+#  Note that the PKG_PROVIDES 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_PROVIDES.
+#****
+#****v* Packaging/CONFLICTS
+#  DESCRIPTION
+#  A single-line string containing a comma-separated list of packages, possibly
+#  with version relations which this package conflicts with.
+#  NOTE
+#  If there is more than one package in PKG_NAMES, this variable will be
+#  ignored; you must use PKG_CONFLICTS instead.
+#  SEE ALSO
+#  PKG_CONFLICTS
+#****
+#****v* Packaging/PKG_CONFLICTS
+#  DESCRIPTION
+#  A single-line string containing a comma-separated list of packages, possibly
+#  with version relations which this package conflicts with.
+#
+#  Note that the PKG_CONFLICTS 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_CONFLICTS.
 #****
 
 	n=0;
@@ -665,6 +709,8 @@ __pkg_dist() {
 		pkg_description_var=${pkg_name[${n}]//[-+\.]/_}_DESCRIPTION;
 		pkg_message_var=${pkg_name[${n}]//[-+\.]/_}_MESSAGE;
 		pkg_obsoletes_var=${pkg_name[${n}]//[-+\.]/_}_OBSOLETES;
+		pkg_provides_var=${pkg_name[${n}]//[-+\.]/_}_PROVIDES;
+		pkg_conflicts_var=${pkg_name[${n}]//[-+\.]/_}_CONFLICTS;
 		dbg_obsoletes_var=${PN//[-+\.]/_}_debuginfo_OBSOLETES;
 
 		case ${pkg_name[${n}]} in
@@ -672,7 +718,7 @@ __pkg_dist() {
 			*)      distsubdir=${pkg_name[${n}]} ;;
 		esac
 
-		# allow REQUIRES and OBSOLETES only for single packages
+		# allow REQUIRES, OBSOLETES etc. only for single packages
 		if [ -z "${distsubdir}${!pkg_requires_var}" -a -n "${REQUIRES+yes}" ]
 		then
 			declare ${pkg_requires_var}="${REQUIRES}"
@@ -681,6 +727,15 @@ __pkg_dist() {
 		then
 			declare ${pkg_obsoletes_var}="${OBSOLETES}"
 		fi
+		if [ -z "${distsubdir}${!pkg_provides_var}" -a -n "${PROVIDES+yes}" ]
+		then
+			declare ${pkg_provides_var}="${PROVIDES}"
+		fi
+
+		if [ -z "${distsubdir}${!pkg_conflicts_var}" -a -n "${CONFLICTS+yes}" ]
+		then
+			declare ${pkg_conflicts_var}="${CONFLICTS}"
+		fi
 
 		if [ -f ${C}/${pkg_hint[${n}]%.hint}.hint ]
 		then
@@ -710,6 +765,21 @@ _EOF
 obsoletes: ${!pkg_obsoletes_var}
 _EOF
 			fi
+
+			if [ -n "${!pkg_provides_var}" ]
+			then
+				cat >> ${distdir}/${PN}/${distsubdir}/${pkg_name[${n}]}-${PVR}.hint <<-_EOF
+provides: ${!pkg_provides_var}
+_EOF
+			fi
+
+			if [ -n "${!pkg_conflicts_var}" ]
+			then
+				cat >> ${distdir}/${PN}/${distsubdir}/${pkg_name[${n}]}-${PVR}.hint <<-_EOF
+conflicts: ${!pkg_conflicts_var}
+_EOF
+			fi
+
 			if defined distsubdir
 			then
 				cat >> ${distdir}/${PN}/${distsubdir}/${pkg_name[${n}]}-${PVR}.hint <<-_EOF
diff --git a/testsuite/hints/multiple/hints/multiple-3.14-1.x86_64/dist/multiple/libmultiple1/libmultiple1-3.14-1.hint b/testsuite/hints/multiple/hints/multiple-3.14-1.x86_64/dist/multiple/libmultiple1/libmultiple1-3.14-1.hint
index 989bfb1..90f0f57 100644
--- a/testsuite/hints/multiple/hints/multiple-3.14-1.x86_64/dist/multiple/libmultiple1/libmultiple1-3.14-1.hint
+++ b/testsuite/hints/multiple/hints/multiple-3.14-1.x86_64/dist/multiple/libmultiple1/libmultiple1-3.14-1.hint
@@ -2,5 +2,7 @@ category: Base
 requires:  cygwin
 sdesc: "Summary of hints for multiple package test"
 ldesc: "Description of hints for multiple package test"
+provides: also-provides
+conflicts: conflicts-with
 external-source: multiple
 
diff --git a/testsuite/hints/multiple/multiple.cygport b/testsuite/hints/multiple/multiple.cygport
index b269ff5..ab6ade9 100644
--- a/testsuite/hints/multiple/multiple.cygport
+++ b/testsuite/hints/multiple/multiple.cygport
@@ -13,6 +13,8 @@ multiple_CATEGORY="Base"
 libmultiple1_CONTENTS=""
 libmultiple1_CATEGORY="Base"
 libmultiple1_REQUIRES="cygwin"
+libmultiple1_PROVIDES="also-provides"
+libmultiple1_CONFLICTS="conflicts-with"
 
 libmultiple_devel_CONTENTS="usr/include"
 libmultiple_devel_CATEGORY="Devel"
diff --git a/testsuite/hints/single/hints/single-2.3.4-1.x86_64/dist/single/single-2.3.4-1.hint b/testsuite/hints/single/hints/single-2.3.4-1.x86_64/dist/single/single-2.3.4-1.hint
index aa534a0..a59628c 100644
--- a/testsuite/hints/single/hints/single-2.3.4-1.x86_64/dist/single/single-2.3.4-1.hint
+++ b/testsuite/hints/single/hints/single-2.3.4-1.x86_64/dist/single/single-2.3.4-1.hint
@@ -3,4 +3,6 @@ requires:  cygwin
 sdesc: "Summary of hints for single package test"
 ldesc: "Description of hints for single package test"
 obsoletes: obsoleted-by-single
+provides: also-provides
+conflicts: conflicts-with
 
diff --git a/testsuite/hints/single/single.cygport b/testsuite/hints/single/single.cygport
index fca0706..9908a70 100644
--- a/testsuite/hints/single/single.cygport
+++ b/testsuite/hints/single/single.cygport
@@ -7,6 +7,8 @@ DESCRIPTION="Description of hints for single package test"
 CATEGORY="Base"
 REQUIRES="cygwin"
 OBSOLETES="obsoleted-by-single"
+PROVIDES="also-provides"
+CONFLICTS="conflicts-with"
 
 src_compile() {
   :
-- 
2.21.0



More information about the Cygwin-apps mailing list