[70795] branches/new-help-system/base
raimue at macports.org
raimue at macports.org
Sat Aug 21 08:04:45 PDT 2010
Revision: 70795
http://trac.macports.org/changeset/70795
Author: raimue at macports.org
Date: 2010-08-21 08:04:44 -0700 (Sat, 21 Aug 2010)
Log Message:
-----------
Merge from trunk
Modified Paths:
--------------
branches/new-help-system/base/ChangeLog
branches/new-help-system/base/aclocal.m4
branches/new-help-system/base/configure
branches/new-help-system/base/src/cregistry/registry.c
branches/new-help-system/base/src/cregistry/registry.h
branches/new-help-system/base/src/macports1.0/macports.tcl
branches/new-help-system/base/src/pextlib1.0/Pextlib.c
branches/new-help-system/base/src/pextlib1.0/tracelib.c
branches/new-help-system/base/src/port/port-help.tcl
branches/new-help-system/base/src/port/port.tcl
branches/new-help-system/base/src/port1.0/portactivate.tcl
branches/new-help-system/base/src/port1.0/portchecksum.tcl
branches/new-help-system/base/src/port1.0/portdeactivate.tcl
branches/new-help-system/base/src/port1.0/portdestroot.tcl
branches/new-help-system/base/src/port1.0/portfetch.tcl
branches/new-help-system/base/src/port1.0/portinstall.tcl
branches/new-help-system/base/src/port1.0/portlint.tcl
branches/new-help-system/base/src/port1.0/porttrace.tcl
branches/new-help-system/base/src/port1.0/portutil.tcl
branches/new-help-system/base/src/registry2.0/entry.c
branches/new-help-system/base/src/registry2.0/registry.c
branches/new-help-system/base/src/registry2.0/registry.tcl
Property Changed:
----------------
branches/new-help-system/base/
branches/new-help-system/base/src/pextlib1.0/sha2.c
branches/new-help-system/base/src/pextlib1.0/sha2.h
branches/new-help-system/base/src/pextlib1.0/sha256cmd.c
branches/new-help-system/base/src/pextlib1.0/sha256cmd.h
branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl
Property changes on: branches/new-help-system/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:49341-69809
/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:49341-70794
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
Modified: branches/new-help-system/base/ChangeLog
===================================================================
--- branches/new-help-system/base/ChangeLog 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/ChangeLog 2010-08-21 15:04:44 UTC (rev 70795)
@@ -2,12 +2,52 @@
# This is a log of major user-visible changes in each MacPorts release.
# $Id$
###
+
+Unreleased changes:
+
+ - Add SHA256 checksums in addition to MD5, SHA1 and RIPEMD160.
+ (afb in r57888, r57913; snc in r68955)
+
Release 1.9.2 (future):
- - Fixed sha256 checksum (snc in r68955)
- - Fixed premature privilege dropping (jmr in r68952)
+ - Added more locking to avoid TOCTOU errors when running multiple port(1)
+ instances (#19935, jmr in r70174)
+ - Fixed -q not suppressing output from 'port lint' (#25880, jmr in r70163)
+ - Added a helpful message when there is a checksum mismatch and the
+ distfile appears to incorrectly be a HTML document (#25128,
+ ryandesign/jmr in r70143)
+
+ - Now checking early on if there are sufficient privileges to install,
+ and failing before building anything if not (#25671, jmr in r70135)
+
+ - Avoided possible failure when the -u option is used when upgrading a
+ port that is marked as being replaced by another (jmr in r69022)
+
+ - Using the platform-specific PortIndex when syncing using a daily tarball
+ (jmr in r68786)
+
+ - Fixed failures when fetch target is run without root privileges and the
+ port is then installed with them (#25418, #25937; jmr in r69334, r70271)
+
+ - Fixed upgrading ports where the new version differs from the old version
+ only in epoch (jmr in r69436)
+
+ - Fixed [un]setrequested when using the flat registry format
+ (jmr in r69387)
+
+ - Fixed checking for conflicting ports before installation
+ (#25386, jmr in r69105)
+
+ - Now gracefully handling distfiles that use a tag that is not
+ associated with any sites (#25332, jmr in r68965)
+
+ - Fixed running 'port deps' on multiple ports, and changed its output
+ format back to how it was in 1.8 (#25324, jmr in r68950)
+
+ - Fixed premature privilege dropping (#25331, jmr in r68952)
+
Release 1.9.1 (2010-06-18):
- Fixed a couple of problems with new 1.9 features when using the flat
registry format (jmr in r68910, r68913)
@@ -200,9 +240,6 @@
- Use CommonCrypto/CommonDigest instead of OpenSSL libcrypto.
(toby in r58131, jberry in r59715)
- - Add SHA256 checksums in addition to MD5, SHA1 and RIPEMD160.
- (afb in r57888, r57913)
-
- New "patch.type gnu" for GNU patch, similar to "build.type gnu"
for GNU make. Only makes a difference for BSD patch and BSD make.
(afb in r58020)
Modified: branches/new-help-system/base/aclocal.m4
===================================================================
--- branches/new-help-system/base/aclocal.m4 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/aclocal.m4 2010-08-21 15:04:44 UTC (rev 70795)
@@ -354,9 +354,7 @@
AC_MSG_CHECKING([for macports user])
if test "x$RUNUSR" = "x" ; then
-# dropping root privs is still buggy
-# RUNUSR=`id -un`
- RUNUSR=root
+ RUNUSR=nobody
fi
AC_MSG_RESULT([$RUNUSR])
Modified: branches/new-help-system/base/configure
===================================================================
--- branches/new-help-system/base/configure 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/configure 2010-08-21 15:04:44 UTC (rev 70795)
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.66 for MacPorts 1.9.99.
+# Generated by GNU Autoconf 2.67 for MacPorts 1.9.99.
#
# Report bugs to <macports-dev at lists.macosforge.org>.
#
@@ -892,8 +892,9 @@
fi
case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
@@ -1578,7 +1579,7 @@
if $ac_init_version; then
cat <<\_ACEOF
MacPorts configure 1.9.99
-generated by GNU Autoconf 2.66
+generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -1734,7 +1735,7 @@
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } >/dev/null && {
+ test $ac_status = 0; } > conftest.i && {
test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||
test ! -s conftest.err
}; then :
@@ -1797,7 +1798,7 @@
else
ac_header_preproc=no
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
@@ -1981,7 +1982,7 @@
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } >/dev/null && {
+ test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then :
@@ -2086,7 +2087,7 @@
else
ac_header_preproc=no
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
@@ -2247,7 +2248,7 @@
running configure, to aid debugging if configure makes a mistake.
It was created by MacPorts $as_me 1.9.99, which was
-generated by GNU Autoconf 2.66. Invocation command line was
+generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -6366,7 +6367,7 @@
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -6382,11 +6383,11 @@
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
@@ -6425,7 +6426,7 @@
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -6441,11 +6442,11 @@
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
@@ -7697,9 +7698,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for macports user" >&5
$as_echo_n "checking for macports user... " >&6; }
if test "x$RUNUSR" = "x" ; then
-# dropping root privs is still buggy
-# RUNUSR=`id -un`
- RUNUSR=root
+ RUNUSR=nobody
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUNUSR" >&5
@@ -7875,7 +7874,7 @@
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -7891,11 +7890,11 @@
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
@@ -7934,7 +7933,7 @@
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -7950,11 +7949,11 @@
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
@@ -9927,7 +9926,7 @@
# values after options handling.
ac_log="
This file was extended by MacPorts $as_me 1.9.99, which was
-generated by GNU Autoconf 2.66. Invocation command line was
+generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -9989,7 +9988,7 @@
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
MacPorts config.status 1.9.99
-configured by $0, generated by GNU Autoconf 2.66,
+configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -10008,11 +10007,16 @@
while test $# != 0
do
case $1 in
- --*=*)
+ --*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
*)
ac_option=$1
ac_optarg=$2
@@ -10034,6 +10038,7 @@
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
Modified: branches/new-help-system/base/src/cregistry/registry.c
===================================================================
--- branches/new-help-system/base/src/cregistry/registry.c 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/cregistry/registry.c 2010-08-21 15:04:44 UTC (rev 70795)
@@ -196,8 +196,11 @@
if (initialized || can_write) {
sqlite3_stmt* stmt = NULL;
char* query = sqlite3_mprintf("ATTACH DATABASE '%q' AS registry", path);
- if (sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK) {
- int r;
+ int r;
+ do {
+ r = sqlite3_prepare(reg->db, query, -1, &stmt, NULL);
+ } while (r == SQLITE_BUSY);
+ if (r == SQLITE_OK) {
/* XXX: Busy waiting, consider using sqlite3_busy_handler/timeout */
do {
sqlite3_step(stmt);
@@ -398,3 +401,44 @@
return 0;
}
}
+
+/**
+ * Runs VACUUM (compact/defragment) on the given db file.
+ * Works on a path rather than an open db pointer because you can't vacuum an
+ * attached db, which is what the rest of the registry uses for some reason.
+ *
+ * @param [in] db_path path to db file to vacuum
+ * @return true if success; false if failure
+ */
+int reg_vacuum(char *db_path) {
+ sqlite3* db;
+ sqlite3_stmt* stmt = NULL;
+ int result = 0;
+ reg_error err;
+
+ if (sqlite3_open(db_path, &db) == SQLITE_OK) {
+ if (!init_db(db, &err)) {
+ sqlite3_close(db);
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+
+ if (sqlite3_prepare(db, "VACUUM", -1, &stmt, NULL) == SQLITE_OK) {
+ int r;
+ /* XXX: Busy waiting, consider using sqlite3_busy_handler/timeout */
+ do {
+ sqlite3_step(stmt);
+ r = sqlite3_reset(stmt);
+ if (r == SQLITE_OK) {
+ result = 1;
+ }
+ } while (r == SQLITE_BUSY);
+ }
+ if (stmt) {
+ sqlite3_finalize(stmt);
+ }
+ sqlite3_close(db);
+ return result;
+}
Modified: branches/new-help-system/base/src/cregistry/registry.h
===================================================================
--- branches/new-help-system/base/src/cregistry/registry.h 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/cregistry/registry.h 2010-08-21 15:04:44 UTC (rev 70795)
@@ -83,4 +83,6 @@
int reg_commit(reg_registry* reg, reg_error* errPtr);
int reg_rollback(reg_registry* reg, reg_error* errPtr);
+int reg_vacuum(char* db_path);
+
#endif /* _CREG_H */
Modified: branches/new-help-system/base/src/macports1.0/macports.tcl
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/macports1.0/macports.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -975,6 +975,15 @@
}
}
+# call this just before you exit
+proc mportshutdown {} {
+ global macports::registry.format
+ if {${registry.format} == "receipt_sqlite"} {
+ # close it down so the cleanup stuff is called, e.g. vacuuming the db
+ registry::close
+ }
+}
+
proc macports::worker_init {workername portpath porturl portbuildpath options variations} {
global macports::portinterp_options macports::portinterp_deferred_options registry.installtype
@@ -1584,9 +1593,10 @@
# Before we build the port, we must build its dependencies.
set dlist {}
if {[macports::_target_needs_deps $target]} {
-
+ registry::exclusive_lock
# see if we actually need to build this port
- if {![$workername eval registry_exists \$name \$version \$revision \$portvariants]} {
+ if {($target != "activate" && $target != "install") ||
+ ![$workername eval registry_exists \$name \$version \$revision \$portvariants]} {
# possibly warn or error out depending on how old xcode is
if {[$workername eval _check_xcode_version] != 0} {
return 1
@@ -1637,6 +1647,7 @@
} else {
set result [dlist_eval $dlist _mportinstalled [list _mportexec "activate"]]
}
+ registry::exclusive_unlock
if {$result != {}} {
set errstring "The following dependencies failed to build:"
Modified: branches/new-help-system/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/Pextlib.c 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/pextlib1.0/Pextlib.c 2010-08-21 15:04:44 UTC (rev 70795)
@@ -395,10 +395,10 @@
#else
clearenv();
#endif
- /* "If the entire env array is unset then Tcl will stop monitoring
- env accesses and will not update environment variables."
- - <http://www.tcl.tk/man/tcl8.4/TclCmd/tclvars.htm#M4> */
+#ifndef __APPLE__
+ /* Crashes on Linux without this. */
setenv("MACPORTS_DUMMY", "", 0);
+#endif
} else {
(void) unsetenv(name);
}
Property changes on: branches/new-help-system/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:57889-69809
/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:57889-70794
/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/new-help-system/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:57889-69809
/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:57889-70794
/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/new-help-system/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:57889-69809
/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:57889-70794
/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/new-help-system/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:57889-69809
/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:57889-70794
/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/new-help-system/base/src/pextlib1.0/tracelib.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tracelib.c 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/pextlib1.0/tracelib.c 2010-08-21 15:04:44 UTC (rev 70795)
@@ -535,7 +535,7 @@
return TCL_OK;
}
-static int TracelibCleanCmd(Tcl_Interp * interp)
+static int TracelibCleanCmd(Tcl_Interp * interp UNUSED)
{
#define safe_free(x) do{free(x); x=0;}while(0);
cleanuping=1;
@@ -559,7 +559,6 @@
enable_fence=0;
#undef safe_free
cleanuping=0;
- Tcl_Eval(interp, "registry::close_file_map");
return TCL_OK;
}
Modified: branches/new-help-system/base/src/port/port-help.tcl
===================================================================
--- branches/new-help-system/base/src/port/port-help.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port/port-help.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -49,13 +49,6 @@
--all Removes everything from above
}
-set porthelp(log) {
-Shows main log for given ports
-
---phase <phase> Filters by phase (fetch, checksum, extract, patch, configure, build, destroot)
---level <level> Filter messages above verbosity level (error, warn, msg, info, debug)
-}
-
set porthelp(configure) {
Configure the given ports
}
@@ -216,6 +209,13 @@
Returns the install location for each of the given ports
}
+set porthelp(log) {
+Shows main log for given ports
+
+--phase <phase> Filters by phase (fetch, checksum, extract, patch, configure, build, destroot)
+--level <level> Filter messages above verbosity level (error, warn, msg, info, debug)
+}
+
set porthelp(mdmg) {
Creates a dmg containing an mpkg for each of the given ports and their dependencies
}
@@ -228,6 +228,10 @@
Creates an mpkg for each of the given ports and their dependencies
}
+set porthelp(notes) {
+Displays informational notes for each of the given ports
+}
+
set porthelp(outdated) {
Returns a list of outdated ports
}
Modified: branches/new-help-system/base/src/port/port.tcl
===================================================================
--- branches/new-help-system/base/src/port/port.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port/port.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -1484,6 +1484,18 @@
}
}
+# check if the install prefix is writable
+# should be called by actions that will modify it
+proc prefix_unwritable {} {
+ global macports::portdbpath
+ if {[file writable $portdbpath]} {
+ return 0
+ } else {
+ ui_error "Insufficient privileges to write to MacPorts install prefix."
+ return 1
+ }
+}
+
proc parsePortSpec { vername varname optname {remainder ""} } {
upvar $vername portversion
@@ -2217,7 +2229,7 @@
proc action_activate { action portlist opts } {
global macports::registry.format
set status 0
- if {[require_portlist portlist]} {
+ if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
foreachport $portlist {
@@ -2251,7 +2263,7 @@
proc action_deactivate { action portlist opts } {
global macports::registry.format
set status 0
- if {[require_portlist portlist]} {
+ if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
foreachport $portlist {
@@ -2412,7 +2424,7 @@
proc action_setrequested { action portlist opts } {
global macports::registry.format
set status 0
- if {[require_portlist portlist]} {
+ if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
# set or unset?
@@ -2440,7 +2452,7 @@
proc action_upgrade { action portlist opts } {
- if {[require_portlist portlist]} {
+ if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
# shared depscache for all ports in the list
@@ -2814,6 +2826,9 @@
return 1
}
}
+ if {[prefix_unwritable]} {
+ return 1
+ }
foreachport $portlist {
if {![registry::entry_exists_for_name $portname]} {
@@ -3491,7 +3506,7 @@
# Invoke the editor, with a reasonable canned default.
if { $editor == "" } { set editor "/usr/bin/vi" }
- if {[catch {eval exec >/dev/stdout </dev/stdin $editor $portfile} result]} {
+ if {[catch {eval exec >@stdout <@stdin 2>@stderr $editor {$portfile}} result]} {
global errorInfo
ui_debug "$errorInfo"
break_softcontinue "unable to invoke editor $editor: $result" 1 status
@@ -3593,6 +3608,9 @@
if {[require_portlist portlist]} {
return 1
}
+ if {($action == "install" || $action == "archive") && [prefix_unwritable]} {
+ return 1
+ }
foreachport $portlist {
# If we have a url, use that, since it's most specific
# otherwise try to map the portname to a url
@@ -4048,6 +4066,23 @@
}
}
+# 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 -
+ setrequested -
+ unsetrequested -
+ upgrade -
+ uninstall -
+ install {
+ registry::exclusive_lock
+ return 1
+ }
+ }
+ return 0
+}
proc process_cmd { argv } {
global cmd_argc cmd_argv cmd_argn
@@ -4074,7 +4109,8 @@
while { [moreargs] } { advance }
break
}
-
+
+ set locked [lock_reg_if_needed $action]
# Always start out processing an action in current_portdir
cd $current_portdir
@@ -4137,6 +4173,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
}
@@ -4425,5 +4466,8 @@
set exit_status [process_command_files $ui_options(ports_commandfiles)]
}
+# shut down macports1.0
+mportshutdown
+
# Return with exit_status
exit $exit_status
Modified: branches/new-help-system/base/src/port1.0/portactivate.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portactivate.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port1.0/portactivate.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -55,7 +55,7 @@
proc portactivate::activate_start {args} {
global prefix registry.installtype
- if { ![file writable $prefix] && ${registry.installtype} == "image"} {
+ if { (![file writable $prefix] || ([getuid] == 0 && [geteuid] != 0)) && ${registry.installtype} == "image"} {
# if install location is not writable, need root privileges
elevateToRoot "activate"
}
Modified: branches/new-help-system/base/src/port1.0/portchecksum.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portchecksum.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port1.0/portchecksum.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -260,6 +260,12 @@
set fail yes
}
}
+ if {[tbool fail] && ![regexp {\.html?$} ${distfile}] &&
+ ![catch {strsed [exec [findBinary file $portutil::autoconf::file_path] $fullpath --brief --mime] {s/;.*$//}} mimetype]
+ && "text/html" == $mimetype} {
+ # file --mime-type would be preferable to file --mime and strsed, but is only available as of Snow Leopard
+ set wrong_mimetype yes
+ }
}
}
@@ -296,6 +302,18 @@
ui_info "The correct checksum line may be:"
ui_info [format "%-20s%s" "checksums" [join $sums [format " \\\n%-20s" ""]]]
+ if {[tbool wrong_mimetype]} {
+ # We got an HTML file, though the distfile name does not suggest that one was
+ # expected. Probably a helpful DNS server sent us to its search results page
+ # instead of admitting that the server we asked for doesn't exist, or a mirror that
+ # no longer has the file served its error page with a 200 response.
+ ui_msg "***"
+ ui_msg "The non-matching file appears to be HTML. See this page for possible reasons"
+ ui_msg "for the checksum mismatch:"
+ ui_msg "<http://trac.macports.org/wiki/MisbehavingServers>"
+ ui_msg "***"
+ }
+
return -code error "[msgcat::mc "Unable to verify file checksums"]"
}
Modified: branches/new-help-system/base/src/port1.0/portdeactivate.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdeactivate.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port1.0/portdeactivate.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -50,7 +50,7 @@
proc portdeactivate::deactivate_start {args} {
global prefix registry.installtype
- if { ![file writable $prefix] && ${registry.installtype} == "image"} {
+ if { (![file writable $prefix] || ([getuid] == 0 && [geteuid] != 0)) && ${registry.installtype} == "image"} {
# if install location is not writable, need root privileges
elevateToRoot "deactivate"
}
Modified: branches/new-help-system/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdestroot.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port1.0/portdestroot.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -175,7 +175,7 @@
alternative destroot mechanism in the Portfile."
ui_error "Files might have been installed directly into your system,\
check before proceeding."
- return -code error "Staging $portname into destroot failed"
+ return -code error "Staging $name into destroot failed"
}
# Compress all manpages with gzip (instead)
Modified: branches/new-help-system/base/src/port1.0/portfetch.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portfetch.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port1.0/portfetch.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -460,11 +460,19 @@
set sorted no
foreach {url_var distfile} $fetch_urls {
- if {![file isfile $distpath/$distfile] && ($usealtworkpath || ![file isfile ${altprefix}${distpath}/$distfile])} {
+ if {![file isfile "${distpath}/${distfile}"]} {
ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $distfile $distpath]"
if {![file writable $distpath]} {
return -code error [format [msgcat::mc "%s must be writable"] $distpath]
}
+ if {!$usealtworkpath && [file isfile ${altprefix}${distpath}/${distfile}]} {
+ if {[catch {file link -hard "${distpath}/${distfile}" "${altprefix}${distpath}/${distfile}"}]} {
+ ui_debug "failed to hardlink ${distfile} into distpath, copying instead"
+ file copy "${altprefix}${distpath}/${distfile}" "${distpath}/${distfile}"
+ }
+ ui_info "Found $distfile in ${altprefix}${distpath}"
+ continue
+ }
if {!$sorted} {
sortsites fetch_urls [mirror_sites $fallback_mirror_site {} {} [get_full_mirror_sites_path]] master_sites
set sorted yes
@@ -475,31 +483,12 @@
}
unset -nocomplain fetched
foreach site $urlmap($url_var) {
- ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]"
+ ui_notice "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]"
set file_url [portfetch::assemble_url $site $distfile]
- set effectiveURL ""
- if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} {"${distpath}/${distfile}.TMP"}} result] &&
+ if {![catch {eval curl fetch $fetch_options {$file_url} {"${distpath}/${distfile}.TMP"}} result] &&
![catch {file rename -force "${distpath}/${distfile}.TMP" "${distpath}/${distfile}"} result]} {
-
- # Special hack to check for sourceforge mirrors, which don't return a proper error code on failure
- if {![string equal $effectiveURL $file_url] &&
- [string match "http://*sourceforge.net/*" $file_url] &&
- [string match "http://*sourceforge.net/projects/*/files/" $effectiveURL]} {
-
- # *SourceForge hackage in effect*
- # The url seen by curl seems to have been a redirect to the sourceforge mirror page
- ui_debug "[msgcat::mc "Fetching from sourceforge mirror failed"]"
- file delete -force "${distpath}/${distfile}.TMP"
-
- # Continue on to try the next mirror, if any
- } else {
-
- # Successful fetch
- set fetched 1
- break
-
- }
-
+ set fetched 1
+ break
} else {
ui_debug "[msgcat::mc "Fetching failed:"]: $result"
file delete -force "${distpath}/${distfile}.TMP"
Modified: branches/new-help-system/base/src/port1.0/portinstall.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portinstall.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port1.0/portinstall.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -142,12 +142,18 @@
proc portinstall::install_main {args} {
global name version portpath categories description long_description \
- homepage depends_run installPlist package-install workdir \
+ homepage depends_run installPlist package-install workdir workpath \
worksrcdir UI_PREFIX destroot revision maintainers user_options \
portvariants negated_variants targets depends_lib PortInfo epoch license \
registry.installtype registry.path registry.format \
os.platform os.major
+ set oldpwd [pwd]
+ if {$oldpwd == ""} {
+ set oldpwd $portpath
+ }
+ _cd $workpath
+
if {[string equal ${registry.format} "receipt_sqlite"]} {
# registry2.0
@@ -266,6 +272,7 @@
registry_write $regref
}
+ _cd $oldpwd
return 0
}
Modified: branches/new-help-system/base/src/port1.0/portlint.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portlint.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port1.0/portlint.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -90,7 +90,7 @@
proc portlint::lint_start {args} {
global UI_PREFIX name
- ui_msg "$UI_PREFIX [format [msgcat::mc "Verifying Portfile for %s"] ${name}]"
+ ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying Portfile for %s"] ${name}]"
}
proc portlint::lint_main {args} {
@@ -532,7 +532,7 @@
ui_debug "Archs: $portarch"
###################################################################
- ui_msg "$UI_PREFIX [format [msgcat::mc "%d errors and %d warnings found."] $errors $warnings]"
+ ui_notice "$UI_PREFIX [format [msgcat::mc "%d errors and %d warnings found."] $errors $warnings]"
return {$errors > 0}
}
Modified: branches/new-help-system/base/src/port1.0/porttrace.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/porttrace.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port1.0/porttrace.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -34,6 +34,7 @@
package provide porttrace 1.0
package require Pextlib 1.0
+package require portutil 1.0
namespace eval porttrace {
}
@@ -50,6 +51,7 @@
# # set trace_fifo "$workpath/trace_fifo"
set trace_fifo "/tmp/macports/[pid]_[expr {int(rand()*1000)}]"
file mkdir "/tmp/macports"
+ chownAsRoot "/tmp/macports"
file delete -force $trace_fifo
# Create the thread/process.
@@ -78,7 +80,7 @@
# /Library/Caches/com.apple.Xcode
# $CCACHE_DIR
# $HOMEDIR/.ccache
- set trace_sandboxbounds "/tmp:/private/tmp:/var/tmp:/private/var/tmp:/dev/:/etc/passwd:/etc/groups:/etc/localtime:/Library/Caches/com.apple.Xcode:$env(HOME)/.ccache:${workpath}:${portpath}:${distpath}"
+ set trace_sandboxbounds "/tmp:/private/tmp:/var/tmp:/private/var/tmp:/var/empty:/private/var/empty:/dev:/etc/passwd:/etc/groups:/etc/localtime:/Library/Caches/com.apple.Xcode:$env(HOME)/.ccache:${workpath}:${portpath}:${distpath}"
if {[info exists env(TMPDIR)]} {
set trace_sandboxbounds "${trace_sandboxbounds}:$env(TMPDIR)"
}
@@ -173,7 +175,7 @@
# Private
# Create the slave thread.
proc porttrace::create_slave {workpath trace_fifo} {
- global trace_thread
+ global trace_thread prefix developer_dir
# Create the thread.
set trace_thread [macports_create_thread]
@@ -181,6 +183,10 @@
thread::send $trace_thread "package require registry 1.0"
# and this file as well.
thread::send $trace_thread "package require porttrace 1.0"
+ # slave needs ui_warn and ui_debug...
+ thread::send $trace_thread "macports::ui_init warn; macports::ui_init debug"
+ # and these variables
+ thread::send $trace_thread "set prefix \"$prefix\"; set developer_dir \"$developer_dir\""
# Initialize the slave
thread::send $trace_thread "porttrace::slave_init $trace_fifo $workpath"
Modified: branches/new-help-system/base/src/port1.0/portutil.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portutil.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/port1.0/portutil.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -1579,6 +1579,7 @@
if {[catch {flock $fd -exclusive -noblock} result]} {
if {"$result" == "EAGAIN"} {
ui_msg "Waiting for lock on $statefile"
+ flock $fd -exclusive
} elseif {"$result" == "EOPNOTSUPP"} {
# Locking not supported, just return
return $fd
@@ -1586,7 +1587,6 @@
return -code error "$result obtaining lock on $statefile"
}
}
- flock $fd -exclusive
}
return $fd
}
@@ -2031,6 +2031,8 @@
ui_warn "adduser only works when running as root."
ui_warn "The requested user '$name' was not created."
return
+ } elseif {[geteuid] != 0} {
+ seteuid 0; setegid 0
}
set passwd {*}
@@ -2072,6 +2074,8 @@
ui_warn "addgroup only works when running as root."
ui_warn "The requested group '$name' was not created."
return
+ } elseif {[geteuid] != 0} {
+ seteuid 0; setegid 0
}
set gid [nextgid]
Modified: branches/new-help-system/base/src/registry2.0/entry.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/entry.c 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/registry2.0/entry.c 2010-08-21 15:04:44 UTC (rev 70795)
@@ -162,6 +162,8 @@
reg_entry_free(entry);
}
Tcl_DeleteCommand(interp, Tcl_GetString(objv[2]));
+ /* set flag so that the db will be vacuumed when we close it */
+ Tcl_SetAssocData(interp, "registry::needs_vacuum", NULL, (ClientData)1);
return TCL_OK;
}
}
Property changes on: branches/new-help-system/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:57889-69809
/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:57889-70794
/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/new-help-system/base/src/registry2.0/registry.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry.c 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/registry2.0/registry.c 2010-08-21 15:04:44 UTC (rev 70795)
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <tcl.h>
@@ -106,9 +107,13 @@
*
* Then it will leak memory :(
*/
-static void delete_reg(ClientData reg, Tcl_Interp* interp UNUSED) {
+static void delete_reg(ClientData reg, Tcl_Interp* interp) {
reg_error error;
if (((reg_registry*)reg)->status & reg_attached) {
+ if (Tcl_GetAssocData(interp, "registry::needs_vacuum", NULL) != NULL) {
+ reg_vacuum(Tcl_GetAssocData(interp, "registry::db_path", NULL));
+ Tcl_DeleteAssocData(interp, "registry::needs_vacuum");
+ }
if (!registry_tcl_detach(interp, (reg_registry*)reg, &error)) {
fprintf(stderr, "%s", error.description);
reg_error_destruct(&error);
@@ -120,6 +125,11 @@
}
}
+/* simple destructor for malloc()ed assoc data */
+static void free_assoc_data(ClientData ptr, Tcl_Interp* interp UNUSED) {
+ free(ptr);
+}
+
/**
* Returns the sqlite3 DB associated with interp.
*
@@ -168,6 +178,10 @@
char* path = Tcl_GetString(objv[1]);
reg_registry* reg = registry_for(interp, 0);
reg_error error;
+ if (Tcl_GetAssocData(interp, "registry::db_path", NULL) == NULL) {
+ char *pathCopy = strdup(path);
+ Tcl_SetAssocData(interp, "registry::db_path", free_assoc_data, pathCopy);
+ }
if (reg == NULL) {
return TCL_ERROR;
} else if (reg_attach(reg, path, &error)) {
@@ -189,6 +203,10 @@
return TCL_ERROR;
} else {
reg_error error;
+ if (Tcl_GetAssocData(interp, "registry::needs_vacuum", NULL) != NULL) {
+ reg_vacuum(Tcl_GetAssocData(interp, "registry::db_path", NULL));
+ Tcl_DeleteAssocData(interp, "registry::needs_vacuum");
+ }
if (registry_tcl_detach(interp, reg, &error)) {
return TCL_OK;
}
Modified: branches/new-help-system/base/src/registry2.0/registry.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry.tcl 2010-08-21 14:53:13 UTC (rev 70794)
+++ branches/new-help-system/base/src/registry2.0/registry.tcl 2010-08-21 15:04:44 UTC (rev 70795)
@@ -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,53 @@
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]} {
+ if {![file writable [file dirname $lockpath]]} {
+ # skip locking, registry can't be modified anyway
+ return
+ }
+ 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/20100821/34452b31/attachment-0001.html>
More information about the macports-changes
mailing list