This is the mail archive of the cygwin 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]

new cygport feature: list-readme [patch]


Hi Yaakov,

Attached is a patch against current stable 0.4.2, which adds list-readme,
a list in README style format for all sub-packages.

Maybe the new feature to support .list files should be better
announced and described.
And maybe some helper is needed to detect changes in previous .list files.
-- 
Reini Urban
http://phpwiki.org/              http://murbreak.at/
difforig /bin/cygport

diff -u /bin/cygport.orig /bin/cygport
--- /bin/cygport.orig	2008-11-11 10:37:49.546875000 +0100
+++ /bin/cygport	2008-11-14 09:04:41.828125000 +0100
@@ -1727,6 +1727,7 @@
 # private:
 #	__list_deps
 #	__list_files
+#	__list_files_readme
 #	__show_info
 #
 ################################################################################
@@ -1748,6 +1749,72 @@
 	)
 }
 
+# List files in the format suitable for README
+# Files included in the ={P}= package:
+#   /usr/..
+__list_files_readme() {
+	local -i n=0;
+	local pkg_contents_var;
+	local pkg_list;
+
+	pkg_list=(${PKG_LISTS:-${PKG_NAMES}});
+
+	cd ${D};
+
+	__step "List files in the format suitable for README";
+
+	while (( n < pkg_count ))
+	do
+		if [ -f ${C}/${pkg_list[${n}]}.list ]
+		then
+			PKG_CONTENTS[${n}]=
+		fi
+		n+=1
+	done
+
+	if defined PKG_CONTENTS[*] && (( ${#PKG_CONTENTS[*]} != ${pkg_count} ))
+	then
+		error "PKG_CONTENTS[n] must be defined from 0 through $((pkg_count - 1))"
+	fi
+
+	n=0
+	while (( n < pkg_count ))
+	do
+		echo ""
+		echo "Files included in the =${pkg_name[${n}]}= package:"
+		echo ""
+
+		pkg_contents_var=${pkg_name[${n}]//[+-\.]/_}_CONTENTS;
+
+		if defined ${pkg_contents_var}
+		then
+			tar cjf ${T}/${pkg_name[${n}]}-${PVR}.tar.bz2 \
+				${!pkg_contents_var};
+			tar tjf ${T}/${pkg_name[${n}]}-${PVR}.tar.bz2 | \
+			    perl -ne 's|^|  /|; print unless m|/$|' | sort
+			rm ${T}/${pkg_name[${n}]}-${PVR}.tar.bz2
+                        
+		elif defined PKG_CONTENTS[${n}]
+		then
+			tar cjf ${T}/${pkg_name[${n}]}-${PVR}.tar.bz2 \
+				${PKG_CONTENTS[${n}]};
+			tar tjf ${T}/${pkg_name[${n}]}-${PVR}.tar.bz2 | \
+			    perl -ne 's|^|  /|; print unless m|/$|' | sort
+			rm ${T}/${pkg_name[${n}]}-${PVR}.tar.bz2
+		elif [ -f ${C}/${pkg_list[${n}]}.list ]
+		then
+			cat ${C}/${pkg_list[${n}]}.list
+		elif (( pkg_count == 1 ))
+		then
+			find . ! -type d | sed 's!^\.!  /!' | sort
+		else
+			inform "empty"
+		fi
+		echo;
+		n+=1;
+	done
+}
+
 __list_deps() {
 	(local d
 
@@ -1775,7 +1842,7 @@
 }
 
 # protect functions
-readonly -f __list_files __list_deps __show_info
+readonly -f __list_files __list_files_readme __list_deps __show_info
 
 
 ################################################################################
@@ -2435,6 +2502,10 @@
 			__list_files;
 			_status=$?;
 			;;
+		list-readme)
+			__list_files_readme;
+			_status=$?;
+			;;
 		dep*)
 			__list_deps;
 			_status=$?;
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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