aboutsummaryrefslogtreecommitdiffstats
path: root/ports-mgmt
diff options
context:
space:
mode:
authorse <se@FreeBSD.org>2016-07-16 15:13:24 +0800
committerse <se@FreeBSD.org>2016-07-16 15:13:24 +0800
commita06bbd7b5d102df01db065d4e625e8b40064d178 (patch)
treeb89f6dadd890571e0a8ad4d6a38c9945f15e5ee8 /ports-mgmt
parent54eec6c07ca8cda2569e59ff604653c67e8029f0 (diff)
downloadfreebsd-ports-gnome-a06bbd7b5d102df01db065d4e625e8b40064d178.tar.gz
freebsd-ports-gnome-a06bbd7b5d102df01db065d4e625e8b40064d178.tar.zst
freebsd-ports-gnome-a06bbd7b5d102df01db065d4e625e8b40064d178.zip
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
Diffstat (limited to 'ports-mgmt')
-rw-r--r--ports-mgmt/portmaster/files/patch-portmaster67
1 files changed, 67 insertions, 0 deletions
diff --git a/ports-mgmt/portmaster/files/patch-portmaster b/ports-mgmt/portmaster/files/patch-portmaster
new file mode 100644
index 000000000000..deaf4682be01
--- /dev/null
+++ b/ports-mgmt/portmaster/files/patch-portmaster
@@ -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"
+