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]

cygport --verbose


I don't know if that is useful and enterily correct, but it
works for me.
I little bit better than
$ bash -x /bin/cygport ...
--
Reini Urban
http://phpwiki.org/  http://murbreak.at/
--- cygport	2008-06-15 23:02:58.001000000 +0000
+++ cygport1	2008-06-28 10:19:47.218750000 +0000
@@ -79,7 +79,7 @@
 set -e;
 
 declare -rx _name=cygport;
-declare -r  _version=0.3.11;
+declare -r  _version=0.3.11a;
 
 if defined CYGPORT_BOOTSTRAP && defined top_srcdir
 then
@@ -229,6 +229,23 @@
 	return $?
 }
 
+# verbose only if --verbose
+_verbose() {
+	if [ -n "$__verbose" ]
+	then
+	    echo "${@}"
+	fi
+	"${@}"
+	return $?
+}
+
+_verbose_echo() {
+	if [ -n "$__verbose" ]
+	then
+	    echo "${@}"
+	fi
+}
+
 # for internal use only
 __stage() {
 	echo -e "\e[1;39m>>> ${1} ${PF}\e[0;0m";
@@ -239,8 +256,8 @@
 }
 
 # protect functions
-readonly -f __show_help __show_version error warning inform verbose __stage __step
-export -f error warning inform verbose
+readonly -f __show_help __show_version error warning inform verbose __stage __step _verbose
+export -f error warning inform verbose _verbose
 
 
 ################################################################################
@@ -456,7 +473,7 @@
 
 	if check_prog wget
 	then
-		if wget --no-check-certificate -O ${urifile}.tmp ${uri}
+		if _verbose wget --no-check-certificate -O ${urifile}.tmp ${uri}
 		then
 			mv -f ${urifile}.tmp ${urifile}
 		else
@@ -465,7 +482,7 @@
 		fi
 	elif check_prog curl
 	then
-		if curl -k --url ${uri} -o ${urifile}.tmp
+		if _verbose curl -k --url ${uri} -o ${urifile}.tmp
 		then
 			mv -f ${urifile}.tmp ${urifile}
 		else
@@ -615,12 +632,13 @@
 
 		if defined unpack_out
 		then
+			_verbose_echo ${unpack_cmd} ${unpack_file_path} \> ${unpack_out}
 			if ! ${unpack_cmd} ${unpack_file_path} > ${unpack_out}
 			then
 				error "${unpack_cmd} ${unpack_file_name} failed";
 			fi
 		else
-			if ! ${unpack_cmd} ${unpack_file_path}
+			if ! _verbose ${unpack_cmd} ${unpack_file_path}
 			then
 				error "${unpack_cmd} ${unpack_file_name} failed";
 			fi
@@ -650,10 +668,10 @@
 
 	if defined USE_MANAGED_MOUNT
 	then
-		mount -u -o managed $(cygpath -w ${workdir}) ${workdir} || error "managed mount creation failed"
+		_verbose mount -u -o managed $(cygpath -w ${workdir}) ${workdir} || error "managed mount creation failed"
 	fi
 
-	mkdir -p ${srcdir} ${origsrcdir} ${B} ${D} ${T} ${configdir} ${logdir} ${distdir} ${patchdir} ${spkgdir};
+	_verbose mkdir -p ${srcdir} ${origsrcdir} ${B} ${D} ${T} ${configdir} ${logdir} ${distdir} ${patchdir} ${spkgdir};
 }
 
 cygpatch() {
@@ -696,7 +714,7 @@
 			if patch -N -s --binary --dry-run -p${patchlevel} -i ${patchfile_path} &> /dev/null
 			then
 				inform "applying patch ${patchfile_name}:";
-				patch -N --binary -p${patchlevel} -i ${patchfile_path} || error "patch ${patchfile_name} failed"
+				_verbose patch -N --binary -p${patchlevel} -i ${patchfile_path} || error "patch ${patchfile_name} failed"
 				break;
 			else
 				if (( patchlevel == 3 ))
@@ -808,12 +826,12 @@
 
 	__step "Preparing working source directory";
 
-	cp -fpr ${origsrcdir}/* ${srcdir};
+	_verbose cp -fpr ${origsrcdir}/* ${srcdir};
 
-	mkdir -p ${C};
-	ln -sfn ${C} ${workdir}/CYGWIN-PATCHES;
+	_verbose mkdir -p ${C};
+	_verbose ln -sfn ${C} ${workdir}/CYGWIN-PATCHES;
 
-	cd ${S};
+	_verbose cd ${S};
 
 	if [ -f ${top}/${cygwin_patchfile} -o -f ${top}/${src_patchfile} ]
 	then
@@ -874,12 +892,12 @@
 
 		for d in $(find . -type d)
 		do
-			mkdir -p ${todir}/${d#./};
+			_verbose mkdir -p ${todir}/${d#./};
 		done
 
 		for f in $(find . ! -type d)
 		do
-			ln -sf ${fromdir}/${f#./} ${todir}/${f#./};
+			_verbose ln -sf ${fromdir}/${f#./} ${todir}/${f#./};
 		done
 	fi
 }
@@ -921,7 +939,7 @@
 				eval $(grep -h '^ac_config_files=' ${d}/configure)
 				# eval $(grep -h '^ac_config_headers=' ${d}/configure)
 
-				chmod +wx ${d}/configure;
+				_verbose chmod +wx ${d}/configure;
 
 				for f in ${ac_config_files} ${ac_config_headers}
 				do
@@ -932,7 +950,7 @@
 
 					if [ -e ${f_in} ]
 					then
-						chmod +w ${f_in};
+						_verbose chmod +w ${f_in};
 					fi
 				done
 
@@ -941,12 +959,12 @@
 
 			if $(grep -q /config.rpath configure)
 			then
-				cp -f /usr/share/gettext/config.rpath .
+				_verbose cp -f /usr/share/gettext/config.rpath .
 			fi
 
 			# Automake will exit if these are not present
 			# dodoc won't install these, however, since they will be empty
-			touch ${d}/{AUTHORS,COPYING,ChangeLog,INSTALL,NEWS,README};
+			_verbose touch ${d}/{AUTHORS,COPYING,ChangeLog,INSTALL,NEWS,README};
 		fi
 	done
 
@@ -954,8 +972,8 @@
 	# restore them afterwards
 	for f in COPYING INSTALL
 	do
-		cp ${f} ${f}.temp;
-		chmod +w ${f}.temp;
+		_verbose cp ${f} ${f}.temp;
+		_verbose chmod +w ${f}.temp;
 	done
 
 	check_prog_req autoreconf autoconf
@@ -994,7 +1012,7 @@
 
 	export WANT_AUTOCONF=${WANT_AUTOCONF:-2.5};
 	export WANT_AUTOMAKE;
-	/usr/bin/autoreconf --force -i --verbose || error "autoreconf failed"
+	_verbose /usr/bin/autoreconf --force -i --verbose || error "autoreconf failed"
 
 	for d in . ${ac_subdirs}
 	do
@@ -1103,7 +1121,7 @@
 		error "cygcmake: cmake directory not found";
 	fi
 
-	cmake \
+	_verbose cmake \
 		${cmdir} \
 		-DCMAKE_BINARY_DIR=. \
 		-DCMAKE_BUILD_TYPE=None \
@@ -1119,7 +1137,7 @@
 # standard GNU make call
 # if parallel build doesn't work for a package, call 'cygmake -j1'
 cygmake() {
-	make ${MAKEOPTS} "${@}" || error "make failed"
+	_verbose make ${MAKEOPTS} "${@}" || error "make failed"
 }
 
 # provides default src_compile
@@ -1154,10 +1172,10 @@
 	then
 		if make -n check &> /dev/null
 		then
-			make check;
+			_verbose make check;
 		elif make -n test &> /dev/null
 		then
-			make test;
+			_verbose make test;
 		else
 			error "Neither make check nor make test work.  You must define your own src_test().";
 		fi
@@ -1209,7 +1227,7 @@
 	do
 		if [ ! -d ${D}${d} ]
 		then
-			mkdir -p ${D}${d} || error "dodir ${d} failed"
+			_verbose mkdir -p ${D}${d} || error "dodir ${d} failed"
 		fi
 	done
 }
@@ -1218,7 +1236,7 @@
 keepdir() {
 	for d
 	do
-		dodir ${d}
+		_verbose dodir ${d}
 		touch ${D}${d}/.keep-${PN}
 	done
 }
@@ -1265,7 +1283,7 @@
 
 # Pre-install steps
 __prepinstalldirs() {
-	rm -fr ${D}/*;
+	_verbose rm -fr ${D}/*;
 
 	# circumvent pointless libtool relinking during install
 	find ${B} -name '*.la' -exec sed -i -e '/^relink_command/d' '{}' +;
@@ -1276,10 +1294,10 @@
 cyginstall() {
 	case ${USE_DESTDIR:-1} in
 		1|[Yy]|[Yy][Ee][Ss])
-			make ${MAKEOPTS} install DESTDIR=${D} "${@}" || error "make install DESTDIR failed"
+			_verbose make ${MAKEOPTS} install DESTDIR=${D} "${@}" || error "make install DESTDIR failed"
 			;;
 		0|[Nn]|[Nn][Oo])
-			make ${MAKEOPTS} install \
+			_verbose make ${MAKEOPTS} install \
 				prefix=${D}/usr \
 				exec_prefix=${D}/usr \
 				bindir=${D}/usr/bin/ \
@@ -1869,16 +1887,20 @@
 			;;
 	esac
 
-	cd ${workdir};
+	_verbose cd ${workdir};
 
 	# diff exits >0 when targets differ, hence catch exception with true
 	if [ "${SRC_DIR}" = "." ]
 	then
+		_verbose_echo diff -urN \
+			${origsrcdir##*/}/CYGWIN-PATCHES ${srcdir##*/}/CYGWIN-PATCHES;
 		diff -urN \
 			${origsrcdir##*/}/CYGWIN-PATCHES ${srcdir##*/}/CYGWIN-PATCHES \
 			> ${patchdir}/${cygwin_patchfile} || true;
 		difflevel=1;
 	else
+		_verbose_echo diff -urN \
+			${origsrcdir##*/}/${SRC_DIR}/CYGWIN-PATCHES ${srcdir##*/}/${SRC_DIR}/CYGWIN-PATCHES
 		diff -urN \
 			${origsrcdir##*/}/${SRC_DIR}/CYGWIN-PATCHES ${srcdir##*/}/${SRC_DIR}/CYGWIN-PATCHES \
 			> ${patchdir}/${cygwin_patchfile} || true;
@@ -1887,9 +1909,11 @@
 
 	if defined _CYGPORT_RESTRICT_diff_
 	then
-		rm -f ${patchdir}/${src_patchfile};
-		touch ${patchdir}/${src_patchfile};
+		_verbose rm -f ${patchdir}/${src_patchfile};
+		_verbose touch ${patchdir}/${src_patchfile};
 	else
+		_verbose_echo diff -urN ${diff_excludes_x} \
+			${origsrcdir##*/} ${srcdir##*/}
 		diff -urN ${diff_excludes_x} \
 			${origsrcdir##*/} ${srcdir##*/} \
 			> ${patchdir}/${src_patchfile} || true;
@@ -1897,45 +1921,45 @@
 
 	if check_prog diffstat
 	then
-		diffstat -p${difflevel} ${patchdir}/${cygwin_patchfile} \
+		_verbose diffstat -p${difflevel} ${patchdir}/${cygwin_patchfile} \
 			${patchdir}/${src_patchfile};
 	fi
 }
 
 __gpg_sign() {
 	echo "${2} signature needs to be updated";
-	rm -f ${1}.sig;
+	_verbose rm -f ${1}.sig;
 	# we 'check_prog gpg' in __pkg_srcpkg()
-	gpg --detach-sign ${1};
+	_verbose gpg --detach-sign ${1};
 }
 
 __pkg_srcpkg() {
 	local src;
 
-	rm -fr ${spkgdir}/*;
+	_verbose rm -fr ${spkgdir}/*;
 
 	echo;
 	__step "Creating source patches";
 
 	__pkg_diff;
 
-	cp ${patchdir}/${cygwin_patchfile} ${spkgdir};
+	_verbose cp ${patchdir}/${cygwin_patchfile} ${spkgdir};
 
 	if [ "x$(file -b ${patchdir}/${src_patchfile})" != "xempty" ]
 	then
-		cp ${patchdir}/${src_patchfile} ${spkgdir};
+		_verbose cp ${patchdir}/${src_patchfile} ${spkgdir};
 	fi
 
 	__step "Creating source package";
 
-	cp ${top}/${PF}.cygport ${spkgdir};
+	_verbose cp ${top}/${PF}.cygport ${spkgdir};
 
 	for src in ${_src_orig_pkgs} ${_src_orig_patches}
 	do
-		cp ${top}/${src} ${spkgdir};
+		_verbose cp ${top}/${src} ${spkgdir};
 	done
 
-	cd ${spkgdir};
+	_verbose cd ${spkgdir};
 
 	if defined SIG && [ "x${SIG}" != "x0" ]
 	then
@@ -1953,20 +1977,20 @@
 		fi
 	fi
 
-	tar cvjf ${top}/${PF}-src.tar.bz2 * || error "Source package creation failed"
+	_verbose tar cvjf ${top}/${PF}-src.tar.bz2 * || error "Source package creation failed"
 }
 
 __pkg_dist() {
 	local -i n=1;
 	local -a pkg_hint;
 
-	rm -fr ${distdir}/*;
+	_verbose rm -fr ${distdir}/*;
 
-	cd ${top};
+	_verbose cd ${top};
 
-	mkdir -p ${distdir}/${PN};
+	_verbose mkdir -p ${distdir}/${PN};
 
-	cp ${top}/${PF}-src.tar.bz2 ${top}/${PF}.tar.bz2 ${distdir}/${PN};
+	_verbose cp ${top}/${PF}-src.tar.bz2 ${top}/${PF}.tar.bz2 ${distdir}/${PN};
 
 	if (( pkg_count > 1 ))
 	then
@@ -1982,19 +2006,19 @@
 
 	if [ -f ${C}/${pkg_hint[0]%.hint}.hint ]
 	then
-		cp ${C}/${pkg_hint[0]%.hint}.hint ${distdir}/${PN}/setup.hint;
+		_verbose cp ${C}/${pkg_hint[0]%.hint}.hint ${distdir}/${PN}/setup.hint;
 	else
 		warning "${pkg_hint[0]%.hint}.hint is missing";
 	fi
 
 	while defined pkg_name[${n}]
 	do
-		mkdir -p ${distdir}/${PN}/${pkg_name[${n}]};
-		cp ${top}/${pkg_name[${n}]}-${PVR}.tar.bz2 ${distdir}/${PN}/${pkg_name[${n}]};
+		_verbose mkdir -p ${distdir}/${PN}/${pkg_name[${n}]};
+		_verbose cp ${top}/${pkg_name[${n}]}-${PVR}.tar.bz2 ${distdir}/${PN}/${pkg_name[${n}]};
 
 		if [ -f ${C}/${pkg_hint[${n}]%.hint}.hint ]
 		then
-			cp ${C}/${pkg_hint[${n}]%.hint}.hint ${distdir}/${PN}/${pkg_name[${n}]}/setup.hint;
+			_verbose cp ${C}/${pkg_hint[${n}]%.hint}.hint ${distdir}/${PN}/${pkg_name[${n}]}/setup.hint;
 		else
 			warning "${pkg_hint[${n}]%.hint}.hint is missing";
 		fi
@@ -2006,7 +2030,7 @@
 __finish() {
 	local -i n=0;
 
-	cd ${top};
+	_verbose cd ${top};
 
 	__step "Removing work directory in 5 seconds...";
 
@@ -2020,16 +2044,16 @@
 
 	__step "Removing work directory NOW.";
 
-	rm -rf ${workdir}/*;
+	_verbose rm -rf ${workdir}/*;
 
 	sleep 1;
 
 	if defined USE_MANAGED_MOUNT
 	then
-		umount -u ${workdir} || warning "managed mount removal failed";
+		_verbose umount -u ${workdir} || warning "managed mount removal failed";
 	fi
 
-	rmdir ${workdir};
+	_verbose rmdir ${workdir};
 
 	__step "Finished.";
 }
@@ -2313,6 +2337,10 @@
 			__show_version;
 			exit 0;
 			;;
+		--verbose)
+		    	__verbose=1;
+		    	shift;
+		    	;;
 		conf*|dist|spkg|src-package)
 			# deprecated commands
 			;;

--
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]