This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[cygport] [PATCH] Add support for VERSIONS


Add VERSIONS and PKG_VERSIONS to specify the versions included in
the auto-generated hints.
---
 lib/pkg_pkg.cygpart |   75 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 3e69c48..cb25ad4 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -466,6 +466,64 @@ __pkg_srcpkg() {
 	echo;
 }
 
+__pkg_versions() {
+	local -i n;
+	local -a vers;
+	local ver_tag;
+	local pkg_version_var;
+
+	if defined $1
+	then
+		pkg_version_var=$1;
+	else
+		pkg_version_var=VERSIONS;
+	fi
+
+	if [ -n "${!pkg_version_var}" ]
+	then
+		vers=(${!pkg_version_var});
+		if (( ${#vers[*]} < 2 ))
+		then
+			error "${pkg_version_var} requires at least two versions."
+		fi
+
+		n=0;
+		while defined vers[${n}]
+		do
+			ver_tag=${vers[${n}]%:*}
+			case ${ver_tag} in
+				prev|curr|test) ;;
+				*) error "${pkg_version_var}: Invalid version tag ${ver_tag}" ;;
+			esac
+			echo "${ver_tag}: ${vers[${n}]#*:}" >> $2;
+			n+=1;
+		done
+	fi
+}
+
+#****v* Packaging/VERSIONS
+#  DESCRIPTION
+#  A single-line string containing the version that will be added to
+#  the auto-generated hint. The string consists of space-separated
+#  tag:version pairs. The allowed tags are prev, curr, and test, and
+#  at least two must be provided.
+#  SEE ALSO
+#  PKG_VERSION
+#****
+#****v* Packaging/PKG_VERSIONS
+#  DESCRIPTION
+#  A single-line string containing the version that will be added to
+#  the auto-generated hint. The string consists of space-separated
+#  tag:version pairs. The allowed tags are prev, curr, and test, and
+#  at least two must be provided.
+#
+#  Note that the PKG_VERSIONS 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_VERSIONS.
+#****
 __pkg_dist() {
 	local -i n;
 	local -a pkg_hint;
@@ -601,6 +659,7 @@ __pkg_dist() {
 		pkg_summary_var=${pkg_name[${n}]//[-+\.]/_}_SUMMARY;
 		pkg_description_var=${pkg_name[${n}]//[-+\.]/_}_DESCRIPTION;
 		pkg_message_var=${pkg_name[${n}]//[-+\.]/_}_MESSAGE;
+		pkg_versions_var=${pkg_name[${n}]//[-+\.]/_}_VERSIONS;
 
 		case ${pkg_name[${n}]} in
 			${PN})  distsubdir="" ;;
@@ -637,8 +696,15 @@ category: ${!pkg_category_var:-${CATEGORY}}
 requires: ${pkg_bin_requires} ${!pkg_requires_var}
 sdesc: "${!pkg_summary_var:-${SUMMARY}}"
 ldesc: "${!pkg_description_var:-${DESCRIPTION:-${!pkg_summary_var:-${SUMMARY}}}}"
-${distsubdir:+external-source: ${PN}}
 _EOF
+
+	                if defined distsubdir
+			then
+				echo "external-source: ${PN}" >> ${distdir}/${PN}/${distsubdir}/setup.hint
+			fi
+
+			__pkg_versions ${pkg_versions_var} ${distdir}/${PN}/${distsubdir}/setup.hint
+
 			if defined ${pkg_message_var}
 			then
 				cat >> ${distdir}/${PN}/${distsubdir}/setup.hint <<-_EOF
@@ -672,6 +738,8 @@ sdesc: "Debug info for ${PN}"
 ldesc: "This package contains files necessary for debugging the
 ${PN} package with gdb."
 _EOF
+
+                        __pkg_versions ${PN}-debuginfo ${distdir}/${PN}/${PN}-debuginfo/setup.hint
 		fi
 	fi
 
@@ -681,6 +749,7 @@ _EOF
 		pkg_category_var=${PN//[-+\.]/_}_CATEGORY;
 		pkg_summary_var=${PN//[-+\.]/_}_SUMMARY;
 		pkg_description_var=${PN//[-+\.]/_}_DESCRIPTION;
+		pkg_versions_var=${PN//[-+\.]/_}_VERSIONS;
 
 		if [ -f ${C}/${PN}.hint ]
 		then
@@ -697,6 +766,8 @@ requires:
 sdesc: "${!pkg_summary_var:-${SUMMARY}}"
 ldesc: "${!pkg_description_var:-${DESCRIPTION:-${!pkg_summary_var:-${SUMMARY}}}}"
 _EOF
+
+                        __pkg_versions ${pkg_versions_var} ${distdir}/${PN}/${distsubdir}/setup.hint
 		else
 			warning "${PN}.hint is missing";
 		fi
@@ -704,4 +775,4 @@ _EOF
 }
 
 # protect functions
-readonly -f __pkg_binpkg __pkg_diff __gpg_sign __pkg_srcpkg __pkg_dist
+readonly -f __pkg_binpkg __pkg_diff __gpg_sign __pkg_srcpkg __pkg_dist __pkg_versions
-- 
1.7.9


-- 
David Rothenberger  ----  daveroth@acm.org

Great American Axiom:
        Some is good, more is better, too much is just right.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]