Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2013 00:30:01 GMT
From:      Ken DEGUCHI <kdeguchi@sz.tokoha-u.ac.jp>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/182371: ports-mgmt/pkg_replace: fixup pattrn matching in pkg_glob() function
Message-ID:  <201309260030.r8Q0U1xI067411@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/182371; it has been noted by GNATS.

From: Ken DEGUCHI <kdeguchi@sz.tokoha-u.ac.jp>
To: <bug-followup@FreeBSD.org>, <ii@any.com.ru>
Cc:  
Subject: Re: ports/182371: ports-mgmt/pkg_replace: fixup pattrn matching in
 pkg_glob() function
Date: Thu, 26 Sep 2013 09:28:58 +0900

 --Multipart=_Thu__26_Sep_2013_09_28_58_+0900_tiFsq5yt=0eJ3XLp
 Content-Type: text/plain; charset="US-ASCII"
 Content-Transfer-Encoding: 7bit
 
 Sorry, I forgot to delete a patch file in "files" directory.
 
 --Multipart=_Thu__26_Sep_2013_09_28_58_+0900_tiFsq5yt=0eJ3XLp
 Content-Type: text/plain; name="patch-pkg_replace.txt"
 Content-Disposition: attachment; filename="patch-pkg_replace.txt"
 Content-Transfer-Encoding: 7bit
 
 diff -Nur pkg_replace.orig/Makefile pkg_replace/Makefile
 --- pkg_replace.orig/Makefile	2013-09-23 07:03:25.927883718 +0900
 +++ pkg_replace/Makefile	2013-09-26 06:42:16.314885105 +0900
 @@ -3,11 +3,14 @@
  
  PORTNAME=	pkg_replace
  PORTVERSION=	0.8.0
 -PORTREVISION=	2
 +PORTREVISION=	3
  CATEGORIES=	ports-mgmt
  MASTER_SITES=	${MASTER_SITE_SOURCEFORGE_JP}
  MASTER_SITE_SUBDIR=portutil/22116
  
 +PATCH_SITES=	http://member.tokoha-u.ac.jp/~kdeguchi/download/
 +PATCHFILES=	patch-sbin-pkg_replace-pkg_replace.sh
 +
  MAINTAINER=	kdeguchi@sz.tokoha-u.ac.jp
  COMMENT=	Utility for upgrading installed packages
  
 @@ -15,8 +18,7 @@
  MAKE_ARGS=	PREFIX="${PREFIX}" \
  		PORTSDIR="${PORTSDIR}" PKG_DBDIR="${PKG_DBDIR}"
  
 -MAN1=		pkg_replace.1
 -MANCOMPRESSED=	maybe
 +#MANCOMPRESSED=	maybe
  
  OPTIONS_DEFINE=		ZSH
  
 @@ -29,13 +31,8 @@
  
  OPTIONS_SUB=	yes
  
 -NO_STAGE=	yes
  .include <bsd.port.options.mk>
  
 -.if ${PORT_OPTIONS:MPKGDB_FIX}
 -MAN1+=	pkgdb_fix.1
 -.endif
 -
  post-patch:
  .if ${PORT_OPTIONS:MPKGDB_FIX}
  	@${REINPLACE_CMD} -e 's/pkg_replace/pkg_replace pkgdb_fix/;' ${WRKSRC}/sbin/Makefile
 @@ -44,4 +41,9 @@
  	@${REINPLACE_CMD} -e  's/^	sbin \\$$/	sbin/;s/^	share$$//;' ${WRKSRC}/Makefile
  .endif
  
 +pre-install:
 +.if ${PORT_OPTIONS:MZSH}
 +	${MKDIR} ${STAGEDIR}${LOCALBASE}/share/zsh/site-functions
 +.endif
 +
  .include <bsd.port.mk>
 diff -Nur pkg_replace.orig/distinfo pkg_replace/distinfo
 --- pkg_replace.orig/distinfo	2012-08-23 06:57:58.000000000 +0900
 +++ pkg_replace/distinfo	2013-09-26 06:02:20.736882949 +0900
 @@ -1,2 +1,4 @@
  SHA256 (pkg_replace-0.8.0.tar.bz2) = 3092f5fc0d18529eb5d38776941c0ee4d0073ecb524ab17671c81ca69c29e214
  SIZE (pkg_replace-0.8.0.tar.bz2) = 17296
 +SHA256 (patch-sbin-pkg_replace-pkg_replace.sh) = 30a4f9037c1d2ffbc3b8076bec9be47e67ea0beb9c85687597e8d36845bbcc56
 +SIZE (patch-sbin-pkg_replace-pkg_replace.sh) = 11124
 diff -Nur pkg_replace.orig/files/patch-pkg_replace_pkgng pkg_replace/files/patch-pkg_replace_pkgng
 --- pkg_replace.orig/files/patch-pkg_replace_pkgng	2013-09-23 07:03:26.068883357 +0900
 +++ pkg_replace/files/patch-pkg_replace_pkgng	1970-01-01 09:00:00.000000000 +0900
 @@ -1,423 +0,0 @@
 ---- sbin/pkg_replace/pkg_replace.sh.orig	2007-01-25 21:55:46.000000000 +0900
 -+++ sbin/pkg_replace/pkg_replace.sh	2013-09-03 06:58:43.000000000 +0900
 -@@ -125,14 +125,27 @@
 - 	: ${PACKAGEROOT="ftp://ftp.NetBSD.org"}
 - 	: ${PKG_SUFX=".tgz"}
 - #else
 -+	: ${use_pkgng="`/usr/bin/make -f/usr/share/mk/bsd.port.mk -V WITH_PKGNG`"}
 -+	if [ "x${use_pkgng}" = "xdevel" ]; then
 -+		use_pkgng="yes"
 -+	fi
 - 	: ${PORTSDIR="/usr/ports"}
 -+	if is_yes ${use_pkgng}; then
 -+	: ${PKGREPOSITORY="/var/cache/pkg/All"}
 -+	else
 - 	: ${PKGREPOSITORY="${PORTSDIR}/packages/All"}
 -+	fi
 - #ifdef WITH_OPENBSD
 - 	: ${PACKAGEROOT="ftp://ftp.OpenBSD.org"}
 - 	: ${PKG_SUFX=".tgz"}
 - #else
 -+	if is_yes ${use_pkgng}; then
 -+	: ${PACKAGEROOT="http://pkgbeta.FreeBSD.org"}
 -+	: ${PKG_SUFX=".txz"}
 -+	else
 - 	: ${PACKAGEROOT="ftp://ftp.FreeBSD.org"}
 - 	: ${PKG_SUFX=".tbz"}
 -+	fi
 - #endif
 - #endif
 - 	: ${PKG_BACKUP_DIR=${PKGREPOSITORY}}
 -@@ -152,10 +165,18 @@
 - }
 - 
 - init_pkgtools() {
 -+	if is_yes ${use_pkgng}; then
 -+	PKG_ADD="pkg add"
 -+	PKG_CREATE="pkg create"
 -+	PKG_DELETE="pkg delete"
 -+	PKG_INFO="pkg info"
 -+	PKG_SET="pkg set"
 -+	else
 - 	PKG_ADD="pkg_add"
 - 	PKG_CREATE="pkg_create"
 - 	PKG_DELETE="pkg_delete"
 - 	PKG_INFO="pkg_info"
 -+	fi
 - 	MAKE="@MAKE@"
 - }
 - 
 -@@ -213,7 +234,7 @@
 - 			expand_path 'file' "${p##*=}"
 - 			file_exist "${file}" || continue
 - 			p=${p%=*} ;;
 --		*.t[bg]z)
 -+		*.t[bgx]z)
 - 			expand_path 'file' "$p"
 - 			get_pkgname_for_binary 'p' "${file}" || continue
 - 			p=${p%-*} ;;
 -@@ -423,6 +444,7 @@
 - 	file_exist "$2" || return 1
 - 
 - 	case $2 in
 -+	*.txz)	_opt=J ;;
 - 	*.tbz)	_opt=j ;;
 - 	*.tgz)	_opt=z ;;
 - 	*)	return 1 ;;
 -@@ -434,6 +456,7 @@
 - #ifdef WITH_OPENBSD
 - 	X=`@TAR@ x${_opt}f "$2" -O "+CONTENTS" |
 - #else
 -+	is_yes ${use_pkgng} && X=`${PKG_INFO} -F "$2"` ||
 - 	X=`@TAR@ x${_opt}f "$2" -O --fast-read "+CONTENTS" |
 - #endif
 - #endif
 -@@ -467,6 +490,11 @@
 - 		done < "${PKG_DBDIR}/$2/+BUILD_INFO"
 - 	fi
 - #else
 -+	if is_yes ${use_pkgng}; then
 -+		X=`${PKG_INFO} -qo $2`
 -+		eval $1=\$X
 -+		return 0
 -+	fi
 - 	if [ -r "${PKG_DBDIR}/$2/+CONTENTS" ]; then
 - 		while read X; do
 - 			case $X in
 -@@ -488,7 +516,11 @@
 - }
 - 
 - set_pkg_vars() {
 -+	if is_yes ${use_pkgng}; then
 -+	${PKG_INFO} -e $1 || return 1
 -+	else
 - 	[ -d "${PKG_DBDIR}/$1" ] || return 1
 -+	fi
 - 
 - 	pkg_name=$1
 - 	pkg_pkgdir=${PKG_DBDIR}/$1
 -@@ -526,10 +558,27 @@
 - 
 - 	for _arg in ${1+"$@"}; do
 - 		_pattern=${_arg#${PKG_DBDIR}/}
 -+		if is_yes ${use_pkgng}; then
 -+			for p in `${PKG_INFO} -g "${_pattern}" 2>/dev/null`; do
 -+				if is_yes ${opt_depends}; then
 -+					pkg_depends '_deps' "$p"
 -+					eval ${_var}=\"\$${_var} \${_deps}\"
 -+				fi
 -+
 -+				eval ${_var}=\"\$${_var} \$p\"
 - 
 -+				if is_yes ${opt_required_by}; then
 -+					pkg_required_by '_req_by' "$p"
 -+					eval ${_var}=\"\$${_var} \${_req_by}\"
 -+				fi
 -+			done
 -+			if [ -z "${pkgs}" ]; then
 -+				warn "No such installed package: ${_arg}"
 -+			fi
 -+		else
 - 		case ${_pattern} in
 --		*\**|*-pl[0-9]*|*-[0-9]*[0-9.][a-z]|*-[0-9]*[0-9]) ;;
 --		*)		_pattern="${_pattern}-[0-9]*[0-9a-z]" ;;
 -+		*\**|*-[0-9]*|*-[brv.][0-9]*|*-a.[0-9]*|*-pl[0-9]*|*-b.r[0-9]*|*-cr.[a-z]*) ;;
 -+		*)		_pattern="${_pattern}-[0-9]*[0-9a-zA-Z]" ;;
 - 		esac
 - 
 - 		for p in ${PKG_DBDIR}/${_pattern}/+CONTENTS; do
 -@@ -552,6 +601,7 @@
 - 				warn "No such installed package: ${_arg}"
 - 			fi
 - 		done
 -+		fi
 - 	done
 - 
 - 	set -f
 -@@ -568,6 +618,12 @@
 - 		done < "${PKG_DBDIR}/$2/+REQUIRING"
 - 	fi
 - #else
 -+	if is_yes ${use_pkgng}; then
 -+		X=`${PKG_INFO} -qd $2`
 -+		eval $1=\"\${X}\"
 -+		return 0
 -+	fi
 -+
 - 	if [ -r "${PKG_DBDIR}/$2/+CONTENTS" ]; then
 - 		while read X; do
 - 			case $X in
 -@@ -588,6 +644,12 @@
 - pkg_required_by() {
 - 	local X
 - 
 -+	if is_yes ${use_pkgng}; then
 -+		X=`${PKG_INFO} -qr $2`
 -+		eval $1=\"\$X\"
 -+		return 0
 -+	fi
 -+
 - 	eval $1=
 - 	if [ -r "${PKG_DBDIR}/$2/+REQUIRED_BY" ]; then
 - 		while read X; do
 -@@ -597,7 +659,7 @@
 - }
 - 
 - pkg_sort() {
 --	local p _var _sorted _unsorted _arg _deps
 -+	local p _var _sorted _unsorted _arg _deps _deplist
 - 
 - 	_var=$1; shift
 - 	_sorted=
 -@@ -612,7 +674,13 @@
 - 		*" ${_arg} "*)	continue ;;
 - 		esac
 - 
 --		if [ -s "${PKG_DBDIR}/${_arg}/+REQUIRED_BY" ]; then
 -+		_deplist=
 -+		if is_yes ${use_pkgng}; then
 -+			_deplist=`${PKG_INFO} -qr ${_arg}`
 -+		else
 -+			_deplist="${PKG_DBDIR}/${_arg}/+REQUIRED_BY"
 -+		fi
 -+		if [ -s "${_deplist}" ]; then
 - 			pkg_depends '_deps' "${_arg}"
 - 
 - 			for p in ${_deps}; do
 -@@ -715,7 +783,7 @@
 - 	if empty ${_log}; then
 - 		try "$@" || return $?
 - 	else
 --		_cookie="${tmpdir}/.$1_failed"
 -+		_cookie="${tmpdir}/.${1##*/}_failed"
 - 
 - 		{ try "$@" || echo $? > "${_cookie}"; } | tee -a "${_log}" ||
 - 			warn "tee(1) failed."
 -@@ -757,9 +825,11 @@
 - 	info "Installing '$1'"
 - 
 - 	case $1 in
 --	*.t[bg]z)
 -+	*.t[bgx]z)
 - 		is_yes ${opt_force} && install_args="-f"
 -+		if ! is_yes ${use_pkgng}; then
 - 		is_yes ${opt_verbose} && install_args="${install_args} -v"
 -+		fi
 - 
 - 		xtry "${2-}" ${PKG_ADD} ${install_args} "$1" || return 1
 - 		;;
 -@@ -795,7 +865,11 @@
 - 
 - 	deinstall_args=
 - 	is_yes ${opt_force} && deinstall_args="-f"
 -+	if is_yes ${use_pkgng}; then
 -+	deinstall_args="${deinstall_args} -y"
 -+	else
 - 	is_yes ${opt_verbose} && deinstall_args="${deinstall_args} -v"
 -+	fi
 - 
 - #ifdef WITH_PKGSRC
 - 	if [ -e "${PKG_DBDIR}/$1/+PRESERVE" ]; then
 -@@ -915,7 +989,11 @@
 - 		*)		subdir="${OS_MAJOR}-stable" ;;
 - 		esac
 - 
 -+		if is_yes ${use_pkgng}; then
 -+		uri_path=/freebsd-${OS_MAJOR}-${ARCH}/latest/All/
 -+		else
 - 		uri_path="/pub/FreeBSD/ports/${ARCH}/packages-${subdir}/All/"
 -+		fi
 - #endif
 - #endif
 - 		uri="${PACKAGEROOT}${uri_path}${pkg}"
 -@@ -987,7 +1065,11 @@
 - 		return 1
 - 	fi
 - #else
 -+	if is_yes ${use_pkgng}; then
 -+	try ${PKG_CREATE} -f ${PKG_SUFX} -o "${2%/*}" "$1" || return 1
 -+	else
 - 	try ${PKG_CREATE} -b "$1" "$2" || return 1
 -+	fi
 - #endif
 - #endif
 - }
 -@@ -1031,12 +1113,17 @@
 - }
 - 
 - preserve_libs() {
 --	local file
 -+	local file pkg_info_opts
 - 
 - 	is_yes ${opt_preserve_libs} || return 0
 - 
 -+	if is_yes ${use_pkgng}; then
 -+		pkg_info_opts='-ql'
 -+	else
 -+		pkg_info_opts='-qL'
 -+	fi
 - 	preserved_files=
 --	for file in $(${PKG_INFO} -qL "$1"); do
 -+	for file in $(${PKG_INFO} ${pkg_info_opts} "$1"); do
 - 		case ${file##*/} in
 - 		lib*.so.[0-9]*)
 - 			if [ -f "${file}" ]; then
 -@@ -1080,20 +1167,30 @@
 - fix_dependencies() {
 - #ifndef WITH_PKGSRC
 - #ifndef WITH_OPENBSD
 --	local p deps newdep opt_depends opt_required_by
 -+	local p deps newdep opt_depends opt_required_by dep_installed
 - 
 - 	opt_depends=NO
 - 	opt_required_by=NO
 - 	pkg_depends 'deps' "$1"
 - 
 - 	for p in ${deps}; do
 --		if [ ! -d "${PKG_DBDIR}/$p" ]; then
 -+		dep_installed=no
 -+		if is_yes ${use_pkgng}; then
 -+			${PKG_INFO} -e $p && dep_installed=yes || dep_installed=no
 -+		else
 -+			[ -d "${PKG_DBDIR}/$p" ] && dep_installed=yes || dep_installed=no
 -+		fi
 -+		if ! is_yes ${dep_installed}; then
 - 			pkg_glob 'newdep' "${p%-*}" 2>/dev/null
 - 
 - 			if empty ${newdep}; then
 - 				warn "'$1' depends on '$p', but it is NOT installed!"
 - 			else
 -+				if is_yes ${use_pkgng}; then
 -+				${PKG_SET} -y -o `${PKG_INFO} -qo $1`:`${PKG_INFO} -qo $p` || return 1
 -+				else
 - 				update_pkgdep "$1" "$p" "${newdep##* }" || return 1
 -+				fi
 - 			fi
 - 		fi
 - 	done
 -@@ -1102,6 +1199,11 @@
 - }
 - 
 - update_dependencies() {
 -+	if is_yes ${use_pkgng}; then
 -+		info "Updating the dependencies"
 -+		[ "x$1" = "x$2" ] && return 0 || ${PKG_SET} -y -o $1:$2
 -+		info "	$1 -> $2"
 -+	else
 - 	local p req_by
 - 
 - 	pkg_required_by 'req_by' "$2"
 -@@ -1114,6 +1216,7 @@
 - 			update_pkgdep "$p" "$1-[^-]*" "$2" || return 1
 - 		done
 - 	fi
 -+	fi
 - }
 - 
 - have_pkgdep() {
 -@@ -1122,7 +1225,7 @@
 - 	if [ -r "${PKG_DBDIR}/$1/+CONTENTS" ]; then
 - 		while read X; do
 - 			case $X in
 --			@pkgdep\ $2-[0-9]*|@pkgdep\ $2-pl[0-9]*)
 -+			@pkgdep\ $2-[0-9]*|@pkgdep\ $2-[brv.][0-9]*|@pkgdep\ $2-a.[0-9]*|@pkgdep\ $2-pl[0-9]*|@pkgdep\ $2-b.r[0-9]*|@pkgdep\ $2-cr.[a-z]*)
 - 				return 0 ;;
 - 			[!@]*)	break ;;
 - 			esac
 -@@ -1134,7 +1237,7 @@
 - 
 - update_pkgdep() {
 - 	update_file "${PKG_DBDIR}/$1/+CONTENTS" \
 --	"s/^@pkgdep $2\$/@pkgdep $3/" || return 1
 -+	"/^@pkgdep $2\$/,/^@comment DEPORIGIN:/ { s|^@pkgdep $2\$|@pkgdep $3|; s|^@comment DEPORIGIN:.*\$|@comment DEPORIGIN:${pkg_origin}|; }" || return 1
 - }
 - 
 - delete_pkgdep() {
 -@@ -1325,7 +1428,7 @@
 - 
 - init_install() {
 - 	case $1 in
 --	*.t[bg]z)
 -+	*.t[bgx]z)
 - 		set_pkg_vars_for_binary "$1" || return 1 ;;
 - 	/*)	set_port_vars "$1" || return 1 ;;
 - 	*)	set_port_vars "${PORTSDIR}/$1" || return 1 ;;
 -@@ -1351,7 +1454,7 @@
 - 	done
 - 
 - 	case ${replace_with} in
 --	*.t[bg]z)
 -+	*.t[bgx]z)
 - 		pkg_binary=${replace_with} ;;
 - 	?*)
 - 		pkg_portdir=${replace_with}
 -@@ -1428,6 +1531,12 @@
 - do_replace() {
 - 	local pkg_log pkg_tmpdir old_package old_required_by preserved_files
 - 
 -+	if is_yes ${use_pkgng}; then
 -+		local old_origin new_origin
 -+		old_origin=
 -+		new_origin=
 -+	fi
 -+
 - 	init_replace "$1" || { status=skipped; return 0; }
 - 
 - 	if [ "${cur_pkg_name}" != "${pkg_name}" ]; then
 -@@ -1482,7 +1591,9 @@
 - 	fi
 - 
 - 	pkg_tmpdir="${tmpdir}/${cur_pkg_name}"
 -+	if ! is_yes ${use_pkgng}; then
 - 	old_required_by="${pkg_tmpdir}/+REQUIRED_BY"
 -+	fi
 - 
 - 	if ! find_package 'old_package' "${cur_pkg_name}"; then
 - 		old_package="${pkg_tmpdir}/${cur_pkg_name}${PKG_SUFX}"
 -@@ -1491,7 +1602,11 @@
 - 	if ! {
 - 		create_dir "${pkg_tmpdir}" &&
 - 		backup_package "${cur_pkg_name}" "${old_package}" &&
 --		backup_file "${cur_pkg_pkgdir}/+REQUIRED_BY" "${old_required_by}" &&
 -+		if is_yes ${use_pkgng}; then
 -+			old_origin=`${PKG_INFO} -qo ${cur_pkg_name}` || return 1
 -+		else
 -+			backup_file "${cur_pkg_pkgdir}/+REQUIRED_BY" "${old_required_by}"
 -+		fi &&
 - 		preserve_libs "${cur_pkg_name}"
 - 	}; then
 - 		log="backup error"
 -@@ -1503,6 +1618,9 @@
 - 		if install_package "${pkg_binary:-${pkg_portdir}}" "${pkg_log}"; then
 - 			status=done
 - 			cur_pkg_pkgdir=${PKG_DBDIR}/${pkg_name}
 -+			if is_yes ${use_pkgng}; then
 -+				new_origin=`${PKG_INFO} -qo ${pkg_name}`
 -+			fi
 - 		else
 - 			log="install error"
 - 			restore_package "${old_package}" || {
 -@@ -1515,8 +1633,10 @@
 - 		log="deinstall error"
 - 	fi
 - 
 -+	if ! is_yes ${use_pkgng}; then
 - 	restore_file "${old_required_by}" "${cur_pkg_pkgdir}/+REQUIRED_BY" ||
 - 		warn "Failed to restore the +REQUIRED_BY file."
 -+	fi
 - 	process_package "${old_package}" ||
 - 		warn "Failed to keep the old version."
 - 	clean_libs ||
 -@@ -1527,7 +1647,11 @@
 - 	case ${status} in
 - 	done)
 - 		fix_dependencies "${pkg_name}" || return 1
 --		update_dependencies "${cur_pkg_name%-*}" "${pkg_name}" || return 1 ;;
 -+		if is_yes ${use_pkgng}; then
 -+		update_dependencies "${old_origin}" "${new_origin}" || return 1
 -+		else
 -+		update_dependencies "${cur_pkg_name%-*}" "${pkg_name}" || return 1
 -+		fi ;;
 - 	*)
 - 		return 1 ;;
 - 	esac
 diff -Nur pkg_replace.orig/pkg-plist pkg_replace/pkg-plist
 --- pkg_replace.orig/pkg-plist	2013-09-21 05:42:45.047884361 +0900
 +++ pkg_replace/pkg-plist	2013-09-26 06:35:49.075884766 +0900
 @@ -1,6 +1,9 @@
 +etc/pkg_replace.conf.sample
 +man/man1/pkg_replace.1.gz
 +%%PKGDB_FIX%%man/man1/pkgdb_fix.1.gz
  sbin/pkg_replace
  %%PKGDB_FIX%%sbin/pkgdb_fix
 -etc/pkg_replace.conf.sample
  %%ZSH%%share/zsh/site-functions/_pkg_replace
  %%ZSH%%@unexec [ -f %D/bin/zsh ] || rmdir %D/share/zsh/site-functions 2>/dev/null || true
 +%%ZSH%%@dirrmtry share/zsh/site-functions
  %%ZSH%%@dirrmtry share/zsh
 
 --Multipart=_Thu__26_Sep_2013_09_28_58_+0900_tiFsq5yt=0eJ3XLp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309260030.r8Q0U1xI067411>