svn commit: r418619 - head/ports-mgmt/portmaster/files

Stefan Esser se at FreeBSD.org
Sat Jul 16 07:13:26 UTC 2016


Author: se
Date: Sat Jul 16 07:13:24 2016
New Revision: 418619
URL: https://svnweb.freebsd.org/changeset/ports/418619

Log:
  A read lock on the sqlite file used by pkg can lock out writers for
  indefinite amounts of time, preventing installation or upgrade of
  ports with portmaster.  Instead of using a pipe to read pkg query
  input to be consumed by a shell loop, buffer the query result in a
  shell variable and let the loop iterate over the contents of this
  variable.
  
  While here, use a call to all_pkgs_by_origin() instead of an inline
  versin of equivalent code.
  
  Reviewed by:	tz
  Approved by:	tz

Added:
  head/ports-mgmt/portmaster/files/
  head/ports-mgmt/portmaster/files/patch-portmaster   (contents, props changed)

Added: head/ports-mgmt/portmaster/files/patch-portmaster
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/ports-mgmt/portmaster/files/patch-portmaster	Sat Jul 16 07:13:24 2016	(r418619)
@@ -0,0 +1,67 @@
+--- portmaster.orig	2016-02-05 22:36:56 UTC
++++ portmaster
+@@ -1239,7 +1239,8 @@ all_pkgs_by_origin () {
+ 			echo $iport $origin
+ 		done
+ 	else
+-		pkg query -a "%n-%v %o"
++		namesorigins=`pkg query -a "%n-%v %o"`
++		echo "$namesorigins"
+ 	fi
+ 	return
+ }
+@@ -1644,42 +1645,19 @@ if [ -n "$CHECK_PORT_DBDIR" ]; then
+ 	unique_list=':'
+ 
+ 	echo "===>>> Building list of installed port names"; echo ''
+-	if [ -z "$use_pkgng" ]; then
+-		for pkg in $pdb/*; do
+-			[ -d $pkg ] || continue
+-
+-			iport=${pkg#$pdb/}
+-			origin=`origin_from_pdb $iport` || continue
+-
+-			if [ ! -d "$pd/$origin" ]; then
+-				find_moved_port $origin $iport nonfatal >/dev/null
+-				[ -n "$moved_npd" ] || continue
+-				origin=$moved_npd
+-			fi
+-
+-			if ! pm_cd $pd/$origin; then
+-				echo "	===>>> $pd/$origin does not exist for $pkg"
+-				continue
+-			fi
+-			unique_list="${unique_list}`make -V UNIQUENAME -V OPTIONS_NAME | tr '\n' ':'`"
+-		done
+-	else
+-		while read pkg origin; do
+-			if [ ! -d "$pd/$origin" ]; then
+-				find_moved_port $origin $pkg nonfatal >/dev/null
+-				[ -n "$moved_npd" ] || continue
+-				origin=$moved_npd
+-			fi
++	all_pkgs_by_origin | while read pkg origin; do
++		if [ ! -d "$pd/$origin" ]; then
++			find_moved_port $origin $pkg nonfatal >/dev/null
++			[ -n "$moved_npd" ] || continue
++			origin=$moved_npd
++		fi
+ 
+-			if ! pm_cd $pd/$origin; then
+-				echo "	===>>> $pd/$origin does not exist for $pkg"
+-				continue
+-			fi
+-			unique_list="${unique_list}`make -V UNIQUENAME -V OPTIONS_NAME | tr '\n' ':'`"
+-		done <<-EOF
+-		$(pkg query -a "%n-%v %o")
+-		EOF
+-	fi
++		if ! pm_cd $pd/$origin; then
++			echo "	===>>> $pd/$origin does not exist for $pkg"
++			continue
++		fi
++		unique_list="${unique_list}`make -V UNIQUENAME -V OPTIONS_NAME | tr '\n' ':'`"
++	done
+ 
+ 	echo "===>>> Checking $port_dbdir"
+ 


More information about the svn-ports-all mailing list