ports/186406: ports-mgmt/pkg_replace: preserve automatic flag

KAMADA Ken'ichi kamada at nanohz.org
Mon Feb 3 13:00:01 UTC 2014


The following reply was made to PR ports/186406; it has been noted by GNATS.

From: KAMADA Ken'ichi <kamada at nanohz.org>
To: kdeguchi at sz.tokoha-u.ac.jp,
	FreeBSD-gnats-submit at freebsd.org
Cc: kamada at nanohz.org
Subject: Re: ports/186406: ports-mgmt/pkg_replace: preserve automatic flag
Date: Mon, 03 Feb 2014 21:56:45 +0900

 Not enough tested, sorry.  The third fragment of the patch
 should say "${cur_pkg_name}" instead of "${old_package}".
 Revised patch attached.
 
 --- /usr/local/sbin/pkg_replace	2014-02-03 08:15:28.000000000 +0900
 +++ pkg_replace	2014-02-03 21:50:42.000000000 +0900
 @@ -1290,7 +1290,8 @@
  }
  
  do_replace() {
 -	local pkg_log pkg_tmpdir old_package old_required_by preserved_files
 +	local pkg_log pkg_tmpdir old_package old_required_by preserved_files \
 +		automatic_flag
  
  	if is_yes ${use_pkgng}; then
  		local old_origin new_origin
 @@ -1365,6 +1366,7 @@
  		backup_package "${cur_pkg_name}" "${old_package}" &&
  		if is_yes ${use_pkgng}; then
  			old_origin=`${PKG_INFO} -qo ${cur_pkg_name}` || return 1
 +			automatic_flag=$(${PKG_QUERY} %a "${cur_pkg_name}")
  		else
  			backup_file "${cur_pkg_pkgdir}/+REQUIRED_BY" "${old_required_by}"
  		fi &&
 @@ -1381,6 +1383,7 @@
  			cur_pkg_pkgdir=${PKG_DBDIR}/${pkg_name}
  			if is_yes ${use_pkgng}; then
  				new_origin=`${PKG_INFO} -qo ${pkg_name}`
 +				${PKG_SET} -y -A "${automatic_flag}" "${pkg_name}"
  			fi
  		else
  			log="install error"
 @@ -1389,6 +1392,9 @@
  				"please reinstall '${old_package}' manually."
  				return 1
  			}
 +			if is_yes ${use_pkgng}; then
 +				${PKG_SET} -y -A "${automatic_flag}" "${cur_pkg_name}"
 +			fi
  		fi
  	else
  		log="deinstall error"


More information about the freebsd-ports-bugs mailing list