[70175] branches/release_1_9
jmr at macports.org
jmr at macports.org
Sat Jul 31 06:01:15 PDT 2010
Revision: 70175
http://trac.macports.org/changeset/70175
Author: jmr at macports.org
Date: 2010-07-31 06:01:13 -0700 (Sat, 31 Jul 2010)
Log Message:
-----------
merge r70174 from trunk:
acquire an exclusive lock when making registry modifications (#19935)
Revision Links:
--------------
http://trac.macports.org/changeset/70174
Modified Paths:
--------------
branches/release_1_9/base/src/macports1.0/macports.tcl
branches/release_1_9/base/src/port/port.tcl
branches/release_1_9/base/src/registry2.0/registry.tcl
Property Changed:
----------------
branches/release_1_9/
branches/release_1_9/base/
branches/release_1_9/base/portmgr/fedora/macports.spec
branches/release_1_9/base/src/pextlib1.0/sha2.c
branches/release_1_9/base/src/pextlib1.0/sha2.h
branches/release_1_9/base/src/pextlib1.0/sha256cmd.c
branches/release_1_9/base/src/pextlib1.0/sha256cmd.h
branches/release_1_9/base/src/registry2.0/receipt_sqlite.tcl
Property changes on: branches/release_1_9
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:67304-67305,67307,67384,67447,67449,67451,67487,67593,67595,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697
+ /trunk:67304-67305,67307,67384,67447,67449,67451,67487,67593,67595,67717,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68786,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69001,69019,69022,69105,69191,69316,69318,69334-69335,69387,69436,69470,69887,70009-70010,70120,70135,70138,70143,70163,70174
Property changes on: branches/release_1_9/base
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:67304-67305,67307,67384,67447,67449,67451,67487,67593,67595,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
+ /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:67304-67305,67307,67384,67447,67449,67451,67487,67593,67595,67717,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68786,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69001,69019,69022,69105,69191,69316,69318,69334-69335,69387,69436,69470,69887,70009-70010,70120,70135,70138,70143,70163,70174
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
Property changes on: branches/release_1_9/base/portmgr/fedora/macports.spec
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base/portmgr/fedora/macports.spec:37343-46937
/branches/universal-sanity/base/portmgr/fedora/macports.spec:51872-52323
/branches/variant-descs-14482/base/portmgr/fedora/macports.spec:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/portmgr/fedora/macports.spec:67304-67305,67307,67384,67449,67451,67487,67593,67595,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697
/trunk/base/portmgr/fedora/macports.spec.in:30388-57826
/users/perry/base-bugs_and_notes/portmgr/fedora/macports.spec:45682-46060
/users/perry/base-select/portmgr/fedora/macports.spec:44044-44692
+ /branches/gsoc08-privileges/base/portmgr/fedora/macports.spec:37343-46937
/branches/universal-sanity/base/portmgr/fedora/macports.spec:51872-52323
/branches/variant-descs-14482/base/portmgr/fedora/macports.spec:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/portmgr/fedora/macports.spec:67304-67305,67307,67384,67449,67451,67487,67593,67595,67717,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68786,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69001,69019,69022,69105,69191,69316,69318,69334-69335,69387,69436,69470,69887,70009-70010,70120,70135,70138,70143,70163,70174
/trunk/base/portmgr/fedora/macports.spec.in:30388-57826
/users/perry/base-bugs_and_notes/portmgr/fedora/macports.spec:45682-46060
/users/perry/base-select/portmgr/fedora/macports.spec:44044-44692
Modified: branches/release_1_9/base/src/macports1.0/macports.tcl
===================================================================
--- branches/release_1_9/base/src/macports1.0/macports.tcl 2010-07-31 12:57:09 UTC (rev 70174)
+++ branches/release_1_9/base/src/macports1.0/macports.tcl 2010-07-31 13:01:13 UTC (rev 70175)
@@ -1564,7 +1564,7 @@
# Before we build the port, we must build its dependencies.
set dlist {}
if {[macports::_target_needs_deps $target]} {
-
+ registry::exclusive_lock
# possibly warn or error out depending on how old xcode is
if {[$workername eval _check_xcode_version] != 0} {
return 1
@@ -1610,6 +1610,7 @@
} else {
set result [dlist_eval $dlist _mportinstalled [list _mportexec "activate"]]
}
+ registry::exclusive_unlock
if {$result != {}} {
set errstring "The following dependencies failed to build:"
Property changes on: branches/release_1_9/base/src/pextlib1.0/sha2.c
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.c:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/sha2.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/sha2.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha2.c:67304-67305,67307,67384,67449,67451,67487,67593,67595,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69105,69316,69318,69334-69335,69387,69436,70120
/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.c:45682-46060
/users/perry/base-select/src/pextlib1.0/sha2.c:44044-44692
+ /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.c:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/sha2.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/sha2.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha2.c:67304-67305,67307,67384,67449,67451,67487,67593,67595,67717,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68786,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69001,69019,69022,69105,69191,69316,69318,69334-69335,69387,69436,69470,69887,70009-70010,70120,70135,70138,70143,70163,70174
/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.c:45682-46060
/users/perry/base-select/src/pextlib1.0/sha2.c:44044-44692
Property changes on: branches/release_1_9/base/src/pextlib1.0/sha2.h
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.h:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/sha2.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/sha2.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha2.h:67304-67305,67307,67384,67449,67451,67487,67593,67595,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69105,69316,69318,69334-69335,69387,69436,70120
/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.h:45682-46060
/users/perry/base-select/src/pextlib1.0/sha2.h:44044-44692
+ /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.h:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/sha2.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/sha2.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha2.h:67304-67305,67307,67384,67449,67451,67487,67593,67595,67717,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68786,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69001,69019,69022,69105,69191,69316,69318,69334-69335,69387,69436,69470,69887,70009-70010,70120,70135,70138,70143,70163,70174
/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.h:45682-46060
/users/perry/base-select/src/pextlib1.0/sha2.h:44044-44692
Property changes on: branches/release_1_9/base/src/pextlib1.0/sha256cmd.c
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.c:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.c:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha256cmd.c:67304-67305,67307,67384,67449,67451,67487,67593,67595,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69105,69316,69318,69334-69335,69387,69436,70120
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692
+ /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.c:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.c:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha256cmd.c:67304-67305,67307,67384,67449,67451,67487,67593,67595,67717,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68786,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69001,69019,69022,69105,69191,69316,69318,69334-69335,69387,69436,69470,69887,70009-70010,70120,70135,70138,70143,70163,70174
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692
Property changes on: branches/release_1_9/base/src/pextlib1.0/sha256cmd.h
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.h:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.h:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha256cmd.h:67304-67305,67307,67384,67449,67451,67487,67593,67595,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69105,69316,69318,69334-69335,69387,69436,70120
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692
+ /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.h:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.h:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha256cmd.h:67304-67305,67307,67384,67449,67451,67487,67593,67595,67717,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68786,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69001,69019,69022,69105,69191,69316,69318,69334-69335,69387,69436,69470,69887,70009-70010,70120,70135,70138,70143,70163,70174
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692
Modified: branches/release_1_9/base/src/port/port.tcl
===================================================================
--- branches/release_1_9/base/src/port/port.tcl 2010-07-31 12:57:09 UTC (rev 70174)
+++ branches/release_1_9/base/src/port/port.tcl 2010-07-31 13:01:13 UTC (rev 70175)
@@ -4063,6 +4063,24 @@
}
}
+# acquire exclusive registry lock for actions that need it
+# returns 1 if locked, 0 otherwise
+proc lock_reg_if_needed {action} {
+ switch -- $action {
+ activate -
+ deactivate -
+ select -
+ setrequested -
+ unsetrequested -
+ upgrade -
+ uninstall -
+ install {
+ registry::exclusive_lock
+ return 1
+ }
+ }
+ return 0
+}
proc process_cmd { argv } {
global cmd_argc cmd_argv cmd_argn
@@ -4089,7 +4107,8 @@
while { [moreargs] } { advance }
break
}
-
+
+ set locked [lock_reg_if_needed $action]
# Always start out processing an action in current_portdir
cd $current_portdir
@@ -4152,6 +4171,11 @@
# execute the action
set action_status [$action_proc $action $portlist [array get global_options]]
+ # unlock if needed
+ if {$locked} {
+ registry::exclusive_unlock
+ }
+
# semaphore to exit
if {$action_status == -999} break
}
Property changes on: branches/release_1_9/base/src/registry2.0/receipt_sqlite.tcl
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base/src/registry1.0/receipt_sqlite.tcl:37343-46937
/branches/gsoc09-logging/base/src/registry1.0/receipt_sqlite.tcl:51231-60371
/branches/universal-sanity/base/src/registry1.0/receipt_sqlite.tcl:51872-52323
/branches/variant-descs-14482/base/src/registry1.0/receipt_sqlite.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/registry2.0/receipt_sqlite.tcl:67304-67305,67307,67384,67449,67451,67487,67593,67595,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69105,69316,69318
/users/perry/base-bugs_and_notes/src/registry1.0/receipt_sqlite.tcl:45682-46060
/users/perry/base-select/src/registry1.0/receipt_sqlite.tcl:44044-44692
+ /branches/gsoc08-privileges/base/src/registry1.0/receipt_sqlite.tcl:37343-46937
/branches/gsoc09-logging/base/src/registry1.0/receipt_sqlite.tcl:51231-60371
/branches/universal-sanity/base/src/registry1.0/receipt_sqlite.tcl:51872-52323
/branches/variant-descs-14482/base/src/registry1.0/receipt_sqlite.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/registry2.0/receipt_sqlite.tcl:67304-67305,67307,67384,67449,67451,67487,67593,67595,67717,67763,67792,67838,68058,68281,68286,68288,68413,68416,68463,68593,68620,68675-68676,68680,68683-68684,68691,68697,68746,68749,68764,68779,68786,68806,68816-68817,68849,68851,68864,68872,68902,68910,68913,68919,68950,68952,68965,69001,69019,69022,69105,69191,69316,69318,69334-69335,69387,69436,69470,69887,70009-70010,70120,70135,70138,70143,70163,70174
/users/perry/base-bugs_and_notes/src/registry1.0/receipt_sqlite.tcl:45682-46060
/users/perry/base-select/src/registry1.0/receipt_sqlite.tcl:44044-44692
Modified: branches/release_1_9/base/src/registry2.0/registry.tcl
===================================================================
--- branches/release_1_9/base/src/registry2.0/registry.tcl 2010-07-31 12:57:09 UTC (rev 70174)
+++ branches/release_1_9/base/src/registry2.0/registry.tcl 2010-07-31 13:01:13 UTC (rev 70175)
@@ -39,6 +39,8 @@
package require msgcat
namespace eval registry {
+ variable lockfd
+ variable nlocked 0
# Begin creating a new registry entry for the port version_revision+variant
# This process assembles the directory name and creates a receipt dlist
@@ -387,6 +389,49 @@
return [${macports::registry.format}::write_dep_map $args]
}
+# acquire exclusive lock on registry, do this before modifying it or reading
+# any info which will affect a decision on what to modify
+proc exclusive_lock {} {
+ global macports::registry.path
+ variable lockfd
+ variable nlocked
+ incr nlocked
+ if {$nlocked > 1} {
+ return
+ }
+ set lockpath [file join ${registry.path} registry .registry.lock]
+ if {![info exists lockfd]} {
+ set lockfd [::open $lockpath w]
+ }
+ if {[catch {flock $lockfd -exclusive -noblock} result]} {
+ if {$result == "EAGAIN"} {
+ ui_msg "Waiting for lock on $lockpath"
+ flock $lockfd -exclusive
+ } elseif {$result == "EOPNOTSUPP"} {
+ # Locking not supported, just return
+ ui_debug "flock not supported, not locking registry"
+ } else {
+ return -code error "$result obtaining lock on $lockpath"
+ }
+ }
+}
+
+# release exclusive lock on registry, do this when done writing to it
+proc exclusive_unlock {} {
+ variable lockfd
+ variable nlocked
+ incr nlocked -1
+ if {$nlocked > 0} {
+ return
+ } elseif {$nlocked < 0} {
+ ui_warn "exclusive_unlock called more often than exclusive_lock!"
+ }
+ if {[info exists lockfd]} {
+ # not much point trying to handle errors
+ catch {flock $lockfd -unlock}
+ }
+}
+
# upgrade flat receipts to registry2.0 sqlite db
proc convert_to_sqlite {} {
set ilist [receipt_flat::installed "" ""]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100731/cade6051/attachment-0001.html>
More information about the macports-changes
mailing list