public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH cygport 2/4] pkg_dist: add support for dependencies with version relations
  2018-06-25 15:10 [PATCH cygport 0/4] Support dependencies with version relations Ken Brown
  2018-06-25 15:10 ` [PATCH cygport 3/4] pkg_dist: record package versions in "depends:" Ken Brown
@ 2018-06-25 15:10 ` Ken Brown
  2018-06-25 15:10 ` [PATCH cygport 4/4] Update sample.cygport Ken Brown
  2018-06-25 15:10 ` [PATCH cygport 1/4] pkg_dist: use 'depends:' instead of 'requires:' in generated .hint files Ken Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Ken Brown @ 2018-06-25 15:10 UTC (permalink / raw)
  To: cygwin-apps

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH cygport 4/4] Update sample.cygport
  2018-06-25 15:10 [PATCH cygport 0/4] Support dependencies with version relations Ken Brown
  2018-06-25 15:10 ` [PATCH cygport 3/4] pkg_dist: record package versions in "depends:" Ken Brown
  2018-06-25 15:10 ` [PATCH cygport 2/4] pkg_dist: add support for dependencies with version relations Ken Brown
@ 2018-06-25 15:10 ` Ken Brown
  2018-06-25 15:10 ` [PATCH cygport 1/4] pkg_dist: use 'depends:' instead of 'requires:' in generated .hint files Ken Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Ken Brown @ 2018-06-25 15:10 UTC (permalink / raw)
  To: cygwin-apps

Use BUILD_DEPENDS instead of DEPEND, and illustrate how to use DEPENDS
instead of REQUIRES.
---
 data/sample.cygport | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/data/sample.cygport b/data/sample.cygport
index 4d875de..4617ca7 100644
--- a/data/sample.cygport
+++ b/data/sample.cygport
@@ -15,13 +15,21 @@ SRC_URI="https://github.com/cygwinports/cygport/${VERSION}/cygport-${VERSION}.ta
 ARCH=noarch
 
 # Build dependencies only
-DEPEND="groff help2man robodoc"
+BUILD_DEPENDS="groff help2man robodoc"
 # runtime deps to go in setup.hint, and note the escaped newline
 REQUIRES="autoconf automake binutils bzip2 coreutils diffstat diffutils \
 dos2unix findutils file gawk gcc-core gcc-g++ grep gzip lftp libtool lndir \
 make openssh patch perl-Authen-SASL perl-MIME-tools perl-Net-SMTP-SSL rsync \
 sed tar texinfo unzip util-linux wget which xz"
 
+# Use DEPENDS instead of REQUIRES to specify version relations.  Note
+# the commas.
+# DEPENDS="autoconf (>=13-1), automake (>=10-1), binutils, bzip2, \
+# coreutils, diffstat, diffutils, dos2unix, findutils, file, gawk, \
+# gcc-core, gcc-g++, grep, gzip, lftp, libtool, lndir, make, openssh, \
+# patch, perl-Authen-SASL, perl-MIME-tools, perl-Net-SMTP-SSL, rsync, \
+# sed, tar, texinfo, unzip, util-linux, wget, which, xz"
+
 # We use the src_compile and src_test provided by meson.cygclass
 
 src_install() {
-- 
2.17.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH cygport 1/4] pkg_dist: use 'depends:' instead of 'requires:' in generated .hint files
  2018-06-25 15:10 [PATCH cygport 0/4] Support dependencies with version relations Ken Brown
                   ` (2 preceding siblings ...)
  2018-06-25 15:10 ` [PATCH cygport 4/4] Update sample.cygport Ken Brown
@ 2018-06-25 15:10 ` Ken Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Ken Brown @ 2018-06-25 15:10 UTC (permalink / raw)
  To: cygwin-apps

This paves the way for supporting dependencies with version relations,
which are allowed in the 'depends:' field but not in the 'requires:'
field.
---
 lib/pkg_pkg.cygpart | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 3f9a9a7..91a0865 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -515,6 +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_description_var pkg_message_var pkg_obsoletes_var;
 	local pkg_tag=${1};
 
@@ -598,8 +599,8 @@ __pkg_dist() {
 #****
 #****v* Packaging/REQUIRES
 #  DESCRIPTION
-#  A single-line strings containing a list of packages on which this
-#  package depends. This will be added to the requires: field of the
+#  A single-line string containing a list of packages on which this
+#  package depends. This will be added to the depends: field of the
 #  auto-generated .hint file.
 #  NOTES
 #  * cygport attempts to automatically detect many types of package
@@ -614,8 +615,8 @@ __pkg_dist() {
 #****
 #****v* Packaging/PKG_REQUIRES
 #  DESCRIPTION
-#  A single-line strings containing a list of packages on which this
-#  package depends. This will be added to the requires: field of the
+#  A single-line string containing a list of packages on which this
+#  package depends. This will be added to the depends: field of the
 #  auto-generated .hint file.
 #
 #  Note that the PKG_REQUIRES name is descriptive rather than literal,
@@ -677,6 +678,7 @@ __pkg_dist() {
 		then
 			declare ${pkg_requires_var}="${REQUIRES}"
 		fi
+		declare ${pkg_requires_var}="$(echo ${!pkg_requires_var} | sed -e 's/ /, /g')"
 		if [ -z "${distsubdir}${!pkg_obsoletes_var}" -a -n "${OBSOLETES+yes}" ]
 		then
 			declare ${pkg_obsoletes_var}="${OBSOLETES}"
@@ -691,16 +693,22 @@ __pkg_dist() {
 			then
 				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')
-				__step "${pkg_name[${n}]} requires: ${pkg_bin_requires} ${!pkg_requires_var}"
+						   | sed -e ':a;N;$!ba;s/\n/, /g')
+				if [ -n  "${pkg_bin_requires}" -a -n "${!pkg_requires_var}" ]
+				then
+				    pkg_depends="${pkg_bin_requires}, ${!pkg_requires_var}"
+				else
+				    pkg_depends="${pkg_bin_requires}${!pkg_requires_var}"
+				fi
+				__step "${pkg_name[${n}]} requires: ${pkg_depends}"
 			else
-				pkg_bin_requires=
+				pkg_depends="${!pkg_requires_var}"
 				inform "ADD ${distsubdir:-${PN}} DLL DEPENDENCIES TO ${PN}${distsubdir:+/}${distsubdir}/${pkg_name[${n}]}-${PVR}.hint"
 			fi
 
 			cat > ${distdir}/${PN}/${distsubdir}/${pkg_name[${n}]}-${PVR}.hint <<-_EOF
 category: ${!pkg_category_var:-${CATEGORY}}
-requires: ${pkg_bin_requires} ${!pkg_requires_var}
+depends: ${pkg_depends}
 sdesc: "${!pkg_summary_var:-${SUMMARY}}"
 ldesc: "${!pkg_description_var:-${DESCRIPTION:-${!pkg_summary_var:-${SUMMARY}}}}"
 _EOF
-- 
2.17.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH cygport 0/4] Support dependencies with version relations
@ 2018-06-25 15:10 Ken Brown
  2018-06-25 15:10 ` [PATCH cygport 3/4] pkg_dist: record package versions in "depends:" Ken Brown
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ken Brown @ 2018-06-25 15:10 UTC (permalink / raw)
  To: cygwin-apps

This patch series presupposes the name change of DEPEND to
BUILD_DEPENDS proposed by Jon in
https://sourceware.org/ml/cygwin-apps/2017-10/msg00018.html.

Ever since setup began using libsolv, setup (and calm) are able to
support dependencies with version relations.  These can be specified
in the 'depends:' field of a .hint file like this:

depends: cygwin (>=2.10), bash (=4.4.12-3)

This patch series adds cygport support for such dependencies.  The
user can specify versioned dependencies via a new [PKG_]DEPENDS
variable, and cygport generates versioned dependencies in its
auto-generated .hint files.  The latter is intended to avoid problems
like the one reported here:

  https://cygwin.com/ml/cygwin/2018-03/msg00365.html

An obvious potential problem is the confusion between the new DEPENDS
and the old DEPEND (which is an obsolete alias for BUILD_DEPENDS after
Jon's renaming).  I've chosen to ignore that problem in these patches,
except for a warning in the documentation.  At the very least, a
HEADSUP email to maintainers will be required.  Alternatively, we
could drop DEPENDS and insist on PKG_DEPENDS even if there's only one
package.


Ken Brown (4):
  pkg_dist: use 'depends:' instead of 'requires:' in generated .hint
    files
  pkg_dist: add support for dependencies with version relations
  pkg_dist: record package versions in "depends:"
  Update sample.cygport

 data/sample.cygport | 10 ++++-
 lib/pkg_pkg.cygpart | 91 +++++++++++++++++++++++++++++++++++++++------
 2 files changed, 88 insertions(+), 13 deletions(-)

-- 
2.17.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH cygport 3/4] pkg_dist: record package versions in "depends:"
  2018-06-25 15:10 [PATCH cygport 0/4] Support dependencies with version relations Ken Brown
@ 2018-06-25 15:10 ` Ken Brown
  2018-06-25 15:10 ` [PATCH cygport 2/4] pkg_dist: add support for dependencies with version relations Ken Brown
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ken Brown @ 2018-06-25 15:10 UTC (permalink / raw)
  To: cygwin-apps

For each generated dependency, add a version relation that specifies a
version greater than or equal to the currently installed version.
This should prevent users from updating a package without updating its
dependencies.

https://cygwin.com/ml/cygwin/2018-03/msg00365.html
---
 lib/pkg_pkg.cygpart | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index ef3acc3..ae85428 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -627,9 +627,10 @@ __pkg_dist() {
 #  libfoo-devel will use libfoo_devel_REQUIRES.
 #  NOTES
 #  * cygport attempts to automatically detect many types of package
-#    dependencies, which do not need to be listed in REQUIRES.  This is still
-#    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.
+#    dependencies, which do not need to be listed in PKG_REQUIRES.
+#    This is still 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
@@ -643,6 +644,10 @@ __pkg_dist() {
 #  NOTES
 #  * Do not confuse DEPENDS with DEPEND, which is an obsolete alias
 #    for BUILD_DEPENDS.
+#  * cygport attempts to automatically detect many types of package
+#    dependencies, which do not need to be listed in DEPENDS.  This is still
+#    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.
 #  * 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
@@ -667,6 +672,11 @@ __pkg_dist() {
 #  NOTES
 #  * Dependencies without version relations can be listed either in
 #    PKG_DEPENDS or in PKG_REQUIRES.
+#  * cygport attempts to automatically detect many types of package
+#    dependencies, which do not need to be listed in PKG_DEPENDS.
+#    This is still 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_REQUIRES
@@ -742,7 +752,7 @@ __pkg_dist() {
 			if [ "${CBUILD##*-}" = "cygwin" ]
 			then
 				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" \
+						   | sort -fu | sed -e "/^${pkg_name[${n}]}-[0-9].*$/d;s/-\([0-9].*\)$/ (>=\1)/g" \
 						   | sed -e ':a;N;$!ba;s/\n/, /g')
 				if [ -n  "${pkg_bin_requires}" -a -n "${pkg_depends}" ]
 				then
-- 
2.17.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-25 15:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-25 15:10 [PATCH cygport 0/4] Support dependencies with version relations Ken Brown
2018-06-25 15:10 ` [PATCH cygport 3/4] pkg_dist: record package versions in "depends:" Ken Brown
2018-06-25 15:10 ` [PATCH cygport 2/4] pkg_dist: add support for dependencies with version relations Ken Brown
2018-06-25 15:10 ` [PATCH cygport 4/4] Update sample.cygport Ken Brown
2018-06-25 15:10 ` [PATCH cygport 1/4] pkg_dist: use 'depends:' instead of 'requires:' in generated .hint files Ken Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).