Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Feb 2014 13:00:01 GMT
From:      "KAMADA Ken'ichi" <kamada@nanohz.org>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/186406: ports-mgmt/pkg_replace: preserve automatic flag
Message-ID:  <201402031300.s13D01dU054378@freefall.freebsd.org>

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

From: KAMADA Ken'ichi <kamada@nanohz.org>
To: kdeguchi@sz.tokoha-u.ac.jp,
	FreeBSD-gnats-submit@freebsd.org
Cc: kamada@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"



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