[110832] branches/new-help-system/base
raimue at macports.org
raimue at macports.org
Sat Sep 7 02:48:49 PDT 2013
Revision: 110832
https://trac.macports.org/changeset/110832
Author: raimue at macports.org
Date: 2013-09-07 02:48:49 -0700 (Sat, 07 Sep 2013)
Log Message:
-----------
Merge from trunk
Modified Paths:
--------------
branches/new-help-system/base/ChangeLog
branches/new-help-system/base/Mk/macports.autoconf.mk.in
branches/new-help-system/base/Mk/macports.tea.mk
branches/new-help-system/base/config/RELEASE_URL
branches/new-help-system/base/config/macports_version
branches/new-help-system/base/configure
branches/new-help-system/base/configure.ac
branches/new-help-system/base/doc/archive_sites.conf
branches/new-help-system/base/doc/exampleport/Portfile
branches/new-help-system/base/doc/macports.conf.in
branches/new-help-system/base/doc/pubkeys.conf.in
branches/new-help-system/base/doc/sources.conf
branches/new-help-system/base/doc/variants.conf
branches/new-help-system/base/portmgr/ReleaseProcess
branches/new-help-system/base/portmgr/jobs/mprsyncup
branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl
branches/new-help-system/base/src/Makefile.in
branches/new-help-system/base/src/config.h.in
branches/new-help-system/base/src/cregistry/entry.h
branches/new-help-system/base/src/darwintracelib1.0/Makefile
branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c
branches/new-help-system/base/src/images_to_archives.tcl
branches/new-help-system/base/src/machista1.0/Makefile.in
branches/new-help-system/base/src/macports1.0/Makefile
branches/new-help-system/base/src/macports1.0/macports.tcl
branches/new-help-system/base/src/package1.0/portarchivefetch.tcl
branches/new-help-system/base/src/package1.0/portdmg.tcl
branches/new-help-system/base/src/package1.0/portdpkg.tcl
branches/new-help-system/base/src/package1.0/portmdmg.tcl
branches/new-help-system/base/src/package1.0/portmpkg.tcl
branches/new-help-system/base/src/package1.0/portpkg.tcl
branches/new-help-system/base/src/package1.0/portrpm.tcl
branches/new-help-system/base/src/package1.0/portsrpm.tcl
branches/new-help-system/base/src/package1.0/portunarchive.tcl
branches/new-help-system/base/src/pextlib1.0/curl.c
branches/new-help-system/base/src/pextlib1.0/system.c
branches/new-help-system/base/src/pextlib1.0/tracelib.c
branches/new-help-system/base/src/pextlib1.0/tracelib.h
branches/new-help-system/base/src/port/port.tcl
branches/new-help-system/base/src/port/portindex.tcl
branches/new-help-system/base/src/port1.0/fetch_common.tcl
branches/new-help-system/base/src/port1.0/portactivate.tcl
branches/new-help-system/base/src/port1.0/portbuild.tcl
branches/new-help-system/base/src/port1.0/portchecksum.tcl
branches/new-help-system/base/src/port1.0/portclean.tcl
branches/new-help-system/base/src/port1.0/portconfigure.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/portdistcheck.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/portlivecheck.tcl
branches/new-help-system/base/src/port1.0/portmain.tcl
branches/new-help-system/base/src/port1.0/portsandbox.tcl
branches/new-help-system/base/src/port1.0/portstartupitem.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/Makefile
branches/new-help-system/base/src/registry2.0/portimage.tcl
branches/new-help-system/base/tests/test/checksums-1/master
branches/new-help-system/base/tests/test/dependencies-c/master
branches/new-help-system/base/tests/test/dependencies-d/master
branches/new-help-system/base/tests/test/envvariables/master
branches/new-help-system/base/tests/test/site-tags/master
branches/new-help-system/base/tests/test/statefile-version1-outdated/master
branches/new-help-system/base/tests/test/statefile-version2-invalid/master
branches/new-help-system/base/tests/test/statefile-version2-outdated/master
branches/new-help-system/base/tests/test/svn-and-patchsites/master
branches/new-help-system/base/tests/test/trace/Makefile
branches/new-help-system/base/tests/test/trace/Portfile
branches/new-help-system/base/tests/test/trace/master
branches/new-help-system/base/tests/test/variants/master
branches/new-help-system/base/tests/test/xcodeversion/Portfile
branches/new-help-system/base/tests/test/xcodeversion/master
Added Paths:
-----------
branches/new-help-system/base/src/pextlib1.0/Makefile.in
branches/new-help-system/base/src/pextlib1.0/strlcat.c
branches/new-help-system/base/src/pextlib1.0/strlcat.h
branches/new-help-system/base/tests/test/dependencies-a/master
branches/new-help-system/base/tests/test/dependencies-b/master
Removed Paths:
-------------
branches/new-help-system/base/src/macports1.0/macports_index.tcl
branches/new-help-system/base/src/pextlib1.0/Makefile
Property Changed:
----------------
branches/new-help-system/base/
branches/new-help-system/base/src/pextlib1.0/
Property changes on: branches/new-help-system/base
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/gsoc11-rev-upgrade/base:78828-88375
/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-104698
/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/gsoc11-rev-upgrade/base:78828-88375
/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-110831
/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 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/ChangeLog 2013-09-07 09:48:49 UTC (rev 110832)
@@ -3,10 +3,49 @@
# $Id$
###
-Release 2.2.0 (unreleased)
- - Remove unimplemented 'port submit'.
+Release 2.2.1 (unreleased)
+ - Provide choice of GCC version when compiling with DragonEgg.
+ (larryv in r108040)
+
+ - Add Portfile options for setting OBJCXX, OBJCXXFLAGS, and
+ universal architecture flags in OBJCFLAGS.
+ (#38512, larryv in r107973, r107976, r107987)
+
+ - Add support for autostarting tasks with startupitems after installing.
+ Useful for the certsync port. (#35474, cal in r106810, 109245)
+
+Release 2.2.0 (2013-07-23 by jmr)
+ - Fixed ports sometimes being incorrectly cleaned after the unarchive
+ target is run with newer archives. (jmr in r106717)
+
+ - When rebuilding an installed port, fixed the old copy being removed
+ before the new copy has been built. (jmr in r106668)
+
+ - Support deleting selected files and directories before creating a pkg.
+ (blair in r105575)
+
+ - Remove unsupported xpkg package type, xar-based format with XML.
+ (afb in r105002)
+
+ - Support pattern matching in compiler.blacklist.
+ (larryv in r104174, r104178)
+
+ - Workaround for some OS commands hanging on 10.8 when started from a root
+ login shell. (#34221, jeremyhu in r104118)
+
+ - TMPDIR is now set to ${workpath}/.tmp while building ports, to avoid
+ problems with using /tmp. (#37834, ryandesign in r103518)
+
+ - Remove unimplemented 'port submit', remove XAR source packages.
(cal in r103400)
+ - Prevent overlinking by removing dependency_libs information from
+ GNU Libtool (.la) files or by deleting the files entirely.
+ (#38010; jmr in r102945; jeremyhu in r107465, r107527)
+
+ - Setting configure.compiler will now automatically add a dependency if
+ the chosen compiler is provided by a port. (#32542, cal in r102932)
+
- Add 'port space --total' which displays the grand total only.
(raimue in r102248)
@@ -17,12 +56,14 @@
- Fixes bringing trace mode back to a working state. Improvements to reduce
the number of builds trace mode breaks.
- (cal in r100071-100073, r100077, r100126, r100221)
+ (cal in r100071-100073, r100077, r100126, r100221, r106710)
- Began using sandbox-exec(1) on 10.5+ to prevent commands executed using
the 'system' procedure from writing files outside of the build directory
and selected other locations like /tmp. (jmr in r98156, r98193, etc.)
+ - Added ability to sync ports tree with git (jeremyhu in r92410)
+
Release 2.1.3 (2013-01-31 by jmr)
- Fixed a bug where a certain order of starting and aborting a build,
running selfupdate and continuing a build would resume building although
Modified: branches/new-help-system/base/Mk/macports.autoconf.mk.in
===================================================================
--- branches/new-help-system/base/Mk/macports.autoconf.mk.in 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/Mk/macports.autoconf.mk.in 2013-09-07 09:48:49 UTC (rev 110832)
@@ -7,7 +7,7 @@
VPATH = @srcdir@
CC = @CC@
-CFLAGS = @CFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_PEDANTIC) $(CFLAGS_WERROR)
+CFLAGS = @CFLAGS@ -std=c99 $(CFLAGS_QUICHEEATERS) $(CFLAGS_PEDANTIC) $(CFLAGS_WERROR)
OBJCFLAGS = @OBJCFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_PEDANTIC) $(CFLAGS_WERROR)
CPPFLAGS = @CPPFLAGS@ @DEFS@ @INCLUDES@ @TCL_INCLUDES@
TCL_DEFS = @TCL_DEFS@
Modified: branches/new-help-system/base/Mk/macports.tea.mk
===================================================================
--- branches/new-help-system/base/Mk/macports.tea.mk 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/Mk/macports.tea.mk 2013-09-07 09:48:49 UTC (rev 110832)
@@ -10,7 +10,7 @@
all:: ${SHLIB_NAME} pkgIndex.tcl
-$(SHLIB_NAME):: ${OBJS}
+$(SHLIB_NAME): ${OBJS}
${SHLIB_LD} ${OBJS} -o ${SHLIB_NAME} ${TCL_STUB_LIB_SPEC} ${SHLIB_LDFLAGS} ${LIBS}
pkgIndex.tcl: $(SHLIB_NAME)
Modified: branches/new-help-system/base/config/RELEASE_URL
===================================================================
--- branches/new-help-system/base/config/RELEASE_URL 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/config/RELEASE_URL 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1 +1 @@
-https://svn.macports.org/repository/macports/tags/release_2_1_3/base
+https://svn.macports.org/repository/macports/tags/release_2_2_0/base
Modified: branches/new-help-system/base/config/macports_version
===================================================================
--- branches/new-help-system/base/config/macports_version 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/config/macports_version 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1 +1 @@
-2.1.99
+2.2.99
Modified: branches/new-help-system/base/configure
===================================================================
--- branches/new-help-system/base/configure 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/configure 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for MacPorts 2.1.99.
+# Generated by GNU Autoconf 2.69 for MacPorts 2.2.99.
#
# Report bugs to <macports-dev at lists.macosforge.org>.
#
@@ -580,8 +580,8 @@
# Identity of this package.
PACKAGE_NAME='MacPorts'
PACKAGE_TARNAME='macports'
-PACKAGE_VERSION='2.1.99'
-PACKAGE_STRING='MacPorts 2.1.99'
+PACKAGE_VERSION='2.2.99'
+PACKAGE_STRING='MacPorts 2.2.99'
PACKAGE_BUGREPORT='macports-dev at lists.macosforge.org'
PACKAGE_URL=''
@@ -661,6 +661,7 @@
READLINE_LIBS
MD5_LIBS
READLINK_IS_NOT_P1003_1A
+ac_cv_func_strlcat
CPP
UNIVERSAL_ARCHS
MPFRAMEWORKSDIR
@@ -841,7 +842,6 @@
with_sqlite3prefix
with_tcl_sqlite3
with_included_tclthread
-with_trace_sdk
enable_shared
'
ac_precious_vars='build_alias
@@ -1414,7 +1414,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures MacPorts 2.1.99 to adapt to many kinds of systems.
+\`configure' configures MacPorts 2.2.99 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1480,7 +1480,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of MacPorts 2.1.99:";;
+ short | recursive ) echo "Configuration of MacPorts 2.2.99:";;
esac
cat <<\_ACEOF
@@ -1527,8 +1527,6 @@
--with-tcl-sqlite3=DIR directory for Tcl sqlite3 (default /usr/lib/sqlite3)
--with-included-tclthread
install included Thread package.
- --with-trace-sdk=SDK SDK for redirection in trace lib (for example
- MacOSX10.4u.sdk)
Some influential environment variables:
CC C compiler command
@@ -1627,7 +1625,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-MacPorts configure 2.1.99
+MacPorts configure 2.2.99
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2296,7 +2294,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by MacPorts $as_me 2.1.99, which was
+It was created by MacPorts $as_me 2.2.99, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2791,7 +2789,7 @@
# Read in the MacPorts version from the base/config/macports_version file
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking MacPorts version" >&5
$as_echo_n "checking MacPorts version... " >&6; }
-MACPORTS_VERSION=2.1.99
+MACPORTS_VERSION=2.2.99
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACPORTS_VERSION" >&5
$as_echo "$MACPORTS_VERSION" >&6; }
@@ -2957,7 +2955,7 @@
as_fn_error $? "This version of Mac OS X is not supported
Please upgrade at http://store.apple.com/" "$LINENO" 5
;;
- 10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-7]|10.7.[0-4]|10.8.[0-1])
+ 10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-7]|10.7.[0-4]|10.8.[0-3])
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This version of Mac OS X is out of date" >&5
$as_echo "$as_me: WARNING: This version of Mac OS X is out of date" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please run Software Update to update it" >&5
@@ -3011,8 +3009,8 @@
1.*|2.[0-1]*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This version of Xcode Tools is not supported" >&5
$as_echo "$as_me: WARNING: This version of Xcode Tools is not supported" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please upgrade at http://connect.apple.com/" >&5
-$as_echo "$as_me: WARNING: Please upgrade at http://connect.apple.com/" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please upgrade at https://developer.apple.com/downloads/" >&5
+$as_echo "$as_me: WARNING: Please upgrade at https://developer.apple.com/downloads/" >&2;}
;;
2.[2-3]*|3.[0]*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This version of Xcode Tools is out of date" >&5
@@ -8829,7 +8827,7 @@
fi
for ac_header in limits.h paths.h sys/file.h crt_externs.h fcntl.h sys/fcntl.h sys/cdefs.h err.h sys/socket.h \
- sys/sysctl.h readline/readline.h readline/history.h pwd.h sys/paths.h utime.h
+ sys/event.h sys/sysctl.h readline/readline.h readline/history.h pwd.h sys/paths.h utime.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -8846,7 +8844,7 @@
INCLUDES="-I.. -I. $INCLUDES"
# Checks for library functions.
-for ac_func in bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile clearenv sysctlbyname
+for ac_func in bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy strlcat copyfile clearenv sysctlbyname kqueue
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -8859,6 +8857,8 @@
done
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if readlink conforms to POSIX 1003.1a" >&5
$as_echo_n "checking if readlink conforms to POSIX 1003.1a... " >&6; }
@@ -10048,17 +10048,6 @@
patch -p0 < src/thread2.6.diff
fi
-
-
-# Check whether --with-trace-sdk was given.
-if test "${with_trace_sdk+set}" = set; then :
- withval=$with_trace_sdk; test -d ${DEVELOPER_DIR}/SDKs/$withval && cat >>confdefs.h <<_ACEOF
-#define TRACE_SDK "${withval}"
-_ACEOF
-
-fi
-
-
# Allows building of shared libraries
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
@@ -10151,7 +10140,7 @@
# Output
-ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/base.mtree doc/prefix.mtree doc/macosx.mtree doc/macports.conf doc/pubkeys.conf portmgr/freebsd/Makefile src/Makefile src/machista1.0/Makefile src/macports1.0/macports_autoconf.tcl src/port1.0/port_autoconf.tcl src/registry2.0/registry_autoconf.tcl src/programs/Makefile src/macports1.0/macports_fastload.tcl setupenv.bash"
+ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile setupenv.bash src/Makefile src/machista1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_fastload.tcl src/pextlib1.0/Makefile src/port1.0/port_autoconf.tcl src/programs/Makefile src/registry2.0/registry_autoconf.tcl"
ac_config_files="$ac_config_files src/pkg_mkindex.sh"
@@ -10663,7 +10652,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by MacPorts $as_me 2.1.99, which was
+This file was extended by MacPorts $as_me 2.2.99, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -10725,7 +10714,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-MacPorts config.status 2.1.99
+MacPorts config.status 2.2.99
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -10853,19 +10842,20 @@
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"Mk/macports.autoconf.mk") CONFIG_FILES="$CONFIG_FILES Mk/macports.autoconf.mk" ;;
"doc/base.mtree") CONFIG_FILES="$CONFIG_FILES doc/base.mtree" ;;
- "doc/prefix.mtree") CONFIG_FILES="$CONFIG_FILES doc/prefix.mtree" ;;
"doc/macosx.mtree") CONFIG_FILES="$CONFIG_FILES doc/macosx.mtree" ;;
"doc/macports.conf") CONFIG_FILES="$CONFIG_FILES doc/macports.conf" ;;
+ "doc/prefix.mtree") CONFIG_FILES="$CONFIG_FILES doc/prefix.mtree" ;;
"doc/pubkeys.conf") CONFIG_FILES="$CONFIG_FILES doc/pubkeys.conf" ;;
"portmgr/freebsd/Makefile") CONFIG_FILES="$CONFIG_FILES portmgr/freebsd/Makefile" ;;
+ "setupenv.bash") CONFIG_FILES="$CONFIG_FILES setupenv.bash" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"src/machista1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/machista1.0/Makefile" ;;
"src/macports1.0/macports_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_autoconf.tcl" ;;
+ "src/macports1.0/macports_fastload.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_fastload.tcl" ;;
+ "src/pextlib1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/pextlib1.0/Makefile" ;;
"src/port1.0/port_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/port1.0/port_autoconf.tcl" ;;
- "src/registry2.0/registry_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/registry2.0/registry_autoconf.tcl" ;;
"src/programs/Makefile") CONFIG_FILES="$CONFIG_FILES src/programs/Makefile" ;;
- "src/macports1.0/macports_fastload.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_fastload.tcl" ;;
- "setupenv.bash") CONFIG_FILES="$CONFIG_FILES setupenv.bash" ;;
+ "src/registry2.0/registry_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/registry2.0/registry_autoconf.tcl" ;;
"src/pkg_mkindex.sh") CONFIG_FILES="$CONFIG_FILES src/pkg_mkindex.sh" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
Modified: branches/new-help-system/base/configure.ac
===================================================================
--- branches/new-help-system/base/configure.ac 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/configure.ac 2013-09-07 09:48:49 UTC (rev 110832)
@@ -32,7 +32,7 @@
AC_MSG_ERROR([This version of Mac OS X is not supported
Please upgrade at http://store.apple.com/])
;;
- 10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-1]])
+ 10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-3]])
AC_MSG_WARN([This version of Mac OS X is out of date])
AC_MSG_WARN([Please run Software Update to update it])
;;
@@ -80,7 +80,7 @@
case "$XCODE_VERSION" in
1.*|2.[[0-1]]*)
AC_MSG_WARN([This version of Xcode Tools is not supported])
- AC_MSG_WARN([Please upgrade at http://connect.apple.com/])
+ AC_MSG_WARN([Please upgrade at https://developer.apple.com/downloads/])
;;
2.[[2-3]]*|3.[[0]]*)
AC_MSG_WARN([This version of Xcode Tools is out of date])
@@ -240,12 +240,14 @@
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([limits.h paths.h sys/file.h crt_externs.h fcntl.h sys/fcntl.h sys/cdefs.h err.h sys/socket.h \
- sys/sysctl.h readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
+ sys/event.h sys/sysctl.h readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
INCLUDES="-I.. -I. $INCLUDES"
# Checks for library functions.
-AC_CHECK_FUNCS([bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile clearenv sysctlbyname])
+AC_CHECK_FUNCS([bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy strlcat copyfile clearenv sysctlbyname kqueue])
+AC_SUBST(ac_cv_func_strlcat)
+
MP_CHECK_READLINK_IS_P1003_1A
# Check for md5 implementation
@@ -330,13 +332,6 @@
patch -p0 < src/thread2.6.diff
fi
-AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
-AC_ARG_WITH(
- trace-sdk,
- AS_HELP_STRING([--with-trace-sdk=SDK],
- [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
- [test -d ${DEVELOPER_DIR}/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
-
# Allows building of shared libraries
SC_ENABLE_SHARED
@@ -394,19 +389,20 @@
Makefile
Mk/macports.autoconf.mk
doc/base.mtree
- doc/prefix.mtree
doc/macosx.mtree
doc/macports.conf
+ doc/prefix.mtree
doc/pubkeys.conf
portmgr/freebsd/Makefile
+ setupenv.bash
src/Makefile
src/machista1.0/Makefile
src/macports1.0/macports_autoconf.tcl
+ src/macports1.0/macports_fastload.tcl
+ src/pextlib1.0/Makefile
src/port1.0/port_autoconf.tcl
- src/registry2.0/registry_autoconf.tcl
src/programs/Makefile
- src/macports1.0/macports_fastload.tcl
- setupenv.bash
+ src/registry2.0/registry_autoconf.tcl
])
AC_CONFIG_FILES([src/pkg_mkindex.sh], [chmod +x src/pkg_mkindex.sh])
Modified: branches/new-help-system/base/doc/archive_sites.conf
===================================================================
--- branches/new-help-system/base/doc/archive_sites.conf 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/doc/archive_sites.conf 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,27 +1,44 @@
-# Configuration for (binary) archive sources.
# $Id$
-# Each entry is started by a name line. The only required values are name and
-# urls. Other fields are type, prefix, applications_dir and frameworks_dir,
-# which have the usual default values:
-# type tbz2
-# prefix /opt/local
-# applications_dir /Applications/MacPorts
-# frameworks_dir ${prefix}/Library/Frameworks
+# MacPorts configuration file for binary archive sources.
+
+# Each source entry consists of one or more fields.
#
-# type can be any of: tgz, tar, tbz, tbz2, tlz, txz, xar, zip, cpgz, cpio
-# Note that some types require a corresponding tool to be installed, and
-# entries with an unsupported type will not be used.
+# name: A name for the archive source. This field always starts a new
+# entry. Required.
+#
+# urls: A space- or tab-delimited list of the source's URLs. Defaults
+# to an empty list.
+#
+# type: The filetype of the archives; valid values are "cpgz", "cpio",
+# "tar", "tbz", "tbz2", "tgz", "tlz", "txz", "xar", and "zip".
+# MacPorts handles each archive type with an appropriate external
+# executable; if it cannot find such an executable, or if the
+# specified type is invalid, the source is not used. Defaults to
+# "tbz2".
+#
+# prefix: The prefix of the MacPorts installation used to create the
+# source's archives. This must match the value of "prefix" set in
+# macports.conf, or the source is not used. Defaults to
+# "/opt/local".
+#
+# applications_dir: The applications directory of the MacPorts
+# installation used to create the source's archives. This must
+# match the value of "applications_dir" set in macports.conf, or
+# the source is not used. Defaults to "/Applications/MacPorts".
+#
+# frameworks_dir: The frameworks directory of the MacPorts
+# installation used to create the source's archives. This must
+# match the value of "frameworks_dir" set in macports.conf, or the
+# source is not used. Defaults to "[prefix]/Library/Frameworks".
-# Example:
-#name mysource
-#urls http://example.com/ ftp://ftp.example.org/
-#type tbz2
-#prefix /opt/mysource
-#applications_dir /opt/mysource/Applications
-#frameworks_dir /opt/mysource/Library/Frameworks
+# Example source:
+#name My Source
+#urls http://example.com/ ftp://ftp.example.com/packages/
+#type zip
+#prefix /opt/mysource
+#applications_dir /opt/mysource/Applications
-# If you want to disable use of the archive sites listed in the ports tree,
-# you could do this:
-#name macports_archives
-#urls
+# To disable the default archive source, uncomment the following dummy
+# entry; it will shadow the one from the ports tree.
+#name macports_archives
Modified: branches/new-help-system/base/doc/exampleport/Portfile
===================================================================
--- branches/new-help-system/base/doc/exampleport/Portfile 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/doc/exampleport/Portfile 2013-09-07 09:48:49 UTC (rev 110832)
@@ -7,88 +7,88 @@
# PortSystem <version>
# where version is the version of the ports system your port relies upon.
# This can NOT be commented out.
-PortSystem 1.0
+PortSystem 1.0
# The name of the port
-name glib2
+name glib2
# Its version information
-version 2.12.11
+version 2.12.11
# Supported and tested platforms
-platforms darwin
+platforms darwin
# Categories and identifying keywords
-categories devel
+categories devel
# Email address(es) of the port's Maintainer(s)
-maintainers ryandesign at macports.org
+maintainers ryandesign at macports.org
# A short description of this port
-description Library with data structure functions and other constructs
+description Library with data structure functions and other constructs
# A long description, with more details
-long_description Glib is a library which includes support routines for \
- C, such as lists, trees, hashes, memory allocation, and \
- many other things.
+long_description Glib is a library which includes support routines for \
+ C, such as lists, trees, hashes, memory allocation, and \
+ many other things.
# Homepage for the port:
-homepage http://www.gtk.org/
+homepage http://www.gtk.org/
# Master download sites for port's distribution file(s)
-master_sites ftp://ftp.gtk.org/pub/glib/2.12 \
- gnome:sources/glib/2.12
+master_sites ftp://ftp.gtk.org/pub/glib/2.12 \
+ gnome:sources/glib/2.12
# Name of the distribution file, minus extract suffix (see below)
-distname glib-${version}
+distname glib-${version}
# (Optional) Explicitly set suffix (default: .tar.gz)
-#extract.suffix .tar.bz2
+#extract.suffix .tar.bz2
# (Optional) Use bzip2 instead of gzip for uncompressing distribution file
-use_bzip2 yes
+use_bzip2 yes
# List of checksums for files to be fetched
# <file name> <checksum type> <checksum>
-checksums ${distname}${extract.suffix} md5 077a9917b673a9a0bc63f351786dde24 \
- ${distname}${extract.suffix} sha1 02d344295ddaeafeec6bc6824b71e12bbf1b0394 \
- ${distname}${extract.suffix} rmd160 8680d27e630643e6653d88537907d06e3ba6e91a
+checksums ${distname}${extract.suffix} md5 077a9917b673a9a0bc63f351786dde24 \
+ ${distname}${extract.suffix} sha1 02d344295ddaeafeec6bc6824b71e12bbf1b0394 \
+ ${distname}${extract.suffix} rmd160 8680d27e630643e6653d88537907d06e3ba6e91a
# Any patches which should be applied after extracting this port. These
-
# should go in the files/ subdirectory of the port.
-patchfiles patch-glib-2.0.pc.in patch-glib__gutils.c
+patchfiles patch-glib-2.0.pc.in \
+ patch-glib__gutils.c
# Dependencies are defined by three settings:
-# depends_lib: installed at build time and at install time
-# depends_run: installed at install time
-# depends_build: installed at build time
+# depends_lib: installed at build time and at install time
+# depends_run: installed at install time
+# depends_build: installed at build time
#
# These options accept a list of depspecs. Depspecs are ':' delimited three
# value lists of type:match:portname. The following types are supported:
#
-# lib - The lib type requires the match argument in the
-# format <libraryname>.<major version>
-# bin - The bin type requires the match argument to be the full
-# executable name
-# <path> - If a full path is specified as the type, the math argument
-# must be a complete regexp.
-# portname must be the name of a valid port to build and install
-# if the depspec is not matched.
-# An alternative dependency depspec is the port:<portname> syntax,
-# used when you want to insure the given dependency is satisfied
-# exclusively by MacPorts.
-depends_build port:pkgconfig
-depends_lib port:gettext
+# lib - The lib type requires the match argument in the
+# format <libraryname>.<major version>
+# bin - The bin type requires the match argument to be the full
+# executable name
+# <path> - If a full path is specified as the type, the math argument
+# must be a complete regexp.
+# portname must be the name of a valid port to build and install
+# if the depspec is not matched.
+# An alternative dependency depspec is the port:<portname> syntax,
+# used when you want to insure the given dependency is satisfied
+# exclusively by MacPorts.
+depends_build port:pkgconfig
+depends_lib port:gettext
# The type of configuration script this port uses.
-#configure.type gnu
+#configure.type gnu
# A list of configuration time arguments you might want to pass to the configure script:
-configure.args --mandir=${prefix}/share/man
+configure.args --mandir=${prefix}/share/man
# The directory name of the subdirectory of work/ where this port extracts
-#worksrcdir glib
+#worksrcdir glib
# Alternative ways to build the port, packed as 'variants'
variant puredarwin { depends_run bin:perl:perl5.8 }
Modified: branches/new-help-system/base/doc/macports.conf.in
===================================================================
--- branches/new-help-system/base/doc/macports.conf.in 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/doc/macports.conf.in 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,168 +1,199 @@
-# MacPorts system wide configuration file
# $Id$
-# Set the directory in which to install ports. Must match where MacPorts itself is installed.
-prefix @prefix_expanded@
+# MacPorts system-wide configuration file.
+# Commented-out values are defaults unless otherwise noted.
-# Set the user to run MacPorts compiles, etc as when privileges are dropped during an install
-#macportsuser @RUNUSR@
+# Directory under which MacPorts should install ports. This must be
+# where MacPorts itself is installed.
+prefix @prefix_expanded@
-# Where to store MacPorts working data
-portdbpath @localstatedir_expanded@/macports
+# User to run operations as when MacPorts drops privileges.
+#macportsuser @RUNUSR@
-# PATH settings that are used for external tools (configure, make, etc.) while
-# installing ports. The default paths are given in the example; it need not be
-# uncommented. Customizing binpath is unsupported and is intended for
-# advanced users only.
-#binpath @prefix_expanded@/bin:@prefix_expanded@/sbin:/bin:/sbin:/usr/bin:/usr/sbin
+# Directory for MacPorts working data.
+portdbpath @localstatedir_expanded@/macports
-# Directory containing Xcode Tools (default is to ask xcode-select)
-#developer_dir @DEVELOPER_DIR@
+# Colon-delimited list of directories to search for external tools
+# (make(1), pkg-config(1), etc.). While installing ports, MacPorts uses
+# this list for PATH. Changing this setting is intended for advanced
+# users only and is unsupported.
+#binpath @prefix_expanded@/bin:@prefix_expanded@/sbin:/bin:/sbin:/usr/bin:/usr/sbin
-# Path to PackageMaker.app
-# It may be necessary to set this with Xcode >= 4.3, as that version
-# requires PackageMaker to be installed manually from the Auxiliary Tools for
-# Xcode disk image. The default is /Applications/PackageMaker.app with Xcode
-# 4.3 and ${developer_dir}/Applications/Utilities/PackageMaker.app with older
-# versions.
-#packagemaker_path /Applications/PackageMaker.app
+# Directory containing Xcode Tools. By default, MacPorts determines this
+# using xcode-select(1).
+#developer_dir @DEVELOPER_DIR@
-# Directory containing Applications from ports.
-applications_dir @MPAPPLICATIONSDIR@
+# Location of PackageMaker. Defaults to
+# "${developer_dir}/Applications/Utilities/PackageMaker.app" with Xcode
+# 4.2 and earlier and "/Applications/PackageMaker.app" with 4.3 and later.
+#packagemaker_path /Applications/PackageMaker.app
-# Directory containing Frameworks from ports.
-frameworks_dir @MPFRAMEWORKSDIR@
+# Directory for application bundles installed by ports.
+applications_dir @MPAPPLICATIONSDIR@
-# Where to find the sources list.
-sources_conf @MPCONFIGDIR_EXPANDED@/sources.conf
+# Directory for frameworks installed by ports.
+frameworks_dir @MPFRAMEWORKSDIR@
-# Where to find global variants definition file (optional)
-variants_conf @MPCONFIGDIR_EXPANDED@/variants.conf
+# Location of the MacPorts sources list.
+sources_conf @MPCONFIGDIR_EXPANDED@/sources.conf
-# When to build ports from source. Default is 'ifneeded', which downloads an
-# archive if available or builds from source otherwise. 'always' has the same
-# effect as -s on the command line, and 'never' is likewise the same as -b.
-#buildfromsource ifneeded
+# Location of the MacPorts global variants definition file. Optional.
+variants_conf @MPCONFIGDIR_EXPANDED@/variants.conf
-# Type of archives to use for port images
-#
-# Supported types: tgz, tar, tbz, tbz2 (default), tlz, txz, xar, zip, cpgz, cpio
-#portarchivetype tbz2
+# When MacPorts should build ports from source.
+# - ifneeded: Download binary archives if available; build from source
+# otherwise.
+# - always: Always build from source; never try fetching archives.
+# - never: Never build from source; try fetching archives and abort if
+# unavailable.
+#buildfromsource ifneeded
-# CPU architecture to compile for. Defaults to i386 or ppc on Mac OS X 10.5
-# and earlier, depending on the CPU type detected at runtime. On Mac OS X 10.6
-# the default is x86_64 if the CPU supports it, i386 otherwise.
-#build_arch i386
+# Type of archive to use for port images. Supported types are cpgz,
+# cpio, tar, tbz, tbz2, tgz, tlz, txz, xar, zip.
+#portarchivetype tbz2
-# CPU architectures to use for Universal Binaries (+universal variant)
-universal_archs @UNIVERSAL_ARCHS@
+# CPU architecture to target. Supported values are "ppc", "ppc64",
+# "i386", and "x86_64". Defaults to:
+# - OS X 10.5 and earlier: "ppc" on PowerPC, otherwise "i386".
+# - OS X 10.6 and later: "x86_64" on Intel 64, otherwise "i386".
+#build_arch i386
-# Use ccache (C/C++ compiler cache) - see http://ccache.samba.org/
-#configureccache no
+# Space-delimited list of CPU architectures to target when building
+# universal. Defaults to "i386 ppc" on OS X 10.5 and earlier and
+# "x64_64 i386" on OS X 10.6 and later.
+universal_archs @UNIVERSAL_ARCHS@
-# Location where ccache stores its files
-#ccache_dir @localstatedir_expanded@/macports/build/.ccache
+# Use ccache, a compiler cache for C, C++, Objective-C, and
+# Objective-C++. (See http://ccache.samba.org.) The "ccache" executable
+# must exist in one of the directories in binpath.
+#configureccache no
-# Maximum size ccache may use.
-# Use 'G', 'M', or 'K' suffix for giga-, mega- or kilobytes.
-#ccache_size 2G
+# Directory for ccache's cached compiler output.
+#ccache_dir @localstatedir_expanded@/macports/build/.ccache
-# Use distcc (distributed compiler) - see http://distcc.samba.org/
-#configuredistcc no
+# Maximum size of files stored in ccache's cache. Append "G", "M", or
+# "K" for gigabytes, megabytes, or kilobytes.
+#ccache_size 2G
-# Use pipes rather than intermediate files when compiling C/C++/etc
-#configurepipe yes
+# Use distcc, a distributed compiler for C, C++, Objective-C, and
+# Objective-C++. (See http://distcc.org.) The "distcc" executable must
+# exist in one of the directories in binpath.
+#configuredistcc no
-# Lowered scheduling priority (0-20) to use for make when building ports
-#buildnicevalue 0
+# Use pipes rather than temporary files for communication between the
+# various stages of C, C++, Objective-C, and Objective-C++ compilation.
+#configurepipe yes
-# Number of simultaneous make jobs (commands) to use when building ports. This
-# value may be set to 0 so the number of simultaneous make jobs will be set to
-# the number of CPU cores that are automatically detected, or the number of GB
-# of physical memory plus one, whichever is less.
-#buildmakejobs 0
+# Lowered scheduling priority to use for commands run during configure,
+# build, and destroot. Accepted values are 0 (normal priority) through
+# 20 (lowest priority).
+#buildnicevalue 0
-# umask value to use when a port installs its files
-#destroot_umask 022
+# Number of simultaneous make(1) jobs to use when building ports. If set
+# to 0, the number of jobs will be the lesser of:
+# - number of automatically-detected CPU cores
+# - gigabytes of physical memory + 1
+#buildmakejobs 0
-# Set whether to automatically execute "clean" after "install" of ports
-#portautoclean yes
+# umask value to use when a port installs its files.
+#destroot_umask 022
-# Set to yes if you don't want logs to be deleted after successful builds
-#keeplogs no
+# Automatically execute "clean" after "install" of ports.
+#portautoclean yes
-# Rsync server to fetch MacPorts sources from. Note that this is only used
-# for selfupdate. The source(s) for the ports tree are set in sources.conf.
-# Known mirrors at time of writing (see https://trac.macports.org/wiki/Mirrors
-# for the current list):
-# rsync.macports.org - California, USA (master)
-# trd.no.rsync.macports.org - Trondheim, Norway
-#rsync_server rsync.macports.org
+# Keep logs after successful installations.
+#keeplogs no
-# Rsync directory from which to pull the base/ component (infrastructure) of MacPorts
-# If this points to a .tar file, a signed .rmd160 must exist next to it
-# on the server and will be used to verify its integrity.
-#rsync_dir release/tarballs/base.tar
+# The rsync server for fetching MacPorts base during selfupdate. This
+# setting is NOT used when downloading the ports tree; the sources for
+# the ports tree are set in sources.conf. See
+# https://trac.macports.org/wiki/Mirrors#MacPortsSource for a list of
+# available servers.
+#rsync_server rsync.macports.org
-# Rsync options
-#rsync_options -rtzv --delete-after
+# Location of MacPorts base sources on rsync_server. If this references
+# a .tar file, a signed .rmd160 file must exist in the same directory
+# and will be used to verify its integrity. See
+# https://trac.macports.org/wiki/Mirrors#MacPortsSource to find the
+# correct rsync_dir for a particular rsync_server.
+#rsync_dir release/tarballs/base.tar
-# Options for generated startup items
-# startupitem_type may be "default", "systemstarter", "launchd", or "none";
-# if the option is empty or "default" then a startupitem type appropriate
-# to the platform will be chosen. Mac OS X 10.4 Tiger and above will default to
-# launchd, while older Mac OS X systems will default to systemstarter. If
-# option "none" is chosen, port startupitems are ignored and no startupitems
-# are installed.
-#startupitem_type default
+# Options to pass to rsync when fetching MacPorts base and the ports tree.
+#rsync_options -rtzv --delete-after
-# Option to install symlinks into /Library/LaunchAgents or /Library/LaunchDaemons
-# startupitem_install may be empty, "yes" or "no";
-# if the option is NOT "no" then a symlink for the startupitem will be created in
-# the appropriate system directory.
+# Type of generated StartupItems.
+# - launchd: Create StartupItems for use with launchd.
+# - systemstarter: Create StartupItems for use with SystemStarter.
+# - rcng: Create StartupItems for use with the rc.d system.
+# - default: Create StartupItems for launchd on OS X and for rc.d on
+# other platforms.
+# - none: Disable creation of StartupItems.
+#startupitem_type default
+
+# Create system-level symlinks to generated StartupItems. If set to
+# "no", symlinks will not be created; otherwise, symlinks will be placed
+# in /Library/LaunchDaemons or /Library/LaunchAgents as appropriate.
#startupitem_install yes
-# Extra environment variables to keep. Any variables listed here are added
-# to the list of variables that are not removed from the environment used
-# while processing ports. As with binpath, setting extra_env is intended for
-# advanced users and is unsupported.
-# extra_env KEEP_THIS THIS_TOO
+# Extra environment variables to keep. MacPorts sanitizes its
+# environment while processing ports, keeping:
+# - DISPLAY
+# - DYLD_FALLBACK_FRAMEWORK_PATH, DYLD_FALLBACK_LIBRARY_PATH,
+# DYLD_FRAMEWORK_PATH, DYLD_INSERT_LIBRARIES, DYLD_LIBRARY_PATH
+# - JAVA_HOME
+# - ARCHIVE_SITE_LOCAL, MASTER_SITE_LOCAL, PATCH_SITE_LOCAL
+# - PORTSRC
+# - ALL_PROXY, FTP_PROXY, http_proxy, HTTPS_PROXY, NO_PROXY, RSYNC_PROXY
+# - GROUP, USER
+# - COLUMNS, LINES
+# Variables listed in extra_env are added to this list. This has no
+# default value; setting it is intended for advanced users and is
+# unsupported. (Note that sudo(8) sanitizes its environment on OS X 10.5
+# and later, so it may have to be configured to pass the desired
+# variables to MacPorts.)
+#extra_env KEEP_THIS THIS_TOO
-# Proxy support
-# Precedence is: env, macports.conf, System Preferences
-# That is, if it's set in the environment, that will be used instead of
-# anything here or in System Preferences. Setting proxy_override_env to yes
-# will cause any proxies set here (or in System Preferences if set there but
-# not here) to override what's in the environment.
-# Note that System Preferences doesn't have an rsync proxy definition.
-# Also note, on 10.5, sudo will clear many environment variables including
-# those for proxy support.
-# Equivalent environment variables: http_proxy, HTTPS_PROXY, FTP_PROXY,
-# RSYNC_PROXY, NO_PROXY
-#
-#proxy_override_env yes
-# HTTP proxy:
-#proxy_http hostname:12345
-# HTTPS proxy:
-#proxy_https hostname:12345
-# FTP proxy:
-#proxy_ftp hostname:12345
-# rsync proxy:
-#proxy_rsync hostname:12345
-# hosts not to go through the proxy (comma-separated, applies to HTTP, HTTPS,
-# and FTP, but not rsync):
-#proxy_skip internal1, internal2, internal3
+# Override proxy-related environment variables. By default, MacPorts
+# takes proxy settings from the environment, from the proxy_* options
+# below, and from Network Preferences, in that order. If this is set to
+# "yes", MacPorts uses proxy_*, then Network Preferences, then the
+# environment. (Note that Network Preferences does not have a setting
+# for rsync proxies. Also note that sudo(8) sanitizes its environment on
+# OS X 10.5 and later, so it may have to be configured to pass desired
+# variables to MacPorts.)
+#proxy_override_env no
-# Options 'host_blacklist' and 'preferred_hosts', used for indicating
-# space separated lists of download hosts that should not be used or
-# should be used preferentially, respectively. These override the usual
-# ping time check.
-#host_blacklist badhost1.org badhost2.org
-#preferred_hosts preferredhost1.org preferredhost2.org
+# Proxies. These have no default values. The analogous environment
+# variables are "http_proxy", "HTTPS_PROXY", "FTP_PROXY", and
+# "RSYNC_PROXY".
+#proxy_http proxy1:12345
+#proxy_https proxy2:67890
+#proxy_ftp proxy3:02139
+#proxy_rsync proxy4:11377
-# Set whether to automatically run rev-upgrade after upgrading ports
-#revupgrade_autorun yes
-# Option controlling action taken by rev-upgrade, which checks for broken
-# linking and can rebuild affected ports. Possible values are
-#'rebuild' (default) or 'report'.
-#revupgrade_mode rebuild
+# Comma-delimited list of hosts that MacPorts should not access through
+# the HTTP, HTTPS, and FTP proxies. This does not apply to rsync, and it
+# has no default value.
+#proxy_skip host1, host2, host3
+
+# Space-delimited lists of download hosts that MacPorts should not use
+# and that MacPorts should prefer, respectively, overriding the usual
+# ping time checks. These have no default values.
+#host_blacklist badhost1 badhost2
+#preferred_hosts preferredhost1 preferredhost2
+
+# Whether MacPorts should automatically run rev-upgrade after upgrading
+# ports.
+#revupgrade_autorun yes
+
+# Whether rev-upgrade should automatically rebuild ports with broken
+# linking or merely report the breakage. Supported values are "report"
+# and "rebuild".
+#revupgrade_mode rebuild
+
+# Space-delimited list of files and directories to delete after the
+# unarchive stage and before creating a pkg. Paths are interpreted
+# relative to prefix, and there is no default value. This is useful for
+# removing unnecessary files and directories prior to pkg or mpkg
+# deployment.
+#pkg_post_unarchive_deletions include share/doc share/man
Modified: branches/new-help-system/base/doc/pubkeys.conf.in
===================================================================
--- branches/new-help-system/base/doc/pubkeys.conf.in 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/doc/pubkeys.conf.in 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,10 +1,15 @@
-# Downloaded archives will only be used if they can be verified by a public
-# key listed here. Use full paths, one per line.
+# $Id$
+# MacPorts system-wide public key configuration file.
+
+# Downloaded archives will only be used if they can be verified by one
+# of the public keys listed here. Use absolute paths, one per line.
+
@prefix_expanded@/share/macports/macports-pubkey.pem
-# To distribute archives of your own, you need a key pair generated like so:
-# openssl genrsa -des3 -out privkey.pem 2048
-# openssl rsa -in privkey.pem -pubout -out pubkey.pem
-# Then sign the archives like this:
-# openssl dgst -ripemd160 -sign privkey.pem -out archive.tbz2.rmd160 archive.tbz2
+# To distribute archives of your own, generate a key pair:
+# openssl genrsa -des3 -out privkey.pem 2048
+# openssl rsa -in privkey.pem -pubout -out pubkey.pem
+#
+# And sign the archives:
+# openssl dgst -ripemd160 -sign privkey.pem -out archive.tbz2.rmd160 archive.tbz2
Modified: branches/new-help-system/base/doc/sources.conf
===================================================================
--- branches/new-help-system/base/doc/sources.conf 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/doc/sources.conf 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,31 +1,32 @@
-# MacPorts system wide sources configuration file
-# $Id$
+# $Id$
-# To setup a local ports repository, insert a "file://" entry following
-# the example below that points to your local ports directory:
-# Example: file:///Users/landonf/misc/MacPorts/ports
+# MacPorts system-wide configuration file for ports tree sources.
+#
+# To change how MacPorts fetches base, see rsync_server and rsync_dir in
+# macports.conf.
-# The default MacPorts repository should always be tagged [default]
-# for proper functionality of various resources (port groups, mirror
-# sites, etc). If you switch it from the rsync:// URL, be sure to keep
-# it tagged [default].
+# To add a local source, add a "file://" entry.
+#
+# Example: file:///Users/landonf/misc/MacPorts/ports
+#
+# To prevent a source from synchronizing when `port sync` is used,
+# append "[nosync]" at the end.
+#
+# Example: file:///Users/landonf/misc/MacPorts/ports [nosync]
+#
+# Note that MacPorts parses source URLs in order; when a port appears in
+# multiple sources, it installs the first occurrence. For local sources
+# to shadow remote ones, "file://" URLs must come before other URLs.
-# To prevent a source from synchronizing when `port sync` is used,
-# append [nosync] at the end as shown in this example:
-# Example: file:///Users/landonf/misc/MacPorts/ports [nosync]
+# A list of rsync mirrors is available at
+# https://trac.macports.org/wiki/Mirrors#Portfiles.
+#
+# If an "rsync://" URL points to a .tar file, a signed .rmd160 file must
+# exist in the same directory on the server and will be used to verify
+# its integrity.
+#
+# For proper functionality of various resources (port groups, mirror
+# sites, etc.), the primary MacPorts source must always be tagged
+# "[default]", even if switched from the default "rsync://" URL.
-# NOTE: The port command parses source URLs in order and installs the
-# first occurrance when a port appears in multiple repositories.
-# So keep "file://" URLs above other URL types.
-
-
-# To get the ports tree from the master MacPorts server in California, USA use:
-# rsync://rsync.macports.org/release/ports/
-# To get it from the mirror in Trondheim, Norway use:
-# rsync://trd.no.rsync.macports.org/release/ports/
-# A current list of mirrors is available at https://trac.macports.org/wiki/Mirrors
-
-# If an rsync URL points to a .tar file, a signed .rmd160 must exist next to
-# it on the server and will be used to verify its integrity.
-
rsync://rsync.macports.org/release/tarballs/ports.tar [default]
Modified: branches/new-help-system/base/doc/variants.conf
===================================================================
--- branches/new-help-system/base/doc/variants.conf 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/doc/variants.conf 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,9 +1,15 @@
-# To specify global variants to use for all port builds,
-# customize this file to list variant settings you want.
+# $Id$
+
+# MacPorts system-wide global variants configuration file.
+
+# Any variants listed here are applied to all port builds. As on the
+# command line, variants may be either enabled (+) or disabled (-), and
+# unsupported variants are simply ignored.
#
-# Any variants specified here that are not supported by
-# a port will just be ignored. Multiple variants can be
-# specified per line, or one per line is also allowed.
+# Each line must be a space- or tab-delimited list of zero or more
+# variants.
#
# Example:
-# +ipv6 +no_x11
+# -x11 +no_x11 +quartz
+# +gcc48
+# +universal
Modified: branches/new-help-system/base/portmgr/ReleaseProcess
===================================================================
--- branches/new-help-system/base/portmgr/ReleaseProcess 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/portmgr/ReleaseProcess 2013-09-07 09:48:49 UTC (rev 110832)
@@ -108,6 +108,8 @@
And finally we tag the entire directory as release_2_0_0-archive:
+FIXME: this doesn't seem to work any more. The base subdir in the tag ends up being from trunk.
+
cd ../../
svn cp -m "commit-message" release_2.0.0-archive https://svn.macports.org/repository/macports/tags/release_2_0_0-archive
@@ -235,6 +237,7 @@
* [http://sourceforge.net/projects/macports/ sourceforge] (submitted: rhwood@)
* [http://www.macupdate.com/info.php/id/21309/macports MacUpdate] (submitter: ???)
* [http://twitter.com/macports twitter] (submitter: raimue@)
+ * [https://plus.google.com/communities/110287630398071712872 Google+ Community] (submitter: raimue@)
* (Where else?)
Modified: branches/new-help-system/base/portmgr/jobs/mprsyncup
===================================================================
--- branches/new-help-system/base/portmgr/jobs/mprsyncup 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/portmgr/jobs/mprsyncup 2013-09-07 09:48:49 UTC (rev 110832)
@@ -88,6 +88,10 @@
echo "no RELEASE_URL specified in svn trunk, bailing out!"
exit 1
fi
+# cleanup up the working copy if it is locked
+if [ -f ${RBASE}/.svn/lock ]; then
+ ${CLEANUP} ${RBASE}
+fi
if [ -d ${RBASE}/.svn ]; then
${SVN} switch ${RELEASE_URL} ${RBASE}
else
@@ -113,8 +117,8 @@
# generate platform-specific indexes
pushd ${PORTS} >> /dev/null
-# build MP trunk in a private location for indexing
-pushd ${TBASE} >> /dev/null
+# build MP in a private location for indexing
+pushd ${RBASE} >> /dev/null
${MKDIR} -p ${TCLPKG}
./configure \
--prefix=${PREFIX} \
@@ -122,6 +126,7 @@
make clean
make
make install
+make distclean
popd
for PLATFORM in $PLATFORMS; do
Modified: branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl
===================================================================
--- branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -182,7 +182,7 @@
lappend top_license_names $sub_names
if {!$any_good} {
if {$verbose} {
- puts "'$portName' has license '$lic' which is not known to be distributable"
+ puts "\"$portName\" is not distributable because its license \"$lic\" is not known to be distributable"
}
return 1
}
@@ -243,13 +243,13 @@
if {!$any_good} {
if {$verbose} {
- puts "${portName}'s dependency '$aPort' has license '$lic' which is not known to be distributable"
+ puts "\"$portName\" is not distributable because its dependency \"$aPort\" has license \"$lic\" which is not known to be distributable"
}
return 1
}
if {!$any_compatible} {
if {$verbose} {
- puts "dependency '$aPort' has license '$full_lic' which conflicts with license '$top_lic' from '$portName'"
+ puts "\"$portName\" is not distributable because its license \"$top_lic\" conflicts with license \"$full_lic\" of dependency \"$aPort\""
}
return 1
}
@@ -269,7 +269,7 @@
}
if {$verbose} {
- puts "$portName is distributable"
+ puts "\"$portName\" is distributable"
}
return 0
}
Modified: branches/new-help-system/base/src/Makefile.in
===================================================================
--- branches/new-help-system/base/src/Makefile.in 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/Makefile.in 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,14 +1,17 @@
TCLPKG= @OUR_INCLUDED_PACKAGES@ \
cregistry \
+ registry2.0 \
macports1.0 \
port1.0 \
package1.0 \
pextlib1.0 \
- registry2.0 \
- darwintracelib1.0 \
machista1.0
SUBDIR= ${TCLPKG} port programs
+ifeq ($(shell uname),Darwin)
+TCLPKG+= darwintracelib1.0
+endif
+
all::
distclean::
Modified: branches/new-help-system/base/src/config.h.in
===================================================================
--- branches/new-help-system/base/src/config.h.in 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/config.h.in 2013-09-07 09:48:49 UTC (rev 110832)
@@ -83,6 +83,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the `kqueue' function. */
+#undef HAVE_KQUEUE
+
/* Define if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
@@ -173,6 +176,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
+/* Define to 1 if you have the `strlcat' function. */
+#undef HAVE_STRLCAT
+
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
@@ -189,6 +195,9 @@
*/
#undef HAVE_SYS_DIR_H
+/* Define to 1 if you have the <sys/event.h> header file. */
+#undef HAVE_SYS_EVENT_H
+
/* Define to 1 if you have the <sys/fcntl.h> header file. */
#undef HAVE_SYS_FCNTL_H
@@ -264,9 +273,6 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
-/* SDK for SDK redirect in tracelib */
-#undef TRACE_SDK
-
/* Attribute to mark unused variables */
#undef UNUSED
Modified: branches/new-help-system/base/src/cregistry/entry.h
===================================================================
--- branches/new-help-system/base/src/cregistry/entry.h 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/cregistry/entry.h 2013-09-07 09:48:49 UTC (rev 110832)
@@ -62,6 +62,7 @@
int reg_entry_installed(reg_registry* reg, char* name, reg_entry*** entries,
reg_error* errPtr);
+sqlite_int64 reg_entry_owner_id(reg_registry* reg, char* path);
int reg_entry_owner(reg_registry* reg, char* path, reg_entry** entry,
reg_error* errPtr);
Modified: branches/new-help-system/base/src/darwintracelib1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/Makefile 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/darwintracelib1.0/Makefile 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,8 +2,6 @@
SHLIB_NAME= darwintrace${SHLIB_SUFFIX}
INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/darwintrace1.0
-test::
-
include ../../Mk/macports.autoconf.mk
CFLAGS+= -fPIC -Wno-deprecated-declarations
@@ -22,3 +20,5 @@
install:: all
$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 ${SHLIB_NAME} ${INSTALLDIR}
+
+test::
Modified: branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,24 +2,25 @@
* Copyright (c) 2005 Apple Inc. All rights reserved.
* Copyright (c) 2005-2006 Paul Guyot <pguyot at kallisys.net>,
* All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
*
* $Id$
*
* @APPLE_BSD_LICENSE_HEADER_START@
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
+ * from this software without specific prior written permission.
+ *
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -30,7 +31,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* @APPLE_BSD_LICENSE_HEADER_END@
*/
@@ -41,6 +42,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
+
#if defined(_DARWIN_FEATURE_64_BIT_INODE) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE)
/* The architecture we're building for has multiple versions of stat.
We need to undo sys/cdefs.h changes for _DARWIN_FEATURE_64_BIT_INODE */
@@ -59,11 +61,15 @@
#include <sys/paths.h>
#endif
+#include <ctype.h>
#include <dirent.h>
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
+#include <pthread.h>
#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -77,15 +83,11 @@
#ifndef HAVE_STRLCPY
/* Define strlcpy if it's not available. */
-size_t strlcpy(char* dst, const char* src, size_t size);
-size_t strlcpy(char* dst, const char* src, size_t size)
-{
+size_t strlcpy(char *dst, const char *src, size_t size) {
size_t result = strlen(src);
- if (size > 0)
- {
+ if (size > 0) {
size_t copylen = size - 1;
- if (copylen > result)
- {
+ if (copylen > result) {
copylen = result;
}
memcpy(dst, src, copylen);
@@ -95,15 +97,9 @@
}
#endif
-/*
- * Compile time options:
- * DARWINTRACE_SHOW_PROCESS: show the process id of every access
- * DARWINTRACE_LOG_CREATE: log creation of files as well.
- * DARWINTRACE_SANDBOX: control creation, deletion and writing to files and dirs.
- * DARWINTRACE_LOG_FULL_PATH: use F_GETPATH to log the full path.
- * DARWINTRACE_DEBUG_OUTPUT: verbose output of stuff to debug darwintrace.
- *
- * global variables (only checked when setup is first called)
+#include "../pextlib1.0/strlcat.c"
+
+/* global variables (only checked when setup is first called)
* DARWINTRACE_LOG
* path to the log file (no logging happens if it's unset).
* DARWINTRACE_SANDBOX_BOUNDS
@@ -112,316 +108,549 @@
* \\ -> \
*/
-#ifndef DARWINTRACE_SHOW_PROCESS
-#define DARWINTRACE_SHOW_PROCESS 0
+/*
+ * DARWINTRACE_DEBUG: verbose output of operations to debug darwintrace
+ */
+#ifndef DARWINTRACE_DEBUG
+#define DARWINTRACE_DEBUG (0)
#endif
-#ifndef DARWINTRACE_LOG_CREATE
-#define DARWINTRACE_LOG_CREATE 0
-#endif
-#ifndef DARWINTRACE_SANDBOX
-#define DARWINTRACE_SANDBOX 1
-#endif
-#ifndef DARWINTRACE_DEBUG_OUTPUT
-#define DARWINTRACE_DEBUG_OUTPUT 0
-#endif
-#ifndef DARWINTRACE_LOG_FULL_PATH
-#define DARWINTRACE_LOG_FULL_PATH 1
-#endif
-#ifndef DEFFILEMODE
-#define DEFFILEMODE 0666
-#endif
+static inline int __darwintrace_strbeginswith(const char *str, const char *prefix);
+static inline int __darwintrace_pathbeginswith(const char *str, const char *prefix);
+static inline void __darwintrace_log_op(const char *op, const char *path, int fd);
+static void __darwintrace_copy_env() __attribute__((constructor));
+static void __darwintrace_setup_tls() __attribute__((constructor));
+static inline char *__darwintrace_alloc_env(const char *varName, const char *varValue);
+static inline char *const *__darwintrace_restore_env(char *const envp[]);
+static inline void __darwintrace_setup();
+static inline void __darwintrace_cleanup_path(char *path);
+static char *__send(const char *buf, uint32_t len, int answer);
-/*
- * Prototypes.
+/**
+ * PID of the process darwintrace was last used in. This is used to detect
+ * forking and opening a new connection to the control socket in the child
+ * process. Not doing so would potentially cause two processes writing to the
+ * same socket.
*/
-inline int __darwintrace_strbeginswith(const char* str, const char* prefix);
-inline void __darwintrace_log_op(const char* op, const char* path, int fd);
-void __darwintrace_copy_env() __attribute__((constructor));
-inline char* __darwintrace_alloc_env(const char* varName, const char* varValue);
-inline char* const* __darwintrace_restore_env(char* const envp[]);
-static inline void __darwintrace_setup();
-inline void __darwintrace_cleanup_path(char *path);
-static char * exchange_with_port(const char * buf, size_t len, int answer);
+static pid_t __darwintrace_pid = (pid_t) - 1;
-static int __darwintrace_fd = -2;
-static FILE *__darwintrace_debug = NULL;
-static pid_t __darwintrace_pid = (pid_t) -1;
-#define BUFFER_SIZE 1024
+/**
+ * pthread_key_ts for the pthread_t returned by pthread_self() and the
+ * darwintrace socket to ensure the socket is only used from a single thread.
+ */
+static pthread_key_t tid_key;
+static pthread_key_t sock_key;
/**
- * filemap: path\0whattodo\0path\0whattodo\0\0
- * path: begin of path (for example /opt)
- * whattodo:
- * 0 -- allow
- * 1PATH -- map
- * 2 -- ask for allow
-**/
-static char * filemap=0;
+ * Helper variable containing the number of the darwintrace socket, iff the
+ * close(2) syscall should be allowed to close it. Used by \c
+ * __darwintrace_close.
+ */
+static volatile int __darwintrace_close_sock = -1;
-/* copy of the global variables */
-static char* __env_dyld_insert_libraries;
-static char* __env_dyld_force_flat_namespace;
-static char* __env_darwintrace_log;
-static char* __env_darwintrace_debug_log;
+/**
+ * size of the communication buffer
+ */
+#define BUFFER_SIZE 1024
-#if DARWINTRACE_DEBUG_OUTPUT
-#if __STDC_VERSION__>=199901L
-#define debug_printf(format, ...) fprintf(stderr, "darwintrace[%d]: " format, getpid(), __VA_ARGS__); \
- if (__darwintrace_debug) { \
- fprintf(__darwintrace_debug, "darwintrace: " format, __VA_ARGS__); \
- }
-#else
-__attribute__ ((format (printf, 1, 2)))
-static inline
-int debug_printf(const char *format, ...) {
- int ret;
- va_list args;
- va_start(args, format);
- ret = vfprintf(stderr, format, args);
- va_end(args);
- return ret;
+/**
+ * Variable holding the sandbox bounds in the following format:
+ * <filemap> :: (<spec> '\0')+ '\0'
+ * <spec> :: <path> '\0' <operation> <additional_data>?
+ * <operation> :: '0' | '1' | '2'
+ * where
+ * 0: allow
+ * 1: map the path to the one given in additional_data
+ * 2: check for a dependency using the socket
+ */
+static char *filemap;
+
+enum {
+ FILEMAP_ALLOW = 0,
+ FILEMAP_REDIR = 1,
+ FILEMAP_ASK = 2
+};
+
+/**
+ * Copy of the DYLD_INSERT_LIBRARIES environment variable to restore it in
+ * execve(2). DYLD_INSERT_LIBRARIES is needed to preload this library into any
+ * process' address space.
+ */
+static char *__env_dyld_insert_libraries;
+
+/**
+ * Copy of the DYLD_FORCE_FLAT_NAMESPACE environment variable to restore it in
+ * execve(2). DYLD_FORCE_FLAT_NAMESPACE=1 is needed for the preload-based
+ * sandbox to work.
+ */
+static char *__env_dyld_force_flat_namespace;
+
+/**
+ * Copy of the DARWINTRACE_LOG environment variable to restore it in execve(2).
+ * Contains the path to the unix socket used for communication with the
+ * MacPorts-side of the sandbox.
+ */
+static char *__env_darwintrace_log;
+
+#if DARWINTRACE_DEBUG
+# if __STDC_VERSION__>=199901L
+# define debug_printf(format, ...) \
+ fprintf(stderr, "darwintrace[%d]: " format, getpid(), __VA_ARGS__);
+# else
+__attribute__((format(printf, 1, 2))) static inline void debug_printf(const char *format, ...) {
+ va_list args;
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
}
-#endif
+# endif
#else
-#define debug_printf(...)
+# define debug_printf(...)
#endif
-/*
- * return 0 if str doesn't begin with prefix, 1 otherwise.
+/**
+ * Setup method called as constructor to set up thread-local storage for the
+ * thread id and the darwintrace socket.
*/
-inline int __darwintrace_strbeginswith(const char* str, const char* prefix) {
- char theCharS;
- char theCharP;
- do {
- theCharS = *str++;
- theCharP = *prefix++;
- } while(theCharP && (theCharP == theCharS));
- return (theCharP == 0);
+static void __darwintrace_setup_tls() {
+ if (0 != (errno = pthread_key_create(&tid_key, NULL))) {
+ perror("darwintrace: pthread_key_create");
+ abort();
+ }
+ if (0 != (errno = pthread_key_create(&sock_key, NULL))) {
+ perror("darwintrace: pthread_key_create");
+ abort();
+ }
}
-/*
- * Copy the environment variables, if they're defined.
+/**
+ * Convenience getter function for the thread-local darwintrace socket
*/
-void __darwintrace_copy_env() {
- char* theValue;
- theValue = getenv("DYLD_INSERT_LIBRARIES");
- if (theValue != NULL) {
- __env_dyld_insert_libraries = strdup(theValue);
- } else {
- __env_dyld_insert_libraries = NULL;
+static inline FILE *__darwintrace_sock() {
+ return (FILE *) pthread_getspecific(sock_key);
+}
+
+/**
+ * Convenience getter function for the thread ID
+ */
+static inline pthread_t __darwintrace_tid() {
+ return (pthread_t) pthread_getspecific(tid_key);
+}
+
+/**
+ * Convenience setter function for the thread-local darwintrace socket
+ */
+static inline void __darwintrace_sock_set(FILE *stream) {
+ if (0 != (errno = pthread_setspecific(sock_key, stream))) {
+ perror("darwintrace: pthread_setspecific");
+ abort();
}
- theValue = getenv("DYLD_FORCE_FLAT_NAMESPACE");
- if (theValue != NULL) {
- __env_dyld_force_flat_namespace = strdup(theValue);
- } else {
- __env_dyld_force_flat_namespace = NULL;
+}
+
+/**
+ * Convenience setter function for the thread-local darwintrace socket
+ */
+static inline void __darwintrace_tid_set() {
+ if (0 != (errno = pthread_setspecific(tid_key, (const void *) pthread_self()))) {
+ perror("darwintrace: pthread_setspecific");
+ abort();
}
- theValue = getenv("DARWINTRACE_LOG");
- if (theValue != NULL) {
- __env_darwintrace_log = strdup(theValue);
- } else {
- __env_darwintrace_log = NULL;
+}
+
+/**
+ * Return 0 if str doesn't begin with prefix, 1 otherwise. Note that this is
+ * not a simple string comparison, but works on a path component level.
+ * A prefix of /var/tmp will not match a string of /var/tmpfoo.
+ */
+static inline int __darwintrace_pathbeginswith(const char *str, const char *prefix) {
+ char s;
+ char p;
+
+ /* '/' is the allow all wildcard */
+ if (strcmp(prefix, "/") == 0) {
+ return 1;
}
- theValue = getenv("DARWINTRACE_DEBUG_LOG");
- if (theValue != NULL) {
- __env_darwintrace_debug_log = strdup(theValue);
- } else {
- __env_darwintrace_debug_log = NULL;
+
+ do {
+ s = *str++;
+ p = *prefix++;
+ } while (p && (p == s));
+ return (p == 0 && (s == '/' || s == '\0'));
+}
+
+/**
+ * Return 0 if str doesn't begin with prefix, 1 otherwise.
+ */
+static inline int __darwintrace_strbeginswith(const char *str, const char *prefix) {
+ char s;
+ char p;
+ do {
+ s = *str++;
+ p = *prefix++;
+ } while (p && (p == s));
+ return (p == 0);
+}
+
+/*
+ * Copy the environment variables, if they're defined. This is run as
+ * a constructor at startup.
+ */
+static void __darwintrace_copy_env() {
+#define COPYENV(name, variable) \
+ if (NULL != (val = getenv(#name))) {\
+ if (NULL == (variable = strdup(val))) {\
+ perror("darwintrace: strdup");\
+ abort();\
+ }\
+ } else {\
+ variable = NULL;\
}
+
+ char *val;
+ COPYENV(DYLD_INSERT_LIBRARIES, __env_dyld_insert_libraries)
+ COPYENV(DYLD_FORCE_FLAT_NAMESPACE, __env_dyld_force_flat_namespace)
+ COPYENV(DARWINTRACE_LOG, __env_darwintrace_log)
+#undef COPYENV
}
-/*
+/**
* Allocate a X=Y string where X is the variable name and Y its value.
* Return the new string.
*
* If the value is NULL, return NULL.
*/
-inline char* __darwintrace_alloc_env(const char* varName, const char* varValue) {
- char* theResult = NULL;
- if (varValue) {
- int theSize = strlen(varName) + strlen(varValue) + 2;
- theResult = (char*) malloc(theSize);
- if (theResult) {
- snprintf(theResult, theSize, "%s=%s", varName, varValue);
- theResult[theSize - 1] = 0;
+static inline char *__darwintrace_alloc_env(const char *name, const char *val) {
+ char *result = NULL;
+
+ if (val) {
+ size_t size = strlen(name) + strlen(val) + 2;
+ if (NULL == (result = malloc(size))) {
+ perror("darwintrace: malloc");
+ abort();
}
+ snprintf(result, size, "%s=%s", name, val);
+ if (size > 0) {
+ result[size - 1] = '\0';
+ }
}
-
- return theResult;
+
+ return result;
}
-/*
+/**
* This function checks that envp contains the global variables we had when the
* library was loaded and modifies it if it doesn't.
*/
-__attribute__((always_inline))
-inline char* const* __darwintrace_restore_env(char* const envp[]) {
+static inline char *const *__darwintrace_restore_env(char *const envp[]) {
/* allocate the strings. */
/* we don't care about the leak here because we're going to call execve,
- * which, if it succeeds, will get rid of our heap */
- char* dyld_insert_libraries_ptr =
- __darwintrace_alloc_env(
- "DYLD_INSERT_LIBRARIES",
- __env_dyld_insert_libraries);
- char* dyld_force_flat_namespace_ptr =
- __darwintrace_alloc_env(
- "DYLD_FORCE_FLAT_NAMESPACE",
- __env_dyld_force_flat_namespace);
- char* darwintrace_log_ptr =
- __darwintrace_alloc_env(
- "DARWINTRACE_LOG",
- __env_darwintrace_log);
- char* darwintrace_debug_log_ptr =
- __darwintrace_alloc_env(
- "DARWINTRACE_DEBUG_LOG",
- __env_darwintrace_debug_log);
+ * which, if it succeeds, will get rid of our heap */
+ char *dyld_insert_libraries_ptr = __darwintrace_alloc_env("DYLD_INSERT_LIBRARIES", __env_dyld_insert_libraries);
+ char *dyld_force_flat_namespace_ptr = __darwintrace_alloc_env("DYLD_FORCE_FLAT_NAMESPACE", __env_dyld_force_flat_namespace);
+ char *darwintrace_log_ptr = __darwintrace_alloc_env("DARWINTRACE_LOG", __env_darwintrace_log);
- char* const * theEnvIter = envp;
- int theEnvLength = 0;
- char** theCopy;
- char** theCopyIter;
+ char *const *enviter = envp;
+ size_t envlen = 0;
+ char **copy;
+ char **copyiter;
- while (*theEnvIter != NULL) {
- theEnvLength++;
- theEnvIter++;
+ while (*enviter != NULL) {
+ envlen++;
+ enviter++;
}
- /* 5 is sufficient for the four variables we copy and the terminator */
- theCopy = (char**) malloc(sizeof(char*) * (theEnvLength + 5));
- theEnvIter = envp;
- theCopyIter = theCopy;
+ /* 4 is sufficient for the three variables we copy and the terminator */
+ copy = malloc(sizeof(char *) * (envlen + 4));
- while (*theEnvIter != NULL) {
- char* theValue = *theEnvIter;
- if (__darwintrace_strbeginswith(theValue, "DYLD_INSERT_LIBRARIES=")) {
- theValue = dyld_insert_libraries_ptr;
+ enviter = envp;
+ copyiter = copy;
+
+ while (*enviter != NULL) {
+ char *val = *enviter;
+ if (__darwintrace_strbeginswith(val, "DYLD_INSERT_LIBRARIES=")) {
+ val = dyld_insert_libraries_ptr;
dyld_insert_libraries_ptr = NULL;
- } else if (__darwintrace_strbeginswith(theValue, "DYLD_FORCE_FLAT_NAMESPACE=")) {
- theValue = dyld_force_flat_namespace_ptr;
+ } else if (__darwintrace_strbeginswith(val, "DYLD_FORCE_FLAT_NAMESPACE=")) {
+ val = dyld_force_flat_namespace_ptr;
dyld_force_flat_namespace_ptr = NULL;
- } else if (__darwintrace_strbeginswith(theValue, "DARWINTRACE_LOG=")) {
- theValue = darwintrace_log_ptr;
+ } else if (__darwintrace_strbeginswith(val, "DARWINTRACE_LOG=")) {
+ val = darwintrace_log_ptr;
darwintrace_log_ptr = NULL;
- } else if (__darwintrace_strbeginswith(theValue, "DARWINTRACE_DEBUG_LOG=")) {
- theValue = darwintrace_debug_log_ptr;
- darwintrace_debug_log_ptr = NULL;
}
-
- if (theValue) {
- *theCopyIter++ = theValue;
+
+ if (val) {
+ *copyiter++ = val;
}
- theEnvIter++;
+ enviter++;
}
-
+
if (dyld_insert_libraries_ptr) {
- *theCopyIter++ = dyld_insert_libraries_ptr;
+ *copyiter++ = dyld_insert_libraries_ptr;
}
if (dyld_force_flat_namespace_ptr) {
- *theCopyIter++ = dyld_force_flat_namespace_ptr;
+ *copyiter++ = dyld_force_flat_namespace_ptr;
}
if (darwintrace_log_ptr) {
- *theCopyIter++ = darwintrace_log_ptr;
+ *copyiter++ = darwintrace_log_ptr;
}
- if (darwintrace_debug_log_ptr) {
- *theCopyIter++ = darwintrace_debug_log_ptr;
+
+ *copyiter = 0;
+
+ return copy;
+}
+
+/*
+ * Data structures and functions to iterate over the filemap received from
+ * tracelib code.
+ */
+
+/**
+ * \c filemap_iterator_t is an (opaque) iterator type that keeps the state
+ * required to iterate through the filemap. Create a new filemap_iterator_t on
+ * stack, initialize it using \c __darwintrace_filemap_iterator_init and pass
+ * it to \c __darwintrace_filemap_iter to iterate over the filemap.
+ */
+typedef struct filemap_iterator {
+ char *next;
+} filemap_iterator_t;
+
+/**
+ * Initialize a given \c filemap_iterator_t. Calling this function again will
+ * rewind the iterator.
+ *
+ * \param[in] it pointer to the iterator to be initialized
+ */
+static inline void __darwintrace_filemap_iterator_init(filemap_iterator_t *it) {
+ it->next = filemap;
+}
+
+/**
+ * Iterate through the filemap passed from tracelib code. Call this multiple
+ * times with the same iterator object until it returns \c NULL to iterate
+ * through the filemap.
+ *
+ * \param[out] command location for the command specified for this filemap
+ * entry
+ * \param[out] replacement location for a replacement path, if any. This field
+ * is only valid if the command field indicates
+ * a replacement path is being used.
+ * \param[in] it pointer to a \c filemap_iterator_t keeping the state of this
+ * iteration
+ * \return string containing the path this filemap entry corresponds to, or \c
+ * NULL if the end of the filemap was reached
+ */
+static inline char *__darwintrace_filemap_iter(char *command, char **replacement, filemap_iterator_t *it) {
+ enum { PATH, COMMAND, REPLACEPATH, DONE } state = PATH;
+ char *t;
+ char *path;
+
+ if (it == NULL || it->next == NULL || *it->next == '\0') {
+ return NULL;
}
- *theCopyIter = 0;
-
- return theCopy;
+ path = t = it->next;
+
+ /* advance the cursor: if the number after the string is not 1, there's no
+ * path behind it and we can advance by strlen(t) + 3. If it is 1, make
+ * sure to skip the path, too.
+ */
+ state = PATH;
+ while (state != DONE) {
+ switch (state) {
+ case DONE:
+ fprintf(stderr, "darwintrace: illegal state in dfa in " __FILE__ ":%d\n", __LINE__);
+ abort();
+ break;
+ case PATH:
+ if (!*t) {
+ state = COMMAND;
+ }
+ break;
+ case COMMAND:
+ *command = *t;
+ if (*t == 1) {
+ state = REPLACEPATH;
+ *replacement = t + 1;
+ } else {
+ state = DONE;
+ /* the byte after the status code is 0, if the status
+ * code isn't 1 */
+ t++;
+ }
+ break;
+ case REPLACEPATH:
+ if (!*t) {
+ state = DONE;
+ }
+ break;
+ }
+ t++;
+ }
+
+ it->next = t;
+ return path;
}
-static void ask_for_filemap()
-{
- filemap=exchange_with_port("filemap\t", sizeof("filemap\t"), 1);
- if(filemap==(char*)-1)
- filemap=0;
+/**
+ * Request sandbox boundaries from tracelib (the MacPorts base-controlled side
+ * of the trace setup) and store it.
+ */
+static void __darwintrace_get_filemap() {
+ char *newfilemap;
+#if DARWINTRACE_DEBUG && 0
+ filemap_iterator_t it;
+ char *path, *replacement, command;
+#endif
+
+#if __GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
+#error Please build with gcc-4.2 or later
+#endif
+
+ /*
+ * ensure we have a filemap present; this might be called simultanously
+ * from multiple threads and needs to work without leaking and in a way
+ * that ensures a filemap has been set before any of the calls return. We
+ * achieve that by using non-blocking synchronization. Blocking
+ * synchronization might be a bad idea, because we never know where this
+ * code is actually called in an application.
+ */
+ newfilemap = NULL;
+ do {
+ free(newfilemap);
+ if (filemap != NULL)
+ break;
+ newfilemap = __send("filemap\t", (uint32_t) strlen("filemap\t"), 1);
+ } while (!__sync_bool_compare_and_swap(&filemap, NULL, newfilemap));
+
+#if DARWINTRACE_DEBUG && 0
+ for (__darwintrace_filemap_iterator_init(&it);
+ (path = __darwintrace_filemap_iter(&command, &replacement, &it));) {
+ debug_printf("filemap: {cmd=%d, path=%-120s, replacement=%s}\n", command, path, (command == 1) ? replacement : "-");
+ }
+#endif
}
-__attribute__((always_inline))
+/**
+ * Close the darwintrace socket and set it to \c NULL. Since this uses \c
+ * fclose(3), which internally calls \c close(2), which is intercepted by this
+ * library and this library prevents closing the socket to MacPorts, we use \c
+ * __darwintrace_close_sock to allow closing specific FDs.
+ */
+static inline void __darwintrace_close() {
+ FILE *dtsock = __darwintrace_sock();
+ if (dtsock) {
+ __darwintrace_close_sock = fileno(dtsock);
+ fclose(dtsock);
+ __darwintrace_close_sock = -1;
+ pthread_setspecific(sock_key, NULL);
+ }
+}
+
+/**
+ * Ensures darwintrace is correctly set up by opening a socket connection to
+ * the MacPorts-side of trace mode. Will close an re-open this connection when
+ * called after \c fork(2), i.e. when the current PID doesn't match the one
+ * stored when the function was called last.
+ */
static inline void __darwintrace_setup() {
-#define open(x,y,z) syscall(SYS_open, (x), (y), (z))
-#define close(x) syscall(SYS_close, (x))
- pid_t oldpid = __darwintrace_pid;
+ /*
+ * Check whether this is a child process and we've inherited the socket. We
+ * want to avoid race conditions with our parent process when communicating
+ * with tracelib and thus re-open all sockets, if that's the case. Note
+ * this also applies to threads within the same process, since we really
+ * want to avoid mixing up the results from two calls in different threads
+ * when reading from the socket.
+ */
+
+ /*
+ * if the PID changed, close the current socket (which will force the
+ * following code to re-open it).
+ */
if (__darwintrace_pid != (pid_t) -1 && __darwintrace_pid != getpid()) {
- if (__darwintrace_fd != -2) {
- close(__darwintrace_fd);
- __darwintrace_fd = -2;
- }
- if (__darwintrace_debug) {
- fclose(__darwintrace_debug);
- __darwintrace_debug = NULL;
- }
+ __darwintrace_close();
__darwintrace_pid = (pid_t) -1;
}
- if (__darwintrace_pid == (pid_t) -1) {
+
+ /*
+ * We don't need to watch for TID changes, because each thread has thread
+ * local storage for the socket that will contain NULL when the socket has
+ * not been initialized.
+ */
+
+ if (__darwintrace_sock() == NULL) {
+ int sock;
+ FILE *stream;
+ struct sockaddr_un sun;
+
__darwintrace_pid = getpid();
- if (__env_darwintrace_log != NULL) {
- int olderrno = errno;
- int sock = socket(AF_UNIX, SOCK_STREAM, 0);
- struct sockaddr_un sun;
- sun.sun_family = AF_UNIX;
- strncpy(sun.sun_path, __env_darwintrace_log, sizeof(sun.sun_path));
- if (connect(sock, (struct sockaddr*)&sun, strlen(__env_darwintrace_log) + 1 + sizeof(sun.sun_family)) != -1) {
- debug_printf("connect successful, socket %d in pid %d\n", sock, __darwintrace_pid);
- __darwintrace_fd = sock;
- ask_for_filemap();
- } else {
- debug_printf("connect failed: %s\n", strerror(errno));
- abort();
- }
- errno = olderrno;
+ __darwintrace_tid_set();
+ if (__env_darwintrace_log == NULL) {
+ fprintf(stderr, "darwintrace: trace library loaded, but DARWINTRACE_LOG not set\n");
+ abort();
}
- if (__darwintrace_debug == NULL) {
- if (__env_darwintrace_debug_log != NULL) {
- char logpath[MAXPATHLEN];
- snprintf(logpath, MAXPATHLEN, __env_darwintrace_debug_log, getpid());
- if (NULL == (__darwintrace_debug = fopen(logpath, "w"))) {
- fprintf(stderr, "failed to open logfile: %s\n", strerror(errno));
- abort();
- }
- fprintf(__darwintrace_debug, "pid %d is process %s\n", getpid(), getenv("_"));
- debug_printf("logging socket communication to: %s\n", logpath);
- }
+
+ if (-1 == (sock = socket(PF_LOCAL, SOCK_STREAM, 0))) {
+ perror("darwintrace: socket");
+ abort();
}
- if (oldpid != (pid_t) -1) {
- debug_printf("seems to have forked from %d, re-opened files\n", oldpid);
+
+ if (strlen(__env_darwintrace_log) > sizeof(sun.sun_path) - 1) {
+ fprintf(stderr, "darwintrace: Can't connect to socket %s: name too long\n", __env_darwintrace_log);
+ abort();
}
+ sun.sun_family = AF_UNIX;
+ strlcpy(sun.sun_path, __env_darwintrace_log, sizeof(sun.sun_path));
+
+ if (-1 == (connect(sock, (struct sockaddr *) &sun, sizeof(sun)))) {
+ perror("darwintrace: connect");
+ abort();
+ }
+
+ if (NULL == (stream = fdopen(sock, "a+"))) {
+ perror("darwintrace: fdopen");
+ abort();
+ }
+
+ /* store FILE * into thread local storage for the socket */
+ __darwintrace_sock_set(stream);
+
+ /* request sandbox bounds */
+ __darwintrace_get_filemap();
}
-#undef close
-#undef open
}
-/* log a call and optionally get the real path from the fd if it's not 0.
- * op: the operation (open, readlink, execve)
- * path: the path of the file
- * fd: a fd to the file, or 0 if we don't have any.
+/**
+ * Send a path to tracelib either given a path, or an FD (where
+ * fcntl(F_GETPATH) will be used).
+ *
+ * \param[in] op the operation (sent as-is to tracelib, should be interpreted
+ * as command)
+ * \param[in] path the (not necessarily absolute) path to send to tracelib
+ * \param[in] fd a FD to the file, or 0, if none available
*/
-__attribute__((always_inline))
-inline void __darwintrace_log_op(const char* op, const char* path, int fd) {
- int size;
+static inline void __darwintrace_log_op(const char *op, const char *path, int fd) {
+ uint32_t size;
char somepath[MAXPATHLEN];
char logbuffer[BUFFER_SIZE];
do {
-#ifdef __APPLE__ /* Only Darwin has volfs and F_GETPATH */
- if ((fd > 0) && (DARWINTRACE_LOG_FULL_PATH
- || (strncmp(path, "/.vol/", 6) == 0))) {
- if(fcntl(fd, F_GETPATH, somepath) == -1) {
- /* getpath failed. use somepath instead */
- strlcpy(somepath, path, sizeof(somepath));
+# ifdef __APPLE__ /* Only Darwin has volfs and F_GETPATH */
+ if ((fd > 0) && (strncmp(path, "/.vol/", 6) == 0)) {
+ if (fcntl(fd, F_GETPATH, somepath) != -1) {
break;
}
}
-#endif
- if (path[0] != '/') {
- int len;
- (void) getcwd(somepath, sizeof(somepath));
- len = strlen(somepath);
- somepath[len++] = '/';
- strlcpy(&somepath[len], path, sizeof(somepath) - len);
+# endif
+
+ if (*path != '/') {
+ if (!getcwd(somepath, sizeof(somepath))) {
+ perror("darwintrace: getcwd");
+ abort();
+ }
+
+ strlcat(somepath, "/", sizeof(somepath));
+ strlcat(somepath, path, sizeof(somepath));
break;
}
@@ -432,68 +661,73 @@
/* clean the path. */
__darwintrace_cleanup_path(somepath);
- size = snprintf(logbuffer, sizeof(logbuffer),
- "%s\t%s",
- op, somepath);
-
- exchange_with_port(logbuffer, size+1, 0);
-
- return;
+ size = snprintf(logbuffer, sizeof(logbuffer), "%s\t%s", op, somepath);
+ __send(logbuffer, size, 0);
}
-/* remap resource fork access to the data fork.
+/**
+ * remap resource fork access to the data fork.
* do a partial realpath(3) to fix "foo//bar" to "foo/bar"
*/
-inline void __darwintrace_cleanup_path(char *path) {
+static inline void __darwintrace_cleanup_path(char *path) {
size_t pathlen;
-#ifdef __APPLE__
+# ifdef __APPLE__
size_t rsrclen;
-#endif
- size_t i, shiftamount;
+# endif
+ char *dst, *src;
enum { SAWSLASH, NOTHING } state = NOTHING;
/* if this is a foo/..namedfork/rsrc, strip it off */
pathlen = strlen(path);
/* ..namedfork/rsrc is only on OS X */
-#ifdef __APPLE__
+# ifdef __APPLE__
rsrclen = strlen(_PATH_RSRCFORKSPEC);
if (pathlen > rsrclen && 0 == strcmp(path + pathlen - rsrclen, _PATH_RSRCFORKSPEC)) {
path[pathlen - rsrclen] = '\0';
pathlen -= rsrclen;
}
-#endif
+# endif
- /* for each position in string (including terminal \0), check if we're in
- * a run of multiple slashes, and only emit the first one */
- for(i = 0, shiftamount = 0; i <= pathlen; i++) {
+ /* for each position in string, check if we're in a run of multiple
+ * slashes, and only emit the first one */
+ for (src = path, dst = path; *src; src++) {
if (state == SAWSLASH) {
- if (path[i] == '/') {
+ if (*src == '/') {
/* consume it */
- shiftamount++;
continue;
- } else {
- state = NOTHING;
}
+ state = NOTHING;
} else {
- if (path[i] == '/') {
+ if (*src == '/') {
state = SAWSLASH;
}
}
- path[i - shiftamount] = path[i];
+ if (dst != src) {
+ // if dst == src, avoid the copy operation
+ *dst = *src;
+ }
+ dst++;
}
}
-/*
- * return 1 if path allowed, 0 otherwise
+/**
+ * Check whether the port currently being installed declares a dependency on
+ * a given file. Communicates with MacPorts tracelib, which uses the registry
+ * database to answer this question. Returns 1, if a dependency was declared,
+ * 0, if the file belongs to a port and no dependency was declared and -1 if
+ * the file isnt't registered to any port.
+ *
+ * \param[in] path the path to send to MacPorts for dependency info
+ * \return 1, if access should be granted, 0, if access should be denied, and
+ * -1 if MacPorts doesn't know about the file.
*/
-static int ask_for_dependency(char * path) {
+static int dependency_check(char *path) {
#define stat(y, z) syscall(SYS_stat, (y), (z))
char buffer[BUFFER_SIZE], *p;
+ uint32_t len;
int result = 0;
struct stat st;
- debug_printf("ask_for_dependency: %s\n", path);
-
if (-1 == stat(path, &st)) {
return 1;
}
@@ -501,131 +735,207 @@
debug_printf("%s is directory\n", path);
return 1;
}
-
- strncpy(buffer, "dep_check\t", sizeof(buffer));
- strncpy(buffer+10, path, sizeof(buffer)-10);
- p=exchange_with_port(buffer, strlen(buffer)+1, 1);
- if(p==(char*)-1||!p)
- return 0;
-
- if(*p=='+')
- result=1;
-
+
+ len = snprintf(buffer, sizeof(buffer), "dep_check\t%s", path);
+ if (len > sizeof(buffer)) {
+ len = sizeof(buffer) - 1;
+ }
+ p = __send(buffer, len, 1);
+ if (!p) {
+ fprintf(stderr, "darwintrace: dependency check failed for %s\n", path);
+ abort();
+ }
+
+ switch (*p) {
+ case '+':
+ result = 1;
+ break;
+ case '!':
+ result = 0;
+ break;
+ case '?':
+ result = -1;
+ break;
+ default:
+ fprintf(stderr, "darwintrace: unexpected answer from tracelib: '%c' (0x%x)\n", *p, *p);
+ abort();
+ break;
+ }
+
+ debug_printf("dependency_check: %s returned %d\n", path, result);
+
free(p);
return result;
#undef stat
}
-/*
- * exchange_with_port - routine to send/recv from/to socket
- * Parameters:
- * buf -- buffer with data to send
- * len -- length of data
- * answer -- 1 (yes, I want to receive answer) and 0 (no, thanks, just send)
- * failures -- should be setted 0 on external calls (avoid infinite recursion)
- * Return value:
- * -1 -- something went wrong
- * 0 -- data successfully sent
- * string -- answer (caller shoud free it)
+/**
+ * Helper function to recieve a number of bytes from the tracelib communication
+ * socket and deal with any errors that might occur.
+ *
+ * \param[out] buf buffer to hold received data
+ * \param[in] size number of bytes to read from the socket
*/
-static char * exchange_with_port(const char * buf, size_t len, int answer) {
- size_t sent = 0;
+static void frecv(void *restrict buf, size_t size) {
+ FILE *stream = __darwintrace_sock();
+ if (1 != fread(buf, size, 1, stream)) {
+ if (ferror(stream)) {
+ perror("darwintrace: fread");
+ } else {
+ fprintf(stderr, "darwintrace: fread: end-of-file\n");
+ }
+ abort();
+ }
+}
- if (__darwintrace_debug) {
- fprintf(__darwintrace_debug, "> %s\n", buf);
- }
- while (sent < len) {
- ssize_t local_sent = send(__darwintrace_fd, buf + sent, len - sent, 0);
- if (local_sent == -1) {
- debug_printf("error communicating with socket %d: %s\n", __darwintrace_fd, strerror(errno));
- if (__darwintrace_debug)
- fprintf(__darwintrace_debug, "darwintrace: error communicating with socket %d: %s\n", __darwintrace_fd, strerror(errno));
- abort();
+/**
+ * Helper function to send a buffer to MacPorts using the tracelib
+ * communication socket and deal with any errors that might occur.
+ *
+ * \param[in] buf buffer to send
+ * \param[in] size number of bytes in the buffer
+ */
+static void fsend(const void *restrict buf, size_t size) {
+ FILE *stream = __darwintrace_sock();
+ if (1 != fwrite(buf, size, 1, stream)) {
+ if (ferror(stream)) {
+ perror("darwintrace: fwrite");
+ } else {
+ fprintf(stderr, "darwintrace: fwrite: end-of-file\n");
}
- sent += local_sent;
+ abort();
}
+ fflush(stream);
+}
+
+/**
+ * Communication wrapper targeting tracelib. Automatically enforces the on-wire
+ * protocol and supports reading and returning an answer.
+ *
+ * \param[in] buf buffer to send to tracelib
+ * \param[in] size size of the buffer to send
+ * \param[in] answer boolean indicating whether an answer is expected and
+ * should be returned
+ * \return allocated answer buffer. Callers should free this buffer. If an
+ * answer was not requested, \c NULL.
+ */
+static char *__send(const char *buf, uint32_t len, int answer) {
+ fsend(&len, sizeof(len));
+ fsend(buf, len);
+
if (!answer) {
+ return NULL;
+ }
+
+ uint32_t recv_len = 0;
+ char *recv_buf;
+
+ frecv(&recv_len, sizeof(recv_len));
+ if (recv_len == 0) {
return 0;
- } else {
- size_t recv_len = 0, received;
- char *recv_buf;
-
- received = 0;
- while (received < sizeof(recv_len)) {
- ssize_t local_received = recv(__darwintrace_fd, ((char *) &recv_len) + received, sizeof(recv_len) - received, 0);
- if (local_received == -1) {
- debug_printf("error reading data from socket %d: %s\n", __darwintrace_fd, strerror(errno));
- if (__darwintrace_debug)
- fprintf(__darwintrace_debug, "darwintrace: error reading data from socket %d: %s\n", __darwintrace_fd, strerror(errno));
- abort();
- }
- received += local_received;
- }
- if (recv_len == 0) {
- return 0;
- }
+ }
- recv_buf = malloc(recv_len + 1);
- recv_buf[recv_len] = '\0';
+ recv_buf = malloc(recv_len + 1);
+ recv_buf[recv_len] = '\0';
+ frecv(recv_buf, recv_len);
- received = 0;
- while (received < recv_len) {
- ssize_t local_received = recv(__darwintrace_fd, recv_buf + received, recv_len - received, 0);
- if (local_received == -1) {
- debug_printf("error reading data from socket %d: %s\n", __darwintrace_fd, strerror(errno));
- if (__darwintrace_debug)
- fprintf(__darwintrace_debug, "darwintrace: error reading data from socket %d: %s\n", __darwintrace_fd, strerror(errno));
- abort();
- }
- received += local_received;
- }
- if (__darwintrace_debug) {
- fprintf(__darwintrace_debug, "< %s\n", recv_buf);
- }
- return recv_buf;
- }
+ return recv_buf;
}
-#define DARWINTRACE_STATUS_PATH ((char) 0)
-#define DARWINTRACE_STATUS_COMMAND ((char) 1)
-#define DARWINTRACE_STATUS_DONE ((char) 2)
-
-/*
- * return 1 if path (once normalized) is in sandbox or redirected, 0 otherwise.
+/**
+ * Check a path against the current sandbox
+ *
+ * \param[in] path the path to be checked; not necessarily absolute
+ * \param[out] newpath buffer for a replacement path when redirection should
+ * occur. Initialize the first byte with 0 before calling
+ * this function. The buffer should be at least MAXPATHLEN
+ * bytes large. If newpath[0] isn't 0 after the call,
+ * redirection should occur and the path from newpath
+ * should be used for the syscall instead.
+ * \param[in] report If access to this path is being denied, report it as
+ * sandbox violation. Set this to \c true for all operations
+ * that read file contents. Set this to \c false for
+ * operations that only check for the file's existance, e.g.,
+ * reading a directory.
+ * \return 1, if the file is within sandbox bounds, 0, if access should be denied
*/
-__attribute__((always_inline))
-inline int __darwintrace_is_in_sandbox(const char* path, char * newpath) {
- char *t, *p, *_;
+static inline int __darwintrace_is_in_sandbox(const char *path, char *newpath, bool report) {
+ char *t, *_;
+ char *strpos, *normpos;
char lpath[MAXPATHLEN];
-
+ char normalizedpath[MAXPATHLEN];
+ filemap_iterator_t filemap_it;
+ char command;
+ char *replacementpath;
+
__darwintrace_setup();
-
- if (!filemap)
+
+ if (!filemap) {
return 1;
-
- if (*path=='/') {
- p = strcpy(lpath, path);
+ }
+
+ /* Make sure the path is absolute. */
+ if (*path == '/') {
+ strcpy(lpath, path);
} else {
if (getcwd(lpath, MAXPATHLEN - 1) == NULL) {
- fprintf(stderr, "darwintrace: getcwd: %s, path was: %s\n", strerror(errno), path);
+ perror("darwintrace: getcwd");
abort();
}
- strcat(lpath, "/");
- strcat(lpath, path);
+ strlcat(lpath, "/", MAXPATHLEN);
+ strlcat(lpath, path, MAXPATHLEN);
}
- p = lpath;
+ /* Make sure the path is normalized. NOTE: Do _not_ use realpath(3) here.
+ * Doing so _will_ lead to problems. This is essentially a very simple
+ * re-implementation of realpath(3). */
+ normalizedpath[0] = '\0';
+ strpos = lpath + 1;
+ normpos = normalizedpath;
+ for (;;) {
+ char *curpos = strsep(&strpos, "/");
+ if (curpos == NULL) {
+ /* reached the end of the path */
+ break;
+ } else if (*curpos == '\0') {
+ /* empty entry, ignore */
+ continue;
+ } else if (strcmp(curpos, ".") == 0) {
+ /* no-op directory, ignore */
+ continue;
+ } else if (strcmp(curpos, "..") == 0) {
+ /* walk up one directory */
+ char *lastSep = strrchr(normalizedpath, '/');
+ if (lastSep == NULL) {
+ /* path is completely empty */
+ normpos = normalizedpath;
+ *normpos = '\0';
+ continue;
+ }
+ /* remove last component by overwriting the slash with \0, update normpos */
+ *lastSep = '\0';
+ normpos = lastSep;
+ continue;
+ }
+ /* default case: standard path, copy */
+ strcat(normpos, "/");
+ normpos++;
+ strcat(normpos, curpos);
+ }
+ if (*normalizedpath == '\0') {
+ strcat(normalizedpath, "/");
+ }
- for (t = filemap; *t;) {
- char state;
-
- if (__darwintrace_strbeginswith(p, t)) {
+ /* Iterate over the sandbox bounds and try to find a directive matching this path */
+ for (__darwintrace_filemap_iterator_init(&filemap_it);
+ (t = __darwintrace_filemap_iter(&command, &replacementpath, &filemap_it));) {
+ if (__darwintrace_pathbeginswith(normalizedpath, t)) {
/* move t to the integer describing how to handle this match */
t += strlen(t) + 1;
switch (*t) {
- case 0:
+ case FILEMAP_ALLOW:
return 1;
- case 1:
+ case FILEMAP_REDIR:
if (!newpath) {
return 0;
}
@@ -635,51 +945,42 @@
_ = newpath + strlen(newpath);
/* append '/' if it's missing */
if (_[-1] != '/') {
- *_ = '/';
+ *_++ = '/';
}
- strcpy(_, p);
+ strcpy(_, normalizedpath);
return 1;
- case 2:
+ case FILEMAP_ASK:
/* ask the socket whether this file is OK */
- return ask_for_dependency(p);
+ switch (dependency_check(normalizedpath)) {
+ case 1:
+ return 1;
+ case -1:
+ /* if the file isn't known to MacPorts, allow
+ * access anyway, but report a sandbox violation.
+ * TODO find a better solution */
+ if (report)
+ __darwintrace_log_op("sandbox_violation", normalizedpath, 0);
+ return 1;
+ case 0:
+ /* file belongs to a foreign port, deny access */
+ if (report)
+ __darwintrace_log_op("sandbox_violation", normalizedpath, 0);
+ return 0;
+ }
default:
fprintf(stderr, "darwintrace: error: unexpected byte in file map: `%x'\n", *t);
abort();
}
}
-
- /* advance the cursor: if the number after the string is not 1, there's
- * no path behind it and we can advance by strlen(t) + 3. If it is 1,
- * make sure to skip the path, too.
- */
- state = DARWINTRACE_STATUS_PATH;
- while (state != DARWINTRACE_STATUS_DONE) {
- switch (state) {
- case DARWINTRACE_STATUS_PATH:
- if (!*t) {
- state = DARWINTRACE_STATUS_COMMAND;
- }
- break;
- case DARWINTRACE_STATUS_COMMAND:
- if (*t == 1) {
- state = DARWINTRACE_STATUS_PATH;
- t++;
- } else {
- state = DARWINTRACE_STATUS_DONE;
- }
- break;
- }
- t++;
- }
- t++;
}
- __darwintrace_log_op("sandbox_violation", path, 0);
+ if (report)
+ __darwintrace_log_op("sandbox_violation", normalizedpath, 0);
return 0;
}
/* wrapper for open(2) preventing opening files outside the sandbox */
-int open(const char* path, int flags, ...) {
+int open(const char *path, int flags, ...) {
#define open(x,y,z) syscall(SYS_open, (x), (y), (z))
mode_t mode;
va_list args;
@@ -688,7 +989,7 @@
debug_printf("open(%s)\n", path);
*newpath = '\0';
- if (!__darwintrace_is_in_sandbox(path, newpath)) {
+ if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
debug_printf("open %s was forbidden\n", path);
errno = ((flags & O_CREAT) > 0) ? EACCES : ENOENT;
return -1;
@@ -712,9 +1013,9 @@
Only logs files where the readlink succeeds.
*/
#ifdef READLINK_IS_NOT_P1003_1A
-int readlink(const char * path, char * buf, int bufsiz) {
+int readlink(const char *path, char *buf, int bufsiz) {
#else
-ssize_t readlink(const char * path, char * buf, size_t bufsiz) {
+ssize_t readlink(const char *path, char *buf, size_t bufsiz) {
#endif
#define readlink(x,y,z) syscall(SYS_readlink, (x), (y), (z))
char newpath[MAXPATHLEN];
@@ -722,7 +1023,7 @@
debug_printf("readlink(%s)\n", path);
*newpath = '\0';
- if (!__darwintrace_is_in_sandbox(path, newpath)) {
+ if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
errno = ENOENT;
return -1;
}
@@ -735,83 +1036,75 @@
#undef readlink
}
-int execve(const char* path, char* const argv[], char* const envp[]) {
-#define __execve(x,y,z) syscall(SYS_execve, (x), (y), (z))
+int execve(const char *path, char *const argv[], char *const envp[]) {
+#define execve(x,y,z) syscall(SYS_execve, (x), (y), (z))
#define open(x,y,z) syscall(SYS_open, (x), (y), (z))
#define close(x) syscall(SYS_close, (x))
#define lstat(x, y) syscall(SYS_lstat, (x), (y))
debug_printf("execve(%s)\n", path);
__darwintrace_setup();
- if (__darwintrace_fd >= 0) {
- struct stat sb;
- /* for symlinks, we want to capture both the original path and the
- * modified one, since for /usr/bin/gcc -> gcc-4.0, both "gcc_select"
- * and "gcc" are contributors
- */
- if (lstat(path, &sb) == 0) {
- int fd;
- if (S_ISLNK(sb.st_mode)) {
- /* for symlinks, print both */
- __darwintrace_log_op("execve", path, 0);
- }
+ struct stat sb;
+ /* for symlinks, we want to capture both the original path and the modified
+ * one, since for $prefix/bin/gcc -> mp-gcc-4.8, both "gcc_select" and
+ * "gcc48" are contributors. This requires changes to the select code such
+ * that the symlinks are registered to the *_select ports. Since this
+ * a general problem (when executing $prefix/libexec/mysql/bin/foo where
+ * $prefix/libexec/mysql is a symlink to $prefix/libexec/mysql55, the
+ * mysql_select port needs to be a contributor!) we should really implement
+ * this in __darwintrace_is_in_sandbox().
+ */
+ if (lstat(path, &sb) == 0) {
+ if (!__darwintrace_is_in_sandbox(path, NULL, true)) {
+ errno = ENOENT;
+ return -1;
+ }
- fd = open(path, O_RDONLY, 0);
- if (fd > 0) {
- char buffer[MAXPATHLEN+1];
- ssize_t bytes_read;
+ int fd = open(path, O_RDONLY, 0);
+ if (fd > 0) {
+ char buffer[MAXPATHLEN + 1];
+ ssize_t bytes_read;
- if(!__darwintrace_is_in_sandbox(path, NULL)) {
+ /* Read the file for the interpreter. Fortunately, on OS X:
+ * The system guarantees to read the number of bytes requested if
+ * the descriptor references a normal file that has that many
+ * bytes left before the end-of-file, but in no other case.
+ * That _does_ save us another ugly loop to get things right. */
+ bytes_read = read(fd, buffer, MAXPATHLEN);
+ buffer[bytes_read] = '\0';
+ const char *buffer_end = buffer + bytes_read;
+ if (bytes_read > 2 && buffer[0] == '#' && buffer[1] == '!') {
+ char *interp = buffer + 2;
+
+ /* skip past leading whitespace */
+ while (interp < buffer_end && isblank(*interp)) {
+ ++interp;
+ }
+ /* found interpreter (or ran out of data); skip until next
+ * whitespace, then terminate the string */
+ if (interp < buffer_end) {
+ char *interp_end = interp;
+ strsep(&interp_end, " \t");
+ }
+
+ /* check the iterpreter against the sandbox */
+ if (!__darwintrace_is_in_sandbox(interp, NULL, true)) {
close(fd);
errno = ENOENT;
return -1;
}
-
- /* once we have an open fd, if a full path was requested, do it */
- __darwintrace_log_op("execve", path, fd);
-
- /* read the file for the interpreter */
- bytes_read = read(fd, buffer, MAXPATHLEN);
- buffer[bytes_read] = 0;
- if (bytes_read > 2 && buffer[0] == '#' && buffer[1] == '!') {
- const char* interp = &buffer[2];
- int i;
- /* skip past leading whitespace */
- for (i = 2; i < bytes_read; ++i) {
- if (buffer[i] != ' ' && buffer[i] != '\t') {
- interp = &buffer[i];
- break;
- }
- }
- /* found interpreter (or ran out of data); skip until next
- * whitespace, then terminate the string */
- for (; i < bytes_read; ++i) {
- if (buffer[i] == ' ' || buffer[i] == '\t' || buffer[i] == '\n') {
- buffer[i] = 0;
- break;
- }
- }
- /* we have liftoff */
- if (interp && interp[0] != '\0') {
- __darwintrace_log_op("execve", interp, 0);
- }
- }
- close(fd);
}
+
+ close(fd);
+
}
}
+
/* our variables won't survive exec, clean up */
- if (__darwintrace_fd != -2) {
- close(__darwintrace_fd);
- __darwintrace_fd = -2;
- }
- if (__darwintrace_debug) {
- fclose(__darwintrace_debug);
- __darwintrace_debug = NULL;
- }
- __darwintrace_pid = (pid_t) -1;
+ __darwintrace_close();
+ __darwintrace_pid = (pid_t) - 1;
/* call the original execve function, but fix the environment if required. */
- return __execve(path, argv, __darwintrace_restore_env(envp));
+ return execve(path, argv, __darwintrace_restore_env(envp));
#undef lstat
#undef close
#undef open
@@ -822,9 +1115,13 @@
* descriptor */
int close(int fd) {
#define close(x) syscall(SYS_close, (x))
- if (__darwintrace_fd != -2 && fd == __darwintrace_fd) {
- errno = EBADF;
- return -1;
+ FILE *stream = __darwintrace_sock();
+ if (stream) {
+ int dtsock = fileno(stream);
+ if (fd == dtsock && dtsock != __darwintrace_close_sock) {
+ errno = EBADF;
+ return -1;
+ }
}
return close(fd);
@@ -834,35 +1131,41 @@
/* if darwintrace has been initialized, trap attempts to dup2 over our file descriptor */
int dup2(int filedes, int filedes2) {
#define dup2(x, y) syscall(SYS_dup2, (x), (y))
+ FILE *stream = __darwintrace_sock();
debug_printf("dup2(%d, %d)\n", filedes, filedes2);
- if (__darwintrace_fd != -2 && filedes2 == __darwintrace_fd) {
+ if (stream && filedes2 == fileno(stream)) {
/* if somebody tries to close our file descriptor, just move it out of
* the way. Make sure it doesn't end up as stdin/stdout/stderr, though!
* */
int new_darwintrace_fd;
+ FILE *new_stream;
- if (-1 == (new_darwintrace_fd = fcntl(__darwintrace_fd, F_DUPFD, STDOUT_FILENO + 1))) {
+ if (-1 == (new_darwintrace_fd = fcntl(fileno(stream), F_DUPFD, STDOUT_FILENO + 1))) {
/* if duplicating fails, do not allow overwriting either! */
return -1;
}
- debug_printf("moving __darwintrace_fd from %d to %d\n", __darwintrace_fd, new_darwintrace_fd);
- __darwintrace_fd = new_darwintrace_fd;
+ debug_printf("moving __darwintrace FD from %d to %d\n", fileno(stream), new_darwintrace_fd);
+ __darwintrace_close();
+ if (NULL == (new_stream = fdopen(new_darwintrace_fd, "a+"))) {
+ perror("darwintrace: fdopen");
+ abort();
+ }
+ __darwintrace_sock_set(new_stream);
}
return dup2(filedes, filedes2);
#undef dup2
}
-
/* Trap attempts to unlink a file outside the sandbox. */
-int unlink(const char* path) {
+int unlink(const char *path) {
#define __unlink(x) syscall(SYS_unlink, (x))
char newpath[MAXPATHLEN];
*newpath = '\0';
- if (!__darwintrace_is_in_sandbox(path, newpath)) {
+ if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
debug_printf("unlink %s was forbidden\n", path);
errno = ENOENT;
return -1;
@@ -879,12 +1182,12 @@
/* Trap attempts to create directories outside the sandbox.
*/
-int mkdir(const char* path, mode_t mode) {
+int mkdir(const char *path, mode_t mode) {
#define __mkdir(x,y) syscall(SYS_mkdir, (x), (y))
char newpath[MAXPATHLEN];
*newpath = '\0';
- if (!__darwintrace_is_in_sandbox(path, newpath)) {
+ if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
struct stat st;
if (-1 == lstat(path, &st)) {
if (errno == ENOENT) {
@@ -909,9 +1212,9 @@
/* Trap attempts to remove directories outside the sandbox.
*/
-int rmdir(const char* path) {
+int rmdir(const char *path) {
#define __rmdir(x) syscall(SYS_rmdir, (x))
- if (!__darwintrace_is_in_sandbox(path, NULL)) {
+ if (!__darwintrace_is_in_sandbox(path, NULL, true)) {
debug_printf("removing directory %s was forbidden\n", path);
errno = ENOENT;
return -1;
@@ -924,15 +1227,15 @@
/* Trap attempts to rename files/directories outside the sandbox.
*/
-int rename(const char* from, const char* to) {
+int rename(const char *from, const char *to) {
#define __rename(x,y) syscall(SYS_rename, (x), (y))
- if (!__darwintrace_is_in_sandbox(from, NULL)) {
+ if (!__darwintrace_is_in_sandbox(from, NULL, true)) {
/* outside sandbox, forbid */
debug_printf("renaming from %s was forbidden\n", from);
errno = ENOENT;
return -1;
}
- if (!__darwintrace_is_in_sandbox(to, NULL)) {
+ if (!__darwintrace_is_in_sandbox(to, NULL, true)) {
debug_printf("renaming to %s was forbidden\n", to);
errno = EACCES;
return -1;
@@ -943,7 +1246,7 @@
return __rename(from, to);
}
-int stat(const char * path, struct stat * sb) {
+int stat(const char *path, struct stat *sb) {
#define stat(path, sb) syscall(SYS_stat, path, sb)
int result = 0;
char newpath[MAXPATHLEN];
@@ -958,7 +1261,7 @@
}
*newpath = '\0';
- if (!__darwintrace_is_in_sandbox(path, newpath)) {
+ if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
errno = ENOENT;
return -1;
}
@@ -973,7 +1276,7 @@
#if defined(__DARWIN_64_BIT_INO_T) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE)
-int stat64(const char * path, struct stat64 * sb) {
+int stat64(const char *path, struct stat64 *sb) {
#define stat64(path, sb) syscall(SYS_stat64, path, sb)
int result = 0;
char newpath[MAXPATHLEN];
@@ -988,7 +1291,7 @@
}
*newpath = '\0';
- if (!__darwintrace_is_in_sandbox(path, newpath)) {
+ if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
errno = ENOENT;
return -1;
}
@@ -1001,14 +1304,14 @@
#undef stat64
}
-int stat$INODE64(const char * path, struct stat64 * sb) {
- return stat64(path, sb);
+int stat$INODE64(const char *path, struct stat64 *sb) {
+ return stat64(path, sb);
}
#endif /* defined(__DARWIN_64_BIT_INO_T) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE) */
-int lstat(const char * path, struct stat * sb) {
+int lstat(const char *path, struct stat *sb) {
#define lstat(path, sb) syscall(SYS_lstat, path, sb)
int result = 0;
char newpath[MAXPATHLEN];
@@ -1023,7 +1326,7 @@
}
*newpath = '\0';
- if (!__darwintrace_is_in_sandbox(path, newpath)) {
+ if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
errno = ENOENT;
return -1;
}
@@ -1038,7 +1341,7 @@
#if defined(__DARWIN_64_BIT_INO_T) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE)
-int lstat64(const char * path, struct stat64 * sb) {
+int lstat64(const char *path, struct stat64 *sb) {
#define lstat64(path, sb) syscall(SYS_lstat64, path, sb)
int result = 0;
char newpath[MAXPATHLEN];
@@ -1053,7 +1356,7 @@
}
*newpath = '\0';
- if (!__darwintrace_is_in_sandbox(path, newpath)) {
+ if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
errno = ENOENT;
return -1;
}
@@ -1066,8 +1369,8 @@
#undef lstat64
}
-int lstat$INODE64(const char * path, struct stat64 * sb) {
- return lstat64(path, sb);
+int lstat$INODE64(const char *path, struct stat64 *sb) {
+ return lstat64(path, sb);
}
#endif /* defined(__DARWIN_64_BIT_INO_T) && !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE) */
@@ -1087,22 +1390,14 @@
* other systems, and because other system's syscall names are probably
* different anyway */
-#pragma pack(4)
-struct dirent32 {
- ino_t d_ino; /* file number of entry */
- __uint16_t d_reclen; /* length of this record */
- __uint8_t d_type; /* file type, see below */
- __uint8_t d_namlen; /* length of string in d_name */
- char d_name[__DARWIN_MAXNAMLEN + 1]; /* name must be no longer than this */
-};
-#pragma pack()
+#if defined(__DARWIN_64_BIT_INO_T)
struct dirent64 {
__uint64_t d_ino; /* file number of entry */
- __uint64_t d_seekoff; /* seek offset (optional, used by servers) */
+ __uint64_t d_seekoff; /* seek offset */
__uint16_t d_reclen; /* length of this record */
__uint16_t d_namlen; /* length of string in d_name */
- __uint8_t d_type; /* file type, see below */
+ __uint8_t d_type; /* file type */
char d_name[__DARWIN_MAXPATHLEN]; /* entry name (up to MAXPATHLEN bytes) */
};
@@ -1114,7 +1409,7 @@
if (-1 == fcntl(fd, F_GETPATH, dirname)) {
errno = EBADF;
- return 0;
+ return -1;
}
dnamelen = strlen(dirname);
@@ -1130,7 +1425,7 @@
struct dirent64 *dent = (struct dirent64 *)(((char *) buf) + offset);
dirname[dnamelen] = '\0';
strcat(dirname, dent->d_name);
- if (!__darwintrace_is_in_sandbox(dirname, NULL)) {
+ if (!__darwintrace_is_in_sandbox(dirname, NULL, false)) {
debug_printf("__getdirentries64: filtered %s\n", dirname);
dent->d_ino = 0;
} else {
@@ -1143,6 +1438,18 @@
#undef __getdirentries64
}
+#endif /* defined(__DARWIN_64_BIT_INO_T) */
+
+#pragma pack(4)
+struct dirent32 {
+ ino_t d_ino; /* file number of entry */
+ __uint16_t d_reclen; /* length of this record */
+ __uint8_t d_type; /* file type */
+ __uint8_t d_namlen; /* length of string in d_name */
+ char d_name[__DARWIN_MAXNAMLEN + 1]; /* name must be no longer than this */
+};
+#pragma pack()
+
int getdirentries(int fd, char *buf, int nbytes, long *basep) {
#define getdirentries(w,x,y,z) syscall(SYS_getdirentries, (w), (x), (y), (z))
size_t sz = getdirentries(fd, buf, nbytes, basep);
@@ -1166,7 +1473,7 @@
struct dirent32 *dent = (struct dirent32 *)(buf + offset);
dirname[dnamelen] = '\0';
strcat(dirname, dent->d_name);
- if (!__darwintrace_is_in_sandbox(dirname, NULL)) {
+ if (!__darwintrace_is_in_sandbox(dirname, NULL, false)) {
debug_printf("getdirentries: filtered %s\n", dirname);
dent->d_ino = 0;
} else {
@@ -1178,4 +1485,36 @@
return sz;
#undef getdirentries
}
+
+int access(const char *path, int amode) {
+#define access(x, y) syscall(SYS_access, (x), (y))
+#define lstat(path, sb) syscall(SYS_lstat, path, sb)
+ struct stat st;
+ char newpath[MAXPATHLEN];
+
+ debug_printf("access(%s, %d)\n", path, amode);
+
+ if (-1 == lstat(path, &st)) {
+ return -1;
+ }
+
+ if (S_ISDIR(st.st_mode)) {
+ return access(path, amode);
+ }
+
+ *newpath = '\0';
+ if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (*newpath) {
+ return access(newpath, amode);
+ }
+
+ return access(path, amode);
+#undef lstat
+#undef access
+}
+
#endif /* __APPLE__ */
Modified: branches/new-help-system/base/src/images_to_archives.tcl
===================================================================
--- branches/new-help-system/base/src/images_to_archives.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/images_to_archives.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -74,7 +74,7 @@
}
set found 0
foreach adir [list $oldarchivedir $olderarchivedir] {
- foreach type {tbz2 tbz tgz tar txz tlz xar xpkg zip cpgz cpio} {
+ foreach type {tbz2 tbz tgz tar txz tlz xar zip cpgz cpio} {
set oldarchivefullpath "[file join $adir $oldarchiverootname].${type}"
if {[file isfile $oldarchivefullpath]} {
set found 1
Modified: branches/new-help-system/base/src/machista1.0/Makefile.in
===================================================================
--- branches/new-help-system/base/src/machista1.0/Makefile.in 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/machista1.0/Makefile.in 2013-09-07 09:48:49 UTC (rev 110832)
@@ -15,7 +15,7 @@
include ../../Mk/macports.autoconf.mk
include ../../Mk/macports.tea.mk
-CFLAGS+= -fPIC -std=c99 -pedantic
+CFLAGS+= -fPIC
${SWIG_SRCS}:: ${SWIG_IFACE}
ifdef SWIG
Modified: branches/new-help-system/base/src/macports1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/macports1.0/Makefile 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/macports1.0/Makefile 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,5 +1,5 @@
SRCS= macports.tcl macports_dlist.tcl macports_util.tcl \
- macports_autoconf.tcl macports_index.tcl macports_fastload.tcl
+ macports_autoconf.tcl macports_fastload.tcl
OBJS= macports.o get_systemconfiguration_proxies.o sysctl.o
SHLIB_NAME= MacPorts${SHLIB_SUFFIX}
Modified: branches/new-help-system/base/src/macports1.0/macports.tcl
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/macports1.0/macports.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -6,7 +6,7 @@
# Copyright (c) 2004 - 2005 Paul Guyot, <pguyot at kallisys.net>.
# Copyright (c) 2004 - 2006 Ole Guldberg Jensen <olegb at opendarwin.org>.
# Copyright (c) 2004 - 2005 Robert Shaw <rshaw at opendarwin.org>
-# Copyright (c) 2004 - 2012 The MacPorts Project
+# Copyright (c) 2004 - 2013 The MacPorts Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -35,11 +35,10 @@
#
package provide macports 1.0
package require macports_dlist 1.0
-package require macports_index 1.0
package require macports_util 1.0
namespace eval macports {
- namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases
+ namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases
variable bootstrap_options "\
portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat \
portarchivetype portautoclean \
@@ -50,9 +49,9 @@
macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip \
master_site_local patch_site_local archive_site_local buildfromsource \
revupgrade_autorun revupgrade_mode revupgrade_check_id_loadcmds \
- host_blacklist preferred_hosts\
- packagemaker_path default_compilers"
- variable user_options ""
+ host_blacklist preferred_hosts sandbox_enable delete_la_files cxx_stdlib \
+ packagemaker_path default_compilers pkg_post_unarchive_deletions"
+ variable user_options {}
variable portinterp_options "\
portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
registry.path registry.format user_home \
@@ -61,7 +60,8 @@
configureccache ccache_dir ccache_size configuredistcc configurepipe buildnicevalue buildmakejobs \
applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch \
os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target \
- packagemaker_path default_compilers $user_options"
+ packagemaker_path default_compilers sandbox_enable delete_la_files cxx_stdlib \
+ pkg_post_unarchive_deletions $user_options"
# deferred options are only computed when needed.
# they are not exported to the trace thread.
@@ -72,7 +72,7 @@
variable ui_priorities "error warn msg notice info debug any"
variable port_phases "any fetch checksum"
- variable current_phase "main"
+ variable current_phase main
variable ui_prefix "---> "
}
@@ -99,7 +99,7 @@
# ui_options accessor
proc macports::ui_isset {val} {
if {[info exists macports::ui_options($val)]} {
- if {$macports::ui_options($val) == "yes"} {
+ if {$macports::ui_options($val) eq {yes}} {
return 1
}
}
@@ -110,7 +110,7 @@
# global_options accessor
proc macports::global_option_isset {val} {
if {[info exists macports::global_options($val)]} {
- if {$macports::global_options($val) == "yes"} {
+ if {$macports::global_options($val) eq {yes}} {
return 1
}
}
@@ -129,7 +129,7 @@
}
# Add our log-channel to all already initialized channels
foreach key [array names channels] {
- set macports::channels($key) [concat $macports::channels($key) "debuglog"]
+ set macports::channels($key) [concat $macports::channels($key) debuglog]
}
return 0
}
@@ -143,13 +143,13 @@
set logname [macports::getportlogpath $portpath $portname]
file mkdir $logname
- set logname [file join $logname "main.log"]
+ set logname [file join $logname main.log]
set ::debuglogname $logname
# Truncate the file if already exists
set ::debuglog [open $::debuglogname w]
- puts $::debuglog "version:1"
+ puts $::debuglog version:1
}
proc macports::push_log {mport} {
global ::logstack ::logenabled ::debuglog ::debuglogname
@@ -173,6 +173,7 @@
lappend ::logstack [list $::debuglog $::debuglogname]
}
}
+
proc macports::pop_log {} {
global ::logenabled ::logstack ::debuglog ::debuglogname
if {![info exists ::logenabled]} {
@@ -195,7 +196,7 @@
proc set_phase {phase} {
global macports::current_phase
set macports::current_phase $phase
- if {$phase != "main"} {
+ if {$phase ne {main}} {
set cur_time [clock format [clock seconds] -format {%+}]
ui_debug "$phase phase started at $cur_time"
}
@@ -204,23 +205,23 @@
proc ui_message {priority prefix phase args} {
global macports::channels ::debuglog macports::current_phase
foreach chan $macports::channels($priority) {
- if {[info exists ::debuglog] && ($chan == "debuglog")} {
+ if {[info exists ::debuglog] && ($chan eq {debuglog})} {
set chan $::debuglog
if {[info exists macports::current_phase]} {
set phase $macports::current_phase
}
- set strprefix ":$priority:$phase "
- if {[lindex $args 0] == "-nonewline"} {
- puts -nonewline $chan "$strprefix[lindex $args 1]"
+ set strprefix ":${priority}:$phase "
+ if {[lindex $args 0] eq {-nonewline}} {
+ puts -nonewline $chan $strprefix[lindex $args 1]
} else {
- puts $chan "$strprefix[lindex $args 0]"
+ puts $chan $strprefix[lindex $args 0]
}
-
+
} else {
- if {[lindex $args 0] == "-nonewline"} {
- puts -nonewline $chan "$prefix[lindex $args 1]"
+ if {[lindex $args 0] eq {-nonewline}} {
+ puts -nonewline $chan $prefix[lindex $args 1]
} else {
- puts $chan "$prefix[lindex $args 0]"
+ puts $chan $prefix[lindex $args 0]
}
}
}
@@ -234,10 +235,10 @@
} else {
set channels($priority) $default_channel
}
-
+
# if some priority initialized after log file is being created
if {[info exists ::debuglog]} {
- set channels($priority) [concat $channels($priority) "debuglog"]
+ set channels($priority) [concat $channels($priority) debuglog]
}
# Simplify ui_$priority.
try {
@@ -249,16 +250,16 @@
try {
eval ::ui_init $priority $prefix $channels($priority) $args
} catch * {
- interp alias {} ui_$priority {} ui_message $priority $prefix ""
+ interp alias {} ui_$priority {} ui_message $priority $prefix {}
foreach phase $phases {
- interp alias {} ui_${priority}_${phase} {} ui_message $priority $prefix $phase
+ interp alias {} ui_${priority}_$phase {} ui_message $priority $prefix $phase
}
}
}
# Default implementation of ui_prefix
proc macports::ui_prefix_default {priority} {
- switch $priority {
+ switch -- $priority {
debug {
return "DEBUG: "
}
@@ -269,7 +270,7 @@
return "Warning: "
}
default {
- return ""
+ return {}
}
}
}
@@ -279,17 +280,17 @@
# ui_options(ports_verbose) - If set, output info messages (ui_info)
# ui_options(ports_quiet) - If set, don't output "standard messages"
proc macports::ui_channels_default {priority} {
- switch $priority {
+ switch -- $priority {
debug {
if {[ui_isset ports_debug]} {
- return {stderr}
+ return stderr
} else {
return {}
}
}
info {
if {[ui_isset ports_verbose]} {
- return {stdout}
+ return stdout
} else {
return {}
}
@@ -298,18 +299,18 @@
if {[ui_isset ports_quiet]} {
return {}
} else {
- return {stdout}
+ return stdout
}
}
msg {
- return {stdout}
+ return stdout
}
warn -
error {
- return {stderr}
+ return stderr
}
default {
- return {stdout}
+ return stdout
}
}
}
@@ -330,14 +331,14 @@
# find a binary either in a path defined at MacPorts' configuration time
# or in the PATH environment variable through macports::binaryInPath (fallback)
-proc macports::findBinary {prog {autoconf_hint ""}} {
- if {${autoconf_hint} != "" && [file executable ${autoconf_hint}]} {
- return ${autoconf_hint}
+proc macports::findBinary {prog {autoconf_hint {}}} {
+ if {$autoconf_hint ne {} && [file executable $autoconf_hint]} {
+ return $autoconf_hint
} else {
- if {[catch {set cmd_path [macports::binaryInPath ${prog}]} result] == 0} {
- return ${cmd_path}
+ if {[catch {set cmd_path [macports::binaryInPath $prog]} result] == 0} {
+ return $cmd_path
} else {
- return -code error "${result} or at its MacPorts configuration time location, did you move it?"
+ return -code error "$result or at its MacPorts configuration time location, did you move it?"
}
}
}
@@ -357,13 +358,12 @@
# deferred option processing
proc macports::getoption {name} {
global macports::$name
- return [expr $$name]
+ return [set $name]
}
# deferred and on-need extraction of xcodeversion and xcodebuildcmd.
proc macports::setxcodeinfo {name1 name2 op} {
- global macports::xcodeversion
- global macports::xcodebuildcmd
+ global macports::xcodeversion macports::xcodebuildcmd
trace remove variable macports::xcodeversion read macports::setxcodeinfo
trace remove variable macports::xcodebuildcmd read macports::setxcodeinfo
@@ -371,51 +371,51 @@
if {![catch {findBinary xcodebuild $macports::autoconf::xcodebuild_path} xcodebuild]} {
if {![info exists xcodeversion]} {
# Determine xcode version
- set macports::xcodeversion "2.0orlower"
+ set macports::xcodeversion 2.0orlower
if {[catch {set xcodebuildversion [exec -- $xcodebuild -version 2> /dev/null]}] == 0} {
if {[regexp {Xcode ([0-9.]+)} $xcodebuildversion - xcode_v] == 1} {
set macports::xcodeversion $xcode_v
- } elseif {[regexp "DevToolsCore-(.*);" $xcodebuildversion - devtoolscore_v] == 1} {
+ } elseif {[regexp {DevToolsCore-(.*);} $xcodebuildversion - devtoolscore_v] == 1} {
if {$devtoolscore_v >= 1809.0} {
- set macports::xcodeversion "3.2.6"
+ set macports::xcodeversion 3.2.6
} elseif {$devtoolscore_v >= 1204.0} {
- set macports::xcodeversion "3.1.4"
+ set macports::xcodeversion 3.1.4
} elseif {$devtoolscore_v >= 1100.0} {
- set macports::xcodeversion "3.1"
+ set macports::xcodeversion 3.1
} elseif {$devtoolscore_v >= 921.0} {
- set macports::xcodeversion "3.0"
+ set macports::xcodeversion 3.0
} elseif {$devtoolscore_v >= 798.0} {
- set macports::xcodeversion "2.5"
+ set macports::xcodeversion 2.5
} elseif {$devtoolscore_v >= 762.0} {
- set macports::xcodeversion "2.4.1"
+ set macports::xcodeversion 2.4.1
} elseif {$devtoolscore_v >= 757.0} {
- set macports::xcodeversion "2.4"
+ set macports::xcodeversion 2.4
} elseif {$devtoolscore_v > 650.0} {
# XXX find actual version corresponding to 2.3
- set macports::xcodeversion "2.3"
+ set macports::xcodeversion 2.3
} elseif {$devtoolscore_v >= 650.0} {
- set macports::xcodeversion "2.2.1"
+ set macports::xcodeversion 2.2.1
} elseif {$devtoolscore_v > 620.0} {
# XXX find actual version corresponding to 2.2
- set macports::xcodeversion "2.2"
+ set macports::xcodeversion 2.2
} elseif {$devtoolscore_v >= 620.0} {
- set macports::xcodeversion "2.1"
+ set macports::xcodeversion 2.1
}
}
} else {
ui_warn "xcodebuild exists but failed to execute"
- set macports::xcodeversion "none"
+ set macports::xcodeversion none
}
}
if {![info exists xcodebuildcmd]} {
- set macports::xcodebuildcmd "$xcodebuild"
+ set macports::xcodebuildcmd $xcodebuild
}
} else {
if {![info exists xcodeversion]} {
- set macports::xcodeversion "none"
+ set macports::xcodeversion none
}
if {![info exists xcodebuildcmd]} {
- set macports::xcodebuildcmd "none"
+ set macports::xcodebuildcmd none
}
}
}
@@ -425,7 +425,7 @@
global macports::developer_dir macports::os_major macports::xcodeversion
trace remove variable macports::developer_dir read macports::set_developer_dir
-
+
# Look for xcodeselect, and make sure it has a valid value
if {![catch {findBinary xcode-select $macports::autoconf::xcode_select_path} xcodeselect]} {
@@ -438,21 +438,21 @@
}
# The directory from xcode-select isn't correct.
-
+
# Ask mdfind where Xcode is and make some suggestions for the user,
# searching by bundle identifier for various Xcode versions (3.x and 4.x)
set installed_xcodes {}
if {![catch {findBinary mdfind $macports::autoconf::mdfind_path} mdfind]} {
set installed_xcodes [exec $mdfind "kMDItemCFBundleIdentifier == 'com.apple.Xcode' || kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"]
}
-
+
# In case mdfind metadata wasn't complete, also look in two well-known locations for Xcode.app
foreach app {/Applications/Xcode.app /Developer/Applications/Xcode.app} {
if {[file isdirectory $app]} {
lappend installed_xcodes $app
}
}
-
+
# Form a list of unique xcode installations
set installed_xcodes [lsort -unique $installed_xcodes]
@@ -464,20 +464,20 @@
ui_error "Please use xcode-select to select an Xcode installation:"
foreach xcode $installed_xcodes {
set vers [exec $mdls -raw -name kMDItemVersion $xcode]
- if {$vers == "(null)"} { set vers "unknown" }
- if {[_is_valid_developer_dir "${xcode}/Contents/Developer"]} {
+ if {$vers eq {(null)}} {set vers unknown}
+ if {[_is_valid_developer_dir ${xcode}/Contents/Developer]} {
# Though xcode-select shipped with xcode 4.3 supports and encourages
# direct use of the app path, older xcode-select does not.
# Specify the Contents/Developer directory if it exists
- ui_error " sudo xcode-select -switch ${xcode}/Contents/Developer # version ${vers}"
+ ui_error " sudo xcode-select -switch ${xcode}/Contents/Developer # version $vers"
} elseif {[vercmp $vers 4.3] >= 0} {
# Future proofing: fall back to the app-path only for xcode >= 4.3, since Contents/Developer doesn't exist
- ui_error " sudo xcode-select -switch ${xcode} # version ${vers}"
- } elseif {[_is_valid_developer_dir "${xcode}/../.."]} {
+ ui_error " sudo xcode-select -switch $xcode # version $vers"
+ } elseif {[_is_valid_developer_dir ${xcode}/../..]} {
# Older xcode (< 4.3) is below the developer directory
- ui_error " sudo xcode-select -switch [file normalize ${xcode}/../..] # version ${vers}"
+ ui_error " sudo xcode-select -switch [file normalize ${xcode}/../..] # version $vers"
} else {
- ui_error " # malformed Xcode at ${xcode}, version ${vers}"
+ ui_error " # malformed Xcode at ${xcode}, version $vers"
}
}
} else {
@@ -489,9 +489,9 @@
# Try the default
if {$os_major >= 11 && [vercmp $xcodeversion 4.3] >= 0} {
- set devdir "/Applications/Xcode.app/Contents/Developer"
+ set devdir /Applications/Xcode.app/Contents/Developer
} else {
- set devdir "/Developer"
+ set devdir /Developer
}
set macports::developer_dir $devdir
@@ -507,7 +507,7 @@
# Verify that the directory has some key subdirectories
foreach subdir {Library usr} {
- if {![file isdirectory "${dir}/${subdir}"]} {
+ if {![file isdirectory ${dir}/$subdir]} {
return 0
}
}
@@ -518,91 +518,87 @@
proc mportinit {{up_ui_options {}} {up_options {}} {up_variations {}}} {
- if {$up_ui_options eq ""} {
+ if {$up_ui_options eq {}} {
array set macports::ui_options {}
} else {
upvar $up_ui_options temp_ui_options
array set macports::ui_options [array get temp_ui_options]
}
- if {$up_options eq ""} {
+ if {$up_options eq {}} {
array set macports::global_options {}
} else {
upvar $up_options temp_options
array set macports::global_options [array get temp_options]
}
- if {$up_variations eq ""} {
+ if {$up_variations eq {}} {
array set variations {}
} else {
upvar $up_variations variations
}
# Initialize ui_*
- foreach priority ${macports::ui_priorities} {
+ foreach priority $macports::ui_priorities {
macports::ui_init $priority
}
- global auto_path env tcl_platform
- global macports::autoconf::macports_conf_path
- global macports::macports_user_dir
- global macports::bootstrap_options
- global macports::user_options
- global macports::extra_env
- global macports::portconf
- global macports::portdbpath
- global macports::portsharepath
- global macports::registry.format
- global macports::registry.path
- global macports::sources
- global macports::sources_default
- global macports::sources_conf
- global macports::destroot_umask
- global macports::libpath
- global macports::prefix
- global macports::macportsuser
- global macports::prefix_frozen
- global macports::rsync_dir
- global macports::rsync_options
- global macports::rsync_server
- global macports::variants_conf
- global macports::xcodebuildcmd
- global macports::xcodeversion
- global macports::configureccache
- global macports::ccache_dir
- global macports::ccache_size
- global macports::configuredistcc
- global macports::configurepipe
- global macports::buildnicevalue
- global macports::buildmakejobs
- global macports::universal_archs
- global macports::build_arch
- global macports::os_arch
- global macports::os_endian
- global macports::os_version
- global macports::os_major
- global macports::os_platform
- global macports::macosx_version
- global macports::macosx_deployment_target
- global macports::archivefetch_pubkeys
- global macports::ping_cache
- global macports::host_blacklisted
- global macports::host_preferred
+ global auto_path env tcl_platform \
+ macports::autoconf::macports_conf_path \
+ macports::macports_user_dir \
+ macports::bootstrap_options \
+ macports::user_options \
+ macports::portconf \
+ macports::portsharepath \
+ macports::registry.format \
+ macports::registry.path \
+ macports::sources \
+ macports::sources_default \
+ macports::destroot_umask \
+ macports::libpath \
+ macports::prefix \
+ macports::macportsuser \
+ macports::prefix_frozen \
+ macports::xcodebuildcmd \
+ macports::xcodeversion \
+ macports::configureccache \
+ macports::ccache_dir \
+ macports::ccache_size \
+ macports::configuredistcc \
+ macports::configurepipe \
+ macports::buildnicevalue \
+ macports::buildmakejobs \
+ macports::universal_archs \
+ macports::build_arch \
+ macports::os_arch \
+ macports::os_endian \
+ macports::os_version \
+ macports::os_major \
+ macports::os_platform \
+ macports::macosx_version \
+ macports::macosx_deployment_target \
+ macports::archivefetch_pubkeys \
+ macports::ping_cache \
+ macports::host_blacklisted \
+ macports::host_preferred \
+ macports::delete_la_files \
+ macports::cxx_stdlib
+
# Set the system encoding to utf-8
encoding system utf-8
# set up platform info variables
set os_arch $tcl_platform(machine)
- if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
- if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
+ if {$os_arch eq {Power Macintosh}} {set os_arch "powerpc"}
+ if {$os_arch eq {i586} || $os_arch eq {i686} || $os_arch eq {x86_64}} {set os_arch "i386"}
set os_version $tcl_platform(osVersion)
set os_major [lindex [split $os_version .] 0]
set os_platform [string tolower $tcl_platform(os)]
# Remove trailing "Endian"
set os_endian [string range $tcl_platform(byteOrder) 0 end-6]
set macosx_version {}
- if {$os_platform == "darwin"} {
+ if {$os_platform eq {darwin}} {
# This will probably break when Apple changes versioning
- set macosx_version [expr 10.0 + ($os_major - 4) / 10.0]
+ set macosx_version [expr {10.0 + ($os_major - 4) / 10.0}]
}
# Ensure that the macports user directory (i.e. ~/.macports) exists if HOME is defined.
@@ -610,32 +606,32 @@
if {[info exists env(HOME)]} {
set macports::user_home $env(HOME)
set macports::macports_user_dir [file normalize $macports::autoconf::macports_user_dir]
- } elseif {[info exists env(SUDO_USER)] && $os_platform == "darwin"} {
+ } elseif {[info exists env(SUDO_USER)] && $os_platform eq {darwin}} {
set macports::user_home [exec dscl -q . -read /Users/$env(SUDO_USER) NFSHomeDirectory | cut -d ' ' -f 2]
- set macports::macports_user_dir [file join ${macports::user_home} [string range $macports::autoconf::macports_user_dir 2 end]]
- } elseif {[exec id -u] != 0 && $os_platform == "darwin"} {
+ set macports::macports_user_dir [file join $macports::user_home [string range $macports::autoconf::macports_user_dir 2 end]]
+ } elseif {[exec id -u] != 0 && $os_platform eq {darwin}} {
set macports::user_home [exec dscl -q . -read /Users/[exec id -un] NFSHomeDirectory | cut -d ' ' -f 2]
- set macports::macports_user_dir [file join ${macports::user_home} [string range $macports::autoconf::macports_user_dir 2 end]]
+ set macports::macports_user_dir [file join $macports::user_home [string range $macports::autoconf::macports_user_dir 2 end]]
} else {
# Otherwise define the user directory as a directory that will never exist
- set macports::macports_user_dir "/dev/null/NO_HOME_DIR"
- set macports::user_home "/dev/null/NO_HOME_DIR"
+ set macports::macports_user_dir /dev/null/NO_HOME_DIR
+ set macports::user_home /dev/null/NO_HOME_DIR
}
# Configure the search path for configuration files
- set conf_files ""
- lappend conf_files "${macports_conf_path}/macports.conf"
- if { [file isdirectory $macports_user_dir] } {
- lappend conf_files "${macports_user_dir}/macports.conf"
+ set conf_files {}
+ lappend conf_files ${macports_conf_path}/macports.conf
+ if {[file isdirectory $macports_user_dir]} {
+ lappend conf_files ${macports_user_dir}/macports.conf
}
if {[info exists env(PORTSRC)]} {
set PORTSRC $env(PORTSRC)
- lappend conf_files ${PORTSRC}
+ lappend conf_files $PORTSRC
}
# Process all configuration files we find on conf_files list
foreach file $conf_files {
- if [file exists $file] {
+ if {[file exists $file]} {
set portconf $file
set fd [open $file r]
while {[gets $fd line] >= 0} {
@@ -651,8 +647,8 @@
}
# Process per-user only settings
- set per_user "${macports_user_dir}/user.conf"
- if [file exists $per_user] {
+ set per_user ${macports_user_dir}/user.conf
+ if {[file exists $per_user]} {
set fd [open $per_user r]
while {[gets $fd line] >= 0} {
if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
@@ -678,7 +674,7 @@
if {[lsearch -exact [list nosync default] $flag] == -1} {
ui_warn "$sources_conf source '$line' specifies invalid flag '$flag'"
}
- if {$flag == "default"} {
+ if {$flag eq {default}} {
if {[info exists sources_default]} {
ui_warn "More than one default port source is defined."
}
@@ -696,20 +692,20 @@
# [macports::getportresourcepath] fails when the first source doesn't
# contain _resources.
if {![info exists sources_default]} {
- ui_warn "No default port source specified in $sources_conf, using last source as default"
+ ui_warn "No default port source specified in ${sources_conf}, using last source as default"
set sources_default [lindex $sources end]
}
if {![info exists sources]} {
if {[file isdirectory ports]} {
- set sources "file://[pwd]/ports"
+ set sources file://[pwd]/ports
} else {
return -code error "No sources defined in $sources_conf"
}
}
if {[info exists variants_conf]} {
- if {[file exist $variants_conf]} {
+ if {[file exists $variants_conf]} {
set fd [open $variants_conf r]
while {[gets $fd line] >= 0} {
set line [string trimright $line]
@@ -735,8 +731,8 @@
# pubkeys.conf
set macports::archivefetch_pubkeys {}
- if {[file isfile [file join ${macports_conf_path} pubkeys.conf]]} {
- set fd [open [file join ${macports_conf_path} pubkeys.conf] r]
+ if {[file isfile [file join $macports_conf_path pubkeys.conf]]} {
+ set fd [open [file join $macports_conf_path pubkeys.conf] r]
while {[gets $fd line] >= 0} {
set line [string trim $line]
if {![regexp {^[\ \t]*#.*$|^$} $line]} {
@@ -766,7 +762,7 @@
# Format for receipts; currently only "sqlite" is allowed
# could previously be "flat", so we switch that to sqlite
- if {![info exists portdbformat] || $portdbformat == "flat" || $portdbformat == "sqlite"} {
+ if {![info exists portdbformat] || $portdbformat eq {flat} || $portdbformat eq {sqlite}} {
set registry.format receipt_sqlite
} else {
return -code error "unknown registry format '$portdbformat' set in macports.conf"
@@ -774,29 +770,29 @@
# Autoclean mode, whether to automatically call clean after "install"
if {![info exists portautoclean]} {
- set macports::portautoclean "yes"
+ set macports::portautoclean yes
global macports::portautoclean
}
# whether to keep logs after successful builds
if {![info exists keeplogs]} {
- set macports::keeplogs "no"
+ set macports::keeplogs no
global macports::keeplogs
}
-
+
# Check command line override for autoclean
if {[info exists macports::global_options(ports_autoclean)]} {
- if {![string equal $macports::global_options(ports_autoclean) $portautoclean]} {
+ if {$macports::global_options(ports_autoclean) ne $portautoclean} {
set macports::portautoclean $macports::global_options(ports_autoclean)
}
}
# Trace mode, whether to use darwintrace to debug ports.
if {![info exists porttrace]} {
- set macports::porttrace "no"
+ set macports::porttrace no
global macports::porttrace
}
# Check command line override for trace
if {[info exists macports::global_options(ports_trace)]} {
- if {![string equal $macports::global_options(ports_trace) $porttrace]} {
+ if {$macports::global_options(ports_trace) ne $porttrace} {
set macports::porttrace $macports::global_options(ports_trace)
}
}
@@ -804,14 +800,14 @@
if {![info exists macports::global_options(ports_binary_only)]
&& ![info exists macports::global_options(ports_source_only)]
&& [info exists macports::buildfromsource]} {
- if {${macports::buildfromsource} == "never"} {
+ if {$macports::buildfromsource eq {never}} {
set macports::global_options(ports_binary_only) yes
set temp_options(ports_binary_only) yes
- } elseif {${macports::buildfromsource} == "always"} {
+ } elseif {$macports::buildfromsource eq {always}} {
set macports::global_options(ports_source_only) yes
set temp_options(ports_source_only) yes
- } elseif {${macports::buildfromsource} != "ifneeded"} {
- ui_warn "'buildfromsource' set to unknown value '${macports::buildfromsource}', using 'ifneeded' instead"
+ } elseif {$macports::buildfromsource ne {ifneeded}} {
+ ui_warn "'buildfromsource' set to unknown value '$macports::buildfromsource', using 'ifneeded' instead"
}
}
@@ -825,11 +821,11 @@
# Export verbosity.
if {![info exists portverbose]} {
- set macports::portverbose "no"
+ set macports::portverbose no
global macports::portverbose
}
if {[info exists macports::ui_options(ports_verbose)]} {
- if {![string equal $macports::ui_options(ports_verbose) $portverbose]} {
+ if {$macports::ui_options(ports_verbose) ne $portverbose} {
set macports::portverbose $macports::ui_options(ports_verbose)
}
}
@@ -838,23 +834,23 @@
# CPIO, XAR, etc.)
global macports::portarchivetype
if {![info exists portarchivetype]} {
- set macports::portarchivetype "tbz2"
+ set macports::portarchivetype tbz2
} else {
set macports::portarchivetype [lindex $portarchivetype 0]
}
# Set rync options
if {![info exists rsync_server]} {
+ global macports::rsync_server
set macports::rsync_server rsync.macports.org
- global macports::rsync_server
}
if {![info exists rsync_dir]} {
+ global macports::rsync_dir
set macports::rsync_dir release/tarballs/base.tar
- global macports::rsync_dir
}
if {![info exists rsync_options]} {
+ global macports::rsync_options
set rsync_options "-rtzv --delete-after"
- global macports::rsync_options
}
set portsharepath ${prefix}/share/macports
@@ -863,18 +859,18 @@
}
if {![info exists libpath]} {
- set libpath "${prefix}/share/macports/Tcl"
+ set libpath ${prefix}/share/macports/Tcl
}
if {![info exists binpath]} {
- set env(PATH) "${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin"
+ set env(PATH) ${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
} else {
- set env(PATH) "$binpath"
+ set env(PATH) $binpath
}
# Set startupitem default type (can be overridden by portfile)
if {![info exists macports::startupitem_type]} {
- set macports::startupitem_type "default"
+ set macports::startupitem_type default
}
# Set whether startupitems are symlinked into system directories
@@ -895,7 +891,7 @@
set macports::ccache_dir [file join $portdbpath build .ccache]
}
if {![info exists macports::ccache_size]} {
- set macports::ccache_size "2G"
+ set macports::ccache_size 2G
}
if {![info exists macports::configuredistcc]} {
set macports::configuredistcc no
@@ -927,10 +923,10 @@
} elseif {[llength $macports::universal_archs] < 2} {
ui_warn "invalid universal_archs configured (should contain at least 2 archs)"
}
-
+
# Default arch to build for
if {![info exists macports::build_arch]} {
- if {$os_platform == "darwin"} {
+ if {$os_platform eq {darwin}} {
if {$os_major >= 10} {
if {[sysctl hw.cpu64bit_capable] == 1} {
set macports::build_arch x86_64
@@ -938,14 +934,14 @@
set macports::build_arch i386
}
} else {
- if {$os_arch == "powerpc"} {
+ if {$os_arch eq {powerpc}} {
set macports::build_arch ppc
} else {
set macports::build_arch i386
}
}
} else {
- set macports::build_arch ""
+ set macports::build_arch {}
}
} else {
set macports::build_arch [lindex $macports::build_arch 0]
@@ -959,14 +955,32 @@
set macports::revupgrade_autorun yes
}
if {![info exists macports::revupgrade_mode]} {
- set macports::revupgrade_mode "rebuild"
+ set macports::revupgrade_mode rebuild
}
+ if {![info exists macports::delete_la_files]} {
+ if {$os_platform eq "darwin" && $os_major >= 13} {
+ set macports::delete_la_files yes
+ } else {
+ set macports::delete_la_files no
+ }
+ }
+ if {![info exists macports::cxx_stdlib]} {
+ if {$os_platform eq "darwin" && $os_major < 13} {
+ set macports::cxx_stdlib libstdc++
+ } else {
+ set macports::cxx_stdlib {}
+ }
+ }
if {![info exists macports::global_options(ports_rev-upgrade_id-loadcmd-check)]
&& [info exists macports::revupgrade_check_id_loadcmds]} {
- set macports::global_options(ports_rev-upgrade_id-loadcmd-check) ${macports::revupgrade_check_id_loadcmds}
- set temp_options(ports_rev-upgrade_id-loadcmd-check) ${macports::revupgrade_check_id_loadcmds}
+ set macports::global_options(ports_rev-upgrade_id-loadcmd-check) $macports::revupgrade_check_id_loadcmds
+ set temp_options(ports_rev-upgrade_id-loadcmd-check) $macports::revupgrade_check_id_loadcmds
}
+ if {![info exists macports::sandbox_enable]} {
+ set macports::sandbox_enable yes
+ }
+
# make tools we run operate in UTF-8 mode
set env(LANG) en_US.UTF-8
@@ -982,7 +996,7 @@
COLUMNS LINES
}
if {[info exists extra_env]} {
- set keepenvkeys [concat ${keepenvkeys} ${extra_env}]
+ set keepenvkeys [concat $keepenvkeys $extra_env]
}
if {[file isdirectory $libpath]} {
@@ -1002,9 +1016,9 @@
# don't keep unusable TMPDIR/TMP values
foreach var {TMP TMPDIR} {
- if {[info exists env($var)] && [file writable $env($var)] &&
- ([getuid] != 0 || $macportsuser == "root" ||
- [file attributes $env($var) -owner] == $macportsuser)} {
+ if {[info exists env($var)] && [file writable $env($var)] &&
+ ([getuid] != 0 || $macportsuser eq {root} ||
+ [file attributes $env($var) -owner] eq $macportsuser)} {
lappend keepenvkeys $var
}
}
@@ -1017,7 +1031,7 @@
}
# unset environment an extra time, to work around bugs in Leopard Tcl
- if {$macosx_version == "10.5"} {
+ if {$macosx_version eq {10.5}} {
foreach envkey $env_names {
if {[lsearch -exact $keepenvkeys $envkey] == -1} {
unsetenv $envkey
@@ -1032,20 +1046,20 @@
}
if {![info exists developer_dir]} {
- if {$os_platform == "darwin"} {
+ if {$os_platform eq {darwin}} {
trace add variable macports::developer_dir read macports::set_developer_dir
} else {
- set macports::developer_dir ""
+ set macports::developer_dir {}
}
} else {
- if {$os_platform == "darwin" && ![file isdirectory $developer_dir]} {
+ if {$os_platform eq {darwin} && ![file isdirectory $developer_dir]} {
ui_warn "Your developer_dir setting in macports.conf points to a non-existing directory.\
Since this is known to cause problems, please correct the setting or comment it and let\
macports auto-discover the correct path."
}
}
- if {[getuid] == 0 && $os_major >= 11 && $os_platform == "darwin" &&
+ if {[getuid] == 0 && $os_major >= 11 && $os_platform eq {darwin} &&
[file isfile "${macports::user_home}/Library/Preferences/com.apple.dt.Xcode.plist"]} {
macports::copy_xcode_plist $env(HOME)
}
@@ -1056,49 +1070,49 @@
}
if {[info exists master_site_local] && ![info exists env(MASTER_SITE_LOCAL)]} {
- set env(MASTER_SITE_LOCAL) "$master_site_local"
+ set env(MASTER_SITE_LOCAL) $master_site_local
}
if {[info exists patch_site_local] && ![info exists env(PATCH_SITE_LOCAL)]} {
- set env(PATCH_SITE_LOCAL) "$patch_site_local"
+ set env(PATCH_SITE_LOCAL) $patch_site_local
}
if {[info exists archive_site_local] && ![info exists env(ARCHIVE_SITE_LOCAL)]} {
- set env(ARCHIVE_SITE_LOCAL) "$archive_site_local"
+ set env(ARCHIVE_SITE_LOCAL) $archive_site_local
}
# Proxy handling (done this late since Pextlib is needed)
- if {![info exists proxy_override_env] } {
- set proxy_override_env "no"
+ if {![info exists proxy_override_env]} {
+ set proxy_override_env no
}
if {[catch {array set sysConfProxies [get_systemconfiguration_proxies]} result]} {
return -code error "Unable to get proxy configuration from system: $result"
}
- if {![info exists env(http_proxy)] || $proxy_override_env == "yes" } {
+ if {![info exists env(http_proxy)] || $proxy_override_env eq {yes}} {
if {[info exists proxy_http]} {
set env(http_proxy) $proxy_http
} elseif {[info exists sysConfProxies(proxy_http)]} {
set env(http_proxy) $sysConfProxies(proxy_http)
}
}
- if {![info exists env(HTTPS_PROXY)] || $proxy_override_env == "yes" } {
+ if {![info exists env(HTTPS_PROXY)] || $proxy_override_env eq {yes}} {
if {[info exists proxy_https]} {
set env(HTTPS_PROXY) $proxy_https
} elseif {[info exists sysConfProxies(proxy_https)]} {
set env(HTTPS_PROXY) $sysConfProxies(proxy_https)
}
}
- if {![info exists env(FTP_PROXY)] || $proxy_override_env == "yes" } {
+ if {![info exists env(FTP_PROXY)] || $proxy_override_env eq {yes}} {
if {[info exists proxy_ftp]} {
set env(FTP_PROXY) $proxy_ftp
} elseif {[info exists sysConfProxies(proxy_ftp)]} {
set env(FTP_PROXY) $sysConfProxies(proxy_ftp)
}
}
- if {![info exists env(RSYNC_PROXY)] || $proxy_override_env == "yes" } {
+ if {![info exists env(RSYNC_PROXY)] || $proxy_override_env eq {yes}} {
if {[info exists proxy_rsync]} {
set env(RSYNC_PROXY) $proxy_rsync
}
}
- if {![info exists env(NO_PROXY)] || $proxy_override_env == "yes" } {
+ if {![info exists env(NO_PROXY)] || $proxy_override_env eq {yes}} {
if {[info exists proxy_skip]} {
set env(NO_PROXY) $proxy_skip
} elseif {[info exists sysConfProxies(proxy_skip)]} {
@@ -1107,22 +1121,22 @@
}
# add ccache to environment
- set env(CCACHE_DIR) ${macports::ccache_dir}
+ set env(CCACHE_DIR) $macports::ccache_dir
# load cached ping times
if {[catch {
set pingfile [open ${macports::portdbpath}/pingtimes r]
array set macports::ping_cache [gets $pingfile]
close $pingfile
- }]} { array set macports::ping_cache {} }
+ }]} {array set macports::ping_cache {}}
# set up arrays of blacklisted and preferred hosts
if {[info exists macports::host_blacklist]} {
- foreach host ${macports::host_blacklist} {
+ foreach host $macports::host_blacklist {
set macports::host_blacklisted($host) 1
}
}
if {[info exists macports::preferred_hosts]} {
- foreach host ${macports::preferred_hosts} {
+ foreach host $macports::preferred_hosts {
set macports::host_preferred($host) 1
}
}
@@ -1131,10 +1145,10 @@
_mports_load_quickindex
if {![info exists macports::ui_options(ports_no_old_index_warning)]} {
- set default_source_url [lindex ${sources_default} 0]
- if {[macports::getprotocol $default_source_url] == "file" || [macports::getprotocol $default_source_url] == "rsync"} {
+ set default_source_url [lindex $sources_default 0]
+ if {[macports::getprotocol $default_source_url] eq {file} || [macports::getprotocol $default_source_url] eq {rsync}} {
set default_portindex [macports::getindex $default_source_url]
- if {[file exists $default_portindex] && [expr [clock seconds] - [file mtime $default_portindex]] > 1209600} {
+ if {[file exists $default_portindex] && [clock seconds] - [file mtime $default_portindex] > 1209600} {
ui_warn "port definitions are more than two weeks old, consider updating them by running 'port selfupdate'."
}
}
@@ -1151,7 +1165,7 @@
if {$db_exists == 0 && [file exists ${registry.path}/receipts] && [file writable $db_path]} {
ui_warn "Converting your registry to sqlite format, this might take a while..."
if {[catch {registry::convert_to_sqlite}]} {
- ui_debug "$::errorInfo"
+ ui_debug $::errorInfo
file delete -force $db_path
error "Failed to convert your registry to sqlite!"
} else {
@@ -1164,11 +1178,11 @@
proc mportshutdown {} {
# save ping times
global macports::ping_cache macports::portdbpath
- if {[file writable ${macports::portdbpath}]} {
+ if {[file writable $macports::portdbpath]} {
catch {
foreach host [array names ping_cache] {
# don't save expired entries
- if {[expr [clock seconds] - [lindex $ping_cache($host) 1]] < 86400} {
+ if {[clock seconds] - [lindex $ping_cache($host) 1] < 86400} {
lappend pinglist_fresh $host $ping_cache($host)
}
}
@@ -1188,16 +1202,16 @@
set target_dir "${target_homedir}/Library/Preferences"
file delete -force "${target_dir}/com.apple.dt.Xcode.plist"
if {[file isfile $user_plist]} {
- if {![file isdirectory "${target_dir}"]} {
- if {[catch {file mkdir "${target_dir}"} result]} {
+ if {![file isdirectory $target_dir]} {
+ if {[catch {file mkdir $target_dir} result]} {
ui_warn "Failed to create Library/Preferences in ${target_homedir}: $result"
return
}
}
- if {[file writable ${target_dir}] && [catch {
- ui_debug "Copying $user_plist to ${target_dir}"
+ if {[file writable $target_dir] && [catch {
+ ui_debug "Copying $user_plist to $target_dir"
file copy -force $user_plist $target_dir
- file attributes "${target_dir}/com.apple.dt.Xcode.plist" -owner $macportsuser -permissions 0644
+ file attributes ${target_dir}/com.apple.dt.Xcode.plist -owner $macportsuser -permissions 0644
} result]} {
ui_warn "Failed to copy com.apple.dt.Xcode.plist to ${target_dir}: $result"
}
@@ -1236,17 +1250,17 @@
$workername alias set_phase set_phase
# instantiate the UI call-backs
- foreach priority ${macports::ui_priorities} {
+ foreach priority $macports::ui_priorities {
$workername alias ui_$priority ui_$priority
- foreach phase ${macports::port_phases} {
- $workername alias ui_${priority}_${phase} ui_${priority}_${phase}
+ foreach phase $macports::port_phases {
+ $workername alias ui_${priority}_$phase ui_${priority}_$phase
}
-
+
}
$workername alias ui_prefix ui_prefix
$workername alias ui_channels ui_channels
-
+
$workername alias ui_warn_once ui_warn_once
# Export some utility functions defined here.
@@ -1317,7 +1331,7 @@
# next access will actually define the variable.
$workername eval "trace add variable ::$opt read ::trace_$opt"
# define some value now
- $workername eval set $opt "?"
+ $workername eval set $opt ?
}
foreach {opt val} $options {
@@ -1370,10 +1384,10 @@
switch -- $suffix {
.tbz -
.tbz2 {
- return "-j"
+ return -j
}
.tgz {
- return "-z"
+ return -z
}
.txz {
return "--use-compress-program [findBinary xz {}] -"
@@ -1382,48 +1396,75 @@
return "--use-compress-program [findBinary lzma {}] -"
}
default {
- return "-"
+ return -
}
}
}
+##
+# Extracts a Portfile from a tarball pointed to by the given \a url to a path
+# in \c $portdbpath and returns its path.
+#
+# @param url URL pointing to a tarball containing either a file named \c
+# Portfile at the root level -- in which case the tarball is
+# extracted completely, -- or a file named \c +CONTENTS at the root
+# level (i.e., the archive is a valid MacPorts binary archive), in
+# which case the Portfile is extracted from the file \c +PORTFILE
+# and put in a separate directory.
+# @param local one, if the URL is local, zero otherwise
+# @return a path to a directory containing the Portfile, or an error code
proc macports::fetch_port {url {local 0}} {
- global macports::portdbpath
+ global macports::portdbpath macports::ui_prefix macports::portverbose
+
set fetchdir [file join $portdbpath portdirs]
file mkdir $fetchdir
if {![file writable $fetchdir]} {
return -code error "Port remote fetch failed: You do not have permission to write to $fetchdir"
}
+
if {$local} {
set fetchfile $url
} else {
+ ui_msg "$macports::ui_prefix Fetching port $url"
set fetchfile [file tail $url]
- if {[catch {curl fetch $url [file join $fetchdir $fetchfile]} result]} {
+ set verboseflag {}
+ if {$macports::portverbose eq {yes}} {
+ set verboseflag -v
+ }
+ if {[catch {eval curl fetch $verboseflag {$url} {[file join $fetchdir $fetchfile]}} result]} {
return -code error "Port remote fetch failed: $result"
}
}
+
set oldpwd [pwd]
cd $fetchdir
- # check if this is a binary archive or just the port dir
+
+ # check if this is a binary archive or just the port dir by checking
+ # whether the file "+CONTENTS" exists.
set tarcmd [findBinary tar $macports::autoconf::tar_path]
set tarflags [get_tar_flags [file extension $fetchfile]]
- set qflag ${macports::autoconf::tar_q}
+ set qflag $macports::autoconf::tar_q
set cmdline "$tarcmd ${tarflags}${qflag}xOf \"$fetchfile\" +CONTENTS"
- ui_debug "$cmdline"
+ ui_debug $cmdline
if {![catch {set contents [eval exec $cmdline]}]} {
+ # the file is probably a valid binary archive
set binary 1
ui_debug "getting port name from binary archive"
# get the portname from the contents file
- foreach line [split $contents "\n"] {
- if {[lindex $line 0] == "@name"} {
- # actually ${name}-${version}_${revision}
+ foreach line [split $contents \n] {
+ if {[lindex $line 0] eq {@name}} {
+ # actually ${name}-${version}_$revision
set portname [lindex $line 1]
}
}
ui_debug "port name is '$portname'"
+
+ # create a correctly-named directory and put the Portfile there
file mkdir $portname
cd $portname
} else {
+ # the file is not a valid binary archive, assume it's an archive just
+ # containing Portfile and the files directory
set binary 0
set portname [file rootname $fetchfile]
}
@@ -1431,53 +1472,67 @@
# extract the portfile (and possibly files dir if not a binary archive)
ui_debug "extracting port archive to [pwd]"
if {$binary} {
- set cmdline "$tarcmd ${tarflags}${qflag}xOf \"$fetchfile\" +PORTFILE > Portfile"
+ set cmdline "$tarcmd ${tarflags}${qflag}xOf \"../$fetchfile\" +PORTFILE > Portfile"
} else {
set cmdline "$tarcmd ${tarflags}xf \"$fetchfile\""
}
- ui_debug "$cmdline"
+ ui_debug $cmdline
if {[catch {eval exec $cmdline} result]} {
+ # clean up the archive, we don't need it anymore
+ file delete [file join $fetchdir $fetchfile]
+
+ cd $oldpwd
return -code error "Port extract failed: $result"
}
+ # clean up the archive, we don't need it anymore
+ file delete [file join $fetchdir $fetchfile]
+
cd $oldpwd
return [file join $fetchdir $portname]
}
proc macports::getprotocol {url} {
if {[regexp {(?x)([^:]+)://.+} $url match protocol] == 1} {
- return ${protocol}
+ return $protocol
} else {
return -code error "Can't parse url $url"
}
}
-# XXX: this really needs to be rethought in light of the remote index
-# I've added the destdir parameter. This is the location a remotely
-# fetched port will be downloaded to (currently only applies to
-# mports:// sources).
-proc macports::getportdir {url {destdir "."}} {
+##
+# Return the directory where the port identified by the given \a url is
+# located. Can be called with either local paths (starting with \c file://), or
+# local or remote URLs pointing to a tarball that will be extracted.
+#
+# @param url URL identifying the port to be installed
+# @return normalized path to the port's directory, or error when called with an
+# unsupported protocol, or if the tarball pointed to by \a url didn't
+# contain a Portfile.
+proc macports::getportdir {url} {
global macports::extracted_portdirs
+
set protocol [macports::getprotocol $url]
- switch ${protocol} {
+ switch -- $protocol {
file {
- set path [file normalize [string range $url [expr [string length $protocol] + 3] end]]
+ set path [file normalize [string range $url [expr {[string length $protocol] + 3}] end]]
if {![file isfile $path]} {
+ # the URL points to a local directory
return $path
} else {
- # need to create a local dir for the exracted port, but only once
+ # the URL points to a local tarball that (hopefully) contains a Portfile
+ # create a local dir for the extracted port, but only once
if {![info exists macports::extracted_portdirs($url)]} {
set macports::extracted_portdirs($url) [macports::fetch_port $path 1]
}
return $macports::extracted_portdirs($url)
}
}
- mports {
- return [macports::index::fetch_port $url $destdir]
- }
https -
http -
ftp {
+ # the URL points to a remote tarball that (hopefully) contains a Portfile
+ # create a local dir for the extracted port, but only once
if {![info exists macports::extracted_portdirs($url)]} {
set macports::extracted_portdirs($url) [macports::fetch_port $url 0]
}
@@ -1499,12 +1554,12 @@
# @param path path in _resources we are interested in
# @param fallback fall back to the default source tree
# @return path to the _resources directory or the path to the fallback
-proc macports::getportresourcepath {url {path ""} {fallback yes}} {
+proc macports::getportresourcepath {url {path {}} {fallback yes}} {
global macports::sources_default
set protocol [getprotocol $url]
- switch -- ${protocol} {
+ switch -- $protocol {
file {
set proposedpath [file normalize [file join [getportdir $url] .. ..]]
}
@@ -1516,7 +1571,7 @@
# append requested path
set proposedpath [file join $proposedpath _resources $path]
- if {$fallback == "yes" && ![file exists $proposedpath]} {
+ if {$fallback eq {yes} && ![file exists $proposedpath]} {
return [getdefaultportresourcepath $path]
}
@@ -1528,11 +1583,11 @@
#
# @param path path in _resources we are interested in
# @return path to the _resources directory of the default source
-proc macports::getdefaultportresourcepath {{path ""}} {
+proc macports::getdefaultportresourcepath {{path {}}} {
global macports::sources_default
- set default_source_url [lindex ${sources_default} 0]
- if {[getprotocol $default_source_url] == "file"} {
+ set default_source_url [lindex $sources_default 0]
+ if {[getprotocol $default_source_url] eq {file}} {
set proposedpath [getportdir $default_source_url]
} else {
set proposedpath [getsourcepath $default_source_url]
@@ -1545,23 +1600,38 @@
}
-# mportopen
-# Opens a MacPorts portfile specified by a URL. The Portfile is
-# opened with the given list of options and variations. The result
-# of this function should be treated as an opaque handle to a
-# MacPorts Portfile.
-
-proc mportopen {porturl {options ""} {variations ""} {nocache ""}} {
+##
+# Opens a MacPorts portfile specified by a URL. The URL can be local (starting
+# with file://), or remote (http, https, or ftp). In the local case, the URL
+# can point to a directory containing a Portfile, or to a tarball in the format
+# detailed below. In the remote case, the URL must point to a tarball. The
+# Portfile is opened with the given list of options and variations. The result
+# of this function should be treated as an opaque handle to a MacPorts
+# Portfile.
+#
+# @param porturl URL to the directory of the port to be opened. Can the path to
+# a local directory, or an URL (both remote and local) pointing
+# to a tarball that
+# \li either contains a \c Portfile and possible a \c files
+# directory, or
+# \li is a MacPorts binary archive, where the Portfile is in
+# a file called \c +PORTFILE.
+# @param options an optional array (in list format) of options
+# @param variations an optional array (ist list format) of variations, passed
+# to \c eval_variants after running the Portfile
+# @param nocache a non-empty string, if port information caching should be
+# avoided.
+proc mportopen {porturl {options {}} {variations {}} {nocache {}}} {
global macports::portdbpath macports::portconf macports::open_mports auto_path
# Look for an already-open MPort with the same URL.
# if found, return the existing reference and bump the refcount.
- if {$nocache != ""} {
+ if {$nocache ne {}} {
set mport {}
} else {
set mport [dlist_match_multi $macports::open_mports [list porturl $porturl variations $variations options $options]]
}
- if {$mport != {}} {
+ if {$mport ne {}} {
# just in case more than one somehow matches
set mport [lindex $mport 0]
set refcnt [ditem_key $mport refcnt]
@@ -1570,14 +1640,8 @@
return $mport
}
- array set options_array $options
- if {[info exists options_array(portdir)]} {
- set portdir $options_array(portdir)
- } else {
- set portdir ""
- }
-
- set portpath [macports::getportdir $porturl $portdir]
+ # Will download if remote and extract if tarball.
+ set portpath [macports::getportdir $porturl]
ui_debug "Changing to port directory: $portpath"
cd $portpath
if {![file isfile Portfile]} {
@@ -1621,24 +1685,24 @@
proc mportopen_installed {name version revision variants options} {
global macports::registry.path
set regref [lindex [registry::entry imaged $name $version $revision $variants] 0]
- set portfile_dir [file join ${registry.path} registry portfiles $name "${version}_${revision}${variants}"]
+ set portfile_dir [file join ${registry.path} registry portfiles $name ${version}_${revision}$variants]
file mkdir $portfile_dir
- set fd [open "${portfile_dir}/Portfile" w]
+ set fd [open ${portfile_dir}/Portfile w]
puts $fd [$regref portfile]
close $fd
- file mtime "${portfile_dir}/Portfile" [$regref date]
+ file mtime ${portfile_dir}/Portfile [$regref date]
set variations {}
set minusvariant [lrange [split [$regref negated_variants] -] 1 end]
set plusvariant [lrange [split [$regref variants] +] 1 end]
foreach v $plusvariant {
- lappend variations $v "+"
+ lappend variations $v +
}
foreach v $minusvariant {
- lappend variations $v "-"
+ lappend variations $v -
}
lappend options subport $name
- return [mportopen "file://${portfile_dir}/" $options $variations]
+ return [mportopen file://${portfile_dir}/ $options $variations]
}
# mportclose_installed
@@ -1650,7 +1714,7 @@
}
mportclose $mport
set portfiles_dir [file join ${registry.path} registry portfiles $subport]
- set portfile [file join $portfiles_dir "${version}_${revision}${portvariants}" Portfile]
+ set portfile [file join $portfiles_dir ${version}_${revision}$portvariants Portfile]
file delete -force $portfile [file dirname $portfile]
if {[llength [glob -nocomplain -directory $portfiles_dir *]] == 0} {
file delete -force $portfiles_dir
@@ -1679,12 +1743,12 @@
foreach category [lsort -increasing -unique [readdir $root]] {
set pathToCategory [file join $root $category]
# process the category dirs but not _resources
- if {[file isdirectory $pathToCategory] && [string index [file tail $pathToCategory] 0] != "_"} {
+ if {[file isdirectory $pathToCategory] && [string index [file tail $pathToCategory] 0] ne {_}} {
# Iterate on port directories.
foreach port [lsort -increasing -unique [readdir $pathToCategory]] {
set pathToPort [file join $pathToCategory $port]
if {[file isdirectory $pathToPort] &&
- [file exists [file join $pathToPort "Portfile"]]} {
+ [file exists [file join $pathToPort Portfile]]} {
# Call the function.
$func [file join $category $port]
@@ -1734,7 +1798,7 @@
if {$found} {
return [file join $path $filename]
} else {
- return ""
+ return {}
}
} else {
return $found
@@ -1748,20 +1812,20 @@
proc _mportinstalled {mport} {
# Check for the presence of the port in the registry
set workername [ditem_key $mport workername]
- return [$workername eval registry_exists_for_name \${subport}]
+ return [$workername eval registry_exists_for_name \$subport]
}
# Determine if a port is active
proc _mportactive {mport} {
set workername [ditem_key $mport workername]
- if {![catch {set reslist [$workername eval registry_active \${subport}]}] && [llength $reslist] > 0} {
+ if {![catch {set reslist [$workername eval registry_active \$subport]}] && [llength $reslist] > 0} {
set i [lindex $reslist 0]
set name [lindex $i 0]
set version [lindex $i 1]
set revision [lindex $i 2]
set variants [lindex $i 3]
array set portinfo [mportinfo $mport]
- if {$name == $portinfo(name) && $version == $portinfo(version)
+ if {$name eq $portinfo(name) && $version == $portinfo(version)
&& $revision == $portinfo(revision) && $variants == $portinfo(canonical_active_variants)} {
return 1
}
@@ -1774,7 +1838,7 @@
if {[catch {set reslist [registry::active $portname]}]} {
return 0
} else {
- return [expr [llength $reslist] > 0]
+ return [expr {[llength $reslist] > 0}]
}
}
@@ -1798,11 +1862,11 @@
ui_debug "Didn't find receipt, going to depspec regex for: $portname"
set workername [ditem_key $mport workername]
set type [lindex [split $depspec :] 0]
- switch $type {
- lib { return [$workername eval _libtest $depspec] }
- bin { return [$workername eval _bintest $depspec] }
- path { return [$workername eval _pathtest $depspec] }
- port { return 0 }
+ switch -- $type {
+ lib {return [$workername eval _libtest $depspec]}
+ bin {return [$workername eval _bintest $depspec]}
+ path {return [$workername eval _pathtest $depspec]}
+ port {return 0}
default {return -code error "unknown depspec type: $type"}
}
return 0
@@ -1824,7 +1888,7 @@
[llength $portinfo(conflicts)] > 0} {
ui_debug "Checking for conflicts against [_mportkey $mport subport]"
foreach conflictport $portinfo(conflicts) {
- if {[_mportispresent $mport port:${conflictport}]} {
+ if {[_mportispresent $mport port:$conflictport]} {
lappend conflictlist $conflictport
}
}
@@ -1832,14 +1896,14 @@
ui_debug "[_mportkey $mport subport] has no conflicts"
}
- if {[llength ${conflictlist}] != 0} {
+ if {[llength $conflictlist] != 0} {
if {[macports::global_option_isset ports_force]} {
- ui_warn "Force option set; installing $portinfo(name) despite conflicts with: ${conflictlist}"
+ ui_warn "Force option set; installing $portinfo(name) despite conflicts with: $conflictlist"
} else {
if {![macports::ui_isset ports_debug]} {
- ui_msg ""
+ ui_msg {}
}
- return -code error "Can't install $portinfo(name) because conflicting ports are installed: ${conflictlist}"
+ return -code error "Can't install $portinfo(name) because conflicting ports are installed: $conflictlist"
}
}
}
@@ -1856,7 +1920,7 @@
![catch {$workername eval check_supported_archs} result] && $result == 0 &&
![catch {$workername eval eval_targets $target} result] && $result == 0} {
# If auto-clean mode, clean-up after dependency install
- if {[string equal ${macports::portautoclean} "yes"]} {
+ if {$macports::portautoclean eq {yes}} {
# Make sure we are back in the port path before clean
# otherwise if the current directory had been changed to
# inside the port, the next port may fail when trying to
@@ -1874,7 +1938,7 @@
# An error occurred.
global ::logenabled ::debuglogname
ui_error "Failed to install $portname"
- ui_debug "$::errorInfo"
+ ui_debug $::errorInfo
if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
ui_notice "Please see the log file for port $portname for details:\n $::debuglogname"
}
@@ -1895,7 +1959,7 @@
return 1
}
set portname [_mportkey $mport subport]
- if {$target != "clean"} {
+ if {$target ne {clean}} {
macports::push_log $mport
}
@@ -1918,9 +1982,9 @@
if {[macports::_target_needs_deps $target] && [macports::_mport_has_deptypes $mport [macports::_deptypes_for_target $target $workername]]} {
registry::exclusive_lock
# see if we actually need to build this port
- if {($target != "activate" && $target != "install") ||
+ if {($target ne {activate} && $target ne {install}) ||
![$workername eval registry_exists \$subport \$version \$revision \$portvariants]} {
-
+
# upgrade dependencies that are already installed
if {![macports::global_option_isset ports_nodeps]} {
macports::_upgrade_mport_deps $mport $target
@@ -1930,13 +1994,13 @@
ui_msg -nonewline "$macports::ui_prefix Computing dependencies for [_mportkey $mport subport]"
if {[macports::ui_isset ports_debug]} {
# play nice with debug messages
- ui_msg ""
+ ui_msg {}
}
if {[mportdepends $mport $target] != 0} {
return 1
}
if {![macports::ui_isset ports_debug]} {
- ui_msg ""
+ ui_msg {}
}
# Select out the dependents along the critical path,
@@ -1944,7 +2008,7 @@
set dlist [dlist_append_dependents $macports::open_mports $mport {}]
dlist_delete dlist $mport
-
+
# print the dep list
if {[llength $dlist] > 0} {
set depstring "$macports::ui_prefix Dependencies to be installed:"
@@ -1955,11 +2019,11 @@
}
# install them
- set result [dlist_eval $dlist _mportactive [list _mportexec "activate"]]
+ set result [dlist_eval $dlist _mportactive [list _mportexec activate]]
registry::exclusive_unlock
- if {$result != {}} {
+ if {$result ne {}} {
set errstring "The following dependencies were not installed:"
foreach ditem $result {
append errstring " [ditem_key $ditem provides]"
@@ -1977,13 +2041,13 @@
}
} else {
# No dependencies, but we still need to check for conflicts.
- if {$target == "" || $target == "install" || $target == "activate"} {
+ if {$target eq {} || $target eq {install} || $target eq {activate}} {
_mporterrorifconflictsinstalled $mport
}
}
set clean 0
- if {[string equal ${macports::portautoclean} "yes"] && ([string equal $target "install"] || [string equal $target "activate"])} {
+ if {$macports::portautoclean eq {yes} && ($target eq {install} || $target eq {activate})} {
# If we're doing an install, check if we should clean after
set clean 1
}
@@ -1998,7 +2062,7 @@
catch {cd $portpath}
$workername eval eval_targets clean
}
-
+
global ::logenabled ::debuglogname
if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
if {$result != 0} {
@@ -2029,13 +2093,13 @@
}
foreach depspec $portinfo($deptype) {
set dep_portname [$workername eval _get_dep_port $depspec]
- if {$dep_portname != "" && ![info exists depscache(port:$dep_portname)] && [$test $dep_portname]} {
+ if {$dep_portname ne {} && ![info exists depscache(port:$dep_portname)] && [$test $dep_portname]} {
set variants {}
-
+
# check that the dep has the required archs
set active_archs [_get_registry_archs $dep_portname]
- if {$deptype != "depends_fetch" && $deptype != "depends_extract"
- && $active_archs != "" && $active_archs != "noarch" && $required_archs != "noarch"
+ if {$deptype ne {depends_fetch} && $deptype ne {depends_extract}
+ && $active_archs ne {} && $active_archs ne {noarch} && $required_archs ne {noarch}
&& [lsearch -exact $depends_skip_archcheck $dep_portname] == -1} {
set missing {}
foreach arch $required_archs {
@@ -2087,8 +2151,8 @@
}
}
}
-
- set status [macports::upgrade $dep_portname "port:$dep_portname" $variants $options depscache]
+
+ set status [macports::upgrade $dep_portname port:$dep_portname $variants $options depscache]
# status 2 means the port was not found in the index
if {$status != 0 && $status != 2 && ![macports::ui_isset ports_processall]} {
return -code error "upgrade $dep_portname failed"
@@ -2105,7 +2169,7 @@
set regref [registry::open_entry [lindex $i 0] [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
set archs [registry::property_retrieve $regref archs]
if {$archs == 0} {
- set archs ""
+ set archs {}
}
return $archs
}
@@ -2129,7 +2193,7 @@
#
# @param url source URL to check
# @return a list containing filename and extension or an empty list
-proc _source_is_snapshot {url {filename ""} {extension ""}} {
+proc _source_is_snapshot {url {filename {}} {extension {}}} {
upvar $filename myfilename
upvar $extension myextension
@@ -2143,14 +2207,14 @@
return 0
}
-proc macports::getportbuildpath {id {portname ""}} {
+proc macports::getportbuildpath {id {portname {}}} {
global macports::portdbpath
regsub {://} $id {.} port_path
regsub -all {/} $port_path {_} port_path
return [file join $portdbpath build $port_path $portname]
}
-proc macports::getportlogpath {id {portname ""}} {
+proc macports::getportlogpath {id {portname {}}} {
global macports::portdbpath
regsub {://} $id {.} port_path
regsub -all {/} $port_path {_} port_path
@@ -2161,13 +2225,13 @@
return [file join $portbuildpath work]
}
-proc macports::getportworkpath_from_portdir {portpath {portname ""}} {
+proc macports::getportworkpath_from_portdir {portpath {portname {}}} {
return [macports::getportworkpath_from_buildpath [macports::getportbuildpath $portpath $portname]]
}
proc macports::getindex {source} {
# Special case file:// sources
- if {[macports::getprotocol $source] == "file"} {
+ if {[macports::getprotocol $source] eq {file}} {
return [file join [macports::getportdir $source] PortIndex]
}
@@ -2175,9 +2239,9 @@
}
proc mportsync {{optionslist {}}} {
- global macports::sources macports::portdbpath macports::rsync_options tcl_platform
- global macports::portverbose
- global macports::autoconf::rsync_path macports::autoconf::tar_path macports::autoconf::openssl_path
+ global macports::sources macports::portdbpath macports::rsync_options \
+ tcl_platform macports::portverbose macports::autoconf::rsync_path \
+ macports::autoconf::tar_path macports::autoconf::openssl_path
array set options $optionslist
if {[info exists options(no_reindex)]} {
upvar $options(needed_portindex_var) any_needed_portindex
@@ -2198,12 +2262,12 @@
switch -regexp -- [macports::getprotocol $source] {
{^file$} {
set portdir [macports::getportdir $source]
- set svn_cmd ""
+ set svn_cmd {}
catch {set svn_cmd [macports::findBinary svn]}
- set git_cmd ""
+ set git_cmd {}
catch {set git_cmd [macports::findBinary git]}
- if {$svn_cmd != "" && ([file exists $portdir/.svn] || ![catch {exec $svn_cmd info $portdir > /dev/null 2>@1}])} {
- set svn_commandline "$svn_cmd update --non-interactive ${portdir}"
+ if {$svn_cmd ne {} && ([file exists ${portdir}/.svn] || ![catch {exec $svn_cmd info $portdir > /dev/null 2>@1}])} {
+ set svn_commandline "$svn_cmd update --non-interactive $portdir"
ui_debug $svn_commandline
if {
[catch {
@@ -2221,13 +2285,19 @@
}
}]
} {
- ui_debug "$::errorInfo"
+ ui_debug $::errorInfo
ui_error "Synchronization of the local ports tree failed doing an svn update"
incr numfailed
continue
}
- } elseif {$git_cmd != "" && [file exists $portdir/.git]} {
- set git_commandline "pushd $portdir ; $git_cmd pull --rebase ; popd"
+ } elseif {$git_cmd ne {} && [file exists ${portdir}/.git]} {
+ # determine what type of git repository this is
+ if {![catch {exec sh -c "$git_cmd --git-dir=${portdir}/.git config --local --get svn-remote.svn.url"} result]} {
+ set git_action "svn rebase"
+ } else {
+ set git_action "pull --rebase"
+ }
+ set git_commandline "$git_cmd --git-dir=${portdir}/.git --work-tree=${portdir} $git_action"
ui_debug $git_commandline
if {
[catch {
@@ -2245,17 +2315,14 @@
}
}]
} {
- ui_debug "$::errorInfo"
- ui_error "Synchronization of the local ports tree failed doing a git pull --rebase"
+ ui_debug $::errorInfo
+ ui_error "Synchronization of the local ports tree failed doing a git update"
incr numfailed
continue
}
}
set needs_portindex 1
}
- {^mports$} {
- macports::index::sync $macports::portdbpath $source
- }
{^rsync$} {
# Where to, boss?
set indexfile [macports::getindex $source]
@@ -2264,19 +2331,19 @@
file mkdir $destdir
if {$is_tarball} {
- set exclude_option ""
+ set exclude_option {}
# need to do a few things before replacing the ports tree in this case
set destdir [file dirname $destdir]
} else {
# Keep rsync happy with a trailing slash
- if {[string index $source end] != "/"} {
- append source "/"
+ if {[string index $source end] ne {/}} {
+ append source /
}
# don't sync PortIndex yet; we grab the platform specific one afterwards
- set exclude_option "'--exclude=/PortIndex*'"
+ set exclude_option '--exclude=/PortIndex*'
}
# Do rsync fetch
- set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${exclude_option} ${source} ${destdir}"
+ set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $exclude_option $source $destdir"
ui_debug $rsync_commandline
if {[catch {system $rsync_commandline}]} {
ui_error "Synchronization of the local ports tree failed doing rsync"
@@ -2287,18 +2354,18 @@
if {$is_tarball} {
# verify signature for tarball
global macports::archivefetch_pubkeys
- set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${exclude_option} ${source}.rmd160 ${destdir}"
+ set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $exclude_option ${source}.rmd160 $destdir"
ui_debug $rsync_commandline
if {[catch {system $rsync_commandline}]} {
ui_error "Synchronization of the ports tree signature failed doing rsync"
incr numfailed
continue
}
- set tarball "${destdir}/[file tail $source]"
- set signature "${tarball}.rmd160"
+ set tarball ${destdir}/[file tail $source]
+ set signature ${tarball}.rmd160
set openssl [macports::findBinary openssl $macports::autoconf::openssl_path]
set verified 0
- foreach pubkey ${macports::archivefetch_pubkeys} {
+ foreach pubkey $macports::archivefetch_pubkeys {
if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball} result]} {
set verified 1
ui_debug "successful verification with key $pubkey"
@@ -2317,7 +2384,7 @@
# extract tarball and move into place
set tar [macports::findBinary tar $macports::autoconf::tar_path]
file mkdir ${destdir}/tmp
- set tar_cmd "$tar -C ${destdir}/tmp -xf ${tarball}"
+ set tar_cmd "$tar -C ${destdir}/tmp -xf $tarball"
ui_debug $tar_cmd
if {[catch {system $tar_cmd}]} {
ui_error "Failed to extract ports tree from tarball!"
@@ -2339,16 +2406,16 @@
set needs_portindex 1
# now sync the index if the local file is missing or older than a day
- if {![file isfile $indexfile] || [expr [clock seconds] - [file mtime $indexfile]] > 86400
+ if {![file isfile $indexfile] || [clock seconds] - [file mtime $indexfile] > 86400
|| [info exists options(no_reindex)]} {
if {$is_tarball} {
# chop ports.tar off the end
set index_source [string range $source 0 end-[string length [file tail $source]]]
} else {
- set index_source $source
+ set index_source $source
}
set remote_indexfile "${index_source}PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex"
- set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} $remote_indexfile ${destdir}"
+ set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $remote_indexfile $destdir"
ui_debug $rsync_commandline
if {[catch {system $rsync_commandline}]} {
ui_debug "Synchronization of the PortIndex failed doing rsync"
@@ -2359,10 +2426,10 @@
set ok 0
set needs_portindex 1
# verify signature for PortIndex
- set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${remote_indexfile}.rmd160 ${destdir}"
+ set rsync_commandline "$macports::autoconf::rsync_path $rsync_options ${remote_indexfile}.rmd160 $destdir"
ui_debug $rsync_commandline
if {![catch {system $rsync_commandline}]} {
- foreach pubkey ${macports::archivefetch_pubkeys} {
+ foreach pubkey $macports::archivefetch_pubkeys {
if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature ${destdir}/PortIndex.rmd160 ${destdir}/PortIndex} result]} {
set ok 1
set needs_portindex 0
@@ -2389,78 +2456,85 @@
}
}
{^https?$|^ftp$} {
- if {[_source_is_snapshot $source filename extension]} {
- # sync a daily port snapshot tarball
- set indexfile [macports::getindex $source]
- set destdir [file dirname $indexfile]
- set tarpath [file join [file normalize [file join $destdir ..]] $filename]
+ if {![_source_is_snapshot $source filename extension]} {
+ ui_error "Synchronization using http, https and ftp only supported with tarballs."
+ ui_error "The source ${source} doesn't seem to point to a tarball."
+ ui_error "Please switch to a different sync protocol (e.g. rsync) in your sources.conf"
+ ui_error "Remove the line mentioned above from your sources.conf to silence this error."
+ incr numfailed
+ continue
+ }
+ # sync a daily port snapshot tarball
+ set indexfile [macports::getindex $source]
+ set destdir [file dirname $indexfile]
+ set tarpath [file join [file normalize [file join $destdir ..]] $filename]
- set updated 1
- if {[file isdirectory $destdir]} {
- set moddate [file mtime $destdir]
- if {[catch {set updated [curl isnewer $source $moddate]} error]} {
- ui_warn "Cannot check if $source was updated, ($error)"
- }
+ set updated 1
+ if {[file isdirectory $destdir]} {
+ set moddate [file mtime $destdir]
+ if {[catch {set updated [curl isnewer $source $moddate]} error]} {
+ ui_warn "Cannot check if $source was updated, ($error)"
}
+ }
- if {(![info exists options(ports_force)] || $options(ports_force) != "yes") && $updated <= 0} {
- ui_info "No updates for $source"
- continue
- }
+ if {(![info exists options(ports_force)] || $options(ports_force) ne {yes}) && $updated <= 0} {
+ ui_info "No updates for $source"
+ continue
+ }
- file mkdir $destdir
+ file mkdir $destdir
- set verboseflag {}
- if {$macports::portverbose == "yes"} {
- set verboseflag "-v"
- }
+ set verboseflag {}
+ if {$macports::portverbose eq {yes}} {
+ set verboseflag -v
+ }
- if {[catch {eval curl fetch $verboseflag {$source} {$tarpath}} error]} {
- ui_error "Fetching $source failed ($error)"
- incr numfailed
- continue
- }
+ if {[catch {eval curl fetch $verboseflag {$source} {$tarpath}} error]} {
+ ui_error "Fetching $source failed ($error)"
+ incr numfailed
+ continue
+ }
- set extflag {}
- switch $extension {
- {tar.gz} {
- set extflag "-z"
- }
- {tar.bz2} {
- set extflag "-j"
- }
+ set extflag {}
+ switch -- $extension {
+ {tar.gz} {
+ set extflag -z
}
-
- set tar [macports::findBinary tar $macports::autoconf::tar_path]
- if { [catch { system "cd $destdir/.. && $tar ${verboseflag} ${extflag} -xf $filename" } error] } {
- ui_error "Extracting $source failed ($error)"
- incr numfailed
- continue
+ {tar.bz2} {
+ set extflag -j
}
+ }
- if {[catch {system "chmod -R a+r \"$destdir\""}]} {
- ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
- }
+ set tar [macports::findBinary tar $macports::autoconf::tar_path]
+ if {[catch {system "cd ${destdir}/.. && $tar $verboseflag $extflag -xf $filename"} error]} {
+ ui_error "Extracting $source failed ($error)"
+ incr numfailed
+ continue
+ }
- set platindex "PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex"
- if {[file isfile ${destdir}/${platindex}] && [file isfile ${destdir}/${platindex}.quick]} {
- file rename -force "${destdir}/${platindex}" "${destdir}/${platindex}.quick" $destdir
- }
+ if {[catch {system "chmod -R a+r \"$destdir\""}]} {
+ ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
+ }
- file delete $tarpath
- } else {
- # sync just a PortIndex file
- set indexfile [macports::getindex $source]
- file mkdir [file dirname $indexfile]
- curl fetch ${source}/PortIndex $indexfile
- curl fetch ${source}/PortIndex.quick ${indexfile}.quick
+ set platindex "PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex"
+ if {[file isfile ${destdir}/$platindex] && [file isfile ${destdir}/${platindex}.quick]} {
+ file rename -force ${destdir}/$platindex ${destdir}/${platindex}.quick $destdir
}
+
+ file delete $tarpath
}
+ {^mports$} {
+ ui_error "Synchronization using the mports protocol no longer supported."
+ ui_error "Please switch to a different sync protocol (e.g. rsync) in your sources.conf"
+ ui_error "Remove the line starting with mports:// from your sources.conf to silence this error."
+ incr numfailed
+ continue
+ }
default {
ui_warn "Unknown synchronization protocol for $source"
}
}
-
+
if {$needs_portindex} {
set any_needed_portindex 1
if {![info exists options(no_reindex)]} {
@@ -2483,96 +2557,137 @@
}
}
+##
+# Searches all configured port sources for a given pattern in a given field
+# using a given matching style and optional case-sensitivity.
+#
+# @param pattern pattern to search for; will be interpreted according to the \a
+# matchstyle parameter
+# @param case_sensitive "yes", if a case-sensitive search should be performed,
+# "no" otherwise. Defaults to "yes".
+# @param matchstyle One of the values \c exact, \c glob and \c regexp, where \c
+# exact performs a standard string comparison, \c glob
+# performs Tcl string matching using <tt>[string match]</tt>
+# and \c regexp interprets \a pattern as a regular
+# expression.
+# @param field name of the field to apply \a pattern to. Must be one of the
+# fields available in the used portindex. The portindex currently
+# contains
+# \li \c name (the default)
+# \li \c homepage
+# \li \c description
+# \li \c long_description
+# \li \c license
+# \li \c categories
+# \li \c platforms
+# \li \c maintainers
+# \li \c variants
+# \li \c portdir
+# \li all \c depends_* values
+# \li \c epoch
+# \li \c version
+# \li \c revision
+# \li \c replaced_by
+# \li \c installs_libs
+# @return a list where each even index (starting with 0) contains the name of
+# a matching port. Each entry at an odd index is followed by its
+# corresponding line from the portindex, which can be passed to
+# <tt>array set</tt>. The whole return value can also be passed to
+# <tt>array set</tt> to create an associate array where the port names
+# are the keys and the lines from portindex are the values.
proc mportsearch {pattern {case_sensitive yes} {matchstyle regexp} {field name}} {
- global macports::portdbpath macports::sources
+ global macports::sources
set matches [list]
- set easy [expr { $field == "name" }]
+ set easy [expr {$field eq {name}}]
set found 0
foreach source $sources {
set source [lindex $source 0]
set protocol [macports::getprotocol $source]
- if {$protocol == "mports"} {
- set res [macports::index::search $macports::portdbpath $source [list name $pattern]]
- eval lappend matches $res
+ if {[catch {set fd [open [macports::getindex $source] r]} result]} {
+ ui_warn "Can't open index file for source: $source"
} else {
- if {[catch {set fd [open [macports::getindex $source] r]} result]} {
- ui_warn "Can't open index file for source: $source"
- } else {
- try {
- incr found 1
- while {[gets $fd line] >= 0} {
- array unset portinfo
- set name [lindex $line 0]
- set len [lindex $line 1]
- set line [read $fd $len]
+ try {
+ incr found 1
+ while {[gets $fd line] >= 0} {
+ array unset portinfo
+ set name [lindex $line 0]
+ set len [lindex $line 1]
+ set line [read $fd $len]
- if {$easy} {
- set target $name
- } else {
- array set portinfo $line
- if {![info exists portinfo($field)]} continue
- set target $portinfo($field)
+ if {$easy} {
+ set target $name
+ } else {
+ array set portinfo $line
+ if {![info exists portinfo($field)]} {
+ continue
}
+ set target $portinfo($field)
+ }
- switch $matchstyle {
- exact {
- set matchres [expr 0 == ( {$case_sensitive == "yes"} ? [string compare $pattern $target] : [string compare -nocase $pattern $target] )]
+ switch -- $matchstyle {
+ exact {
+ if {$case_sensitive eq yes} {
+ set compres [string compare $pattern $target]
+ } else {
+ set compres [string compare -nocase $pattern $target]
}
- glob {
- set matchres [expr {$case_sensitive == "yes"} ? [string match $pattern $target] : [string match -nocase $pattern $target]]
+ set matchres [expr 0 == $compres]
+ }
+ glob {
+ if {$case_sensitive eq yes} {
+ set matchres [string match $pattern $target]
+ } else {
+ set matchres [string match -nocase $pattern $target]
}
- regexp -
- default {
- set matchres [expr {$case_sensitive == "yes"} ? [regexp -- $pattern $target] : [regexp -nocase -- $pattern $target]]
+ }
+ regexp {
+ if {$case_sensitive eq yes} {
+ set matchres [regexp -- $pattern $target]
+ } else {
+ set matchres [regexp -nocase -- $pattern $target]
}
}
+ default {
+ return -code error "mportsearch: Unsupported matching style: ${matchstyle}."
+ }
+ }
- if {$matchres == 1} {
- if {$easy} {
- array set portinfo $line
+ if {$matchres == 1} {
+ if {$easy} {
+ array set portinfo $line
+ }
+ switch -- $protocol {
+ rsync {
+ # Rsync files are local
+ set source_url file://[macports::getsourcepath $source]
}
- switch $protocol {
- rsync {
- # Rsync files are local
- set source_url "file://[macports::getsourcepath $source]"
- }
- https -
- http -
- ftp {
- if {[_source_is_snapshot $source filename extension]} {
- # daily snapshot tarball
- set source_url "file://[macports::getsourcepath $source]"
- } else {
- # default action
- set source_url $source
- }
- }
- default {
- set source_url $source
- }
+ https -
+ http -
+ ftp {
+ # daily snapshot tarball
+ set source_url file://[macports::getsourcepath $source]
}
- if {[info exists portinfo(portarchive)]} {
- set porturl ${source_url}/$portinfo(portarchive)
- } elseif {[info exists portinfo(portdir)]} {
- set porturl ${source_url}/$portinfo(portdir)
+ default {
+ set source_url $source
}
- if {[info exists porturl]} {
- lappend line porturl $porturl
- ui_debug "Found port in $porturl"
- } else {
- ui_debug "Found port info: $line"
- }
- lappend matches $name
- lappend matches $line
}
+ if {[info exists portinfo(portdir)]} {
+ set porturl ${source_url}/$portinfo(portdir)
+ lappend line porturl $porturl
+ ui_debug "Found port in $porturl"
+ } else {
+ ui_debug "Found port info: $line"
+ }
+ lappend matches $name
+ lappend matches $line
}
- } catch {*} {
- ui_warn "It looks like your PortIndex file for $source may be corrupt."
- throw
- } finally {
- close $fd
}
+ } catch * {
+ ui_warn "It looks like your PortIndex file for $source may be corrupt."
+ throw
+ } finally {
+ close $fd
}
}
}
@@ -2583,86 +2698,79 @@
return $matches
}
+##
# Returns the PortInfo for a single named port. The info comes from the
# PortIndex, and name matching is case-insensitive. Unlike mportsearch, only
# the first match is returned, but the return format is otherwise identical.
-# The advantage is that mportlookup is much faster than mportsearch, due to
-# the use of the quick index.
+# The advantage is that mportlookup is usually much faster than mportsearch,
+# due to the use of the quick index, which is a name-based index into the
+# PortIndex.
+#
+# @param name name of the port to look up. Returns the first match while
+# traversing the sources in-order.
+# @return associative array in list form where the first field is the port name
+# and the second field is the line from PortIndex containing the port
+# info. See the return value of mportsearch().
+# @see mportsearch()
proc mportlookup {name} {
- global macports::portdbpath macports::sources
+ global macports::portdbpath macports::sources macports::quick_index
set sourceno 0
set matches [list]
foreach source $sources {
set source [lindex $source 0]
set protocol [macports::getprotocol $source]
- if {$protocol != "mports"} {
- global macports::quick_index
- if {![info exists quick_index($sourceno,[string tolower $name])]} {
- incr sourceno 1
- continue
- }
- # The quick index is keyed on the port name, and provides the
- # offset in the main PortIndex where the given port's PortInfo
- # line can be found.
- set offset $quick_index($sourceno,[string tolower $name])
+ if {![info exists quick_index(${sourceno},[string tolower $name])]} {
+ # no entry in this source, advance to next source
incr sourceno 1
- if {[catch {set fd [open [macports::getindex $source] r]} result]} {
- ui_warn "Can't open index file for source: $source"
- } else {
- try {
- seek $fd $offset
- gets $fd line
- set name [lindex $line 0]
- set len [lindex $line 1]
- set line [read $fd $len]
+ continue
+ }
+ # The quick index is keyed on the port name, and provides the offset in
+ # the main PortIndex where the given port's PortInfo line can be found.
+ set offset $quick_index(${sourceno},[string tolower $name])
+ incr sourceno 1
+ if {[catch {set fd [open [macports::getindex $source] r]} result]} {
+ ui_warn "Can't open index file for source: $source"
+ } else {
+ try {
+ seek $fd $offset
+ gets $fd line
+ set name [lindex $line 0]
+ set len [lindex $line 1]
+ set line [read $fd $len]
- array set portinfo $line
+ array set portinfo $line
- switch $protocol {
- rsync {
- set source_url "file://[macports::getsourcepath $source]"
- }
- https -
- http -
- ftp {
- if {[_source_is_snapshot $source filename extension]} {
- set source_url "file://[macports::getsourcepath $source]"
- } else {
- set source_url $source
- }
- }
- default {
- set source_url $source
- }
+ switch -- $protocol {
+ rsync {
+ set source_url file://[macports::getsourcepath $source]
}
- if {[info exists portinfo(portarchive)]} {
- set porturl ${source_url}/$portinfo(portarchive)
- } elseif {[info exists portinfo(portdir)]} {
- set porturl ${source_url}/$portinfo(portdir)
+ https -
+ http -
+ ftp {
+ set source_url file://[macports::getsourcepath $source]
}
- if {[info exists porturl]} {
- lappend line porturl $porturl
+ default {
+ set source_url $source
}
- lappend matches $name
- lappend matches $line
+ }
+ if {[info exists portinfo(portdir)]} {
+ lappend line porturl ${source_url}/$portinfo(portdir)
+ }
+ lappend matches $name
+ lappend matches $line
+ close $fd
+ set fd -1
+ } catch * {
+ ui_warn "It looks like your PortIndex file for $source may be corrupt."
+ } finally {
+ if {$fd != -1} {
close $fd
- set fd -1
- } catch {*} {
- ui_warn "It looks like your PortIndex file for $source may be corrupt."
- } finally {
- if {$fd != -1} {
- close $fd
- }
}
- if {[llength $matches] > 0} {
- break
- }
}
- } else {
- set res [macports::index::search $macports::portdbpath $source [list name $name]]
- if {[llength $res] > 0} {
- eval lappend matches $res
+ if {[llength $matches] > 0} {
+ # if we have a match, exit. If we don't, continue with the next
+ # source.
break
}
}
@@ -2671,66 +2779,59 @@
return $matches
}
-# Returns all ports in the indices. Faster than 'mportsearch .*'
-proc mportlistall {args} {
- global macports::portdbpath macports::sources
+##
+# Returns all ports in the indices. Faster than 'mportsearch .*' because of the
+# lack of matching.
+#
+# @return associative array in list form where the first field is the port name
+# and the second field is the line from PortIndex containing the port
+# info. See the return value of mportsearch().
+# @see mportsearch()
+proc mportlistall {} {
+ global macports::sources
set matches [list]
set found 0
foreach source $sources {
set source [lindex $source 0]
set protocol [macports::getprotocol $source]
- if {$protocol != "mports"} {
- if {![catch {set fd [open [macports::getindex $source] r]} result]} {
- try {
- incr found 1
- while {[gets $fd line] >= 0} {
- array unset portinfo
- set name [lindex $line 0]
- set len [lindex $line 1]
- set line [read $fd $len]
+ if {![catch {set fd [open [macports::getindex $source] r]} result]} {
+ try {
+ incr found 1
+ while {[gets $fd line] >= 0} {
+ array unset portinfo
+ set name [lindex $line 0]
+ set len [lindex $line 1]
+ set line [read $fd $len]
- array set portinfo $line
+ array set portinfo $line
- switch $protocol {
- rsync {
- set source_url "file://[macports::getsourcepath $source]"
- }
- https -
- http -
- ftp {
- if {[_source_is_snapshot $source filename extension]} {
- set source_url "file://[macports::getsourcepath $source]"
- } else {
- set source_url $source
- }
- }
- default {
- set source_url $source
- }
+ switch -- $protocol {
+ rsync {
+ set source_url file://[macports::getsourcepath $source]
}
- if {[info exists portinfo(portdir)]} {
- set porturl ${source_url}/$portinfo(portdir)
- } elseif {[info exists portinfo(portarchive)]} {
- set porturl ${source_url}/$portinfo(portarchive)
+ https -
+ http -
+ ftp {
+ set source_url file://[macports::getsourcepath $source]
}
- if {[info exists porturl]} {
- lappend line porturl $porturl
+ default {
+ set source_url $source
}
- lappend matches $name $line
}
- } catch {*} {
- ui_warn "It looks like your PortIndex file for $source may be corrupt."
- throw
- } finally {
- close $fd
+ if {[info exists portinfo(portdir)]} {
+ lappend line porturl ${source_url}/$portinfo(portdir)
+ }
+ lappend matches $name $line
}
- } else {
- ui_warn "Can't open index file for source: $source"
+ } catch * {
+ ui_warn "It looks like your PortIndex file for $source may be corrupt."
+ throw
+ } finally {
+ close $fd
}
} else {
- set res [macports::index::search $macports::portdbpath $source [list name .*]]
- eval lappend matches $res
+ ui_warn "Can't open index file for source: $source"
}
}
if {!$found} {
@@ -2740,10 +2841,11 @@
return $matches
}
-
-# Loads PortIndex.quick from each source into the quick_index, generating
-# it first if necessary.
-proc _mports_load_quickindex {args} {
+##
+# Loads PortIndex.quick from each source into the quick_index, generating it
+# first if necessary. Private API of macports1.0, do not use this from outside
+# macports1.0.
+proc _mports_load_quickindex {} {
global macports::sources macports::quick_index
unset -nocomplain macports::quick_index
@@ -2754,13 +2856,13 @@
# chop off any tags
set source [lindex $source 0]
set index [macports::getindex $source]
- if {![file exists ${index}]} {
+ if {![file exists $index]} {
incr sourceno
continue
}
if {![file exists ${index}.quick]} {
ui_warn "No quick index file found, attempting to generate one for source: $source"
- if {[catch {set quicklist [mports_generate_quickindex ${index}]}]} {
+ if {[catch {set quicklist [mports_generate_quickindex $index]}]} {
incr sourceno
continue
}
@@ -2776,8 +2878,8 @@
close $fd
}
}
- foreach entry [split $quicklist "\n"] {
- set quick_index($sourceno,[lindex $entry 0]) [lindex $entry 1]
+ foreach entry [split $quicklist \n] {
+ set quick_index(${sourceno},[lindex $entry 0]) [lindex $entry 1]
}
incr sourceno 1
}
@@ -2786,27 +2888,41 @@
}
}
+##
+# Generates a PortIndex.quick file from a PortIndex by using the name field as
+# key. This allows fast indexing into the PortIndex when using the port name as
+# key.
+#
+# @param index the PortIndex file to create the index for. The resulting quick
+# index will be in a file named like \a index, but with ".quick"
+# appended.
+# @return a list of entries written to the quick index file in the same format
+# if the file would just have been written.
+# @throws if the given \a index cannot be opened, the output file cannot be
+# opened, an error occurs while using the PortIndex (e.g., because it
+# is corrupt), or the quick index generation failed for some other
+# reason.
proc mports_generate_quickindex {index} {
- if {[catch {set indexfd [open ${index} r]} result] || [catch {set quickfd [open ${index}.quick w]} result]} {
+ if {[catch {set indexfd [open $index r]} result] || [catch {set quickfd [open ${index}.quick w]} result]} {
ui_warn "Can't open index file: $index"
return -code error
} else {
try {
set offset [tell $indexfd]
- set quicklist ""
+ set quicklist {}
while {[gets $indexfd line] >= 0} {
if {[llength $line] != 2} {
continue
}
set name [lindex $line 0]
- append quicklist "[string tolower $name] ${offset}\n"
+ append quicklist "[string tolower $name] $offset\n"
set len [lindex $line 1]
read $indexfd $len
set offset [tell $indexfd]
}
puts -nonewline $quickfd $quicklist
- } catch {*} {
+ } catch * {
ui_warn "It looks like your PortIndex file $index may be corrupt."
throw
} finally {
@@ -2828,7 +2944,7 @@
}
proc mportclose {mport} {
- global macports::open_mports
+ global macports::open_mports macports::extracted_portdirs
set refcnt [ditem_key $mport refcnt]
incr refcnt -1
ditem_key $mport refcnt $refcnt
@@ -2839,6 +2955,18 @@
if {[interp exists $workername]} {
interp delete $workername
}
+ set porturl [ditem_key $mport porturl]
+ if {[info exists macports::extracted_portdirs($porturl)]} {
+ # TODO port.tcl calls mportopen multiple times on the same port to
+ # determine a number of attributes and will close the port after
+ # each call. $macports::extracted_portdirs($porturl) will however
+ # stay set, which means it will not be extracted twice. We could
+ # (1) unset $macports::extracted_portdirs($porturl), which would
+ # lead to downloading the port multiple times, or (2) fix the
+ # port.tcl code to delay mportclose until the end.
+ #ui_debug "Removing temporary port directory $macports::extracted_portdirs($porturl)"
+ #file delete -force $macports::extracted_portdirs($porturl)
+ }
ditem_delete $mport
}
}
@@ -2852,7 +2980,7 @@
proc _mportkey {mport key} {
set workername [ditem_key $mport workername]
- return [$workername eval "return \$${key}"]
+ return [$workername eval "return \$$key"]
}
# mportdepends builds the list of mports which the given port depends on.
@@ -2870,7 +2998,7 @@
# dependencies ports.
# accDeps -> accumulator for recursive calls
# return 0 if everything was ok, an non zero integer otherwise.
-proc mportdepends {mport {target ""} {recurseDeps 1} {skipSatisfied 1} {accDeps 0}} {
+proc mportdepends {mport {target {}} {recurseDeps 1} {skipSatisfied 1} {accDeps 0}} {
array set portinfo [mportinfo $mport]
if {$accDeps} {
@@ -2881,11 +3009,11 @@
# progress indicator
if {![macports::ui_isset ports_debug]} {
- ui_info -nonewline "."
+ ui_info -nonewline .
flush stdout
}
-
- if {$target == "" || $target == "install" || $target == "activate"} {
+
+ if {$target eq {} || $target eq {install} || $target eq {activate}} {
_mporterrorifconflictsinstalled $mport
}
@@ -2914,7 +3042,7 @@
# get the portname that satisfies the depspec
set dep_portname [$workername eval _get_dep_port $depspec]
# skip port/archs combos we've already seen, and ones with the same port but less archs than ones we've seen (or noarch)
- set seenkey "${dep_portname},[join $required_archs ,]"
+ set seenkey ${dep_portname},[join $required_archs ,]
set seen 0
if {[info exists port_seen($seenkey)]} {
set seen 1
@@ -2923,7 +3051,7 @@
set nrequired [llength $required_archs]
foreach key $prev_seenkeys {
set key_archs [lrange [split $key ,] 1 end]
- if {$key_archs == "noarch" || $required_archs == "noarch" || [llength $key_archs] > $nrequired} {
+ if {$key_archs eq {noarch} || $required_archs eq {noarch} || [llength $key_archs] > $nrequired} {
set seen 1
set seenkey $key
break
@@ -2937,17 +3065,17 @@
}
continue
}
-
+
# Is that dependency satisfied or this port installed?
# If we don't skip or if it is not, add it to the list.
set present [_mportispresent $mport $depspec]
- if {!$skipSatisfied && $dep_portname == ""} {
+ if {!$skipSatisfied && $dep_portname eq {}} {
set dep_portname [lindex [split $depspec :] end]
}
set check_archs 0
- if {$dep_portname != "" && $deptype != "depends_fetch" && $deptype != "depends_extract" && [lsearch -exact $depends_skip_archcheck $dep_portname] == -1} {
+ if {$dep_portname ne {} && $deptype ne {depends_fetch} && $deptype ne {depends_extract} && [lsearch -exact $depends_skip_archcheck $dep_portname] == -1} {
set check_archs 1
}
@@ -2960,8 +3088,8 @@
# Find the porturl
if {[catch {set res [mportlookup $dep_portname]} error]} {
global errorInfo
- ui_msg ""
- ui_debug "$errorInfo"
+ ui_msg {}
+ ui_debug $errorInfo
ui_error "Internal error: port lookup failed: $error"
return 1
}
@@ -2970,7 +3098,7 @@
array set dep_portinfo [lindex $res 1]
if {![info exists dep_portinfo(porturl)]} {
if {![macports::ui_isset ports_debug]} {
- ui_msg ""
+ ui_msg {}
}
ui_error "Dependency '$dep_portname' not found."
return 1
@@ -2984,7 +3112,7 @@
# because mportexec only closes each open mport once.
set depport [dlist_match_multi $macports::open_mports [list porturl $dep_portinfo(porturl) options $dep_options]]
- if {$depport == {}} {
+ if {$depport eq {}} {
# We haven't opened this one yet.
set depport [mportopen $dep_portinfo(porturl) $dep_options $variations]
}
@@ -3003,7 +3131,7 @@
if {[info exists dep_portinfo(variants)] && [lsearch -exact $dep_portinfo(variants) universal] != -1} {
# a universal variant is offered
set has_universal 1
- if {![info exists variation_array(universal)] || $variation_array(universal) != "+"} {
+ if {![info exists variation_array(universal)] || $variation_array(universal) ne {+}} {
set variation_array(universal) +
# try again with +universal
set depport [mportopen $dep_portinfo(porturl) $dep_options [array get variation_array]]
@@ -3025,11 +3153,11 @@
}
# Append the sub-port's provides to the port's requirements list.
- set depport_provides "[ditem_key $depport provides]"
+ set depport_provides [ditem_key $depport provides]
ditem_append_unique $mport requires $depport_provides
# record actual archs we ended up getting
set port_seen(${dep_portname},[join [macports::_mport_archs $depport] ,]) $depport_provides
- } elseif {$present && $dep_portname != ""} {
+ } elseif {$present && $dep_portname ne {}} {
# record actual installed archs
set port_seen(${dep_portname},[join [macports::_active_archs $dep_portname] ,]) 0
}
@@ -3040,7 +3168,7 @@
if {$recurseDeps} {
foreach depport $depPorts {
# Sub ports should be installed (all dependencies must be satisfied).
- set res [mportdepends $depport "" $recurseDeps $skipSatisfied 1]
+ set res [mportdepends $depport {} $recurseDeps $skipSatisfied 1]
if {$res != 0} {
return $res
}
@@ -3052,11 +3180,11 @@
# check if the given mport can support dependents with the given archs
proc macports::_mport_supports_archs {mport required_archs} {
- if {$required_archs == "noarch"} {
+ if {$required_archs eq {noarch}} {
return 1
}
set provided_archs [_mport_archs $mport]
- if {$provided_archs == "noarch"} {
+ if {$provided_archs eq {noarch}} {
return 1
}
foreach arch $required_archs {
@@ -3075,14 +3203,14 @@
# check if the active version of a port supports the given archs
proc macports::_active_supports_archs {portname required_archs} {
- if {$required_archs == "noarch"} {
+ if {$required_archs eq {noarch}} {
return 1
}
if {[catch {registry::active $portname}]} {
return 0
}
set provided_archs [_active_archs $portname]
- if {$provided_archs == "noarch" || $provided_archs == "" || $provided_archs == 0} {
+ if {$provided_archs eq {noarch} || $provided_archs eq {} || $provided_archs == 0} {
return 1
}
foreach arch $required_archs {
@@ -3096,7 +3224,7 @@
# get the archs for a given active port
proc macports::_active_archs {portname} {
if {[catch {set ilist [registry::active $portname]}]} {
- return ""
+ return {}
}
set i [lindex $ilist 0]
set regref [registry::open_entry $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
@@ -3107,10 +3235,10 @@
proc macports::_explain_arch_mismatch {port dep required_archs supported_archs has_universal} {
global macports::universal_archs
if {![macports::ui_isset ports_debug]} {
- ui_msg ""
+ ui_msg {}
}
ui_error "Cannot install $port for the arch(s) '$required_archs' because"
- if {$supported_archs != ""} {
+ if {$supported_archs ne {}} {
foreach arch $required_archs {
if {[lsearch -exact $supported_archs $arch] == -1} {
ui_error "its dependency $dep only supports the arch(s) '$supported_archs'."
@@ -3137,7 +3265,7 @@
proc macports::_mport_has_deptypes {mport deptypes} {
array set portinfo [mportinfo $mport]
foreach type $deptypes {
- if {[info exists portinfo($type)] && $portinfo($type) != ""} {
+ if {[info exists portinfo($type)] && $portinfo($type) ne {}} {
return 1
}
}
@@ -3164,23 +3292,23 @@
mpkg -
rpm -
dpkg -
- srpm { return 1 }
- default { return 0 }
+ srpm {return 1}
+ default {return 0}
}
}
# Determine dependency types required for target
proc macports::_deptypes_for_target {target workername} {
- switch $target {
+ switch -- $target {
fetch -
- checksum { return "depends_fetch" }
+ checksum {return depends_fetch}
extract -
- patch { return "depends_fetch depends_extract" }
+ patch {return "depends_fetch depends_extract"}
configure -
- build { return "depends_fetch depends_extract depends_build depends_lib" }
+ build {return "depends_fetch depends_extract depends_build depends_lib"}
test -
srpm -
- destroot { return "depends_fetch depends_extract depends_build depends_lib depends_run" }
+ destroot {return "depends_fetch depends_extract depends_build depends_lib depends_run"}
dmg -
pkg -
mdmg -
@@ -3196,7 +3324,7 @@
}
install -
activate -
- "" {
+ {} {
if {[global_option_isset ports_binary_only] ||
[$workername eval registry_exists \$subport \$version \$revision \$portvariants]
|| (![global_option_isset ports_source_only] && [$workername eval _archive_available])} {
@@ -3206,32 +3334,33 @@
}
}
}
- return ""
+ return {}
}
# selfupdate procedure
-proc macports::selfupdate {{optionslist {}} {updatestatusvar ""}} {
- global macports::prefix macports::portdbpath macports::libpath macports::rsync_server macports::rsync_dir macports::rsync_options
- global macports::autoconf::macports_version macports::autoconf::rsync_path tcl_platform
- global macports::autoconf::openssl_path macports::autoconf::tar_path
+proc macports::selfupdate {{optionslist {}} {updatestatusvar {}}} {
+ global macports::prefix macports::portdbpath macports::libpath \
+ macports::rsync_server macports::rsync_dir macports::rsync_options \
+ macports::autoconf::macports_version macports::autoconf::rsync_path \
+ tcl_platform macports::autoconf::openssl_path macports::autoconf::tar_path
array set options $optionslist
-
+
# variable that indicates whether we actually updated base
- if {$updatestatusvar != ""} {
+ if {$updatestatusvar ne {}} {
upvar $updatestatusvar updatestatus
set updatestatus no
}
# are we syncing a tarball? (implies detached signature)
set is_tarball 0
- if {[string range ${rsync_dir} end-3 end] == ".tar"} {
+ if {[string range $rsync_dir end-3 end] eq {.tar}} {
set is_tarball 1
- set mp_source_path [file join $portdbpath sources ${rsync_server} [file dirname ${rsync_dir}]]
+ set mp_source_path [file join $portdbpath sources $rsync_server [file dirname $rsync_dir]]
} else {
- if {[string index $rsync_dir end] != "/"} {
- append rsync_dir "/"
+ if {[string index $rsync_dir end] ne {/}} {
+ append rsync_dir /
}
- set mp_source_path [file join $portdbpath sources ${rsync_server} ${rsync_dir}]
+ set mp_source_path [file join $portdbpath sources $rsync_server $rsync_dir]
}
# create the path to the to be downloaded sources if it doesn't exist
if {![file exists $mp_source_path]} {
@@ -3241,21 +3370,21 @@
# sync the MacPorts sources
ui_msg "$macports::ui_prefix Updating MacPorts base sources using rsync"
- if { [catch { system "$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir} $mp_source_path" } result ] } {
+ if {[catch {system "$rsync_path $rsync_options rsync://${rsync_server}/$rsync_dir $mp_source_path"} result]} {
return -code error "Error synchronizing MacPorts sources: $result"
}
if {$is_tarball} {
# verify signature for tarball
global macports::archivefetch_pubkeys
- if { [catch { system "$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir}.rmd160 $mp_source_path" } result ] } {
+ if {[catch {system "$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir}.rmd160 $mp_source_path"} result]} {
return -code error "Error synchronizing MacPorts source signature: $result"
}
set openssl [findBinary openssl $macports::autoconf::openssl_path]
- set tarball "${mp_source_path}/[file tail $rsync_dir]"
- set signature "${tarball}.rmd160"
+ set tarball ${mp_source_path}/[file tail $rsync_dir]
+ set signature ${tarball}.rmd160
set verified 0
- foreach pubkey ${macports::archivefetch_pubkeys} {
+ foreach pubkey $macports::archivefetch_pubkeys {
if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball} result]} {
set verified 1
ui_debug "successful verification with key $pubkey"
@@ -3268,11 +3397,11 @@
if {!$verified} {
return -code error "Failed to verify signature for MacPorts source!"
}
-
+
# extract tarball and move into place
set tar [macports::findBinary tar $macports::autoconf::tar_path]
file mkdir ${mp_source_path}/tmp
- set tar_cmd "$tar -C ${mp_source_path}/tmp -xf ${tarball}"
+ set tar_cmd "$tar -C ${mp_source_path}/tmp -xf $tarball"
ui_debug $tar_cmd
if {[catch {system $tar_cmd}]} {
return -code error "Failed to extract MacPorts sources from tarball!"
@@ -3287,7 +3416,7 @@
# echo current MacPorts version
ui_msg "MacPorts base version $macports::autoconf::macports_version installed,"
- if { [info exists options(ports_force)] && $options(ports_force) == "yes" } {
+ if {[info exists options(ports_force)] && $options(ports_force) eq {yes}} {
set use_the_force_luke yes
ui_debug "Forcing a rebuild and reinstallation of MacPorts"
} else {
@@ -3312,9 +3441,9 @@
set comp [vercmp $macports_version_new $macports::autoconf::macports_version]
# syncing ports tree.
- if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) != "yes"} {
+ if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) ne {yes}} {
if {$comp > 0} {
- # updated portfiles potentially need new base to parse - tell sync to try to
+ # updated portfiles potentially need new base to parse - tell sync to try to
# use prefabricated PortIndex files and signal if it couldn't
lappend optionslist no_reindex 1 needed_portindex_var needed_portindex
}
@@ -3323,24 +3452,24 @@
}
}
- if {$use_the_force_luke == "yes" || $comp > 0} {
- if {[info exists options(ports_dryrun)] && $options(ports_dryrun) == "yes"} {
+ if {$use_the_force_luke eq {yes} || $comp > 0} {
+ if {[info exists options(ports_dryrun)] && $options(ports_dryrun) eq {yes}} {
ui_msg "$macports::ui_prefix MacPorts base is outdated, selfupdate would install $macports_version_new (dry run)"
} else {
ui_msg "$macports::ui_prefix MacPorts base is outdated, installing new version $macports_version_new"
# get installation user/group and permissions
- set owner [file attributes ${prefix} -owner]
- set group [file attributes ${prefix} -group]
- set perms [string range [file attributes ${prefix} -permissions] end-3 end]
- if {$tcl_platform(user) != "root" && ![string equal $tcl_platform(user) $owner]} {
- return -code error "User $tcl_platform(user) does not own ${prefix} - try using sudo"
+ set owner [file attributes $prefix -owner]
+ set group [file attributes $prefix -group]
+ set perms [string range [file attributes $prefix -permissions] end-3 end]
+ if {$tcl_platform(user) ne {root} && $tcl_platform(user) ne $owner} {
+ return -code error "User $tcl_platform(user) does not own $prefix - try using sudo"
}
ui_debug "Permissions OK"
# where to install a link to our macports1.0 tcl package
set mp_tclpackage_path [file join $portdbpath .tclpackage]
- if { [file exists $mp_tclpackage_path]} {
+ if {[file exists $mp_tclpackage_path]} {
set fd [open $mp_tclpackage_path r]
gets $fd tclpackage
close $fd
@@ -3350,26 +3479,26 @@
set configure_args "--prefix=$prefix --with-tclpackage=$tclpackage --with-install-user=$owner --with-install-group=$group --with-directory-mode=$perms"
# too many users have an incompatible readline in /usr/local, see ticket #10651
- if {$tcl_platform(os) != "Darwin" || $prefix == "/usr/local"
- || ([glob -nocomplain "/usr/local/lib/lib{readline,history}*"] == "" && [glob -nocomplain "/usr/local/include/readline/*.h"] == "")} {
+ if {$tcl_platform(os) ne {Darwin} || $prefix eq {/usr/local}
+ || ([glob -nocomplain /usr/local/lib/lib{readline,history}*] eq {} && [glob -nocomplain /usr/local/include/readline/*.h] eq {})} {
append configure_args " --enable-readline"
} else {
ui_warn "Disabling readline support due to readline in /usr/local"
}
- if {$prefix == "/usr/local" || $prefix == "/usr"} {
+ if {$prefix eq {/usr/local} || $prefix eq {/usr}} {
append configure_args " --with-unsupported-prefix"
}
# Choose a sane compiler
- set cc_arg ""
- if {$::macports::os_platform == "darwin"} {
+ set cc_arg {}
+ if {$::macports::os_platform eq {darwin}} {
set cc_arg "CC=/usr/bin/cc OBJC=/usr/bin/cc "
}
# do the actual configure, build and installation of new base
- ui_msg "Installing new MacPorts release in $prefix as $owner:$group; permissions $perms; Tcl-Package in $tclpackage\n"
- if { [catch { system "cd $mp_source_path && ${cc_arg}./configure $configure_args && make SELFUPDATING=1 && make install SELFUPDATING=1" } result] } {
+ ui_msg "Installing new MacPorts release in $prefix as ${owner}:${group}; permissions ${perms}; Tcl-Package in $tclpackage\n"
+ if {[catch {system "cd $mp_source_path && ${cc_arg}./configure $configure_args && make SELFUPDATING=1 && make install SELFUPDATING=1"} result]} {
return -code error "Error installing new MacPorts base: $result"
}
if {[info exists updatestatus]} {
@@ -3385,11 +3514,11 @@
# set the MacPorts sources to the right owner
set sources_owner [file attributes [file join $portdbpath sources/] -owner]
ui_debug "Setting MacPorts sources ownership to $sources_owner"
- if { [catch { exec [findBinary chown $macports::autoconf::chown_path] -R $sources_owner [file join $portdbpath sources/] } result] } {
- return -code error "Couldn't change permissions of the MacPorts sources at $mp_source_path to $sources_owner: $result"
+ if {[catch {exec [findBinary chown $macports::autoconf::chown_path] -R $sources_owner [file join $portdbpath sources/]} result]} {
+ return -code error "Couldn't change permissions of the MacPorts sources at $mp_source_path to ${sources_owner}: $result"
}
- if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) != "yes"} {
+ if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) ne {yes}} {
if {[info exists needed_portindex]} {
ui_msg "Not all sources could be fully synced using the old version of MacPorts."
ui_msg "Please run selfupdate again now that MacPorts base has been updated."
@@ -3408,13 +3537,13 @@
# 1 = general failure
# 2 = port name not found in index
# 3 = port not installed
-proc macports::upgrade {portname dspec variationslist optionslist {depscachename ""}} {
+proc macports::upgrade {portname dspec variationslist optionslist {depscachename {}}} {
# only installed ports can be upgraded
if {![registry::entry_exists_for_name $portname]} {
ui_error "$portname is not installed"
return 3
}
- if {![string match "" $depscachename]} {
+ if {$depscachename ne {}} {
upvar $depscachename depscache
} else {
array set depscache {}
@@ -3425,10 +3554,10 @@
set macports::global_options(ports_nodeps) yes
set orig_nodeps no
}
-
+
# run the actual upgrade
set status [macports::_upgrade $portname $dspec $variationslist $optionslist depscache]
-
+
if {!$orig_nodeps} {
unset -nocomplain macports::global_options(ports_nodeps)
}
@@ -3437,17 +3566,17 @@
}
# main internal upgrade procedure
-proc macports::_upgrade {portname dspec variationslist optionslist {depscachename ""}} {
+proc macports::_upgrade {portname dspec variationslist optionslist {depscachename {}}} {
global macports::global_variations
array set options $optionslist
- if {![string match "" $depscachename]} {
+ if {$depscachename ne {}} {
upvar $depscachename depscache
}
# Is this a dry run?
set is_dryrun no
- if {[info exists options(ports_dryrun)] && $options(ports_dryrun) eq "yes"} {
+ if {[info exists options(ports_dryrun)] && $options(ports_dryrun) eq {yes}} {
set is_dryrun yes
}
@@ -3455,21 +3584,27 @@
set is_revupgrade no
if {[info exists options(ports_revupgrade)] && $options(ports_revupgrade)} {
set is_revupgrade yes
+ # unset revupgrade options so we can upgrade dependencies with the same
+ # $options without also triggering a rebuild there, see #40150
+ unset options(ports_revupgrade)
}
set is_revupgrade_second_run no
if {[info exists options(ports_revupgrade_second_run)] && $options(ports_revupgrade_second_run)} {
set is_revupgrade_second_run yes
+ # unset revupgrade options so we can upgrade dependencies with the same
+ # $options without also triggering a rebuild there, see #40150
+ unset options(ports_revupgrade_second_run)
}
# check if the port is in tree
if {[catch {mportlookup $portname} result]} {
global errorInfo
- ui_debug "$errorInfo"
+ ui_debug $errorInfo
ui_error "port lookup failed: $result"
return 1
}
# argh! port doesnt exist!
- if {$result == ""} {
+ if {$result eq {}} {
ui_warn "No port $portname found in the index."
return 2
}
@@ -3480,15 +3615,15 @@
set options(subport) $portname
set ilist {}
- if { [catch {set ilist [registry::installed $portname ""]} result] } {
- if {$result == "Registry error: $portname not registered as installed." } {
+ if {[catch {set ilist [registry::installed $portname {}]} result]} {
+ if {$result eq "Registry error: $portname not registered as installed."} {
ui_debug "$portname is *not* installed by MacPorts"
# We need to pass _mportispresent a reference to the mport that is
# actually declaring the dependency on the one we're checking for.
# We got here via _upgrade_dependencies, so we grab it from 2 levels up.
- upvar 2 workername parentworker
- if {![_mportispresent $parentworker $dspec ] } {
+ upvar 2 mport parentmport
+ if {![_mportispresent $parentmport $dspec]} {
# open porthandle
set porturl $portinfo(porturl)
if {![info exists porturl]} {
@@ -3497,38 +3632,38 @@
# Grab the variations from the parent
upvar 2 variations variations
- if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result]} {
+ if {[catch {set mport [mportopen $porturl [array get options] [array get variations]]} result]} {
global errorInfo
- ui_debug "$errorInfo"
+ ui_debug $errorInfo
ui_error "Unable to open port: $result"
return 1
}
# While we're at it, update the portinfo
array unset portinfo
- array set portinfo [mportinfo $workername]
-
+ array set portinfo [mportinfo $mport]
+
# upgrade its dependencies first
set status [_upgrade_dependencies portinfo depscache variationslist options]
if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
- catch {mportclose $workername}
+ catch {mportclose $mport}
return $status
}
# now install it
- if {[catch {set result [mportexec $workername activate]} result]} {
+ if {[catch {set result [mportexec $mport activate]} result]} {
global errorInfo
- ui_debug "$errorInfo"
+ ui_debug $errorInfo
ui_error "Unable to exec port: $result"
- catch {mportclose $workername}
+ catch {mportclose $mport}
return 1
}
if {$result > 0} {
ui_error "Problem while installing $portname"
- catch {mportclose $workername}
+ catch {mportclose $mport}
return $result
}
# we just installed it, so mark it done in the cache
- set depscache(port:${portname}) 1
- mportclose $workername
+ set depscache(port:$portname) 1
+ mportclose $mport
} else {
# dependency is satisfied by something other than the named port
ui_debug "$portname not installed, soft dependency satisfied"
@@ -3544,17 +3679,17 @@
}
} else {
# we'll now take care of upgrading it, so we can add it to the cache
- set depscache(port:${portname}) 1
+ set depscache(port:$portname) 1
}
-
+
# set version_in_tree and revision_in_tree
if {![info exists portinfo(version)]} {
- ui_error "Invalid port entry for $portname, missing version"
+ ui_error "Invalid port entry for ${portname}, missing version"
return 1
}
- set version_in_tree "$portinfo(version)"
- set revision_in_tree "$portinfo(revision)"
- set epoch_in_tree "$portinfo(epoch)"
+ set version_in_tree $portinfo(version)
+ set revision_in_tree $portinfo(revision)
+ set epoch_in_tree $portinfo(epoch)
# find latest version installed and active version (if any)
set anyactive no
@@ -3564,7 +3699,7 @@
set version [lindex $i 1]
set revision [lindex $i 2]
set epoch [lindex $i 5]
- if { $version_installed == {} || ($epoch > $epoch_installed && $version != $version_installed) ||
+ if {$version_installed eq {} || ($epoch > $epoch_installed && $version != $version_installed) ||
($epoch >= $epoch_installed && [vercmp $version $version_installed] > 0)
|| ($epoch >= $epoch_installed
&& [vercmp $version $version_installed] == 0
@@ -3587,10 +3722,10 @@
# output version numbers
ui_debug "epoch: in tree: $epoch_in_tree installed: $epoch_installed"
- ui_debug "$portname ${version_in_tree}_${revision_in_tree} exists in the ports tree"
- ui_debug "$portname ${version_installed}_${revision_installed} $variant_installed is the latest installed"
+ ui_debug "$portname ${version_in_tree}_$revision_in_tree exists in the ports tree"
+ ui_debug "$portname ${version_installed}_$revision_installed $variant_installed is the latest installed"
if {$anyactive} {
- ui_debug "$portname ${version_active}_${revision_active} $variant_active is active"
+ ui_debug "$portname ${version_active}_$revision_active $variant_active is active"
# save existing variant for later use
set oldvariant $variant_active
set regref [registry::open_entry $portname $version_active $revision_active $variant_active $epoch_active]
@@ -3620,23 +3755,23 @@
# upgrade; while variations gets existing variants and global variations
# merged in later on, so it applies only to this port's upgrade
array set variations $variationslist
-
+
set globalvarlist [array get macports::global_variations]
set minusvariant [lrange [split $oldnegatedvariant -] 1 end]
set plusvariant [lrange [split $oldvariant +] 1 end]
- ui_debug "Merging existing variants '${oldvariant}${oldnegatedvariant}' into variants"
+ ui_debug "Merging existing variants '${oldvariant}$oldnegatedvariant' into variants"
set oldvariantlist [list]
foreach v $plusvariant {
- lappend oldvariantlist $v "+"
+ lappend oldvariantlist $v +
}
foreach v $minusvariant {
- lappend oldvariantlist $v "-"
+ lappend oldvariantlist $v -
}
# merge in the old variants
foreach {variation value} $oldvariantlist {
- if { ![info exists variations($variation)]} {
+ if {![info exists variations($variation)]} {
set variations($variation) $value
}
}
@@ -3644,24 +3779,24 @@
# Now merge in the global (i.e. variants.conf) variations.
# We wait until now so that existing variants for this port
# override global variations
- foreach { variation value } $globalvarlist {
- if { ![info exists variations($variation)] } {
+ foreach {variation value} $globalvarlist {
+ if {![info exists variations($variation)]} {
set variations($variation) $value
}
}
ui_debug "new fully merged portvariants: [array get variations]"
-
+
# at this point we need to check if a different port will be replacing this one
if {[info exists portinfo(replaced_by)] && ![info exists options(ports_upgrade_no-replace)]} {
ui_msg "$macports::ui_prefix $portname is replaced by $portinfo(replaced_by)"
if {[catch {mportlookup $portinfo(replaced_by)} result]} {
global errorInfo
- ui_debug "$errorInfo"
+ ui_debug $errorInfo
ui_error "port lookup failed: $result"
return 1
}
- if {$result == ""} {
+ if {$result eq {}} {
ui_error "No port $portinfo(replaced_by) found."
return 1
}
@@ -3673,7 +3808,7 @@
if {![info exists porturl]} {
set porturl file://./
}
- set depscache(port:${newname}) 1
+ set depscache(port:$newname) 1
} else {
set newname $portname
}
@@ -3682,38 +3817,38 @@
set interp_options(ports_requested) $requestedflag
set interp_options(subport) $newname
- if {[catch {set workername [mportopen $porturl [array get interp_options] [array get variations]]} result]} {
+ if {[catch {set mport [mportopen $porturl [array get interp_options] [array get variations]]} result]} {
global errorInfo
- ui_debug "$errorInfo"
+ ui_debug $errorInfo
ui_error "Unable to open port: $result"
return 1
}
array unset interp_options
array unset portinfo
- array set portinfo [mportinfo $workername]
- set version_in_tree "$portinfo(version)"
- set revision_in_tree "$portinfo(revision)"
- set epoch_in_tree "$portinfo(epoch)"
+ array set portinfo [mportinfo $mport]
+ set version_in_tree $portinfo(version)
+ set revision_in_tree $portinfo(revision)
+ set epoch_in_tree $portinfo(epoch)
set build_override 0
set will_install yes
# check installed version against version in ports
- if { ( [vercmp $version_installed $version_in_tree] > 0
+ if {([vercmp $version_installed $version_in_tree] > 0
|| ([vercmp $version_installed $version_in_tree] == 0
- && [vercmp $revision_installed $revision_in_tree] >= 0 ))
- && ![info exists options(ports_upgrade_force)] } {
- if {$portname != $newname} {
+ && [vercmp $revision_installed $revision_in_tree] >= 0))
+ && ![info exists options(ports_upgrade_force)]} {
+ if {$portname ne $newname} {
ui_debug "ignoring versions, installing replacement port"
- } elseif { $epoch_installed < $epoch_in_tree } {
+ } elseif {$epoch_installed < $epoch_in_tree && $version_installed != $version_in_tree} {
set build_override 1
ui_debug "epoch override ... upgrading!"
- } elseif {[info exists options(ports_upgrade_enforce-variants)] && $options(ports_upgrade_enforce-variants) eq "yes"
+ } elseif {[info exists options(ports_upgrade_enforce-variants)] && $options(ports_upgrade_enforce-variants) eq {yes}
&& [info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
ui_debug "variant override ... upgrading!"
- } elseif {$os_platform_installed != "" && $os_major_installed != "" && $os_platform_installed != 0
- && ([_mportkey $workername "{os.platform}"] != $os_platform_installed
- || [_mportkey $workername "{os.major}"] != $os_major_installed)} {
+ } elseif {$os_platform_installed ne {} && $os_major_installed ne {} && $os_platform_installed != 0
+ && ([_mportkey $mport {{os.platform}}] != $os_platform_installed
+ || [_mportkey $mport {{os.major}}] != $os_major_installed)} {
ui_debug "platform mismatch ... upgrading!"
set build_override 1
} elseif {$is_revupgrade_second_run} {
@@ -3722,16 +3857,16 @@
} elseif {$is_revupgrade} {
ui_debug "rev-upgrade override ... upgrading!"
# in the first run of rev-upgrade, only activate possibly already existing files and check for missing dependencies
- set will_install yes
+ # do nothing, just prevent will_install being set to no below
} else {
if {[info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
if {[llength $variationslist] > 0} {
- ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\". Use 'upgrade --enforce-variants' to switch to the requested variants."
+ ui_warn "Skipping upgrade since $portname ${version_installed}_$revision_installed >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\". Use 'upgrade --enforce-variants' to switch to the requested variants."
} else {
- ui_debug "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\"."
+ ui_debug "Skipping upgrade since $portname ${version_installed}_$revision_installed >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\"."
}
} else {
- ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
+ ui_debug "No need to upgrade! $portname ${version_installed}_$revision_installed >= $portname ${version_in_tree}_$revision_in_tree"
}
set will_install no
}
@@ -3748,11 +3883,11 @@
}
# first upgrade dependencies
- if {![info exists options(ports_nodeps)] && !$is_revupgrade} {
+ if {![info exists options(ports_nodeps)]} {
# the last arg is because we might have to build from source if a rebuild is being forced
- set status [_upgrade_dependencies portinfo depscache variationslist options [expr $will_build && $already_installed]]
+ set status [_upgrade_dependencies portinfo depscache variationslist options [expr {$will_build && $already_installed && !$is_revupgrade}]]
if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
- catch {mportclose $workername}
+ catch {mportclose $mport}
return $status
}
} else {
@@ -3772,32 +3907,65 @@
set deplist [registry::list_dependents $portname $version_installed $revision_installed $variant_installed]
}
- if { [llength deplist] > 0 } {
+ if {[llength deplist] > 0} {
foreach dep $deplist {
set mpname [lindex $dep 2]
- if {![llength [array get depscache port:${mpname}]]} {
- set status [macports::_upgrade $mpname port:${mpname} $variationslist [array get options] depscache]
+ if {![llength [array get depscache port:$mpname]]} {
+ set status [macports::_upgrade $mpname port:$mpname $variationslist [array get options] depscache]
if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
- catch {mportclose $workername}
+ catch {mportclose $mport}
return $status
}
}
}
}
}
- mportclose $workername
+ mportclose $mport
return 0
}
if {$will_build} {
- # install version_in_tree (but don't activate yet)
- if {[catch {set result [mportexec $workername install]} result] || $result != 0} {
- if {[info exists ::errorInfo]} {
- ui_debug "$::errorInfo"
+ if {$already_installed
+ && ([info exists options(ports_upgrade_force)] || $build_override == 1)} {
+ # Tell archivefetch/unarchive not to use the installed archive, i.e. a
+ # fresh one will be either fetched or built locally.
+ # Ideally this would be done in the interp_options when we mportopen,
+ # but we don't know if we want to do this at that point.
+ set workername [ditem_key $mport workername]
+ $workername eval "set force_archive_refresh yes"
+
+ # run archivefetch and destroot for version_in_tree
+ # doing this instead of just running install ensures that we have the
+ # new copy ready but not yet installed, so we can safely uninstall the
+ # existing one.
+ if {[catch {set result [mportexec $mport archivefetch]} result] || $result != 0} {
+ if {[info exists ::errorInfo]} {
+ ui_debug $::errorInfo
+ }
+ ui_error "Unable to upgrade port: $result"
+ catch {mportclose $mport}
+ return 1
}
- ui_error "Unable to upgrade port: $result"
- catch {mportclose $workername}
- return 1
+ # the following is a noop if archivefetch found an archive
+ if {[catch {set result [mportexec $mport destroot]} result] || $result != 0} {
+ if {[info exists ::errorInfo]} {
+ ui_debug $::errorInfo
+ }
+ ui_error "Unable to upgrade port: $result"
+ catch {mportclose $mport}
+ return 1
+ }
+ } else {
+ # Normal non-forced case
+ # install version_in_tree (but don't activate yet)
+ if {[catch {set result [mportexec $mport install]} result] || $result != 0} {
+ if {[info exists ::errorInfo]} {
+ ui_debug $::errorInfo
+ }
+ ui_error "Unable to upgrade port: $result"
+ catch {mportclose $mport}
+ return 1
+ }
}
}
@@ -3810,38 +3978,38 @@
set options(ports_force) yes
set existing_epoch [lindex [lindex [registry::installed $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)] 0] 5]
set newregref [registry::open_entry $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) $existing_epoch]
- if {$is_dryrun eq "yes"} {
+ if {$is_dryrun eq {yes}} {
ui_msg "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
} elseif {![registry::run_target $newregref uninstall [array get options]]
&& [catch {registry_uninstall::uninstall $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) [array get options]} result]} {
global errorInfo
- ui_debug "$errorInfo"
+ ui_debug $errorInfo
ui_error "Uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
- catch {mportclose $workername}
+ catch {mportclose $mport}
return 1
}
if {!$force_cur} {
unset options(ports_force)
}
if {$anyactive && $version_in_tree == $version_active && $revision_in_tree == $revision_active
- && $portinfo(canonical_active_variants) == $variant_active && $portname == $newname} {
+ && $portinfo(canonical_active_variants) == $variant_active && $portname eq $newname} {
set anyactive no
}
}
- if {$anyactive && $portname != $newname} {
+ if {$anyactive && $portname ne $newname} {
# replaced_by in effect, deactivate the old port
# we have to force the deactivate in case of dependents
set force_cur [info exists options(ports_force)]
set options(ports_force) yes
- if {$is_dryrun eq "yes"} {
- ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}${variant_active} (dry run)"
+ if {$is_dryrun eq {yes}} {
+ ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}$variant_active (dry run)"
} elseif {![catch {registry::active $portname}] &&
![registry::run_target $regref deactivate [array get options]]
&& [catch {portimage::deactivate $portname $version_active $revision_active $variant_active [array get options]} result]} {
global errorInfo
- ui_debug "$errorInfo"
- ui_error "Deactivating $portname @${version_active}_${revision_active}${variant_active} failed: $result"
- catch {mportclose $workername}
+ ui_debug $errorInfo
+ ui_error "Deactivating $portname @${version_active}_${revision_active}$variant_active failed: $result"
+ catch {mportclose $mport}
return 1
}
if {!$force_cur} {
@@ -3849,22 +4017,22 @@
}
set anyactive no
}
- if {[info exists options(port_uninstall_old)] && $portname == $newname} {
+ if {[info exists options(port_uninstall_old)] && $portname eq $newname} {
# uninstalling now could fail due to dependents when not forced,
# because the new version is not installed
set uninstall_later yes
}
- if {$is_dryrun eq "yes"} {
+ if {$is_dryrun eq {yes}} {
if {$anyactive} {
- ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}${variant_active} (dry run)"
+ ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}$variant_active (dry run)"
}
ui_msg "Skipping activate $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
- } elseif {[catch {set result [mportexec $workername activate]} result]} {
+ } elseif {[catch {set result [mportexec $mport activate]} result]} {
global errorInfo
- ui_debug "$errorInfo"
+ ui_debug $errorInfo
ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants): $result"
- catch {mportclose $workername}
+ catch {mportclose $mport}
return 1
}
@@ -3874,7 +4042,7 @@
set options(ports_nodeps) 1
registry::open_dep_map
- if {$portname != $newname} {
+ if {$portname ne $newname} {
set deplist [registry::list_dependents $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
} else {
set deplist [list]
@@ -3885,13 +4053,13 @@
set deplist [concat $deplist [registry::list_dependents $portname $version_installed $revision_installed $variant_installed]]
}
- if { [llength deplist] > 0 } {
+ if {[llength deplist] > 0} {
foreach dep $deplist {
set mpname [lindex $dep 2]
- if {![llength [array get depscache port:${mpname}]]} {
- set status [macports::_upgrade $mpname port:${mpname} $variationslist [array get options] depscache]
+ if {![llength [array get depscache port:$mpname]]} {
+ set status [macports::_upgrade $mpname port:$mpname $variationslist [array get options] depscache]
if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
- catch {mportclose $workername}
+ catch {mportclose $mport}
return $status
}
}
@@ -3899,27 +4067,27 @@
}
}
- if {[info exists uninstall_later] && $uninstall_later == yes} {
+ if {[info exists uninstall_later] && $uninstall_later eq yes} {
foreach i $ilist {
set version [lindex $i 1]
set revision [lindex $i 2]
set variant [lindex $i 3]
- if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants) && $portname == $newname} {
+ if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants) && $portname eq $newname} {
continue
}
set epoch [lindex $i 5]
- ui_debug "Uninstalling $portname ${version}_${revision}${variant}"
+ ui_debug "Uninstalling $portname ${version}_${revision}$variant"
set regref [registry::open_entry $portname $version $revision $variant $epoch]
- if {$is_dryrun eq "yes"} {
- ui_msg "Skipping uninstall $portname @${version}_${revision}${variant} (dry run)"
+ if {$is_dryrun eq {yes}} {
+ ui_msg "Skipping uninstall $portname @${version}_${revision}$variant (dry run)"
} elseif {![registry::run_target $regref uninstall $optionslist]
&& [catch {registry_uninstall::uninstall $portname $version $revision $variant $optionslist} result]} {
global errorInfo
- ui_debug "$errorInfo"
+ ui_debug $errorInfo
# replaced_by can mean that we try to uninstall all versions of the old port, so handle errors due to dependents
- if {$result != "Please uninstall the ports that depend on $portname first." && ![ui_isset ports_processall]} {
- ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
- catch {mportclose $workername}
+ if {$result ne "Please uninstall the ports that depend on $portname first." && ![ui_isset ports_processall]} {
+ ui_error "Uninstall $portname @${version}_${revision}$variant failed: $result"
+ catch {mportclose $mport}
return 1
}
}
@@ -3927,7 +4095,7 @@
}
# close the port handle
- mportclose $workername
+ mportclose $mport
return 0
}
@@ -3938,7 +4106,7 @@
upvar $portinfoname portinfo $depscachename depscache \
$variationslistname variationslist \
$optionsname options
- upvar workername parentworker
+ upvar mport parentmport
# If we're following dependents, we only want to follow this port's
# dependents, not those of all its dependencies. Otherwise, we would
@@ -3952,21 +4120,21 @@
set saved_do_dependents [info exists options(ports_do_dependents)]
unset -nocomplain options(ports_do_dependents)
- set parent_interp [ditem_key $parentworker workername]
+ set parentworker [ditem_key $parentmport workername]
# each required dep type is upgraded
if {$build_needed && ![global_option_isset ports_binary_only]} {
- set dtypes [_deptypes_for_target destroot $parent_interp]
+ set dtypes [_deptypes_for_target destroot $parentworker]
} else {
- set dtypes [_deptypes_for_target install $parent_interp]
+ set dtypes [_deptypes_for_target install $parentworker]
}
set status 0
foreach dtype $dtypes {
if {[info exists portinfo($dtype)]} {
foreach i $portinfo($dtype) {
- set d [$parent_interp eval _get_dep_port $i]
- if {![llength [array get depscache port:${d}]] && ![llength [array get depscache $i]]} {
- if {$d != ""} {
+ set d [$parentworker eval _get_dep_port $i]
+ if {![llength [array get depscache port:$d]] && ![llength [array get depscache $i]]} {
+ if {$d ne {}} {
set dspec port:$d
} else {
set dspec $i
@@ -3989,13 +4157,13 @@
# mportselect
# * command: The only valid commands are list, set and show
# * group: This argument should correspond to a directory under
-# $macports::prefix/etc/select.
+# ${macports::prefix}/etc/select.
# * version: This argument is only used by the 'set' command.
# On error mportselect returns with the code 'error'.
-proc mportselect {command group {version ""}} {
+proc mportselect {command group {version {}}} {
ui_debug "mportselect \[$command] \[$group] \[$version]"
- set conf_path "$macports::prefix/etc/select/$group"
+ set conf_path ${macports::prefix}/etc/select/$group
if {![file isdirectory $conf_path]} {
return -code error "The specified group '$group' does not exist."
}
@@ -4004,8 +4172,8 @@
list {
if {[catch {set versions [glob -directory $conf_path *]} result]} {
global errorInfo
- ui_debug "$result: $errorInfo"
- return -code error [concat "No configurations associated " \
+ ui_debug "${result}: $errorInfo"
+ return -code error [concat "No configurations associated" \
"with '$group' were found."]
}
@@ -4014,7 +4182,7 @@
foreach v $versions {
# Only the file name corresponds to the version name.
set v [file tail $v]
- if {$v eq "base" || $v eq "current"} {
+ if {$v eq {base} || $v eq {current}} {
continue
}
lappend lversions [file tail $v]
@@ -4022,25 +4190,25 @@
return [lsort $lversions]
}
set {
- # Use $conf_path/$version to read in sources.
- if {$version == "" || $version == "base" || $version == "current"
- || [catch {set src_file [open "$conf_path/$version"]} result]} {
+ # Use ${conf_path}/$version to read in sources.
+ if {$version eq {} || $version eq {base} || $version eq {current}
+ || [catch {set src_file [open "${conf_path}/$version"]} result]} {
global errorInfo
- ui_debug "$result: $errorInfo"
+ ui_debug "${result}: $errorInfo"
return -code error "The specified version '$version' is not valid."
}
- set srcs [split [read -nonewline $src_file] "\n"]
+ set srcs [split [read -nonewline $src_file] \n]
close $src_file
- # Use $conf_path/base to read in targets.
- if {[catch {set tgt_file [open "$conf_path/base"]} result]} {
+ # Use ${conf_path}/base to read in targets.
+ if {[catch {set tgt_file [open ${conf_path}/base]} result]} {
global errorInfo
- ui_debug "$result: $errorInfo"
- return -code error [concat "The configuration file " \
- "'$conf_path/base' could not be " \
+ ui_debug "${result}: $errorInfo"
+ return -code error [concat "The configuration file" \
+ "'${conf_path}/base' could not be" \
"opened."]
}
- set tgts [split [read -nonewline $tgt_file] "\n"]
+ set tgts [split [read -nonewline $tgt_file] \n]
close $tgt_file
# Iterate through the configuration files executing the specified
@@ -4072,11 +4240,11 @@
ui_debug "ln -sf $src $tgt"
}
}
- set i [expr $i+1]
+ incr i
}
# Update the selected version.
- set selected_version "$conf_path/current"
+ set selected_version ${conf_path}/current
if {[file exists $selected_version]} {
file delete $selected_version
}
@@ -4084,10 +4252,10 @@
return
}
show {
- set selected_version "$conf_path/current"
+ set selected_version ${conf_path}/current
if {![file exists $selected_version]} {
- return "none"
+ return none
} else {
return [file readlink $selected_version]
}
@@ -4104,19 +4272,19 @@
if {[info exists env(TMPDIR)]} {
return $env(TMPDIR)
} else {
- return "/tmp"
+ return /tmp
}
}
# check if the system we're on can run code of the given architecture
proc macports::arch_runnable {arch} {
global macports::os_major macports::os_arch macports::os_platform
- if {${macports::os_platform} == "darwin"} {
- if {${macports::os_major} >= 11 && [string first "ppc" $arch] == 0} {
+ if {$macports::os_platform eq {darwin}} {
+ if {$macports::os_major >= 11 && [string first ppc $arch] == 0} {
return no
- } elseif {${macports::os_arch} == "i386" && $arch == "ppc64"} {
+ } elseif {$macports::os_arch eq {i386} && $arch eq {ppc64}} {
return no
- } elseif {${macports::os_major} <= 8 && $arch == "x86_64"} {
+ } elseif {$macports::os_major <= 8 && $arch eq {x86_64}} {
return no
}
}
@@ -4139,7 +4307,7 @@
set files [registry::file search active 1 binary -null]
set files_count [llength $files]
- set fancy_output [expr ![macports::ui_isset ports_debug] && [isatty stdout]]
+ set fancy_output [expr {![macports::ui_isset ports_debug] && [isatty stdout]}]
if {$files_count > 0} {
registry::write {
try {
@@ -4148,18 +4316,18 @@
foreach f $files {
if {$fancy_output} {
if {$files_count < 10000 || $i % 10 == 1 || $i == $files_count} {
- ui_msg -nonewline "\r$macports::ui_prefix Updating database of binaries: [expr ($i * 1000 / $files_count) / 10.0]%"
+ ui_msg -nonewline "\r$macports::ui_prefix Updating database of binaries: [expr {($i * 1000 / $files_count) / 10.0}]%"
flush stdout
}
}
set fpath [$f actual_path]
- ui_debug "Updating binary flag for file $i of $files_count: $fpath"
+ ui_debug "Updating binary flag for file $i of ${files_count}: $fpath"
incr i
if {0 != [catch {$f binary [fileIsBinary $fpath]} fileIsBinaryError]} {
# handle errors (e.g. file not found, permission denied) gracefully
if {$fancy_output} {
- ui_msg ""
+ ui_msg {}
}
ui_warn "Error determining file type of `$fpath': $fileIsBinaryError"
ui_warn "A file belonging to the `[[registry::entry owner $fpath] name]' port is missing or unreadable. Consider reinstalling it."
@@ -4170,7 +4338,7 @@
throw
}
}
- ui_msg ""
+ ui_msg {}
}
set broken_files {};
@@ -4179,7 +4347,7 @@
if {$binary_count > 0} {
ui_msg -nonewline "$macports::ui_prefix Scanning binaries for linking errors"
set handle [machista::create_handle]
- if {$handle == "NULL"} {
+ if {$handle eq {NULL}} {
error "Error creating libmachista handle"
}
array unset files_warned_about
@@ -4189,12 +4357,12 @@
foreach b $binaries {
if {$fancy_output} {
if {$binary_count < 10000 || $i % 10 == 1 || $i == $binary_count} {
- ui_msg -nonewline "\r$macports::ui_prefix Scanning binaries for linking errors: [expr ($i * 1000 / $binary_count) / 10.0]%"
+ ui_msg -nonewline "\r$macports::ui_prefix Scanning binaries for linking errors: [expr {($i * 1000 / $binary_count) / 10.0}]%"
flush stdout
}
}
set bpath [$b actual_path]
- #ui_debug "$i/$binary_count: $bpath"
+ #ui_debug "${i}/${binary_count}: $bpath"
incr i
set resultlist [machista::parse_file $handle $bpath]
@@ -4208,7 +4376,7 @@
#ui_debug "Error parsing file ${bpath}: [machista::strerror $returncode]"
} else {
if {$fancy_output} {
- ui_msg ""
+ ui_msg {}
}
ui_warn "Error parsing file ${bpath}: [machista::strerror $returncode]"
}
@@ -4216,51 +4384,51 @@
}
set architecture [$result cget -mt_archs]
- while {$architecture != "NULL"} {
- if {[info exists options(ports_rev-upgrade_id-loadcmd-check)] && $options(ports_rev-upgrade_id-loadcmd-check) == "yes"} {
- if {[$architecture cget -mat_install_name] != "NULL" && [$architecture cget -mat_install_name] != ""} {
+ while {$architecture ne {NULL}} {
+ if {[info exists options(ports_rev-upgrade_id-loadcmd-check)] && $options(ports_rev-upgrade_id-loadcmd-check) eq {yes}} {
+ if {[$architecture cget -mat_install_name] ne {NULL} && [$architecture cget -mat_install_name] ne {}} {
# check if this lib's install name actually refers to this file itself
# if this is not the case software linking against this library might have erroneous load commands
if {0 == [catch {set idloadcmdpath [revupgrade_handle_special_paths $bpath [$architecture cget -mat_install_name]]}]} {
- if {[string index $idloadcmdpath 0] != "/"} {
+ if {[string index $idloadcmdpath 0] ne {/}} {
set port [registry::entry owner $bpath]
- if {$port != ""} {
+ if {$port ne {}} {
set portname [$port name]
} else {
- set portname "<unknown-port>"
+ set portname <unknown-port>
}
if {$fancy_output} {
- ui_msg ""
+ ui_msg {}
}
ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] (belonging to port $portname) contains relative path"
} elseif {![file exists $idloadcmdpath]} {
set port [registry::entry owner $bpath]
- if {$port != ""} {
+ if {$port ne {}} {
set portname [$port name]
} else {
- set portname "<unknown-port>"
+ set portname <unknown-port>
}
if {$fancy_output} {
- ui_msg ""
+ ui_msg {}
}
ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to non-existant file $idloadcmdpath"
ui_warn "This is probably a bug in the $portname port and might cause problems in libraries linking against this file"
} else {
-
+
set hash_this [sha256 file $bpath]
set hash_idloadcmd [sha256 file $idloadcmdpath]
-
- if {$hash_this != $hash_idloadcmd} {
+
+ if {$hash_this ne $hash_idloadcmd} {
set port [registry::entry owner $bpath]
- if {$port != ""} {
+ if {$port ne {}} {
set portname [$port name]
} else {
- set portname "<unknown-port>"
+ set portname <unknown-port>
}
if {$fancy_output} {
- ui_msg ""
+ ui_msg {}
}
- ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file $idloadcmdpath, which is a different file"
+ ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file ${idloadcmdpath}, which is a different file"
ui_warn "This is probably a bug in the $portname port and might cause problems in libraries linking against this file"
}
}
@@ -4277,7 +4445,7 @@
set loadcommand [$architecture cget -mat_loadcmds]
- while {$loadcommand != "NULL"} {
+ while {$loadcommand ne {NULL}} {
if {0 != [catch {set filepath [revupgrade_handle_special_paths $bpath [$loadcommand cget -mlt_install_name]]}]} {
set loadcommand [$loadcommand cget -next]
continue;
@@ -4290,9 +4458,9 @@
if {$libreturncode != $machista::SUCCESS} {
if {![info exists files_warned_about($filepath)]} {
if {[macports::ui_isset ports_verbose]} {
- ui_msg ""
+ ui_msg {}
}
- ui_info "Could not open $filepath: [machista::strerror $libreturncode] (referenced from $bpath)"
+ ui_info "Could not open ${filepath}: [machista::strerror $libreturncode] (referenced from $bpath)"
set files_warned_about($filepath) yes
}
if {$libreturncode == $machista::EFILE} {
@@ -4305,15 +4473,15 @@
set libarchitecture [$libresult cget -mt_archs]
set libarch_found false;
- while {$libarchitecture != "NULL"} {
- if {[$architecture cget -mat_arch] != [$libarchitecture cget -mat_arch]} {
+ while {$libarchitecture ne {NULL}} {
+ if {[$architecture cget -mat_arch] ne [$libarchitecture cget -mat_arch]} {
set libarchitecture [$libarchitecture cget -next]
continue;
}
- if {[$loadcommand cget -mlt_version] != [$libarchitecture cget -mat_version] && [$loadcommand cget -mlt_comp_version] > [$libarchitecture cget -mat_comp_version]} {
+ if {[$loadcommand cget -mlt_version] ne [$libarchitecture cget -mat_version] && [$loadcommand cget -mlt_comp_version] > [$libarchitecture cget -mat_comp_version]} {
if {[macports::ui_isset ports_verbose]} {
- ui_msg ""
+ ui_msg {}
}
ui_info "Incompatible library version: $bpath requires version [machista::format_dylib_version [$loadcommand cget -mlt_comp_version]] or later, but $filepath provides version [machista::format_dylib_version [$libarchitecture cget -mat_comp_version]]"
ui_debug "Marking $bpath as broken"
@@ -4324,7 +4492,7 @@
break;
}
- if {$libarch_found == false} {
+ if {$libarch_found eq false} {
ui_debug "Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file $filepath"
if {[path_is_in_prefix $filepath]} {
ui_debug "Marking $bpath as broken"
@@ -4340,7 +4508,7 @@
set architecture [$architecture cget -next]
}
}
- ui_msg ""
+ ui_msg {}
machista::destroy_handle $handle
@@ -4353,7 +4521,7 @@
set broken_files [lsort -unique $broken_files]
foreach file $broken_files {
set port [registry::entry owner $file]
- if {$port != ""} {
+ if {$port ne {}} {
lappend broken_ports $port
lappend broken_files_by_port($port) $file
} else {
@@ -4362,13 +4530,13 @@
}
set broken_ports [lsort -unique $broken_ports]
- if {${macports::revupgrade_mode} == "rebuild"} {
+ if {$macports::revupgrade_mode eq {rebuild}} {
# don't try to rebuild ports that don't exist in the tree
set temp_broken_ports {}
foreach port $broken_ports {
set portname [$port name]
if {[catch {mportlookup $portname} result]} {
- ui_debug "$::errorInfo"
+ ui_debug $::errorInfo
error "lookup of portname $portname failed: $result"
}
if {[llength $result] >= 2} {
@@ -4400,7 +4568,7 @@
if {$fancy_output} {
ui_error "Please run port -d -y rev-upgrade and use the output to report a bug."
}
- error "Port $portname still broken after rebuilding [expr $broken_port_counts($portname) - 1] time(s)"
+ error "Port $portname still broken after rebuilding [expr {$broken_port_counts($portname) - 1}] time(s)"
} elseif {$broken_port_counts($portname) > 1 && [global_option_isset ports_binary_only]} {
error "Port $portname still broken after reinstalling -- can't rebuild due to binary-only mode"
}
@@ -4408,7 +4576,7 @@
}
unset temp_broken_ports
- if {${macports::revupgrade_mode} != "rebuild"} {
+ if {$macports::revupgrade_mode ne {rebuild}} {
ui_msg "$macports::ui_prefix Found [llength $broken_ports] broken port(s):"
foreach port $broken_ports {
ui_msg " [$port name] @[$port version] [$port variants][$port negated_variants]"
@@ -4461,7 +4629,7 @@
set index [lsearch -exact $unsorted_ports $port]
set unsorted_ports [lreplace $unsorted_ports $index $index]
- # remove edges
+ # remove edges
foreach target $revadjlist($port) {
set index [lsearch -exact $adjlist($target) $port]
set adjlist($target) [lreplace $adjlist($target) $index $index]
@@ -4500,18 +4668,16 @@
set portname [$port name]
if {![info exists depscache(port:$portname)]} {
# set rev-upgrade options and nodeps if this is not the first run
- set my_options(ports_revupgrade) "yes"
- unset -nocomplain my_options(ports_nodeps)
+ set my_options(ports_revupgrade) yes
unset -nocomplain my_options(ports_revupgrade_second_run)
if {$broken_port_counts($portname) > 1} {
set my_options(ports_revupgrade_second_run) yes
- set my_options(ports_nodeps) yes
# build from source only until the buildbot has some method of rev-upgrade, too
set my_options(ports_source_only) yes
}
# call macports::upgrade with ports_revupgrade option to rebuild the port
- set status [macports::upgrade $portname "port:$portname" \
+ set status [macports::upgrade $portname port:$portname \
{} [array get my_options] depscache]
ui_debug "Rebuilding port $portname finished with status $status"
if {$status != 0} {
@@ -4520,7 +4686,7 @@
}
}
- if {[info exists options(ports_dryrun)] && $options(ports_dryrun) == "yes"} {
+ if {[info exists options(ports_dryrun)] && $options(ports_dryrun) eq {yes}} {
ui_warn "If this was no dry run, rev-upgrade would now run the checks again to find unresolved and newly created problems"
return 0
}
@@ -4553,18 +4719,18 @@
proc macports::revupgrade_handle_special_paths {fname path} {
set corrected_path $path
- set loaderpath_idx [string first "@loader_path" $corrected_path]
+ set loaderpath_idx [string first @loader_path $corrected_path]
if {$loaderpath_idx != -1} {
- set corrected_path [string replace $corrected_path $loaderpath_idx $loaderpath_idx+11 [file dirname $fname]]
+ set corrected_path [string replace $corrected_path $loaderpath_idx ${loaderpath_idx}+11 [file dirname $fname]]
}
- set executablepath_idx [string first "@executable_path" $corrected_path]
+ set executablepath_idx [string first @executable_path $corrected_path]
if {$executablepath_idx != -1} {
ui_debug "Ignoring loadcommand containing @executable_path in $fname"
error "@executable_path in loadcommand"
}
- set rpath_idx [string first "@rpath" $corrected_path]
+ set rpath_idx [string first @rpath $corrected_path]
if {$rpath_idx != -1} {
ui_debug "Ignoring loadcommand containing @rpath in $fname"
error "@rpath in loadcommand"
@@ -4597,7 +4763,7 @@
lappend adjlist($dep) [lindex $stack 0]
# make this port the new last broken port by prepending it to the stack
set stack [linsert $stack 0 $dep]
-
+
set is_broken_port true
}
if {![info exists visited($dep)]} {
@@ -4620,7 +4786,7 @@
return 1
} elseif {[info exists ping_cache($host)]} {
# expire entries after 1 day
- if {[expr [clock seconds] - [lindex $ping_cache($host) 1]] <= 86400} {
+ if {[clock seconds] - [lindex $ping_cache($host) 1] <= 86400} {
return [lindex $ping_cache($host) 0]
}
}
@@ -4640,19 +4806,19 @@
set archive_sites_conf_values {}
set all_names {}
array set defaults {applications_dir /Applications/MacPorts prefix /opt/local type tbz2}
- set conf_file "${macports_conf_path}/archive_sites.conf"
+ set conf_file ${macports_conf_path}/archive_sites.conf
set conf_options {applications_dir frameworks_dir name prefix type urls}
if {[file isfile $conf_file]} {
set fd [open $conf_file r]
while {[gets $fd line] >= 0} {
if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
if {[lsearch -exact $conf_options $option] >= 0} {
- if {$option == "name"} {
+ if {$option eq {name}} {
set cur_name $val
lappend all_names $val
} elseif {[info exists cur_name]} {
set trimmedval [string trim $val]
- if {$option == "urls"} {
+ if {$option eq {urls}} {
set processed_urls {}
foreach url $trimmedval {
lappend processed_urls ${url}:nosubdir
@@ -4687,8 +4853,8 @@
}
if {![info exists sites($cur_name)]} {
ui_warn "archive_sites.conf: no urls set for $cur_name"
- set sites($cur_name) ""
- lappend archive_sites_conf_values portfetch::mirror_sites::sites($cur_name) ""
+ set sites($cur_name) {}
+ lappend archive_sites_conf_values portfetch::mirror_sites::sites($cur_name) {}
}
}
}
Deleted: branches/new-help-system/base/src/macports1.0/macports_index.tcl
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports_index.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/macports1.0/macports_index.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,378 +0,0 @@
-# macports_index.tcl
-# $Id$
-#
-# Copyright (c) 2004 Apple Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# 31-Mar-2004
-# Kevin Van Vechten <kevin at opedarwin.org>
-#
-
-package provide macports_index 1.0
-
-namespace eval macports::index {
- variable has_sqlite {}
-}
-
-proc macports::index::init {} {
- global macports::index::has_sqlite macports::prefix
- if {$macports::index::has_sqlite == 1 ||
- [file exists ${macports::prefix}/lib/tclsqlite.dylib]} {
- load ${macports::prefix}/lib/tclsqlite.dylib Sqlite
- set macports::index::has_sqlite 1
- } else {
- return -code error "Sqlite must be installed to use a remote index. Use the tclsqlite port."
- }
-}
-
-proc macports::index::get_path {source} {
- global macports::portdbpath
- regsub {://} $source {.} source_dir
- regsub -all {/} $source_dir {_} source_dir
- return [file join $portdbpath sources $source_dir]
-}
-
-
-# macports::index::sync
-# Interact with the remote index at the specified URL.
-# Replays the SQL transactions contained in the remote
-# index file into a local database, creating it if it
-# does not yet exist. If it does already exist, only
-# the transactions newer than the last sync will be
-# downloaded and replayed.
-#
-# portdbpath - the path to which the local database should
-# be stored. "portindex/" and a unique hash based
-# on the url will be appended to this path.
-# url - the url of the remote index to synchronize with
-
-proc macports::index::sync {portdbpath url} {
- macports::index::init
-
- set indexpath [macports::index::get_path $url]
- if {[catch {file mkdir $indexpath} result]} {
- return -code error "$indexpath could not be created: $result"
- }
-
- set oldpath [pwd]
- cd $indexpath
-
- # We actually use http:// as the transport mechanism
- set url [regsub -- {^mports} $url {http}]
-
- # If the database didn't exist, initialize it.
- # The schema is available on the server in the initialize.sql file.
- if {![file exists [file join $indexpath database.sqlite]]} {
- puts "Initializing portindex"
- exec curl --silent -O "$url/index/initialize.sql"
- # XXX detect curl failures
-
- set fd [open initialize.sql r]
- set sql {}
- while {[gets $fd line] >= 0} {
- append sql " $line\n"
- }
- close $fd
- # Database file has the name database.sqlite
- sqlite DB database.sqlite
- DB eval $sql
- DB eval "CREATE TABLE priv_data (keyword text, value int);"
- DB eval "INSERT INTO priv_data (keyword, value) VALUES ('last_index', 1);"
- DB eval "INSERT INTO priv_data (keyword, value) VALUES ('last_trans', 0);"
- DB close
- }
-
- # Database file has the name database.sqlite
- sqlite DB database.sqlite
-
- ##
- # Download any new files
- ##
-
- # Get the last downloaded file index out of the database.
- set start_index [DB eval "SELECT value FROM priv_data WHERE keyword='last_index';"]
-
- # Get the current high-water mark from the server.
- exec curl --silent -O "$url/index/.last_index"
- # XXX detect curl failures
- set fd [open ".last_index" r]
- gets $fd last_index
- # XXX should validate the contents of $last_index
- close $fd
- # Re-fetch the last file we fetched (transactions may have
- # been appended to it) and any new files.
- for {set i $start_index} {$i <= $last_index} {incr i} {
- puts "Fetching portindex-$i"
- exec curl --silent -O "$url/index/portindex-$i.sql"
- # XXX detect curl failures
- DB eval "UPDATE priv_data SET value=$i WHERE keyword='last_index';\n"
- }
-
- ##
- # Replay the transactions
- ##
-
- # Get the last transaction ID out of the database.
- set last_trans [DB eval "SELECT value FROM priv_data WHERE keyword='last_trans';"]
-
- # Iterate through the files we just downloaded
- for {set i $start_index} {$i <= $last_index} {incr i} {
- puts "Processing portindex-$i"
- set fd [open "portindex-$i.sql" r]
- set sql {}
- while {[gets $fd line] >= 0} {
- append sql " $line\n"
- if {[regexp -- {^-- END TRANSACTION #([0-9]+)} $line unused trans_id] == 1} {
- # If this is a transaction we have not seen before, commit it.
- # Also update the last transaction number.
- if {$trans_id > $last_trans} {
- set last_trans $trans_id
- append sql " UPDATE priv_data SET value=$last_trans WHERE keyword='last_trans';\n"
- DB eval $sql
- }
- set sql {}
- }
- }
- close $fd
- }
-
- # Clean Up
- DB close
- cd $oldpath
-}
-
-# macports::index::search
-#
-# Searches the cached copy of the specified port index for
-# the Portfile satisfying the given query.
-#
-# Todo -- in the future we may want to do an implicit "port sync"
-# when this function is called.
-#
-# portdbpath - the path to which the local database should
-# be stored. "portindex/" and a unique hash based
-# on the url will be appended to this path.
-# url - the url of the remote index to search
-#
-# attrs - an array of the attributes to search for
-# currently only "name" is supported.
-
-proc macports::index::search {portdbpath url attrslist} {
- macports::index::init
- set indexpath [macports::index::get_path $url]
-
- if {![file exists $indexpath/database.sqlite]} {
- return -code error "Can't open index file for source $url. Have you synced your source indexes (port sync)?"
- }
-
- sqlite DB $indexpath/database.sqlite
- # Map some functions into the SQL namespace
- DB function regexp regexp
-
- # The guts of the search logic.
- # Precedence is as follows:
- # - If a name, version, and revision is specified return that single port.
- # - If a name and version is specified, return the highest revision
- # - If only a name is specified, return the highest revision of
- # all distinct name, version combinations.
- # - NOTE: it is an error to specify a revision without a version.
-
- set pids [list]
- array set attrs $attrslist
- if {[info exists attrs(name)]} {
- set name $attrs(name)
-
- # If version was not specified, find all distinct versions;
- # otherwise use the specified version.
- if {![info exists attrs(version)]} {
- set sql "SELECT version FROM ports WHERE regexp('--','$name',name) GROUP BY version ORDER BY version DESC"
- set versions [DB eval $sql]
- } else {
- set versions [list $attrs(version)]
- }
-
- # If revision was not specified, find the highest revision;
- # otherwise use the specified revision.
- if {![info exists attrs(revision)]} {
- foreach version $versions {
- set sql "SELECT max(revision) FROM ports WHERE regexp('--','$name',name) AND version LIKE '$version'"
- set revisions($version) [DB eval $sql]
- }
- } else {
- set revisions($version) $attrs(revision)
- }
-
- foreach version $versions {
- set sql "SELECT pid FROM ports WHERE regexp('--','$name',name) AND version LIKE '$version' AND revision LIKE '$revisions($version)'"
- lappend pids [DB eval $sql]
- }
- }
-
- # Historically mportsearch has returned a serialized list of arrays.
- # This is kinda gross and really needs to change to a more opaque
- # data type in the future, but to ease the transition we're it the old
- # way here. For each port that matched the query, build up an array
- # from the keywords table and append it to the list.
-
- set result [list]
-
- foreach pid $pids {
- set portinfo [list]
- set primary_key [DB eval "SELECT name,version,revision FROM ports WHERE pid=$pid"]
- set name [lindex $primary_key 0]
- set version [lindex $primary_key 1]
- set revision [lindex $primary_key 2]
- lappend portinfo name $name
- lappend portinfo version $version
- lappend portinfo revision $revision
-
- set auxiliary_keys [DB eval "SELECT keyword, value FROM keywords WHERE pid=$pid"]
- foreach {key value} $auxiliary_keys {
- # XXX - special case list types: categories, maintainers, master_sites
- lappend portinfo $key $value
- }
-
- # Craft a URL where the port can be found.
- lappend portinfo porturl $url/files/$name/$version/$revision/Portfile.tar.gz
-
- # Make a note of where this port came from.
- lappend portsource $url
-
- lappend result $name
- lappend result $portinfo
- }
-
- DB close
-
- return $result
-}
-
-
-
-# macports::index::fetch_port
-#
-# Checks for a locally cached copy of the port, or downloads the port
-# from the specified URL. The port is extracted into the current working
-# directory along with a .mports_source file containing the url of the
-# source the port came from.
-#
-# The cached portfiles are in the same directory as the cached remote index.
-#
-# TODO - the existing infrastructure only gives us a URL at this point,
-# but we really ought to have an opaque handle to a port. We want to
-# get the source URL and the Portfile.tar.gz md5 from this opaque handle.
-
-proc macports::index::fetch_port {url destdir} {
- global macports::sources
-
- set portsource ""
- set portname ""
- set portversion ""
- set portrevision ""
-
- # Iterate through the sources, to see which one this port is coming from.
- # If the port is not coming from a known source, return an error (for now).
-
- set indexpath ""
- set fetchpath ""
- foreach source $sources {
- if {[regexp -- "^$source" $url] == 1} {
- set portsource $source
- set indexpath [macports::index::get_path $source]
-
- # Extract the relative portion of the url,
- # and append it to the indexpath, this is where
- # we will store the cached Portfile.
- set dir [file dirname [regsub -- "$source/?" $url {}]]
-
- # XXX: crude hack to get port name and version, should realy come from opaque port handle.
- set portname [lindex [file split $dir] 1]
- set portversion [lindex [file split $dir] 2]
- set portrevision [lindex [file split $dir] 3]
-
- set fetchpath [file join $indexpath $dir]
- break
- }
- }
-
- if {$indexpath == "" || $fetchpath == ""} {
- return -code error "Port URL has unknown source: $url"
- }
-
- if {[catch {file mkdir $fetchpath} result]} {
- return -code error $result
- }
-
- # If the portdir already exists, we don't bother extracting again.
-
- # Look to see if the file exists in our cache, if it does, attempt
- # to extract it into the temporary directory that we will build in.
- # If it does not exist, or if the tar extraction fails, then attempt
- # to fetch it again.
-
-
- set portdir [file join "$destdir" "$portname-$portversion"]
-
- if {[file exists $portdir]} {
- return $portdir
- }
-
- if {[catch {file mkdir $portdir} result]} {
- return -code error $result
- }
-
- set fetchfile [file join $fetchpath [file tail $url]]
- set retries 2
- while {$retries > 0} {
- if {[file exists $fetchfile]} {
- set oldcwd [pwd]
- cd $portdir
-
- if {[catch {exec tar -zxf $fetchfile} result]} {
- return -code error "Could not unpack port file: $result"
- }
-
- set fd [open ".mports_source" w]
- puts $fd "source: $portsource"
- puts $fd "port: $portname"
- puts $fd "version: $portversion"
- puts $fd "revision: $portrevision"
- close $fd
-
- cd $oldcwd
- } else {
- # We actually use http:// as the transport mechanism
- set http_url [regsub -- {^mports} $url {http}]
- if {[catch {exec curl -L -s -S -o $fetchfile $http_url} result ]} {
- return -code error "Could not download port from remote index: $result"
- }
- }
- incr retries -1
- }
-
- return $portdir
-}
Modified: branches/new-help-system/base/src/package1.0/portarchivefetch.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portarchivefetch.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/package1.0/portarchivefetch.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,7 +2,7 @@
# $Id$
#
# Copyright (c) 2002 - 2003 Apple Inc.
-# Copyright (c) 2004 - 2012 The MacPorts Project
+# Copyright (c) 2004 - 2013 The MacPorts Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -93,7 +93,8 @@
if {$missing} {
continue
}
- if {$portfetch::mirror_sites::archive_prefix($site) == $prefix &&
+ if {$portfetch::mirror_sites::sites($site) ne {} &&
+ $portfetch::mirror_sites::archive_prefix($site) == $prefix &&
$portfetch::mirror_sites::archive_frameworks_dir($site) == $frameworks_dir &&
$portfetch::mirror_sites::archive_applications_dir($site) == $applications_dir &&
![catch {archiveTypeIsSupported $portfetch::mirror_sites::archive_type($site)}]} {
@@ -152,10 +153,10 @@
# Perform a standard fetch, assembling fetch urls from
# the listed url variable and associated archive file
proc portarchivefetch::fetchfiles {args} {
- global archivefetch.fulldestpath UI_PREFIX
- global archivefetch.user archivefetch.password archivefetch.use_epsv \
- archivefetch.ignore_sslcert
- global portverbose ports_binary_only
+ global archivefetch.fulldestpath UI_PREFIX \
+ archivefetch.user archivefetch.password archivefetch.use_epsv \
+ archivefetch.ignore_sslcert \
+ portverbose ports_binary_only
variable archivefetch_urls
variable ::portfetch::urlmap
Modified: branches/new-help-system/base/src/package1.0/portdmg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portdmg.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/package1.0/portdmg.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -57,8 +57,8 @@
}
proc portdmg::package_dmg {portname portversion portrevision} {
- global UI_PREFIX package.destpath portpath
- global os.platform os.arch os.version os.major
+ global UI_PREFIX package.destpath portpath \
+ os.platform os.arch os.version os.major
if {[expr (${portrevision} > 0)]} {
set imagename "${portname}-${portversion}-${portrevision}"
@@ -71,7 +71,7 @@
set pkgpath ${package.destpath}/${portname}-${portversion}.pkg
if {[file readable $final_image] && ([file mtime ${final_image}] >= [file mtime ${portpath}/Portfile])} {
- ui_msg "$UI_PREFIX [format [msgcat::mc "Disk Image for %s-%s is up-to-date"] ${portname} ${portversion}]"
+ ui_msg "$UI_PREFIX [format [msgcat::mc "Disk Image for %s version %s is up-to-date"] ${portname} ${portversion}]"
return 0
}
Modified: branches/new-help-system/base/src/package1.0/portdpkg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portdpkg.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/package1.0/portdpkg.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -44,8 +44,8 @@
}
# Options
-options dpkg.asroot
-options package.destpath
+options dpkg.asroot \
+ package.destpath
# Set up defaults
default dpkg.asroot yes
Modified: branches/new-help-system/base/src/package1.0/portmdmg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portmdmg.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/package1.0/portmdmg.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,7 +2,7 @@
# portmdmg.tcl
# $Id$
#
-# Copyright (c) 2005, 2007-2011 The MacPorts Project
+# Copyright (c) 2005, 2007-2013 The MacPorts Project
# Copyright (c) 2003-2004 Apple Inc.
# All rights reserved.
#
@@ -57,8 +57,8 @@
}
proc portmdmg::package_mdmg {portname portepoch portversion portrevision} {
- global UI_PREFIX package.destpath portpath
- global os.platform os.arch os.version os.major
+ global UI_PREFIX package.destpath portpath \
+ os.platform os.arch os.version os.major
if {[expr (${portrevision} > 0)]} {
set imagename "${portname}-${portversion}-${portrevision}"
@@ -71,7 +71,7 @@
set mpkgpath [portmpkg::mpkg_path $portname $portepoch $portversion $portrevision]
if {[file readable $final_image] && ([file mtime ${final_image}] >= [file mtime ${portpath}/Portfile])} {
- ui_msg "$UI_PREFIX [format [msgcat::mc "Disk Image for %s-%s is up-to-date"] ${portname} ${portversion}]"
+ ui_msg "$UI_PREFIX [format [msgcat::mc "Disk Image for %s version %s is up-to-date"] ${portname} ${portversion}]"
return 0
}
Modified: branches/new-help-system/base/src/package1.0/portmpkg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portmpkg.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/package1.0/portmpkg.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,7 +2,7 @@
# portmpkg.tcl
# $Id$
#
-# Copyright (c) 2005, 2007 - 2012 The MacPorts Project
+# Copyright (c) 2005, 2007 - 2013 The MacPorts Project
# Copyright (c) 2002 - 2004 Apple Inc.
# All rights reserved.
#
Modified: branches/new-help-system/base/src/package1.0/portpkg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portpkg.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/package1.0/portpkg.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,7 +2,7 @@
# portpkg.tcl
# $Id$
#
-# Copyright (c) 2005, 2007 - 2012 The MacPorts Project
+# Copyright (c) 2005, 2007 - 2013 The MacPorts Project
# Copyright (c) 2002 - 2003 Apple Inc.
# All rights reserved.
#
@@ -99,8 +99,6 @@
proc portpkg::pkg_main {args} {
global subport epoch version revision UI_PREFIX
- ui_msg "$UI_PREFIX [format [msgcat::mc "Creating pkg for %s-%s_%s_%s"] ${subport} ${epoch} ${version} ${revision}]"
-
if {[getuid] == 0 && [geteuid] != 0} {
elevateToRoot "pkg"
}
@@ -111,7 +109,8 @@
proc portpkg::package_pkg {portname portepoch portversion portrevision} {
global UI_PREFIX portdbpath destpath workpath prefix description \
package.flat package.destpath portpath os.version os.major \
- package.resources package.scripts portpkg::packagemaker portpkg::language
+ package.resources package.scripts portpkg::packagemaker \
+ pkg_post_unarchive_deletions portpkg::language
set portepoch_namestr ""
if {${portepoch} != "0"} {
@@ -123,8 +122,11 @@
}
set pkgpath "${package.destpath}/${portname}-${portepoch_namestr}${portversion}${portrevision_namestr}.pkg"
+
+ ui_msg "$UI_PREFIX [format [msgcat::mc "Creating pkg for %s version %s_%s_%s at %s"] ${portname} ${portepoch} ${portversion} ${portrevision} ${pkgpath}]"
+
if {[file readable $pkgpath] && ([file mtime ${pkgpath}] >= [file mtime ${portpath}/Portfile])} {
- ui_msg "$UI_PREFIX [format [msgcat::mc "Package for %s-%s_%s_%s is up-to-date"] ${portname} ${portepoch} ${portversion} ${portrevision}]"
+ ui_msg "$UI_PREFIX [format [msgcat::mc "Package for %s version %s_%s_%s at %s is up-to-date"] ${portname} ${portepoch} ${portversion} ${portrevision} ${pkgpath}]"
return 0
}
@@ -137,6 +139,15 @@
}
}
+ if {[info exists pkg_post_unarchive_deletions]} {
+ foreach rmfile ${pkg_post_unarchive_deletions} {
+ set full_rmfile "${destpath}${prefix}/${rmfile}"
+ if {[file exists "${full_rmfile}"]} {
+ delete "${full_rmfile}"
+ }
+ }
+ }
+
if ([file exists "$packagemaker"]) {
ui_debug "Calling $packagemaker for $portname pkg"
Modified: branches/new-help-system/base/src/package1.0/portrpm.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portrpm.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/package1.0/portrpm.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,7 +2,7 @@
# portrpm.tcl
# $Id$
#
-# Copyright (c) 2005 - 2007, 2009 - 2011 The MacPorts Project
+# Copyright (c) 2005 - 2007, 2009 - 2011, 2013 The MacPorts Project
# Copyright (c) 2002 - 2003 Apple Inc.
# All rights reserved.
#
@@ -43,12 +43,15 @@
}
# Options
-options rpm.asroot
-options package.destpath
+options rpm.asroot \
+ package.destpath
# Set up defaults
default rpm.asroot yes
+default rpm.srcdir {${prefix}/src/macports}
+default rpm.tmpdir {${prefix}/var/tmp}
+
set_ui_prefix
proc portrpm::rpm_main {args} {
@@ -60,8 +63,10 @@
}
proc portrpm::rpm_pkg {portname portversion portrevision} {
- global UI_PREFIX rpm.asroot package.destpath portdbpath destpath workpath prefix categories maintainers description long_description homepage epoch portpath
- global os.platform os.arch os.version os.major supported_archs configure.build_arch license
+ global UI_PREFIX rpm.asroot package.destpath portdbpath destpath workpath \
+ prefix categories maintainers description long_description \
+ homepage epoch portpath os.platform os.arch os.version os.major \
+ supported_archs configure.build_arch license
set rpmdestpath ""
if {![string equal ${package.destpath} ${workpath}] && ![string equal ${package.destpath} ""]} {
@@ -89,7 +94,7 @@
set rpmpath "$dir/${arch}/${portname}-${portversion}-${portrevision}.${arch}.rpm"
if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
ui_debug "$rpmpath"
- ui_msg "$UI_PREFIX [format [msgcat::mc "RPM package for %s-%s is up-to-date"] ${portname} ${portversion}]"
+ ui_msg "$UI_PREFIX [format [msgcat::mc "RPM package for %s version %s is up-to-date"] ${portname} ${portversion}]"
return 0
}
}
Modified: branches/new-help-system/base/src/package1.0/portsrpm.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portsrpm.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/package1.0/portsrpm.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,7 +2,7 @@
# portsrpm.tcl
# $Id$
#
-# Copyright (c) 2007, 2009, 2011 The MacPorts Project
+# Copyright (c) 2007, 2009, 2011, 2013 The MacPorts Project
# Copyright (c) 2002 - 2003 Apple Inc.
# All rights reserved.
#
@@ -45,6 +45,9 @@
options package.destpath
+# Set up defaults
+default srpm.asroot yes
+
set_ui_prefix
proc portsrpm::srpm_main {args} {
@@ -56,9 +59,14 @@
}
proc portsrpm::srpm_pkg {portname portversion portrevision} {
- global UI_PREFIX package.destpath portdbpath destpath workpath distpath prefix categories maintainers description long_description homepage epoch portpath distfiles fetch_urls
- global os.platform os.arch os.version os.major
+ global UI_PREFIX package.destpath portdbpath destpath workpath distpath \
+ prefix categories maintainers description long_description \
+ homepage epoch portpath distfiles os.platform os.arch os.version \
+ os.major
+ set fetch_urls {}
+ portfetch::checkfiles fetch_urls
+
set rpmdestpath ""
if {![string equal ${package.destpath} ${workpath}] && ![string equal ${package.destpath} ""]} {
set pkgpath ${package.destpath}
@@ -75,7 +83,7 @@
set rpmpath "$dir/${portname}-${portversion}-${portrevision}.${arch}.rpm"
if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
ui_debug "$rpmpath"
- ui_msg "$UI_PREFIX [format [msgcat::mc "SRPM package for %s-%s is up-to-date"] ${portname} ${portversion}]"
+ ui_msg "$UI_PREFIX [format [msgcat::mc "SRPM package for %s version %s is up-to-date"] ${portname} ${portversion}]"
return 0
}
}
@@ -114,12 +122,17 @@
set sourcespath "`rpm --eval %{_sourcedir}`"
system "cp -p ${portpath}/Portfile ${sourcespath}/$portname-Portfile"
- system "cd ${portpath} && zip -r -q ${sourcespath}/$portname-files.zip files -x \\*.DS_Store -x files/.svn\\*"
+ if {[info exists ${portpath}/files]} {
+ system "cd ${portpath} && zip -r -q ${sourcespath}/$portname-files.zip files -x \\*.DS_Store -x files/.svn\\*"
+ set zip $portname-files.zip
+ } else {
+ set zip ""
+ }
foreach dist $distfiles {
system "cp -p ${distpath}/${dist} ${sourcespath}/${dist}"
}
- write_port_spec ${specpath} $portname $portversion $portrevision $pkg_description $pkg_long_description $pkg_homepage $category $license $maintainer $distfiles $fetch_urls $dependencies $epoch $src
+ write_port_spec ${specpath} $portname $portversion $portrevision $pkg_description $pkg_long_description $pkg_homepage $category $license $maintainer $distfiles $fetch_urls $dependencies $epoch $src $zip
system "rpmbuild -bs -v --nodeps ${rpmdestpath} ${specpath}"
return 0
@@ -192,7 +205,7 @@
return $text
}
-proc portsrpm::write_port_spec {specfile portname portversion portrevision description long_description homepage category license maintainer distfiles fetch_urls dependencies epoch src} {
+proc portsrpm::write_port_spec {specfile portname portversion portrevision description long_description homepage category license maintainer distfiles fetch_urls dependencies epoch src zip} {
set specfd [open ${specfile} w+]
set origportname ${portname}
regsub -all -- "\-" $portversion "_" portversion
@@ -210,8 +223,10 @@
License: ${license}
URL: ${homepage}
BuildRoot: %{_tmppath}/%{name}-%{version}-root
-Source0: ${portname}-Portfile
-Source1: ${portname}-files.zip"
+Source0: ${portname}-Portfile"
+ if {$zip != ""} {
+ puts $specfd "Source1: $zip"
+ }
if {[expr ${epoch} != 0]} {
puts $specfd "Epoch: ${epoch}"
}
@@ -224,7 +239,7 @@
if {![info exists $fetch_urls]} {
foreach {url_var distfile} ${fetch_urls} {
if {[string equal $distfile $file]} {
- global portfetch::$url_var
+ global portfetch::$url_var master_sites
set site [lindex [set $url_var] 0]
set file [portfetch::assemble_url $site $distfile]
break
@@ -244,12 +259,17 @@
}
}
set wrap_description [word_wrap ${long_description} 72]
+ if {$zip != ""} {
+ set and "-a 1"
+ } else {
+ set and ""
+ }
puts $specfd "
%description
$wrap_description
%prep
-%setup -c -a 1 -T
+%setup -c $and -T
cp -p %{SOURCE0} Portfile
#prepare work area
port fetch
Modified: branches/new-help-system/base/src/package1.0/portunarchive.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portunarchive.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/package1.0/portunarchive.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -201,7 +201,7 @@
return -code error "No '$tar' was found on this system!"
}
}
- xar|xpkg {
+ xar {
set xar "xar"
if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
ui_debug "Using $xar"
@@ -278,6 +278,7 @@
file copy -force $plus_state $statefile
file mtime $statefile [clock seconds]
chownAsRoot $statefile
+ update_statefile checksum [sha256 file [option portpath]/Portfile] $statefile
set newstate 1
} else {
# fake it
Property changes on: branches/new-help-system/base/src/pextlib1.0
___________________________________________________________________
Modified: svn:ignore
- *.dylib
pkgIndex.tcl
+ *.dylib
Makefile
pkgIndex.tcl
Deleted: branches/new-help-system/base/src/pextlib1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/Makefile 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/pextlib1.0/Makefile 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,25 +0,0 @@
-OBJS= \
- Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
- fs-traverse.o strcasecmp.o vercomp.o filemap.o base32cmd.o \
- sha1cmd.o curl.o rmd160cmd.o sha256cmd.o readline.o uid.o \
- tracelib.o tty.o readdir.o pipe.o flock.o \
- system.o mktemp.o realpath.o
-SHLIB_NAME= Pextlib${SHLIB_SUFFIX}
-INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
-
-include ../../Mk/macports.autoconf.mk
-include ../../Mk/macports.tea.mk
-
-CFLAGS+= ${CURL_CFLAGS} ${MD5_CFLAGS} ${READLINE_CFLAGS}
-LIBS+= ${CURL_LIBS} ${MD5_LIBS} ${READLINE_LIBS}
-
-.PHONY: test
-
-test:: ${SHLIB_NAME}
- ${TCLSH} tests/checksums.tcl ./${SHLIB_NAME}
- ${TCLSH} tests/curl.tcl ./${SHLIB_NAME}
- ${TCLSH} tests/filemap.tcl ./${SHLIB_NAME}
- ${TCLSH} tests/fs-traverse.tcl ./${SHLIB_NAME}
- ${TCLSH} tests/symlink.tcl ./${SHLIB_NAME}
- ${TCLSH} tests/unsetenv.tcl ./${SHLIB_NAME}
- ${TCLSH} tests/vercomp.tcl ./${SHLIB_NAME}
Copied: branches/new-help-system/base/src/pextlib1.0/Makefile.in (from rev 110831, trunk/base/src/pextlib1.0/Makefile.in)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/Makefile.in (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/Makefile.in 2013-09-07 09:48:49 UTC (rev 110832)
@@ -0,0 +1,34 @@
+OBJS= \
+ Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
+ fs-traverse.o strcasecmp.o vercomp.o filemap.o base32cmd.o \
+ sha1cmd.o curl.o rmd160cmd.o sha256cmd.o readline.o uid.o \
+ tracelib.o tty.o readdir.o pipe.o flock.o system.o \
+ mktemp.o realpath.o
+ifneq (@ac_cv_func_strlcat@,yes)
+OBJS+=strlcat.o
+endif
+
+SHLIB_NAME= Pextlib${SHLIB_SUFFIX}
+INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
+
+include ../../Mk/macports.autoconf.mk
+include ../../Mk/macports.tea.mk
+
+CFLAGS+= ${CURL_CFLAGS} ${MD5_CFLAGS} ${READLINE_CFLAGS}
+LIBS+= ${CURL_LIBS} ${MD5_LIBS} ${READLINE_LIBS}
+ifeq ($(shell uname), Darwin)
+LIBS+= ../registry2.0/registry${SHLIB_SUFFIX}
+SHLIB_LDFLAGS+= -install_name ${datadir}/macports/Tcl/pextlib1.0/${SHLIB_NAME}
+${SHLIB_NAME}: ../registry2.0/registry${SHLIB_SUFFIX}
+endif
+
+.PHONY: test
+
+test:: ${SHLIB_NAME}
+ ${TCLSH} tests/checksums.tcl ./${SHLIB_NAME}
+ ${TCLSH} tests/curl.tcl ./${SHLIB_NAME}
+ ${TCLSH} tests/filemap.tcl ./${SHLIB_NAME}
+ ${TCLSH} tests/fs-traverse.tcl ./${SHLIB_NAME}
+ ${TCLSH} tests/symlink.tcl ./${SHLIB_NAME}
+ ${TCLSH} tests/unsetenv.tcl ./${SHLIB_NAME}
+ ${TCLSH} tests/vercomp.tcl ./${SHLIB_NAME}
Property changes on: branches/new-help-system/base/src/pextlib1.0/Makefile.in
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:mergeinfo
+ /branches/gsoc08-privileges/base/src/pextlib1.0/Makefile:37343-46937
/branches/gsoc08-privileges/base/src/pextlib1.0/Makefile.in:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/Makefile:51231-60371
/branches/gsoc09-logging/base/src/pextlib1.0/Makefile.in:51231-60371
/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile:78828-88375
/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile.in:78828-88375
/branches/universal-sanity/base/src/pextlib1.0/Makefile:51872-52323
/branches/universal-sanity/base/src/pextlib1.0/Makefile.in:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/Makefile:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/branches/variant-descs-14482/base/src/pextlib1.0/Makefile.in:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/Makefile.in:49341-104698,108155-110831
/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile:45682-46060
/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile.in:45682-46060
/users/perry/base-select/src/pextlib1.0/Makefile:44044-44692
/users/perry/base-select/src/pextlib1.0/Makefile.in:44044-44692
Added: svn:eol-style
+ native
Modified: branches/new-help-system/base/src/pextlib1.0/curl.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/curl.c 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/pextlib1.0/curl.c 2013-09-07 09:48:49 UTC (rev 110832)
@@ -127,7 +127,7 @@
const char* theUserPassString = NULL;
const char* effectiveURLVarName = NULL;
char* effectiveURL = NULL;
- char* userAgent = PACKAGE_STRING " libcurl/" LIBCURL_VERSION;
+ char* userAgent = PACKAGE_NAME "/" PACKAGE_VERSION " libcurl/" LIBCURL_VERSION;
int optioncrsr;
int lastoption;
const char* theURL;
Copied: branches/new-help-system/base/src/pextlib1.0/strlcat.c (from rev 110831, trunk/base/src/pextlib1.0/strlcat.c)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/strlcat.c (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/strlcat.c 2013-09-07 09:48:49 UTC (rev 110832)
@@ -0,0 +1,39 @@
+/* $Id$
+**
+** Replacement for a missing strlcat.
+**
+** Written by Russ Allbery <rra at stanford.edu>
+** This work is hereby placed in the public domain by its author.
+**
+** Provides the same functionality as the *BSD function strlcat, originally
+** developed by Todd Miller and Theo de Raadt. strlcat works similarly to
+** strncat, except simpler. The result is always nul-terminated even if the
+** source string is longer than the space remaining in the destination
+** string, and the total space required is returned. The third argument is
+** the total space available in the destination buffer, not just the amount
+** of space remaining.
+*/
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef HAVE_STRLCAT
+
+#include <stddef.h>
+#include <string.h>
+
+size_t strlcat(char *dst, const char *src, size_t size)
+{
+ size_t used, length, copy;
+
+ used = strlen(dst);
+ length = strlen(src);
+ if (size > 0 && used < size - 1) {
+ copy = (length >= size - used) ? size - used - 1 : length;
+ memcpy(dst + used, src, copy);
+ dst[used + copy] = '\0';
+ }
+ return used + length;
+}
+#endif
Copied: branches/new-help-system/base/src/pextlib1.0/strlcat.h (from rev 110831, trunk/base/src/pextlib1.0/strlcat.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/strlcat.h (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/strlcat.h 2013-09-07 09:48:49 UTC (rev 110832)
@@ -0,0 +1,6 @@
+/* $Id$ */
+#ifdef HAVE_STRLCAT
+#include <string.h>
+#else
+size_t strlcat(char *dst, const char *src, size_t size);
+#endif
Modified: branches/new-help-system/base/src/pextlib1.0/system.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/system.c 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/pextlib1.0/system.c 2013-09-07 09:48:49 UTC (rev 110832)
@@ -80,11 +80,11 @@
static int check_sandboxing(Tcl_Interp *interp, char **sandbox_exec_path, char **profilestr)
{
Tcl_Obj *tcl_result;
- int supported;
+ int active;
int len;
- tcl_result = Tcl_GetVar2Ex(interp, "portsandbox_supported", NULL, TCL_GLOBAL_ONLY);
- if (!tcl_result || Tcl_GetBooleanFromObj(interp, tcl_result, &supported) != TCL_OK || !supported) {
+ tcl_result = Tcl_GetVar2Ex(interp, "portsandbox_active", NULL, TCL_GLOBAL_ONLY);
+ if (!tcl_result || Tcl_GetBooleanFromObj(interp, tcl_result, &active) != TCL_OK || !active) {
return 0;
}
Modified: branches/new-help-system/base/src/pextlib1.0/tracelib.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tracelib.c 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/pextlib1.0/tracelib.c 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,3 +1,5 @@
+/* # -*- coding: utf-8; mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=c:et:sw=4:ts=4:sts=4
+ */
/*
* tracelib.c
* $Id$
@@ -2,3 +4,4 @@
*
- * Copyright (c) 2007 Eugene Pimenov (GSoC), The MacPorts Project.
+ * Copyright (c) 2007-2008 Eugene Pimenov (GSoC)
+ * Copyright (c) 2008-2010, 2012-2013 The MacPorts Project
* All rights reserved.
@@ -16,7 +19,7 @@
* 3. Neither the name of the MacPorts Team nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -34,651 +37,870 @@
#include <config.h>
#endif
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <pthread.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <sys/time.h>
+#if HAVE_SYS_EVENT_H
+#include <sys/event.h>
+#endif
#include <sys/resource.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/socket.h>
+#include <sys/time.h>
#include <sys/types.h>
-#include <sys/select.h>
#include <sys/un.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <pthread.h>
-#include <limits.h>
+#include <unistd.h>
+
+#include <cregistry/entry.h>
+#include <registry2.0/registry.h>
+
#include "tracelib.h"
+#include "strlcat.h"
+
+#ifdef __APPLE__
#ifndef HAVE_STRLCPY
/* Define strlcpy if it's not available. */
-size_t strlcpy(char* dst, const char* src, size_t size);
-size_t strlcpy(char* dst, const char* src, size_t size)
-{
- size_t result = strlen(src);
- if (size > 0)
- {
- size_t copylen = size - 1;
- if (copylen > result)
- {
- copylen = result;
- }
- memcpy(dst, src, copylen);
- dst[copylen] = 0;
- }
- return result;
+size_t strlcpy(char *dst, const char *src, size_t size);
+size_t strlcpy(char *dst, const char *src, size_t size) {
+ size_t result = strlen(src);
+ if (size > 0) {
+ size_t copylen = size - 1;
+ if (copylen > result) {
+ copylen = result;
+ }
+ memcpy(dst, src, copylen);
+ dst[copylen] = 0;
+ }
+ return result;
}
#endif
-static char * name;
-static char * sandbox;
-static char * filemap, * filemap_end;
-static char * depends;
-static int sock=-1;
-static int enable_fence=0;
-static Tcl_Interp * interp;
-static pthread_mutex_t sock_mutex=PTHREAD_MUTEX_INITIALIZER;
-static int cleanuping=0;
-static char * sdk=
-#ifdef TRACE_SDK
- /*"MacOSX10.4u.sdk"*/
- TRACE_SDK
-#else
- 0
-#endif
-;
+static char *name;
+static char *sandbox;
+static char *filemap, *filemap_end;
+static char *depends;
+static int sock = -1;
+static int kq = -1;
+/* EVFILT_USER isn't available (< 10.6), use the self-pipe trick to return from
+ * the blocking kqueue(2) call by writing a byte to the pipe */
+static int selfpipe[2];
+static int enable_fence = 0;
+static Tcl_Interp *interp;
+static pthread_mutex_t sock_mutex = PTHREAD_MUTEX_INITIALIZER;
+static int cleanuping = 0;
+static char *sdk = NULL;
static void send_file_map(int sock);
-static void dep_check(int sock, const char * path);
-static void sandbox_violation(int sock, const char * path);
-static void ui_warn(const char * format, ...);
-static void ui_info(const char * format, ...);
+static void dep_check(int sock, char *path);
+static void sandbox_violation(int sock, const char *path);
+static void ui_warn(const char *format, ...);
+#if 0
+static void ui_info(const char *format, ...);
+#endif
static void ui_error(const char *format, ...);
-#define MAX_SOCKETS ((FD_SETSIZE)-1)
+#define MAX_SOCKETS (1024)
+#define BUFSIZE (1024)
-static int TracelibSetNameCmd(Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[])
-{
- if (objc != 3)
- {
- Tcl_WrongNumArgs(interp, 2, objv, "number of arguments should be exactly 3");
- return TCL_ERROR;
- }
-
- name=strdup(Tcl_GetString(objv[2]));
- if (!name) {
- Tcl_SetResult(interp, "memory allocation failed", TCL_STATIC);
- return TCL_ERROR;
- }
-
- return TCL_OK;
+/**
+ * send a buffer \c buf with the given length \c size to the socket \c sock, by
+ * using the communication protocol between darwintrace and tracelib (i.e., by
+ * prefixing the code with a uint32_t containing the length of the message)
+ *
+ * \param[in] sock the socket to send to
+ * \param[in] buf the buffer to send, should contain at least \c size bytes
+ * \param[in] size the number of bytes in \c buf
+ */
+static void answer_s(int sock, const char *buf, uint32_t size) {
+ send(sock, &size, sizeof(size), 0);
+ send(sock, buf, size, 0);
}
-/*
- * Save sandbox path into memory and prepare it for checks.
- * For now it just change : to \0, and add last \0
+/**
+ * send a '\0'-terminated string given in \c buf to the socket \c by using the
+ * communication protocol between darwintrace and tracelib. See \c answer_s for
+ * details.
+ *
+ * \param[in] sock the socket to send to
+ * \param[in] buf the string to send; must be \0-terminated
+ */
+static void answer(int sock, const char *buf) {
+ answer_s(sock, buf, (uint32_t) strlen(buf));
+}
+
+/**
+ * Sets the path of the tracelib unix socket where darwintrace should attempt
+ * to connect to. This path should be specific to the port being installed.
+ * Different sockets should be used for different ports (and maybe even
+ * phases).
+ *
+ * \param[inout] interp the Tcl interpreter
+ * \param[in] objc the number of parameters
+ * \param[in] the parameters
+ * \return a Tcl return code
+ */
+static int TracelibSetNameCmd(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "number of arguments should be exactly 3");
+ return TCL_ERROR;
+ }
+
+ name = strdup(Tcl_GetString(objv[2]));
+ if (!name) {
+ Tcl_SetResult(interp, "memory allocation failed", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+/**
+ * Save sandbox boundaries to memory and format them for darwintrace. This
+ * means changing : to \0 (with \ being an escape char).
+ *
* Input:
- * /dev/null:/dev/tty:/tmp
+ * /dev/null:/dev/tty:/tmp\:
* In variable;
- * /dev/null\0/dev/tty\0/tmp\0\0
+ * /dev/null\0/dev/tty\0/tmp:\0\0
+ *
+ * \param[inout] interp the Tcl interpreter
+ * \param[in] objc the number of parameters
+ * \param[in] the parameters
+ * \return a Tcl return code
*/
-static int TracelibSetSandboxCmd(Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[])
-{
- int len;
- char * t;
-
- if (objc != 3)
- {
- Tcl_WrongNumArgs(interp, 2, objv, "number of arguments should be exactly 3");
- return TCL_ERROR;
- }
-
- len=strlen(Tcl_GetString(objv[2]))+2;
- sandbox=(char*)malloc(len);
- if (!sandbox) {
- Tcl_SetResult(interp, "memory allocation failed", TCL_STATIC);
- return TCL_ERROR;
- }
- memset(sandbox, 0, len);
- strlcpy(sandbox, Tcl_GetString(objv[2]), len);
- for(t=sandbox;(t=strchr(t+1, ':'));)
- {
- /* : -> \0 */
- if(t[-1]!='\\')
- *t=0;
- else
- /* \: -> : */
- /* TODO \\: -> \: */
- memmove(t-1, t, strlen(t));
- }
-
- return TCL_OK;
+static int TracelibSetSandboxCmd(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ int len;
+ char *src, *dst;
+ enum { NORMAL, ESCAPE } state = NORMAL;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "number of arguments should be exactly 3");
+ return TCL_ERROR;
+ }
+
+ src = Tcl_GetString(objv[2]);
+ len = strlen(src) + 2;
+ sandbox = malloc(len);
+ if (!sandbox) {
+ Tcl_SetResult(interp, "memory allocation failed", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ for (dst = sandbox; *src != '\0'; src++) {
+ switch (*src) {
+ case '\\':
+ if (state == ESCAPE) {
+ /* double backslash, turn into single backslash (note
+ * C strings use \ as escape char, too! */
+ *dst++ = '\\';
+ state = NORMAL;
+ } else {
+ /* hit a backslash, assume this is an escape sequence */
+ state = ESCAPE;
+ }
+ break;
+ case ':':
+ if (state == ESCAPE) {
+ /* : was escaped, keep literally */
+ *dst++ = ':';
+ state = NORMAL;
+ } else {
+ /* : -> \0, unless it has been escaped */
+ *dst++ = '\0';
+ }
+ break;
+ default:
+ if (state == ESCAPE) {
+ /* unknown escape sequence, free buffer and raise an error */
+ free(sandbox);
+ Tcl_SetResult(interp, "unknown escape sequence", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ /* otherwise: copy the char */
+ *dst++ = *src;
+ break;
+ }
+ }
+ /* add two \0 to mark the end */
+ *dst++ = '\0';
+ *dst = '\0';
+
+ return TCL_OK;
}
-/*
- * Is there more data? (return 1 if more data in socket, 0 otherwise)
+/**
+ * Receive line from socket, parse it and send an answer, if necessary. The
+ * caller should ensure that data is available for reading from the given
+ * socket. This method will block until a complete message has been read.
+ *
+ * \param[in] sock the socket to communicate with
+ * \return 1, if the communication was successful, 0 in case of errors and/or
+ * when the socket should be closed
*/
-static char can_I_recv_more(int sock)
-{
- struct timeval tv;
- fd_set fdr;
- tv.tv_sec = 0;
- tv.tv_usec = 0;
+static int process_line(int sock) {
+ char *f;
+ char buf[BUFSIZE];
+ uint32_t len;
+ ssize_t ret;
- FD_ZERO(&fdr);
- FD_SET(sock, &fdr);
- return select(sock+1, &fdr, 0, 0, &tv) == 1;
+ if ((ret = recv(sock, &len, sizeof(len), MSG_WAITALL)) != sizeof(len)) {
+ if (ret < 0) {
+ perror("tracelib: recv");
+ } else if (ret == 0) {
+ /* this usually means the socket was closed by the remote side */
+ } else {
+ fprintf(stderr, "tracelib: partial data received: expected %ld, but got %ld on socket %d\n", (unsigned long) sizeof(len), (unsigned long) ret, sock);
+ }
+ return 0;
+ }
+
+ if (len > BUFSIZE - 1) {
+ fprintf(stderr, "tracelib: transfer too large: %ld bytes sent, but buffer holds %d on socket %d\n", (unsigned long) len, (int) (BUFSIZE - 1), sock);
+ return 0;
+ }
+
+ if ((ret = recv(sock, buf, len, MSG_WAITALL)) != (ssize_t) len) {
+ if (ret < 0) {
+ perror("tracelib: recv");
+ } else {
+ fprintf(stderr, "tracelib: partial data received: expected %ld, but got %ld on socket %d\n", (unsigned long) len, (unsigned long) ret, sock);
+ }
+ return 0;
+ }
+ buf[len] = '\0';
+
+ f = strchr(buf, '\t');
+ if (!f) {
+ fprintf(stderr, "tracelib: malformed command '%s' from socket %d\n", buf, sock);
+ return 0;
+ }
+
+ /* Replace \t with \0 */
+ *f = '\0';
+ /* Advance pointer to arguments */
+ f++;
+
+ if (strcmp(buf, "filemap") == 0) {
+ send_file_map(sock);
+ } else if (strcmp(buf, "sandbox_violation") == 0) {
+ sandbox_violation(sock, f);
+ } else if (strcmp(buf, "dep_check") == 0) {
+ dep_check(sock, f);
+ } else {
+ fprintf(stderr, "tracelib: unexpected command %s (%s)\n", buf, f);
+ return 0;
+ }
+
+ return 1;
}
-/*
- * receive line from socket, parse it and send answer
+/**
+ * Construct an in-memory representation of the sandbox file map and send it to
+ * the socket indicated by \c sock.
+ *
+ * \param[in] sock the socket to send the sandbox bounds to
*/
-static char process_line(int sock)
-{
- char * t, buf[1024]={0}, *f, *next_t;
- int len;
-
- if((len=recv(sock, buf, sizeof(buf) - 1, 0))==-1)
- return 0;
- if(!len)
- return 0;
-
- buf[len] = '\0';
-
- for(t=buf;*t&&t-buf<(int)sizeof(buf);t=next_t)
- {
- next_t = t+strlen(t)+1;
- if(next_t == buf + sizeof(buf) && len == sizeof(buf) - 1)
- {
- memmove(buf, t, next_t - t);
- t = buf;
- {
- char * end_of_t = t + strlen(t);
- *end_of_t = ' ';
- for(;can_I_recv_more(sock);)
- {
- if(recv(sock, end_of_t, 1, 0) != 1)
- {
- ui_warn("recv failed");
- return 0;
- }
- if(*end_of_t++ == '\0')
- break;
- }
- }
- }
-
- f=strchr(t, '\t');
- if(!f)
- {
- ui_warn("malformed command %s", t);
- break;
- }
+static void send_file_map(int sock) {
+ if (!filemap) {
+ char *t, * _;
- /* Replace \t with \0 */
- *f = '\0';
- /* Advance pointer to arguments */
- f++;
+ size_t remaining = 1024;
+ filemap = (char *)malloc(remaining);
+ if (!filemap) {
+ ui_warn("send_file_map: memory allocation failed");
+ return;
+ }
+ t = filemap;
- if(!strcmp(t, "filemap"))
- {
- send_file_map(sock);
- }else if(!strcmp(t, "sandbox_violation"))
- {
- sandbox_violation(sock, f);
- }else if(!strcmp(t, "dep_check"))
- {
- dep_check(sock, f);
- }else if(!strcmp(t, "execve"))
- {
- /* ====================== */
- /* = TODO: do something = */
- /* ====================== */
- }else
- {
- ui_warn("unknown command %s (%s)", t, f);
- }
- }
- return 1;
-}
+# define append_allow(path, resolution) do { strlcpy(t, path, remaining); \
+ if (remaining < (strlen(t)+3)) \
+ remaining=0; \
+ else \
+ remaining-=strlen(t)+3; \
+ t+=strlen(t)+1; \
+ *t++=resolution; \
+ *t++=0; \
+ } while(0);
-static void send_file_map(int sock)
-{
- if(!filemap)
- {
- char * t, * _;
-
- size_t remaining = 1024;
- filemap=(char*)malloc(remaining);
- if (!filemap) {
- ui_warn("send_file_map: memory allocation failed");
- return;
- }
- t=filemap;
-
- #define append_allow(path, resolution) do { strlcpy(t, path, remaining); \
- if (remaining < (strlen(t)+3)) \
- remaining=0; \
- else \
- remaining-=strlen(t)+3; \
- t+=strlen(t)+1; \
- *t++=resolution; \
- *t++=0; \
- } while(0);
- if(enable_fence)
- {
- for(_=sandbox; *_; _+=strlen(_)+1)
- append_allow(_, 0);
-
- append_allow("/bin", 0);
- append_allow("/sbin", 0);
- append_allow("/dev", 0);
- append_allow(Tcl_GetVar(interp, "prefix", TCL_GLOBAL_ONLY), 2);
- /* If there is no SDK we will allow everything in /usr /System/Library etc, else add binaries to allow, and redirect root to SDK. */
- if(sdk&&*sdk)
- {
- char buf[260];
- buf[0] = '\0';
- strlcat(buf, Tcl_GetVar(interp, "developer_dir", TCL_GLOBAL_ONLY), 260);
- strlcat(buf, "/SDKs/", 260);
- strlcat(buf, sdk, 260);
-
- append_allow("/usr/bin", 0);
- append_allow("/usr/sbin", 0);
- append_allow("/usr/libexec/gcc", 0);
- append_allow("/System/Library/Perl", 0);
- append_allow("/", 1);
- strlcpy(t-1, buf, remaining);
- t+=strlen(t)+1;
- }else
- {
- append_allow("/usr", 0);
- append_allow("/System/Library", 0);
- append_allow("/Library", 0);
- append_allow(Tcl_GetVar(interp, "developer_dir", TCL_GLOBAL_ONLY), 0);
- }
- }else
- append_allow("/", 0);
- filemap_end=t;
- #undef append_allow
- }
-
- {
- size_t s=filemap_end-filemap;
- send(sock, &s, sizeof(s), 0);
- send(sock, filemap, s, 0);
- }
+ if (enable_fence) {
+ for (_ = sandbox; *_; _ += strlen(_) + 1) {
+ append_allow(_, 0);
+ }
+
+ append_allow("/bin", 0);
+ append_allow("/sbin", 0);
+ append_allow("/dev", 0);
+ append_allow(Tcl_GetVar(interp, "prefix", TCL_GLOBAL_ONLY), 2);
+ /* If there is no SDK we will allow everything in /usr /System/Library etc, else add binaries to allow, and redirect root to SDK. */
+ if (sdk && *sdk) {
+ char buf[260];
+ buf[0] = '\0';
+ strlcat(buf, Tcl_GetVar(interp, "developer_dir", TCL_GLOBAL_ONLY), 260);
+ strlcat(buf, "/SDKs/", 260);
+ strlcat(buf, sdk, 260);
+
+ append_allow("/usr/bin", 0);
+ append_allow("/usr/sbin", 0);
+ append_allow("/usr/libexec/gcc", 0);
+ append_allow("/System/Library/Perl", 0);
+ append_allow("/", 1);
+ strlcpy(t - 1, buf, remaining);
+ t += strlen(t) + 1;
+ } else {
+ append_allow("/usr", 0);
+ append_allow("/System/Library", 0);
+ append_allow("/Library", 0);
+ append_allow(Tcl_GetVar(interp, "developer_dir", TCL_GLOBAL_ONLY), 0);
+ }
+ } else {
+ append_allow("/", 0);
+ }
+ append_allow("", 0);
+ filemap_end = t;
+# undef append_allow
+ }
+
+ answer_s(sock, filemap, filemap_end - filemap);
}
-static void sandbox_violation(int sock UNUSED, const char * path)
-{
- Tcl_SetVar(interp, "path", path, 0);
- Tcl_Eval(interp, "slave_add_sandbox_violation $path");
- Tcl_UnsetVar(interp, "path", 0);
+/**
+ * Process a sandbox violation reported by darwintrace. Calls back up to Tcl to
+ * run a callback with the reported violation path.
+ *
+ * \param[in] sock socket reporting the violation; unused.
+ * \param[in] path the offending path to be passed to the callback
+ */
+static void sandbox_violation(int sock UNUSED, const char *path) {
+ Tcl_SetVar(interp, "path", path, 0);
+ Tcl_Eval(interp, "slave_add_sandbox_violation $path");
+ Tcl_UnsetVar(interp, "path", 0);
}
-static void dep_check(int sock, const char * path)
-{
- char * port=0;
- size_t len=1;
- char resolution='!';
- int tcl_retval;
-
- Tcl_SetVar(interp, "path", path, 0);
- /* FIXME: Use C registry API */
- tcl_retval = Tcl_Eval(interp, "registry::file_registered $path");
- port = strdup(Tcl_GetStringResult(interp));
- if (!port) {
- ui_warn("dep_check: memory allocation failed");
- return;
- }
- if (tcl_retval != TCL_OK) {
- ui_error("failed to run registry::file_registered \"%s\": %s", path, port);
- }
- Tcl_UnsetVar(interp, "path", 0);
-
- if (tcl_retval == TCL_OK && (*port != '0' || port[1])) {
- char *t;
-
- t = depends;
- for (; *t; t += strlen(t) + 1) {
- /* fprintf(stderr, "trace: %s =?= %s\n", t, port); */
- if (!strcmp(t, port)) {
- resolution = '+';
- break;
- }
- }
- }
+/**
+ * Check whether a path is in the transitive hull of dependencies of the port
+ * currently being installed and send the result of the query back to the
+ * socket.
+ *
+ * Sends one of the following characters as return code to the socket:
+ * - #: in case of errors. Not handled by the darwintrace code, which will
+ * lead to an error and the termination of the processing that sent the
+ * request causing this error.
+ * - ?: if the file isn't known to MacPorts (i.e., not registered to any port)
+ * - +: if the file was installed by a dependency and access should be granted
+ * - !: if the file was installed by a MacPorts port which is not in the
+ * transitive hull of dependencies and access should be denied.
+ *
+ * \param[in] sock the socket to answer to
+ * \param[in] path the path to return the dependency information for
+ */
+static void dep_check(int sock, char *path) {
+ char *port = 0;
+ char *t;
+ reg_registry *reg;
+ reg_entry entry;
+ reg_error error;
- if (resolution != '+') {
- if (*port == '0' && !port[1]) {
- ui_info("trace: access denied to %s (*unknown*)", path);
- } else {
- ui_info("trace: access denied to %s (%s)", path, port);
- }
+ if (NULL == (reg = registry_for(interp, reg_attached))) {
+ ui_error(Tcl_GetStringResult(interp));
+ /* send unexpected output to make the build fail */
+ answer(sock, "#");
}
- free(port);
-
- if (send(sock, &len, sizeof(len), 0) == -1)
- ui_warn("tracelib send failed");
- if (send(sock, &resolution, 1, 0) == -1)
- ui_warn("tracelib send failed");
+ /* find the port id */
+ entry.reg = reg;
+ entry.proc = NULL;
+ entry.id = reg_entry_owner_id(reg, path);
+ if (entry.id == 0) {
+ /* file isn't known to MacPorts */
+ answer(sock, "?");
+ return;
+ }
+
+ /* find the port's name to compare with out list */
+ if (!reg_entry_propget(&entry, "name", &port, &error)) {
+ /* send unexpected output to make the build fail */
+ ui_error(error.description);
+ answer(sock, "#");
+ }
+
+ /* check our list of dependencies */
+ for (t = depends; *t; t += strlen(t) + 1) {
+ if (strcmp(t, port) == 0) {
+ free(port);
+ answer(sock, "+");
+ return;
+ }
+ }
+
+ free(port);
+ answer(sock, "!");
}
-static void ui_msg(const char * severity, const char * format, va_list va)
-{
- char buf[1024], tclcmd[32];
-
- vsnprintf(buf, sizeof(buf), format, va);
-
- snprintf(tclcmd, sizeof(tclcmd), "ui_%s $warn", severity);
-
- Tcl_SetVar(interp, "warn", buf, 0);
- if (TCL_OK != Tcl_Eval(interp, tclcmd)) {
- fprintf(stderr, "Error evaluating tcl statement `%s': %s\n", tclcmd, Tcl_GetStringResult(interp));
- }
- Tcl_UnsetVar(interp, "warn", 0);
-
+static void ui_msg(const char *severity, const char *format, va_list va) {
+ char buf[1024], tclcmd[32];
+
+ vsnprintf(buf, sizeof(buf), format, va);
+
+ snprintf(tclcmd, sizeof(tclcmd), "ui_%s $warn", severity);
+
+ Tcl_SetVar(interp, "warn", buf, 0);
+ if (TCL_OK != Tcl_Eval(interp, tclcmd)) {
+ fprintf(stderr, "Error evaluating tcl statement `%s': %s\n", tclcmd, Tcl_GetStringResult(interp));
+ }
+ Tcl_UnsetVar(interp, "warn", 0);
+
}
-static void ui_warn(const char * format, ...)
-{
- va_list va;
-
- va_start(va, format);
- ui_msg("warn", format, va);
- va_end(va);
+static void ui_warn(const char *format, ...) {
+ va_list va;
+
+ va_start(va, format);
+ ui_msg("warn", format, va);
+ va_end(va);
}
-static void ui_info(const char * format, ...)
-{
- va_list va;
-
- va_start(va, format);
- ui_msg("info", format, va);
- va_end(va);
+#if 0
+static void ui_info(const char *format, ...) {
+ va_list va;
+
+ va_start(va, format);
+ ui_msg("info", format, va);
+ va_end(va);
}
+#endif
static void ui_error(const char *format, ...) {
- va_list va;
- va_start(va, format);
- ui_msg("error", format, va);
- va_end(va);
+ va_list va;
+ va_start(va, format);
+ ui_msg("error", format, va);
+ va_end(va);
}
-static int TracelibOpenSocketCmd(Tcl_Interp * in)
-{
- struct sockaddr_un sun;
- struct rlimit rl;
-
- pthread_mutex_lock(&sock_mutex);
- if(cleanuping)
- {
- pthread_mutex_unlock(&sock_mutex);
- return 0;
- }
- sock=socket(AF_UNIX, SOCK_STREAM, 0);
- if (sock == -1) {
- Tcl_SetErrno(errno);
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "socket: ", (char *) Tcl_PosixError(interp), NULL);
- pthread_mutex_unlock(&sock_mutex);
- return TCL_ERROR;
- }
- pthread_mutex_unlock(&sock_mutex);
-
- interp=in;
-
- rl.rlim_cur=rl.rlim_max=RLIM_INFINITY;
+static int TracelibOpenSocketCmd(Tcl_Interp *in) {
+ struct sockaddr_un sun;
+ struct rlimit rl;
+
+ cleanuping = 0;
+
+ pthread_mutex_lock(&sock_mutex);
+ if (-1 == (sock = socket(PF_LOCAL, SOCK_STREAM, 0))) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "socket: ", (char *) Tcl_PosixError(interp), NULL);
+ pthread_mutex_unlock(&sock_mutex);
+ return TCL_ERROR;
+ }
+ pthread_mutex_unlock(&sock_mutex);
+
+ interp = in;
+
+ /* raise the limit of open files to the maximum from the default soft limit
+ * of 256 */
+ if (getrlimit(RLIMIT_NOFILE, &rl) == -1) {
+ ui_warn("getrlimit failed (%d), skipping setrlimit", errno);
+ } else {
#if defined(__APPLE__) && defined(OPEN_MAX)
- if (OPEN_MAX < rl.rlim_cur)
- rl.rlim_cur = OPEN_MAX;
+ if (rl.rlim_max > OPEN_MAX) {
+ rl.rlim_max = OPEN_MAX;
+ }
#endif
- if(setrlimit(RLIMIT_NOFILE, &rl)==-1)
- {
- ui_warn("setrlimit failed (%d)", errno);
- }
+ rl.rlim_cur = rl.rlim_max;
+ if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
+ ui_warn("setrlimit failed (%d)", errno);
+ }
+ }
-
- sun.sun_family=AF_UNIX;
- strlcpy(sun.sun_path, name, sizeof(sun.sun_path));
- if (bind(sock, (struct sockaddr*)&sun, sizeof(sun)) == -1) {
- Tcl_SetErrno(errno);
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bind: ", (char *) Tcl_PosixError(interp), NULL);
- return TCL_ERROR;
- }
-
- if (listen(sock, 5) == -1) {
- Tcl_SetErrno(errno);
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "listen: ", (char *) Tcl_PosixError(interp), NULL);
- return TCL_ERROR;
- }
+ sun.sun_family = AF_UNIX;
+ strlcpy(sun.sun_path, name, sizeof(sun.sun_path));
- return TCL_OK;
+ if (-1 == (bind(sock, (struct sockaddr *) &sun, sizeof(sun)))) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "bind: ", (char *) Tcl_PosixError(interp), NULL);
+ close(sock);
+ sock = -1;
+ return TCL_ERROR;
+ }
+
+ if (-1 == listen(sock, 32)) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "listen: ", (char *) Tcl_PosixError(interp), NULL);
+ close(sock);
+ sock = -1;
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
}
+#if HAVE_KQUEUE
+/* create this on heap rather than stack, due to its rather large size */
+static struct kevent res_kevents[MAX_SOCKETS];
+#endif
-static int TracelibRunCmd(Tcl_Interp * in UNUSED)
-{
- int max_fd, max_used, socks[MAX_SOCKETS];
- fd_set fdr;
- int i;
+static int TracelibRunCmd(Tcl_Interp *in) {
+#if HAVE_KQUEUE
+ struct kevent kev;
+ int flags;
+ int oldsock;
+ int opensockcount = 0;
- max_used=0;
- max_fd=sock;
-
- for(;sock!=-1&&!cleanuping;)
- {
- FD_ZERO(&fdr);
- FD_SET(sock, &fdr);
- for(i=0;i<max_used;++i)
- FD_SET(socks[i], &fdr);
-
- if(select(max_fd+1, &fdr, 0, 0, 0)<1)
- {
- continue;
- }
- if(sock==-1)
- {
- break;
- }
- if(FD_ISSET(sock, &fdr))
- {
- int s;
- s=accept(sock, 0, 0);
-
- if(s==-1)
- {
- if(cleanuping)
- break;
- else
- ui_warn("tracelib: accept return -1 (errno: %d)", errno);
- /* failed sometimes and i dunno why*/
- continue;
- }
- /* Temporary solution, it's better to regenerate this variable in each iteration, because when closing socket we'll get it too high */
- if(s>max_fd)
- max_fd=s;
- for(i=0;i<max_used;++i)
- if(!socks[i])
- {
- socks[i]=s;
- break;
- }
- if(i==max_used)
- {
- if(max_used==MAX_SOCKETS-1)
- {
- ui_warn("There is no place to store socket");
- close(s);
- }
- else
- socks[max_used++]=s;
- }
- }
-
- for(i=0;i<max_used;++i)
- {
- if(!socks[i])
- continue;
- if(FD_ISSET(socks[i], &fdr))
- {
- if(!process_line(socks[i]))
- {
- close(socks[i]);
- socks[i]=0;
- continue;
- }
- }
- }
- }
-
- for(i=0;i<max_used;++i)
- {
- if(socks[i])
- {
- close(socks[i]);
- socks[i]=0;
- }
- }
-
- return TCL_OK;
+ pthread_mutex_lock(&sock_mutex);
+ if (-1 == (kq = kqueue())) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "kqueue: ", (char *) Tcl_PosixError(in), NULL);
+ return TCL_ERROR;
+ }
+
+ if (sock != -1) {
+ oldsock = sock;
+
+ /* mark listen socket non-blocking in order to prevent a race condition
+ * that would occur between kevent(2) and accept(2), if a incoming
+ * connection is aborted before it is accepted. Using a non-blocking
+ * accept(2) prevents the problem.*/
+ flags = fcntl(oldsock, F_GETFL, 0);
+ if (-1 == fcntl(oldsock, F_SETFL, flags | O_NONBLOCK)) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "fcntl(F_SETFL, += O_NONBLOCK): ", (char *) Tcl_PosixError(in), NULL);
+ pthread_mutex_unlock(&sock_mutex);
+ return TCL_ERROR;
+ }
+
+ /* register the listen socket in the kqueue */
+ EV_SET(&kev, oldsock, EVFILT_READ, EV_ADD | EV_RECEIPT, 0, 0, NULL);
+ if (1 != kevent(kq, &kev, 1, &kev, 1, NULL)) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "kevent (listen socket): ", (char *) Tcl_PosixError(in), NULL);
+ close(kq);
+ pthread_mutex_unlock(&sock_mutex);
+ return TCL_ERROR;
+ }
+ /* kevent(2) on EV_RECEIPT: When passed as input, it forces EV_ERROR to
+ * always be returned. When a filter is successfully added, the data field
+ * will be zero. */
+ if ((kev.flags & EV_ERROR) == 0 || ((kev.flags & EV_ERROR) > 0 && kev.data != 0)) {
+ Tcl_SetErrno(kev.data);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "kevent (listen socket receipt): ", (char *) Tcl_PosixError(in), NULL);
+ close(kq);
+ pthread_mutex_unlock(&sock_mutex);
+ return TCL_ERROR;
+ }
+
+
+ /* use the self-pipe trick to trigger returning from kevent(2) when
+ * tracelib closesocket is called. */
+ if (-1 == pipe(selfpipe)) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "pipe: ", (char *) Tcl_PosixError(in), NULL);
+ pthread_mutex_unlock(&sock_mutex);
+ return TCL_ERROR;
+ }
+
+ /* mark the write side of the pipe non-blocking */
+ flags = fcntl(selfpipe[1], F_GETFL, 0);
+ if (-1 == fcntl(selfpipe[1], F_SETFL, flags | O_NONBLOCK)) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "fcntl(F_SETFL, += O_NONBLOCK): ", (char *) Tcl_PosixError(in), NULL);
+ pthread_mutex_unlock(&sock_mutex);
+ return TCL_ERROR;
+ }
+
+ /* wait for the user event on the listen socket, as sent by CloseCmd as
+ * deathpill */
+ EV_SET(&kev, selfpipe[0], EVFILT_READ, EV_ADD | EV_RECEIPT, 0, 0, NULL);
+ if (1 != kevent(kq, &kev, 1, &kev, 1, NULL)) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "kevent (selfpipe): ", (char *) Tcl_PosixError(in), NULL);
+ close(kq);
+ pthread_mutex_unlock(&sock_mutex);
+ return TCL_ERROR;
+ }
+ /* kevent(2) on EV_RECEIPT: When passed as input, it forces EV_ERROR to
+ * always be returned. When a filter is successfully added, the data field
+ * will be zero. */
+ if ((kev.flags & EV_ERROR) == 0 || ((kev.flags & EV_ERROR) > 0 && kev.data != 0)) {
+ Tcl_SetErrno(kev.data);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "kevent (selfpipe receipt): ", (char *) Tcl_PosixError(in), NULL);
+ close(kq);
+ pthread_mutex_unlock(&sock_mutex);
+ return TCL_ERROR;
+ }
+ }
+ pthread_mutex_unlock(&sock_mutex);
+
+ while (sock != -1 && !cleanuping) {
+ int keventstatus;
+ int i;
+
+ /* run kevent(2) until new activity is available */
+ do {
+ if (-1 == (keventstatus = kevent(kq, NULL, 0, res_kevents, MAX_SOCKETS, NULL))) {
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "kevent (main loop): ", (char *) Tcl_PosixError(in), NULL);
+ close(kq);
+ return TCL_ERROR;
+ }
+ } while (keventstatus == 0);
+
+ for (i = 0; i < keventstatus; ++i) {
+ /* handle traffic on the selfpipe */
+ if ((int) res_kevents[i].ident == selfpipe[0]) {
+ pthread_mutex_lock(&sock_mutex);
+ close(selfpipe[0]);
+ close(selfpipe[1]);
+ selfpipe[0] = -1;
+ selfpipe[1] = -1;
+ pthread_mutex_unlock(&sock_mutex);
+ break;
+ }
+
+ /* the control socket has activity – we might have a new
+ * connection. We use a copy of sock here, because sock might have
+ * been set to -1 by the close command */
+ if ((int) res_kevents[i].ident == oldsock) {
+ int s;
+
+ /* handle error conditions */
+ if ((res_kevents[i].flags & (EV_ERROR | EV_EOF)) > 0) {
+ if (cleanuping) {
+ break;
+ }
+ Tcl_ResetResult(in);
+ Tcl_SetResult(in, "control socket closed", NULL);
+ close(kq);
+ return TCL_ERROR;
+ }
+
+ /* else: new connection attempt(s) */
+ for (;;) {
+ if (-1 == (s = accept(sock, NULL, NULL))) {
+ if (cleanuping) {
+ break;
+ }
+ if (errno == EWOULDBLOCK) {
+ break;
+ }
+ Tcl_SetErrno(errno);
+ Tcl_ResetResult(in);
+ Tcl_AppendResult(in, "accept: ", (char *) Tcl_PosixError(in), NULL);
+ close(kq);
+ return TCL_ERROR;
+ }
+
+ flags = fcntl(s, F_GETFL, 0);
+ if (-1 == fcntl(s, F_SETFL, flags & ~O_NONBLOCK)) {
+ ui_warn("tracelib: couldn't mark socket as blocking");
+ close(s);
+ continue;
+ }
+
+ /* register the new socket in the kqueue */
+ EV_SET(&kev, s, EVFILT_READ, EV_ADD | EV_RECEIPT, 0, 0, NULL);
+ if (1 != kevent(kq, &kev, 1, &kev, 1, NULL)) {
+ ui_warn("tracelib: error adding socket to kqueue");
+ close(s);
+ continue;
+ }
+ /* kevent(2) on EV_RECEIPT: When passed as input, it forces EV_ERROR to
+ * always be returned. When a filter is successfully added, the data field
+ * will be zero. */
+ if ((kev.flags & EV_ERROR) == 0 || ((kev.flags & EV_ERROR) > 0 && kev.data != 0)) {
+ ui_warn("tracelib: error adding socket to kqueue");
+ close(s);
+ continue;
+ }
+
+ opensockcount++;
+ }
+
+ if (cleanuping) {
+ break;
+ }
+ } else {
+ /* if the socket is to be closed, or */
+ if ((res_kevents[i].flags & (EV_EOF | EV_ERROR)) > 0
+ /* new data is available, and its processing tells us to
+ * close the socket */
+ || (!process_line(res_kevents[i].ident))) {
+ /* an error occured or process_line suggested closing this
+ * socket */
+ close(res_kevents[i].ident);
+ /* closing the socket will automatically remove it from the
+ * kqueue :) */
+ opensockcount--;
+ }
+ }
+ }
+ }
+
+ /* NOTE: We aren't necessarily closing all client sockets here! */
+ if (opensockcount > 0) {
+ fprintf(stderr, "tracelib: %d open sockets will leak at end of runcmd\n", opensockcount);
+ }
+ pthread_mutex_lock(&sock_mutex);
+ close(kq);
+ kq = -1;
+ pthread_mutex_unlock(&sock_mutex);
+
+ return TCL_OK;
+#else
+ Tcl_SetResult(in, "tracelib not supported on this platform", TCL_STATIC);
+ return TCL_ERROR;
+#endif
}
-static int TracelibCleanCmd(Tcl_Interp * interp UNUSED)
-{
- #define safe_free(x) do{free(x); x=0;}while(0);
- cleanuping=1;
- pthread_mutex_lock(&sock_mutex);
- if(sock!=-1)
- {
- /* shutdown(sock, SHUT_RDWR);*/
- close(sock);
- sock=-1;
- }
- pthread_mutex_unlock(&sock_mutex);
- if(name)
- {
- unlink(name);
- safe_free(name);
- }
- if(filemap)
- safe_free(filemap);
- if(depends)
- safe_free(depends);
- enable_fence=0;
- #undef safe_free
- cleanuping=0;
- return TCL_OK;
+static int TracelibCleanCmd(Tcl_Interp *interp UNUSED) {
+#define safe_free(x) do{free(x); x=0;}while(0);
+ cleanuping = 1;
+ pthread_mutex_lock(&sock_mutex);
+ if (sock != -1) {
+ /* shutdown(sock, SHUT_RDWR);*/
+ close(sock);
+ sock = -1;
+ }
+ pthread_mutex_unlock(&sock_mutex);
+ if (name) {
+ unlink(name);
+ safe_free(name);
+ }
+ if (filemap) {
+ safe_free(filemap);
+ }
+ if (depends) {
+ safe_free(depends);
+ }
+ enable_fence = 0;
+#undef safe_free
+ return TCL_OK;
}
-static int TracelibCloseSocketCmd(Tcl_Interp * interp UNUSED)
-{
- cleanuping=1;
- pthread_mutex_lock(&sock_mutex);
- if(sock!=-1)
- {
- /*shutdown(sock, SHUT_RDWR);*/
- close(sock);
- sock=-1;
- }
- pthread_mutex_unlock(&sock_mutex);
- return TCL_OK;
+static int TracelibCloseSocketCmd(Tcl_Interp *interp UNUSED) {
+ cleanuping = 1;
+ pthread_mutex_lock(&sock_mutex);
+ if (sock != -1) {
+ int oldsock = sock;
+ /*shutdown(sock, SHUT_RDWR);*/
+ close(oldsock);
+ sock = -1;
+
+ if (kq != -1) {
+ /* We know the pipes have been created because kq != -1 and we have
+ * the lock. We don't have to check for errors, because none should
+ * occur but when the pipe is full, which we wouldn't care about.
+ * */
+ write(selfpipe[1], "!", 1);
+ }
+ }
+ pthread_mutex_unlock(&sock_mutex);
+ return TCL_OK;
}
-static int TracelibSetDeps(Tcl_Interp * interp UNUSED, int objc, Tcl_Obj* CONST objv[])
-{
- char * t, * d;
- size_t l;
- if(objc!=3)
- {
- Tcl_WrongNumArgs(interp, 2, objv, "number of arguments should be exactly 3");
- return TCL_ERROR;
- }
-
- d=Tcl_GetString(objv[2]);
- l=strlen(d);
- depends=malloc(l+2);
- if (!depends) {
- Tcl_SetResult(interp, "memory allocation failed", TCL_STATIC);
- return TCL_ERROR;
- }
- depends[l+1]=0;
- strlcpy(depends, d, l+2);
- for(t=depends;*t;++t)
- if(*t==' ')
- *t++=0;
-
- return TCL_OK;
+static int TracelibSetDeps(Tcl_Interp *interp UNUSED, int objc, Tcl_Obj *CONST objv[]) {
+ char *t, * d;
+ size_t l;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "number of arguments should be exactly 3");
+ return TCL_ERROR;
+ }
+
+ d = Tcl_GetString(objv[2]);
+ l = strlen(d);
+ depends = malloc(l + 2);
+ if (!depends) {
+ Tcl_SetResult(interp, "memory allocation failed", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ depends[l + 1] = 0;
+ strlcpy(depends, d, l + 2);
+ for (t = depends; *t; ++t)
+ if (*t == ' ') {
+ *t++ = 0;
+ }
+
+ return TCL_OK;
}
-static int TracelibEnableFence(Tcl_Interp * interp UNUSED)
-{
- enable_fence=1;
- if(filemap)
- free(filemap);
- filemap=0;
- return TCL_OK;
+static int TracelibEnableFence(Tcl_Interp *interp UNUSED) {
+ enable_fence = 1;
+ if (filemap) {
+ free(filemap);
+ }
+ filemap = 0;
+ return TCL_OK;
}
+#endif /* __APPLE__ */
-int TracelibCmd(ClientData clientData UNUSED, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
-{
- int result=TCL_OK;
- static const char * options[]={"setname", "opensocket", "run", "clean", "setsandbox", "closesocket", "setdeps", "enablefence", 0};
- typedef enum
- {
- kSetName,
- kOpenSocket,
- kRun,
- kClean,
- kSetSandbox,
- kCloseSocket,
- kSetDeps,
- kEnableFence
- } EOptions;
- EOptions current_option;
-
- /* There is no args for commands now. */
- if (objc <2)
- {
- Tcl_WrongNumArgs(interp, 1, objv, "option");
- return TCL_ERROR;
- }
-
- result=Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, (int*)¤t_option);
- if(result==TCL_OK)
- {
- switch(current_option)
- {
- case kSetName:
- result=TracelibSetNameCmd(interp, objc, objv);
- break;
- case kOpenSocket:
- result=TracelibOpenSocketCmd(interp);
- break;
- case kRun:
- result=TracelibRunCmd(interp);
- break;
- case kClean:
- result=TracelibCleanCmd(interp);
- break;
- case kCloseSocket:
- result=TracelibCloseSocketCmd(interp);
- break;
- case kSetSandbox:
- result=TracelibSetSandboxCmd(interp, objc, objv);
- break;
- case kSetDeps:
- result=TracelibSetDeps(interp, objc, objv);
- break;
- case kEnableFence:
- result=TracelibEnableFence(interp);
- break;
- }
- }
-
- return result;
+int TracelibCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+ int result = TCL_OK;
+ static const char *options[] = {"setname", "opensocket", "run", "clean", "setsandbox", "closesocket", "setdeps", "enablefence", 0};
+ typedef enum {
+ kSetName,
+ kOpenSocket,
+ kRun,
+ kClean,
+ kSetSandbox,
+ kCloseSocket,
+ kSetDeps,
+ kEnableFence
+ } EOptions;
+ EOptions current_option;
+
+ /* There is no args for commands now. */
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "option");
+ return TCL_ERROR;
+ }
+
+#ifdef __APPLE__
+ result = Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, (int *)¤t_option);
+ if (result == TCL_OK) {
+ switch (current_option) {
+ case kSetName:
+ result = TracelibSetNameCmd(interp, objc, objv);
+ break;
+ case kOpenSocket:
+ result = TracelibOpenSocketCmd(interp);
+ break;
+ case kRun:
+ result = TracelibRunCmd(interp);
+ break;
+ case kClean:
+ result = TracelibCleanCmd(interp);
+ break;
+ case kCloseSocket:
+ result = TracelibCloseSocketCmd(interp);
+ break;
+ case kSetSandbox:
+ result = TracelibSetSandboxCmd(interp, objc, objv);
+ break;
+ case kSetDeps:
+ result = TracelibSetDeps(interp, objc, objv);
+ break;
+ case kEnableFence:
+ result = TracelibEnableFence(interp);
+ break;
+ }
+ }
+#else /* __APPLE__ */
+ Tcl_SetResult(interp, "tracelib not supported on this platform", TCL_STATIC);
+ result = TCL_ERROR;
+#endif /* __APPLE__ */
+
+ return result;
}
Modified: branches/new-help-system/base/src/pextlib1.0/tracelib.h
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tracelib.h 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/pextlib1.0/tracelib.h 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,3 +1,5 @@
+/* # -*- coding: utf-8; mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=c:et:sw=4:ts=4:sts=4
+ */
/*
* tracelib.h
* $Id$
@@ -16,7 +18,7 @@
* 3. Neither the name of the MacPorts Team nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -40,24 +42,24 @@
* Command to handle trace lib
*
* It is *NOT* thread safe
- *
+ *
* Syntax:
- * tracelib setname name
- * - return path of unix socket
- * tracelib run
- * - run select, create a socket
- * tracelib clean
- * - cleanup everything
- * tracelib setsandbox
- * - set sandbox bounds
- * tracelib closesocket
- * - close socket. This makes main thread to quit from it's loop
- * tracelib setdeps
- * - set deps for current port
- * tracelib enablefence
- * - enable dep/sandbox checking
+ * tracelib setname name
+ * - return path of unix socket
+ * tracelib run
+ * - run select, create a socket
+ * tracelib clean
+ * - cleanup everything
+ * tracelib setsandbox
+ * - set sandbox bounds
+ * tracelib closesocket
+ * - close socket. This makes main thread to quit from it's loop
+ * tracelib setdeps
+ * - set deps for current port
+ * tracelib enablefence
+ * - enable dep/sandbox checking
*/
-int TracelibCmd(ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
+int TracelibCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
#endif
- /* _PEXTLIB_TRACELIB_H */
+/* _PEXTLIB_TRACELIB_H */
Modified: branches/new-help-system/base/src/port/port.tcl
===================================================================
--- branches/new-help-system/base/src/port/port.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port/port.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -5,7 +5,7 @@
# port.tcl
# $Id$
#
-# Copyright (c) 2004-2012 The MacPorts Project
+# Copyright (c) 2004-2013 The MacPorts Project
# Copyright (c) 2004 Robert Shaw <rshaw at opendarwin.org>
# Copyright (c) 2002-2003 Apple Inc.
# All rights reserved.
@@ -419,11 +419,20 @@
# Supply a default porturl/portname if the portlist is empty
-proc require_portlist { nameportlist } {
+proc require_portlist { nameportlist {is_upgrade "no"} } {
global private_options
upvar $nameportlist portlist
if {[llength $portlist] == 0 && (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == "no")} {
+ if {${is_upgrade} == "yes"} {
+ # $> port upgrade outdated
+ # Error: No ports matched the given expression
+ # is not very user friendly - if we're in the special case of
+ # "upgrade", let's print a message that's a little easier to
+ # understand and less alarming.
+ ui_msg "Nothing to upgrade."
+ return 1
+ }
ui_error "No ports matched the given expression"
return 1
}
@@ -2617,6 +2626,14 @@
if { [catch {macports::selfupdate [array get global_options] base_updated} result ] } {
global errorInfo
ui_debug "$errorInfo"
+ ui_error "$result"
+ if {![macports::ui_isset ports_verbose]} {
+ ui_msg "Please run `port -v selfupdate' for details."
+ } else {
+ # Let's only print the ticket URL if the user has followed the
+ # advice we printed earlier.
+ print_tickets_url
+ }
fatal "port selfupdate failed: $result"
}
@@ -2656,7 +2673,7 @@
proc action_upgrade { action portlist opts } {
- if {[require_portlist portlist] || ([prefix_unwritable] && ![macports::global_option_isset ports_dryrun])} {
+ if {[require_portlist portlist "yes"] || ([prefix_unwritable] && ![macports::global_option_isset ports_dryrun])} {
return 1
}
@@ -3072,7 +3089,15 @@
foreachport $portlist {
if {![registry::entry_exists_for_name $portname]} {
- ui_info "$portname is already uninstalled"
+ # if the code path arrives here the port either isn't installed, or
+ # it doesn't exist at all. We can't be sure, but we can check the
+ # portindex whether a port by that name exists (in which case not
+ # uninstalling it is probably no problem). If there is no port by
+ # that name, alert the user in case of typos.
+ ui_info "$portname is not installed"
+ if {[catch {set res [mportlookup $portname]} result] || [llength $res] == 0} {
+ ui_warn "no such port: $portname, skipping uninstall"
+ }
continue
}
set composite_version [composite_version $portversion [array get variations]]
@@ -3563,11 +3588,14 @@
}
switch -- $opt {
exact -
- glob -
- regex {
+ glob {
set filter_matchstyle $opt
continue
}
+ regex {
+ set filter_matchstyle regexp
+ continue
+ }
case-sensitive {
set filter_case yes
continue
@@ -3605,7 +3633,7 @@
# Map from friendly name
set opt [map_friendly_field_names $opt]
- if {[catch {eval set matches \[mportsearch \$searchstring $filter_case $matchstyle $opt\]} result]} {
+ if {[catch {eval set matches \[mportsearch \$searchstring $filter_case \$matchstyle $opt\]} result]} {
global errorInfo
ui_debug "$errorInfo"
break_softcontinue "search for name $portname failed: $result" 1 status
@@ -3758,8 +3786,7 @@
proc action_portcmds { action portlist opts } {
# Operations on the port's directory and Portfile
- global env boot_env
- global current_portdir
+ global env boot_env current_portdir
array set local_options $opts
@@ -4276,7 +4303,7 @@
install {no-rev-upgrade unrequested}
uninstall {follow-dependents follow-dependencies no-exec}
variants {index}
- clean {all dist work logs}
+ clean {all archive dist work logs}
mirror {new}
lint {nitpick}
select {list set show}
@@ -4474,9 +4501,9 @@
}
proc process_cmd { argv } {
- global cmd_argc cmd_argv cmd_argn
- global global_options global_options_base private_options ui_options
- global current_portdir
+ global cmd_argc cmd_argv cmd_argn \
+ global_options global_options_base private_options ui_options \
+ current_portdir
set cmd_argv $argv
set cmd_argc [llength $argv]
set cmd_argn 0
@@ -4609,8 +4636,7 @@
# return text action beginning with $text
proc complete_action { text state } {
- global action_array
- global complete_choices complete_position
+ global action_array complete_choices complete_position
if {$state == 0} {
set complete_position 0
@@ -4801,17 +4827,15 @@
# We do this here to save it in the boot_env, in case we determined it manually
term_init_size
+global env boot_env argv0 cmdname argc argv cmd_argc cmd_argv cmd_argn \
+ current_portdir global_options_base exit_status
+
# Save off a copy of the environment before mportinit monkeys with it
-global env boot_env
array set boot_env [array get env]
-global argv0
-global cmdname
set cmdname [file tail $argv0]
# Setp cmd_argv to match argv
-global argc argv
-global cmd_argc cmd_argv cmd_argn
set cmd_argv $argv
set cmd_argc $argc
set cmd_argn 0
@@ -4856,16 +4880,13 @@
}
# Set up some global state for our code
-global current_portdir
set current_portdir [pwd]
# Freeze global_options into global_options_base; global_options
# will be reset to global_options_base prior to processing each command.
-global global_options_base
set global_options_base [array get global_options]
# First process any remaining args as action(s)
-global exit_status
set exit_status 0
if { [llength $remaining_args] > 0 } {
Modified: branches/new-help-system/base/src/port/portindex.tcl
===================================================================
--- branches/new-help-system/base/src/port/portindex.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port/portindex.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -12,7 +12,6 @@
package require Pextlib
# Globals
-set archive 0
set full_reindex 0
set stats(total) 0
set stats(failed) 0
@@ -29,7 +28,6 @@
proc print_usage args {
global argv0
puts "Usage: $argv0 \[-adf\] \[-p plat_ver_arch\] \[-o output directory\] \[directory\]"
- puts "-a:\tArchive port directories (for remote sites). Requires -o option"
puts "-o:\tOutput all files to specified directory"
puts "-d:\tOutput debugging information"
puts "-f:\tDo a full re-index instead of updating"
@@ -37,11 +35,11 @@
}
proc pindex {portdir} {
- global target oldfd oldmtime newest qindex fd directory archive outdir stats full_reindex \
+ global target oldfd oldmtime newest qindex fd directory outdir stats full_reindex \
ui_options port_options save_prefix keepkeys
# try to reuse the existing entry if it's still valid
- if {$full_reindex != "1" && $archive != "1" && [info exists qindex([string tolower [file tail $portdir]])]} {
+ if {$full_reindex != "1" && [info exists qindex([string tolower [file tail $portdir]])]} {
try {
set mtime [file mtime [file join $directory $portdir Portfile]]
if {$oldmtime >= $mtime} {
@@ -101,23 +99,6 @@
mportclose $interp
set portinfo(portdir) $portdir
puts "Adding port $portdir"
- if {$archive == "1"} {
- if {![file isdirectory [file join $outdir [file dirname $portdir]]]} {
- if {[catch {file mkdir [file join $outdir [file dirname $portdir]]} result]} {
- puts stderr "$result"
- exit 1
- }
- }
- set portinfo(portarchive) [file join [file dirname $portdir] [file tail $portdir]].tgz
- cd [file join $directory [file dirname $portinfo(portdir)]]
- puts "Archiving port $portinfo(name) to [file join $outdir $portinfo(portarchive)]"
- set tar [macports::findBinary tar $macports::autoconf::tar_path]
- set gzip [macports::findBinary gzip $macports::autoconf::gzip_path]
- if {[catch {exec $tar -cf - [file tail $portdir] | $gzip -c >[file join $outdir $portinfo(portarchive)]} result]} {
- puts stderr "Failed to create port archive $portinfo(portarchive): $result"
- exit 1
- }
- }
foreach availkey [array names portinfo] {
# store list of subports for top-level ports only
@@ -174,9 +155,7 @@
set arg [lindex $argv $i]
switch -regex -- $arg {
{^-.+} {
- if {$arg == "-a"} { # Turn on archiving
- set archive 1
- } elseif {$arg == "-d"} { # Turn on debug output
+ if {$arg == "-d"} { # Turn on debug output
set ui_options(ports_debug) yes
} elseif {$arg == "-o"} { # Set output directory
incr i
@@ -206,12 +185,6 @@
}
}
-if {$archive == 1 && ![info exists outdir]} {
- puts stderr "You must specify an output directory with -o when using the -a option"
- print_usage
- exit 1
-}
-
if {![info exists directory]} {
set directory .
}
@@ -264,7 +237,7 @@
foreach key {categories depends_fetch depends_extract depends_build \
depends_lib depends_run description epoch homepage \
long_description maintainers name platforms revision variants \
- version portdir portarchive replaced_by license installs_libs} {
+ version portdir replaced_by license installs_libs} {
set keepkeys($key) 1
}
mporttraverse pindex $directory
Modified: branches/new-help-system/base/src/port1.0/fetch_common.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/fetch_common.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/fetch_common.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,7 +2,7 @@
# $Id$
#
# Copyright (c) 2002 - 2003 Apple Inc.
-# Copyright (c) 2004 - 2012 The MacPorts Project
+# Copyright (c) 2004 - 2013 The MacPorts Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -84,8 +84,8 @@
# For a given mirror site type, e.g. "gnu" or "x11", check to see if there's a
# pre-registered set of sites, and if so, return them.
proc portfetch::mirror_sites {mirrors tag subdir mirrorfile} {
- global UI_PREFIX name dist_subdir
- global global_mirror_site fallback_mirror_site
+ global UI_PREFIX name dist_subdir \
+ global_mirror_site fallback_mirror_site
if {[file exists $mirrorfile]} {
source $mirrorfile
@@ -343,6 +343,6 @@
proc portfetch::check_dns {} {
# check_broken_dns returns true at most once, so we don't have to worry about spamming this message
if {[check_broken_dns]} {
- ui_warn "Your DNS server(s) incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports."
+ ui_warn "Your DNS servers incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports."
}
}
Modified: branches/new-help-system/base/src/port1.0/portactivate.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portactivate.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portactivate.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -59,7 +59,7 @@
}
proc portactivate::activate_main {args} {
- global env subport version revision portvariants user_options PortInfo
+ global env subport version revision portvariants user_options PortInfo startupitem.autostart UI_PREFIX
registry_activate $subport $version $revision $portvariants [array get user_options]
@@ -97,5 +97,13 @@
ui_notice ""
}
+ if {[tbool startupitem.autostart]} {
+ ui_notice "$UI_PREFIX [format [msgcat::mc "Loading %s"] [option subport]]"
+ if {[eval_targets "load"]} {
+ ui_error [format [msgcat::mc "Failed to load %s"] [option subport]]
+ return 1
+ }
+ }
+
return 0
}
Modified: branches/new-help-system/base/src/port1.0/portbuild.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portbuild.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portbuild.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,7 +2,7 @@
# portbuild.tcl
# $Id$
#
-# Copyright (c) 2007 - 2012 The MacPorts Project
+# Copyright (c) 2007 - 2013 The MacPorts Project
# Copyright (c) 2002 - 2004 Apple Inc.
# All rights reserved.
#
@@ -43,11 +43,10 @@
}
# define options
-options build.asroot
-options build.jobs
-options build.target
-options build.type
-options use_parallel_build
+options build.asroot \
+ build.jobs \
+ build.target \
+ use_parallel_build
commands build
# defaults
default build.asroot no
@@ -66,6 +65,10 @@
# ${build.type} == bsd, ensures bsdmake is present by adding a bin:-style
# dependency.
proc portbuild::add_automatic_buildsystem_dependencies {} {
+ global build.type.add_deps
+ if {!${build.type.add_deps}} {
+ return
+ }
if {[option build.type] == "bsd" && [option os.platform] == "darwin"} {
ui_debug "build.type is BSD, adding bin:bsdmake:bsdmake build dependency"
depends_build-delete bin:bsdmake:bsdmake
@@ -79,6 +82,9 @@
}
# Register the above procedure as a callback after Portfile evaluation
port::register_callback portbuild::add_automatic_buildsystem_dependencies
+# and an option to turn it off if required
+options build.type.add_deps
+default build.type.add_deps yes
proc portbuild::build_getmaketype {args} {
if {[option build.type] == "default"} {
Modified: branches/new-help-system/base/src/port1.0/portchecksum.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portchecksum.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portchecksum.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -192,7 +192,7 @@
proc portchecksum::checksum_start {args} {
global UI_PREFIX
- ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying checksum(s) for %s"] [option subport]]"
+ ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying checksums for %s"] [option subport]]"
}
# checksum_main
@@ -200,8 +200,8 @@
# Target main procedure. Verifies the checksums of all distfiles.
#
proc portchecksum::checksum_main {args} {
- global UI_PREFIX all_dist_files checksum_types checksums_array portverbose checksum.skip
- global usealtworkpath altprefix default_checksum_types
+ global UI_PREFIX all_dist_files checksum_types checksums_array portverbose checksum.skip \
+ usealtworkpath altprefix default_checksum_types
# If no files have been downloaded, there is nothing to checksum.
if {![info exists all_dist_files]} {
Modified: branches/new-help-system/base/src/port1.0/portclean.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portclean.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portclean.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,8 +1,7 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
-# portclean.tcl
# $Id$
#
-# Copyright (c) 2005-2007, 2009-2011 The MacPorts Project
+# Copyright (c) 2005-2007, 2009-2011, 2013 The MacPorts Project
# Copyright (c) 2004 Robert Shaw <rshaw at opendarwin.org>
# Copyright (c) 2002 - 2003 Apple Inc.
# All rights reserved.
@@ -61,9 +60,8 @@
}
proc portclean::clean_main {args} {
- global UI_PREFIX
- global ports_clean_dist ports_clean_work ports_clean_logs
- global ports_clean_all keeplogs usealtworkpath
+ global UI_PREFIX ports_clean_dist ports_clean_work ports_clean_logs \
+ ports_clean_archive ports_clean_all keeplogs usealtworkpath
if {$usealtworkpath} {
ui_warn "Only cleaning in ~/.macports; insufficient privileges for standard locations"
@@ -74,8 +72,16 @@
ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option subport]]"
clean_dist
}
+ if {([info exists ports_clean_all] && $ports_clean_all == "yes" || \
+ [info exists ports_clean_archive] && $ports_clean_archive == "yes")
+ && !$usealtworkpath} {
+ ui_info "$UI_PREFIX [format [msgcat::mc "Removing temporary archives for %s"] [option subport]]"
+ clean_archive
+ }
if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
[info exists ports_clean_work] && $ports_clean_work == "yes" || \
+ [info exists ports_clean_archive] && $ports_clean_archive == "yes" || \
+ [info exists ports_clean_dist] && $ports_clean_dist == "yes" || \
!([info exists ports_clean_logs] && $ports_clean_logs == "yes")} {
ui_info "$UI_PREFIX [format [msgcat::mc "Removing work directory for %s"] [option subport]]"
clean_work
@@ -259,3 +265,55 @@
}
return 0
}
+
+proc portclean::clean_archive {args} {
+ global subport ports_version_glob portdbpath
+
+ # Define archive destination directory, target filename, regex for archive name
+ set archivepath [file join $portdbpath incoming]
+
+ if {[info exists ports_version_glob]} {
+ # Match all possible archive variants that match the version
+ # glob specified by the user.
+ set fileglob "$subport-[option ports_version_glob]*.*.*.*"
+ } else {
+ # Match all possible archives for this port.
+ set fileglob "$subport-*_*.*.*.*"
+ }
+
+ # Remove the archive files
+ set count 0
+ foreach dir [list $archivepath ${archivepath}/verified] {
+ set archivelist [glob -nocomplain -directory $dir $fileglob]
+ foreach path $archivelist {
+ # Make sure file is truly an archive file for this port, and not
+ # an accidental match with some other file that might exist. Also
+ # delete anything ending in .TMP since those are incomplete and
+ # thus can't be checked and aren't useful anyway.
+ set archivetype [string range [file extension $path] 1 end]
+ if {[file isfile $path] && ($archivetype == "TMP"
+ || [extract_archive_metadata $path $archivetype portname] == $subport)} {
+ ui_debug "Removing archive: $path"
+ if {[catch {delete $path} result]} {
+ ui_debug "$::errorInfo"
+ ui_error "$result"
+ }
+ if {[file isfile ${path}.rmd160]} {
+ ui_debug "Removing archive signature: ${path}.rmd160"
+ if {[catch {delete ${path}.rmd160} result]} {
+ ui_debug "$::errorInfo"
+ ui_error "$result"
+ }
+ }
+ incr count
+ }
+ }
+ }
+ if {$count > 0} {
+ ui_debug "$count archive(s) removed."
+ } else {
+ ui_debug "No archives found to remove at $archivepath"
+ }
+
+ return 0
+}
Modified: branches/new-help-system/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portconfigure.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portconfigure.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -77,7 +77,7 @@
([info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] == $option_defaults(${type}.cmd)) ||
(![info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] == "${type}")
)} {
- eval depends_build-append $dep
+ eval [linsert $dep 0 depends_build-append]
}
}
@@ -97,14 +97,14 @@
autoreconf.cmd -
automake.cmd -
autoconf.cmd {
- eval depends_build-delete $configure_map(autoconf)
+ eval [linsert $configure_map(autoconf) 0 depends_build-delete]
}
xmkmf.cmd {
- depends_build-delete $configure_map(xmkmf)
+ eval [linsert $configure_map(xmkmf) 0 depends_build-delete]
}
use_xmkmf {
if {[tbool args]} {
- depends_build-append $configure_map(xmkmf)
+ eval [linsert $configure_map(xmkmf) 0 depends_build-append]
}
}
default {
@@ -127,28 +127,30 @@
default configure.march {}
default configure.mtune {}
# We could have debug/optimizations be global configurable at some point.
-options configure.optflags
-options configure.cflags configure.cxxflags configure.objcflags
-options configure.cppflags configure.ldflags configure.libs
-options configure.fflags configure.f90flags configure.fcflags
-options configure.classpath
+options configure.optflags \
+ configure.cflags configure.cxxflags \
+ configure.objcflags configure.objcxxflags \
+ configure.cppflags configure.ldflags configure.libs \
+ configure.fflags configure.f90flags configure.fcflags \
+ configure.classpath
# compiler flags section
-default configure.optflags {-Os}
-default configure.cflags {${configure.optflags}}
-default configure.cxxflags {${configure.optflags}}
-default configure.objcflags {${configure.optflags}}
-default configure.cppflags {-I${prefix}/include}
-default configure.ldflags {"-L${prefix}/lib -Wl,-headerpad_max_install_names"}
-default configure.libs {}
-default configure.fflags {${configure.optflags}}
-default configure.f90flags {${configure.optflags}}
-default configure.fcflags {${configure.optflags}}
-default configure.classpath {}
+default configure.optflags {-Os}
+default configure.cflags {${configure.optflags}}
+default configure.cxxflags {${configure.optflags}}
+default configure.objcflags {${configure.optflags}}
+default configure.objcxxflags {${configure.optflags}}
+default configure.cppflags {-I${prefix}/include}
+default configure.ldflags {"-L${prefix}/lib -Wl,-headerpad_max_install_names"}
+default configure.libs {}
+default configure.fflags {${configure.optflags}}
+default configure.f90flags {${configure.optflags}}
+default configure.fcflags {${configure.optflags}}
+default configure.classpath {}
# tools section
-options configure.perl configure.python configure.ruby
-options configure.install configure.awk configure.bison
-options configure.pkg_config configure.pkg_config_path
+options configure.perl configure.python configure.ruby \
+ configure.install configure.awk configure.bison \
+ configure.pkg_config configure.pkg_config_path
default configure.perl {}
default configure.python {}
default configure.ruby {}
@@ -162,76 +164,78 @@
default configure.build_arch {[portconfigure::choose_supported_archs ${build_arch}]}
default configure.ld_archflags {[portconfigure::configure_get_ld_archflags]}
default configure.sdkroot {[portconfigure::configure_get_sdkroot]}
-foreach tool {cc cxx objc f77 f90 fc} {
+foreach tool {cc cxx objc objcxx f77 f90 fc} {
options configure.${tool}_archflags
default configure.${tool}_archflags "\[portconfigure::configure_get_archflags $tool\]"
}
-options configure.universal_archs configure.universal_args
-options configure.universal_cflags configure.universal_cxxflags
-options configure.universal_cppflags configure.universal_ldflags
+options configure.universal_archs configure.universal_args \
+ configure.universal_cflags configure.universal_cxxflags \
+ configure.universal_objcflags configure.universal_objcxxflags \
+ configure.universal_cppflags configure.universal_ldflags
default configure.universal_archs {[portconfigure::choose_supported_archs ${universal_archs}]}
default configure.universal_args {--disable-dependency-tracking}
default configure.universal_cflags {[portconfigure::configure_get_universal_cflags]}
default configure.universal_cxxflags {[portconfigure::configure_get_universal_cflags]}
+default configure.universal_objcflags {${configure.universal_cflags}}
+default configure.universal_objcxxflags {${configure.universal_cxxflags}}
default configure.universal_cppflags {}
default configure.universal_ldflags {[portconfigure::configure_get_universal_ldflags]}
# Select a distinct compiler (C, C preprocessor, C++)
options configure.ccache configure.distcc configure.pipe configure.cc \
- configure.cxx configure.cpp configure.objc configure.f77 \
+ configure.cxx configure.cpp configure.objc configure.objcxx configure.f77 \
configure.f90 configure.fc configure.javac configure.compiler \
compiler.blacklist compiler.whitelist compiler.fallback
default configure.ccache {${configureccache}}
default configure.distcc {${configuredistcc}}
default configure.pipe {${configurepipe}}
-default configure.cc {[portconfigure::configure_get_compiler cc]}
-default configure.cxx {[portconfigure::configure_get_compiler cxx]}
-default configure.cpp {[portconfigure::configure_get_compiler cpp]}
-default configure.objc {[portconfigure::configure_get_compiler objc]}
-default configure.f77 {[portconfigure::configure_get_compiler f77]}
-default configure.f90 {[portconfigure::configure_get_compiler f90]}
-default configure.fc {[portconfigure::configure_get_compiler fc]}
-default configure.javac {[portconfigure::configure_get_compiler javac]}
+foreach tool {cc cxx objc objcxx cpp f77 f90 fc javac} {
+ default configure.$tool "\[portconfigure::configure_get_compiler $tool\]"
+}
default configure.compiler {[portconfigure::configure_get_default_compiler]}
default compiler.fallback {[portconfigure::get_compiler_fallback]}
default compiler.blacklist {}
default compiler.whitelist {}
+# Select a C++ STL implementation
+options configure.cxx_stdlib
+default configure.cxx_stdlib {$cxx_stdlib}
+
set_ui_prefix
proc portconfigure::configure_start {args} {
- global UI_PREFIX configure.compiler
-
+ global UI_PREFIX
+
ui_notice "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option subport]]"
- set name ""
- switch -exact ${configure.compiler} {
- cc { set name "System cc" }
- gcc { set name "System GCC" }
- gcc-3.3 { set name "Mac OS X GCC 3.3" }
- gcc-4.0 { set name "Mac OS X GCC 4.0" }
- gcc-4.2 { set name "Mac OS X GCC 4.2" }
- llvm-gcc-4.2 { set name "Mac OS X LLVM-GCC 4.2" }
- clang { set name "Mac OS X Clang" }
- apple-gcc-4.0 { set name "MacPorts Apple GCC 4.0" }
- apple-gcc-4.2 { set name "MacPorts Apple GCC 4.2" }
- macports-gcc { set name "MacPorts GCC (port select)" }
- macports-llvm-gcc-4.2 { set name "MacPorts LLVM-GCC 4.2" }
- macports-clang { set name "MacPorts Clang (port select)" }
- default {
- if {[regexp {macports-clang-(.*)\.(.*)} ${configure.compiler} -> major minor]} {
- set name "MacPorts Clang ${major}.${minor}"
- } elseif {[regexp {macports-dragonegg-(.*)\.(.*)} ${configure.compiler} -> major minor]} {
- set name "MacPorts DragonEgg ${major}.${minor}"
- } elseif {[regexp {macports-gcc-(.*)\.(.*)} ${configure.compiler} -> major minor]} {
- set name "MacPorts GCC ${major}.${minor}"
- } else {
- return -code error "Invalid value for configure.compiler: ${configure.compiler}"
- }
+ set compiler [option configure.compiler]
+ set valid_compilers {
+ {^apple-gcc-(4\.[02])$} {MacPorts Apple GCC %s}
+ {^cc$} {System cc}
+ {^clang$} {Xcode Clang}
+ {^gcc$} {System GCC}
+ {^gcc-(3\.3|4\.[02])$} {Xcode GCC %s}
+ {^llvm-gcc-4\.2$} {Xcode LLVM-GCC 4.2}
+ {^macports-clang$} {MacPorts Clang (port select}
+ {^macports-clang-(\d+\.\d+)$} {MacPorts Clang %s}
+ {^macports-dragonegg-(\d+\.\d+)$} {MacPorts DragonEgg %s}
+ {^macports-dragonegg-(\d+\.\d+)-gcc-(\d+\.\d+)$}
+ {MacPorts DragonEgg %s with GCC %s}
+ {^macports-gcc$} {MacPorts GCC (port select)}
+ {^macports-gcc-(\d+\.\d+)$} {MacPorts GCC %s}
+ {^macports-llvm-gcc-4\.2$} {MacPorts LLVM-GCC 4.2}
+ }
+ foreach {re fmt} $valid_compilers {
+ if {[set matches [regexp -inline $re $compiler]] ne {}} {
+ set compiler_name [eval [linsert [lrange $matches 1 end] 0 format $fmt]]
+ break
}
}
- ui_debug "Using compiler '$name'"
+ if {![info exists compiler_name]} {
+ return -code error "Invalid value for configure.compiler: $compiler"
+ }
+ ui_debug "Using compiler '$compiler_name'"
# Additional ccache directory setup
global configure.ccache ccache_dir ccache_size macportsuser
@@ -295,7 +299,7 @@
set flags "-m32"
} elseif {${configure.build_arch} != ""} {
if {[arch_flag_supported ${configure.compiler}] &&
- ($tool == "cc" || $tool == "cxx" || $tool == "objc")
+ [regexp {^(?:cc|cxx|objc|objcxx)$} $tool]
} then {
set flags "-arch ${configure.build_arch}"
} elseif {${configure.build_arch} == "x86_64" || ${configure.build_arch} == "ppc64"} {
@@ -370,44 +374,22 @@
return [regexp {^gcc-4|llvm|apple|clang} $compiler]
}
-# maps compiler names to the port that provides them
-# TODO: Remove this after 2.2 is released and ports aren't referring to it.
-array set portconfigure::compiler_name_map {
- apple-gcc-4.0 apple-gcc40
- apple-gcc-4.2 apple-gcc42
- macports-gcc-4.2 gcc42
- macports-gcc-4.3 gcc43
- macports-gcc-4.4 gcc44
- macports-gcc-4.5 gcc45
- macports-gcc-4.6 gcc46
- macports-gcc-4.7 gcc47
- macports-gcc-4.8 gcc48
- macports-llvm-gcc-4.2 llvm-gcc42
- macports-clang-2.9 clang-2.9
- macports-clang-3.0 clang-3.0
- macports-clang-3.1 clang-3.1
- macports-clang-3.2 clang-3.2
- macports-clang-3.3 clang-3.3
- macports-dragonegg-3.0 dragonegg-3.0
- macports-dragonegg-3.1 dragonegg-3.1
- macports-dragonegg-3.2 dragonegg-3.2
- macports-dragonegg-3.3 dragonegg-3.3
+# Mapping from compiler names to compiler ports, for private use by
+# compiler_port_name. Do not access directly.
+set portconfigure::valid_compiler_ports {
+ {^apple-gcc-(\d+)\.(\d+)$} {apple-gcc%s%s}
+ {^macports-clang-(\d+\.\d+)$} {clang-%s}
+ {^macports-dragonegg-(\d+\.\d+)(-gcc-\d+\.\d+)?$} {dragonegg-%s%s}
+ {^macports-(llvm-)?gcc-(\d+)\.(\d+)$} {%sgcc%s%s}
}
proc portconfigure::compiler_port_name {compiler} {
- if {[regexp {apple-gcc-(.*)\.(.*)} ${compiler} -> major minor]} {
- return "apple-gcc${major}${minor}"
- } elseif {[regexp {macports-clang-(.*)\.(.*)} ${compiler} -> major minor]} {
- return "clang-${major}.${minor}"
- } elseif {[regexp {macports-dragonegg-(.*)\.(.*)} ${compiler} -> major minor]} {
- return "dragonegg-${major}.${minor}"
- } elseif {[regexp {macports-gcc-(.*)\.(.*)} ${compiler} -> major minor]} {
- return "gcc${major}${minor}"
- } elseif {[regexp {macports-llvm-gcc-(.*)\.(.*)} ${compiler} -> major minor]} {
- return "llvm-gcc${major}${minor}"
+ foreach {re fmt} $portconfigure::valid_compiler_ports {
+ if {[set matches [regexp -inline $re $compiler]] ne {}} {
+ return [eval [linsert [lrange $matches 1 end] 0 format $fmt]]
+ }
}
-
- return ""
+ return {}
}
proc portconfigure::compiler_is_port {compiler} {
@@ -448,23 +430,23 @@
} elseif {$xcodeversion == "none" || $xcodeversion == ""} {
return {cc}
} elseif {[vercmp $xcodeversion 4.6] >= 0} {
- return {clang macports-llvm-gcc-4.2 apple-gcc-4.2 macports-clang-3.2}
+ return {clang macports-llvm-gcc-4.2 apple-gcc-4.2 macports-clang-3.3}
} elseif {[vercmp $xcodeversion 4.2] >= 0} {
- return {clang llvm-gcc-4.2 apple-gcc-4.2 macports-clang-3.2}
+ return {clang llvm-gcc-4.2 apple-gcc-4.2 macports-clang-3.3}
} elseif {[vercmp $xcodeversion 4.0] >= 0} {
- return {llvm-gcc-4.2 clang gcc-4.2 macports-clang-3.2 apple-gcc-4.2}
+ return {llvm-gcc-4.2 clang gcc-4.2 macports-clang-3.3 apple-gcc-4.2}
} elseif {[vercmp $xcodeversion 3.2] >= 0} {
if {$macosx_deployment_target == "10.4"} {
# It's not the deployment target that is the issue, it's the
# 10.4u SDK which base chooses if the deployment_target is set
return {gcc-4.0}
} else {
- return {gcc-4.2 clang llvm-gcc-4.2 macports-clang-3.2 macports-llvm-gcc-4.2 apple-gcc-4.2 gcc-4.0}
+ return {gcc-4.2 clang llvm-gcc-4.2 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2 gcc-4.0}
}
} elseif {[vercmp $xcodeversion 3.0] >= 0} {
- return {gcc-4.2 apple-gcc-4.2 gcc-4.0 macports-clang-3.2}
+ return {gcc-4.2 apple-gcc-4.2 gcc-4.0 macports-clang-3.3}
} else {
- return {gcc-4.0 apple-gcc-4.2 gcc-3.3 macports-clang-3.2}
+ return {gcc-4.0 apple-gcc-4.2 gcc-3.3 macports-clang-3.3}
}
}
@@ -499,25 +481,24 @@
set compiler ${configure.compiler}
}
# Tcl 8.4's switch doesn't support -matchvar.
- if {[regexp {^gcc(-3\.3|-4\.0|-4\.2)?$} $compiler -> suffix]} {
+ if {[regexp {^apple-gcc(-4\.[02])$} $compiler -> suffix]} {
switch $type {
- cc -
- objc { return [find_developer_tool "gcc${suffix}"] }
- cxx { return [find_developer_tool "g++${suffix}"] }
- cpp { return [find_developer_tool "cpp${suffix}"] }
+ cc -
+ objc { return ${prefix}/bin/gcc-apple${suffix} }
+ cxx -
+ objcxx {
+ if {$suffix == "-4.2"} {
+ return ${prefix}/bin/g++-apple${suffix}
+ }
+ }
+ cpp { return ${prefix}/bin/cpp-apple${suffix} }
}
- } elseif {[regexp {^llvm-gcc-4\.2$} $compiler]} {
- switch $type {
- cc -
- objc { return [find_developer_tool llvm-gcc-4.2] }
- cxx { return [find_developer_tool llvm-g++-4.2] }
- cpp { return [find_developer_tool llvm-cpp-4.2] }
- }
} elseif {[regexp {^clang$} $compiler]} {
switch $type {
- cc -
- objc { return [find_developer_tool clang] }
- cxx {
+ cc -
+ objc { return [find_developer_tool clang] }
+ cxx -
+ objcxx {
set clangpp [find_developer_tool clang++]
if {[file executable $clangpp]} {
return $clangpp
@@ -525,63 +506,77 @@
return [find_developer_tool llvm-g++-4.2]
}
}
- } elseif {[regexp {^apple-gcc(-4\.0|-4\.2)$} $compiler -> suffix]} {
+ } elseif {[regexp {^gcc(-3\.3|-4\.[02])?$} $compiler -> suffix]} {
switch $type {
- cc -
- objc { return ${prefix}/bin/gcc-apple${suffix} }
- cxx {
- if {$suffix == "-4.2"} {
- return ${prefix}/bin/g++-apple${suffix}
- }
- }
- cpp { return ${prefix}/bin/cpp-apple${suffix} }
+ cc -
+ objc { return [find_developer_tool "gcc${suffix}"] }
+ cxx -
+ objcxx { return [find_developer_tool "g++${suffix}"] }
+ cpp { return [find_developer_tool "cpp${suffix}"] }
}
- } elseif {[regexp {^macports-gcc(-\d+\.\d+)?$} $compiler -> suffix]} {
- if {[string length $suffix]} {
+ } elseif {[regexp {^llvm-gcc-4\.2$} $compiler]} {
+ switch $type {
+ cc -
+ objc { return [find_developer_tool llvm-gcc-4.2] }
+ cxx -
+ objcxx { return [find_developer_tool llvm-g++-4.2] }
+ cpp { return [find_developer_tool llvm-cpp-4.2] }
+ }
+ } elseif {[regexp {^macports-clang(-\d+\.\d+)?$} $compiler -> suffix]} {
+ if {$suffix ne {}} {
set suffix "-mp${suffix}"
}
switch $type {
- cc -
- objc { return ${prefix}/bin/gcc${suffix} }
- cxx { return ${prefix}/bin/g++${suffix} }
- cpp { return ${prefix}/bin/cpp${suffix} }
- fc -
- f77 -
- f90 { return ${prefix}/bin/gfortran${suffix} }
+ cc -
+ objc { return ${prefix}/bin/clang${suffix} }
+ cxx -
+ objcxx { return ${prefix}/bin/clang++${suffix} }
}
- } elseif {[regexp {^macports-llvm-gcc-4\.2$} $compiler]} {
+ } elseif {[regexp {^macports-dragonegg(-\d+\.\d+)(?:-gcc(-\d+\.\d+))?$} $compiler \
+ -> infix suffix]} {
+ if {$suffix ne {}} {
+ set suffix "-mp${suffix}"
+ }
switch $type {
- cc -
- objc { return ${prefix}/bin/llvm-gcc-4.2 }
- cxx { return ${prefix}/bin/llvm-g++-4.2 }
- cpp { return ${prefix}/bin/llvm-cpp-4.2 }
+ cc -
+ objc { return ${prefix}/bin/dragonegg${infix}-gcc${suffix} }
+ cxx -
+ objcxx { return ${prefix}/bin/dragonegg${infix}-g++${suffix} }
+ cpp { return ${prefix}/bin/dragonegg${infix}-cpp${suffix} }
+ fc -
+ f77 -
+ f90 { return ${prefix}/bin/dragonegg${infix}-gfortran${suffix} }
}
- } elseif {[regexp {^macports-clang(-\d+\.\d+)?$} $compiler -> suffix]} {
- if {[string length $suffix]} {
+ } elseif {[regexp {^macports-gcc(-\d+\.\d+)?$} $compiler -> suffix]} {
+ if {$suffix ne {}} {
set suffix "-mp${suffix}"
}
switch $type {
- cc -
- objc { return ${prefix}/bin/clang${suffix} }
- cxx { return ${prefix}/bin/clang++${suffix} }
+ cc -
+ objc { return ${prefix}/bin/gcc${suffix} }
+ cxx -
+ objcxx { return ${prefix}/bin/g++${suffix} }
+ cpp { return ${prefix}/bin/cpp${suffix} }
+ fc -
+ f77 -
+ f90 { return ${prefix}/bin/gfortran${suffix} }
}
- } elseif {[regexp {^macports-dragonegg(-\d+\.\d+)$} $compiler -> infix]} {
+ } elseif {[regexp {^macports-llvm-gcc-4\.2$} $compiler]} {
switch $type {
- cc -
- objc { return ${prefix}/bin/dragonegg${infix}-gcc }
- cxx { return ${prefix}/bin/dragonegg${infix}-g++ }
- cpp { return ${prefix}/bin/dragonegg${infix}-cpp }
- fc -
- f77 -
- f90 { return ${prefix}/bin/dragonegg${infix}-gfortran }
+ cc -
+ objc { return ${prefix}/bin/llvm-gcc-4.2 }
+ cxx -
+ objcxx { return ${prefix}/bin/llvm-g++-4.2 }
+ cpp { return ${prefix}/bin/llvm-cpp-4.2 }
}
}
# Fallbacks
switch $type {
- cc -
- objc { return [find_developer_tool cc] }
- cxx { return [find_developer_tool c++] }
- cpp { return [find_developer_tool cpp] }
+ cc -
+ objc { return [find_developer_tool cc] }
+ cxx -
+ objcxx { return [find_developer_tool c++] }
+ cpp { return [find_developer_tool cpp] }
}
return ""
}
@@ -590,8 +585,12 @@
# Some of the compilers we use are provided by MacPorts itself; ensure we
# automatically add a dependency when needed
proc portconfigure::add_automatic_compiler_dependencies {} {
- global configure.compiler
+ global configure.compiler configure.compiler.add_deps
+ if {!${configure.compiler.add_deps}} {
+ return
+ }
+
# The default value requires substitution before use.
set compiler [subst ${configure.compiler}]
if {![compiler_is_port $compiler]} {
@@ -617,20 +616,23 @@
}
# Register the above procedure as a callback after Portfile evaluation
port::register_callback portconfigure::add_automatic_compiler_dependencies
+# and an option to turn it off if required
+options configure.compiler.add_deps
+default configure.compiler.add_deps yes
proc portconfigure::configure_main {args} {
global [info globals]
- global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf
- global configure.env configure.pipe configure.libs configure.classpath configure.universal_args
- global configure.perl configure.python configure.ruby configure.install configure.awk configure.bison
- global configure.pkg_config configure.pkg_config_path
- global configure.ccache configure.distcc configure.cpp configure.javac configure.sdkroot
- global configure.march configure.mtune
- global os.platform os.major
- foreach tool {cc cxx objc f77 f90 fc ld} {
+ global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf \
+ configure.env configure.pipe configure.libs configure.classpath configure.universal_args \
+ configure.perl configure.python configure.ruby configure.install configure.awk configure.bison \
+ configure.pkg_config configure.pkg_config_path \
+ configure.ccache configure.distcc configure.cpp configure.javac configure.sdkroot \
+ configure.march configure.mtune configure.cxx_stdlib \
+ os.platform os.major
+ foreach tool {cc cxx objc objcxx f77 f90 fc ld} {
global configure.${tool} configure.${tool}_archflags
}
- foreach flags {cflags cppflags cxxflags objcflags ldflags fflags f90flags fcflags} {
+ foreach flags {cflags cppflags cxxflags objcflags objcxxflags ldflags fflags f90flags fcflags} {
global configure.${flags} configure.universal_${flags}
}
@@ -654,13 +656,13 @@
if {[tbool use_xmkmf]} {
parse_environment xmkmf
- append_list_to_environment_value xmkmf "IMAKECPP" ${configure.cpp}
+ append_to_environment_value xmkmf "IMAKECPP" ${configure.cpp}
if {[catch {command_exec xmkmf} result]} {
return -code error "[format [msgcat::mc "%s failure: %s"] xmkmf $result]"
}
parse_environment xmkmf
- append_list_to_environment_value xmkmf "IMAKECPP" ${configure.cpp}
+ append_to_environment_value xmkmf "IMAKECPP" ${configure.cpp}
if {[catch {command_exec "cd ${worksrcpath} && make Makefiles" -varprefix xmkmf} result]} {
return -code error "[format [msgcat::mc "%s failure: %s"] "make Makefiles" $result]"
}
@@ -670,86 +672,87 @@
# Set pre-compiler filter to use (ccache/distcc), if any.
if {[tbool configure.ccache] && [tbool configure.distcc]} {
- set filter "ccache "
- append_list_to_environment_value configure "CCACHE_PREFIX" "distcc"
+ set filter ccache
+ append_to_environment_value configure "CCACHE_PREFIX" "distcc"
} elseif {[tbool configure.ccache]} {
- set filter "ccache "
+ set filter ccache
} elseif {[tbool configure.distcc]} {
- set filter "distcc "
+ set filter distcc
} else {
set filter ""
}
-
+ foreach env_var {CC CXX OBJC OBJCXX} {
+ append_to_environment_value configure $env_var $filter
+ }
+
# Set flags controlling the kind of compiler output.
if {[tbool configure.pipe]} {
- set output "-pipe "
+ set output -pipe
} else {
set output ""
}
+ foreach env_var {CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS FFLAGS F90FLAGS FCFLAGS} {
+ append_to_environment_value configure $env_var $output
+ }
# Append configure flags.
- append_list_to_environment_value configure "CC" ${filter}${configure.cc}
- append_list_to_environment_value configure "CXX" ${filter}${configure.cxx}
- append_list_to_environment_value configure "OBJC" ${filter}${configure.objc}
- append_list_to_environment_value configure "FC" ${configure.fc}
- append_list_to_environment_value configure "F77" ${configure.f77}
- append_list_to_environment_value configure "F90" ${configure.f90}
- append_list_to_environment_value configure "JAVAC" ${configure.javac}
- append_list_to_environment_value configure "CFLAGS" ${output}${configure.cflags}
- append_list_to_environment_value configure "CPPFLAGS" ${configure.cppflags}
- append_list_to_environment_value configure "CXXFLAGS" ${output}${configure.cxxflags}
- append_list_to_environment_value configure "OBJCFLAGS" ${output}${configure.objcflags}
- append_list_to_environment_value configure "LDFLAGS" ${configure.ldflags}
- append_list_to_environment_value configure "LIBS" ${configure.libs}
- append_list_to_environment_value configure "FFLAGS" ${output}${configure.fflags}
- append_list_to_environment_value configure "F90FLAGS" ${output}${configure.f90flags}
- append_list_to_environment_value configure "FCFLAGS" ${output}${configure.fcflags}
- append_list_to_environment_value configure "CLASSPATH" ${configure.classpath}
- append_list_to_environment_value configure "PERL" ${configure.perl}
- append_list_to_environment_value configure "PYTHON" ${configure.python}
- append_list_to_environment_value configure "RUBY" ${configure.ruby}
- append_list_to_environment_value configure "INSTALL" ${configure.install}
- append_list_to_environment_value configure "AWK" ${configure.awk}
- append_list_to_environment_value configure "BISON" ${configure.bison}
- append_list_to_environment_value configure "PKG_CONFIG" ${configure.pkg_config}
- append_list_to_environment_value configure "PKG_CONFIG_PATH" ${configure.pkg_config_path}
+ foreach env_var { \
+ CC CXX OBJC OBJCXX FC F77 F90 JAVAC \
+ CFLAGS CPPFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS \
+ FFLAGS F90FLAGS FCFLAGS LDFLAGS LIBS CLASSPATH \
+ PERL PYTHON RUBY INSTALL AWK BISON PKG_CONFIG PKG_CONFIG_PATH \
+ } {
+ set value [option configure.[string tolower $env_var]]
+ eval [linsert $value 0 append_to_environment_value configure $env_var]
+ }
# https://trac.macports.org/ticket/34221
if {${os.platform} == "darwin" && ${os.major} == 12} {
- append_list_to_environment_value configure "__CFPREFERENCES_AVOID_DAEMON" 1
+ append_to_environment_value configure "__CFPREFERENCES_AVOID_DAEMON" 1
}
# add SDK flags if cross-compiling (or universal on ppc tiger)
if {${configure.sdkroot} != ""} {
- foreach flags {CPPFLAGS CFLAGS CXXFLAGS OBJCFLAGS} {
- append_list_to_environment_value configure $flags "-isysroot ${configure.sdkroot}"
+ foreach env_var {CPPFLAGS CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS} {
+ append_to_environment_value configure $env_var -isysroot ${configure.sdkroot}
}
- append_list_to_environment_value configure "LDFLAGS" "-Wl,-syslibroot,${configure.sdkroot}"
+ append_to_environment_value configure "LDFLAGS" -Wl,-syslibroot,${configure.sdkroot}
}
# add extra flags that are conditional on whether we're building universal
+ eval [linsert [get_canonical_archflags cc] 0 append_to_environment_value configure CFLAGS]
+ foreach tool {cxx objc objcxx cpp f77 f90 fc ld} {
+ if {[catch {get_canonical_archflags $tool} flags]} {
+ continue
+ }
+ set env_var [string toupper $tool]FLAGS
+ eval [linsert $flags 0 append_to_environment_value configure $env_var]
+ }
if {[variant_exists universal] && [variant_isset universal]} {
- foreach flags {CFLAGS OBJCFLAGS} {
- append_list_to_environment_value configure $flags ${configure.universal_cflags}
- }
- append_list_to_environment_value configure "CXXFLAGS" ${configure.universal_cxxflags}
- append_list_to_environment_value configure "CPPFLAGS" ${configure.universal_cppflags}
- append_list_to_environment_value configure "LDFLAGS" ${configure.universal_ldflags}
- eval configure.pre_args-append ${configure.universal_args}
+ eval [linsert ${configure.universal_args} 0 configure.pre_args-append]
} else {
- foreach {tool flags} {cc CFLAGS cxx CXXFLAGS objc OBJCFLAGS f77 FFLAGS f90 F90FLAGS fc FCFLAGS ld LDFLAGS} {
- append_list_to_environment_value configure $flags [set configure.${tool}_archflags]
+ foreach env_var {CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS FFLAGS F90FLAGS FCFLAGS LDFLAGS} {
if {${configure.march} != {}} {
- append_list_to_environment_value configure $flags "-march=${configure.march}"
+ append_to_environment_value configure $env_var -march=${configure.march}
}
if {${configure.mtune} != {}} {
- append_list_to_environment_value configure $flags "-mtune=${configure.mtune}"
+ append_to_environment_value configure $env_var -mtune=${configure.mtune}
}
}
}
+ # Add flags to specify C++ STL implementation
+ if {${configure.cxx_stdlib} ne {} && [string match *clang* [option configure.cxx]]} {
+ append_to_environment_value configure CXXFLAGS -stdlib=${configure.cxx_stdlib}
+ append_to_environment_value configure OBJCXXFLAGS -stdlib=${configure.cxx_stdlib}
+ }
+
# Execute the command (with the new environment).
if {[catch {command_exec configure} result]} {
+ global configure.dir
+ if {[file exists ${configure.dir}/config.log]} {
+ ui_error "[format [msgcat::mc "Failed to configure %s, consult %s/config.log"] [option subport] ${configure.dir}]"
+ }
return -code error "[format [msgcat::mc "%s failure: %s"] configure $result]"
}
}
Modified: branches/new-help-system/base/src/port1.0/portdeactivate.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdeactivate.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portdeactivate.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -57,7 +57,15 @@
}
proc portdeactivate::deactivate_main {args} {
- global subport version revision portvariants user_options
+ global subport version revision portvariants user_options startupitem.autostart UI_PREFIX
+
+ if {[tbool startupitem.autostart]} {
+ ui_notice "$UI_PREFIX [format [msgcat::mc "Unloading %s"] [option subport]]"
+ if {[eval_targets "unload"]} {
+ ui_warn [format [msgcat::mc "Failed to unload %s, continuing anyway."] [option subport]]
+ }
+ }
+
registry_deactivate $subport $version $revision $portvariants [array get user_options]
return 0
}
Modified: branches/new-help-system/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdestroot.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portdestroot.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -4,7 +4,7 @@
#
# Copyright (c) 2002 - 2003 Apple Inc.
# Copyright (c) 2004 - 2005 Robert Shaw <rshaw at opendarwin.org>
-# Copyright (c) 2004-2005, 2007-2012 The MacPorts Project
+# Copyright (c) 2004-2005, 2007-2013 The MacPorts Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -47,13 +47,14 @@
}
# define options
-options destroot.target destroot.destdir destroot.clean destroot.keepdirs destroot.umask
-options destroot.violate_mtree destroot.asroot destroot.delete_la_files
-options startupitem.create startupitem.requires startupitem.init
-options startupitem.name startupitem.start startupitem.stop startupitem.restart
-options startupitem.type startupitem.executable
-options startupitem.pidfile startupitem.logfile startupitem.logevents startupitem.netchange
-options startupitem.uniquename startupitem.plist startupitem.location startupitem.install
+options destroot.target destroot.destdir destroot.clean destroot.keepdirs destroot.umask \
+ destroot.violate_mtree destroot.asroot destroot.delete_la_files \
+ startupitem.autostart startupitem.create startupitem.executable \
+ startupitem.init startupitem.install startupitem.location \
+ startupitem.logevents startupitem.logfile startupitem.name \
+ startupitem.netchange startupitem.pidfile startupitem.plist \
+ startupitem.requires startupitem.restart startupitem.start \
+ startupitem.stop startupitem.type startupitem.uniquename
commands destroot
# Set defaults
@@ -69,24 +70,25 @@
default destroot.clean no
default destroot.keepdirs ""
default destroot.violate_mtree no
-default destroot.delete_la_files no
+default destroot.delete_la_files {${delete_la_files}}
+default startupitem.autostart no
+default startupitem.executable ""
+default startupitem.init ""
+default startupitem.install {$system_options(startupitem_install)}
+default startupitem.location LaunchDaemons
+default startupitem.logevents no
+default startupitem.logfile ""
default startupitem.name {${subport}}
-default startupitem.uniquename {org.macports.${startupitem.name}}
+default startupitem.netchange no
+default startupitem.pidfile ""
default startupitem.plist {${startupitem.uniquename}.plist}
-default startupitem.location LaunchDaemons
-default startupitem.init ""
+default startupitem.requires ""
+default startupitem.restart ""
default startupitem.start ""
default startupitem.stop ""
-default startupitem.restart ""
-default startupitem.requires ""
-default startupitem.executable ""
default startupitem.type {$system_options(startupitem_type)}
-default startupitem.pidfile ""
-default startupitem.logfile ""
-default startupitem.logevents no
-default startupitem.netchange no
-default startupitem.install {$system_options(startupitem_install)}
+default startupitem.uniquename {org.macports.${startupitem.name}}
set_ui_prefix
@@ -102,9 +104,9 @@
}
proc portdestroot::destroot_start {args} {
- global UI_PREFIX prefix subport porturl destroot os.platform destroot.clean portsharepath
- global destroot.umask destroot.asroot euid egid
- global applications_dir frameworks_dir
+ global UI_PREFIX prefix subport porturl destroot os.platform destroot.clean portsharepath \
+ destroot.umask destroot.asroot euid egid \
+ applications_dir frameworks_dir
variable oldmask
ui_notice "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${subport}]"
@@ -149,9 +151,9 @@
}
proc portdestroot::destroot_finish {args} {
- global UI_PREFIX destroot prefix subport startupitem.create destroot.violate_mtree
- global applications_dir frameworks_dir destroot.keepdirs destroot.delete_la_files
- global os.platform os.version
+ global UI_PREFIX destroot prefix subport startupitem.create destroot.violate_mtree \
+ applications_dir frameworks_dir destroot.keepdirs destroot.delete_la_files \
+ os.platform os.version
variable oldmask
# Create startup-scripts/items
Modified: branches/new-help-system/base/src/port1.0/portdistcheck.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdistcheck.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portdistcheck.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -53,10 +53,8 @@
default distcheck.type moddate
proc portdistcheck::distcheck_main {args} {
- global distcheck.type
- global fetch.type
- global fetch.ignore_sslcert
- global subport portpath
+ global distcheck.type fetch.type fetch.ignore_sslcert \
+ subport portpath
set port_moddate [file mtime ${portpath}/Portfile]
Modified: branches/new-help-system/base/src/port1.0/portfetch.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portfetch.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portfetch.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -323,9 +323,9 @@
# Perform a CVS login and fetch, storing the CVS login
# information in a custom .cvspass file
proc portfetch::cvsfetch {args} {
- global workpath cvs.env cvs.cmd cvs.args cvs.post_args
- global cvs.root cvs.date cvs.tag cvs.method cvs.password
- global patch_sites patchfiles filespath
+ global workpath cvs.env cvs.cmd cvs.args cvs.post_args \
+ cvs.root cvs.date cvs.tag cvs.method cvs.password
+ patch_sites patchfiles filespath
set cvs.args "${cvs.method} ${cvs.args}"
if {${cvs.method} == "export" && ![string length ${cvs.tag}] && ![string length ${cvs.date}]} {
@@ -420,8 +420,8 @@
# Perform a git fetch
proc portfetch::gitfetch {args} {
- global worksrcpath patchfiles
- global git.url git.branch git.sha1 git.cmd
+ global worksrcpath patchfiles \
+ git.url git.branch git.sha1 git.cmd
set options "-q"
if {[string length ${git.branch}] == 0} {
@@ -476,9 +476,9 @@
# Perform a standard fetch, assembling fetch urls from
# the listed url variable and associated distfile
proc portfetch::fetchfiles {args} {
- global distpath all_dist_files UI_PREFIX
- global fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert fetch.remote_time
- global fallback_mirror_site portverbose usealtworkpath altprefix
+ global distpath all_dist_files UI_PREFIX \
+ fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert fetch.remote_time \
+ fallback_mirror_site portverbose usealtworkpath altprefix
variable fetch_urls
variable urlmap
Modified: branches/new-help-system/base/src/port1.0/portinstall.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portinstall.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portinstall.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -54,8 +54,8 @@
set_ui_prefix
proc portinstall::install_start {args} {
- global UI_PREFIX subport version revision portvariants
- global prefix registry_open registry.path
+ global UI_PREFIX subport version revision portvariants \
+ prefix registry_open registry.path
ui_notice "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $subport $version $revision $portvariants]"
# start gsoc08-privileges
@@ -76,39 +76,6 @@
handle_add_users
}
-# fake some info for a list of files to match the format
-# used for contents in the flat registry
-# This list is a 6-tuple of the form:
-# 0: file path
-# 1: uid
-# 2: gid
-# 3: mode
-# 4: size
-# 5: md5 checksum information
-proc portinstall::_fake_fileinfo_for_index {flist} {
- global
- set rval [list]
- foreach file $flist {
- lappend rval [list $file [getuid] [getgid] 0644 0 "MD5 ($fname) NONE"]
- }
- return $rval
-}
-
-proc portinstall::putel { fd el data } {
- # Quote xml data
- set quoted [string map { & & < < > > } $data]
- # Write the element
- puts $fd "<${el}>${quoted}</${el}>"
-}
-
-proc portinstall::putlist { fd listel itemel list } {
- puts $fd "<$listel>"
- foreach item $list {
- putel $fd $itemel $item
- }
- puts $fd "</$listel>"
-}
-
proc portinstall::create_archive {location archive.type} {
global workpath destpath portpath subport version revision portvariants \
epoch os.platform PortInfo installPlist \
@@ -200,22 +167,6 @@
return -code error "No '$xar' was found on this system!"
}
}
- xpkg {
- set xar "xar"
- set compression "bzip2"
- set archive.meta yes
- set archive.metaname "xpkg"
- set archive.metapath [file join $workpath "${archive.metaname}.xml"]
- if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
- ui_debug "Using $xar"
- set archive.cmd "$xar"
- set archive.pre_args "-cv --exclude='\./\+.*' --compression=${compression} -n ${archive.metaname} -s ${archive.metapath} -f"
- set archive.args "${location} ."
- } else {
- ui_debug $errmsg
- return -code error "No '$xar' was found on this system!"
- }
- }
zip {
set zip "zip"
if {[catch {set zip [findBinary $zip ${portutil::autoconf::zip_path}]} errmsg] == 0} {
@@ -334,77 +285,6 @@
}
close $fd
- # the XML package metadata, for XAR package
- # (doesn't contain any file list/checksums)
- if {[tbool archive.meta]} {
- set sd [open ${archive.metapath} w]
- puts $sd "<xpkg version='0.2'>"
- # TODO: split contents into <buildinfo> (new) and <package> (current)
- # see existing <portpkg> for the matching source package layout
-
- putel $sd name ${subport}
- putel $sd epoch ${epoch}
- putel $sd version ${version}
- putel $sd revision ${revision}
- putel $sd major 0
- putel $sd minor 0
-
- putel $sd platform ${os.platform}
- if {[llength [get_canonical_archs]] > 1} {
- putlist $sd archs arch [get_canonical_archs]
- } else {
- putel $sd arch [get_canonical_archs]
- }
- putlist $sd variants variant $vlist
-
- if {[exists categories]} {
- set primary [lindex [split [option categories] " "] 0]
- putel $sd category $primary
- }
- if {[exists description]} {
- putel $sd comment "[option description]"
- }
- if {[exists long_description]} {
- putel $sd desc "[option long_description]"
- }
- if {[exists homepage]} {
- putel $sd homepage "[option homepage]"
- }
-
- # Emit dependencies provided by this package
- puts $sd "<provides>"
- puts $sd "<item>"
- putel $sd name $subport
- putel $sd major 0
- putel $sd minor 0
- puts $sd "</item>"
- puts $sd "</provides>"
-
-
- # Emit build, library, and runtime dependencies
- puts $sd "<requires>"
- foreach {key type} {
- depends_fetch "fetch"
- depends_extract "extract"
- depends_build "build"
- depends_lib "library"
- depends_run "runtime"
- } {
- if {[info exists $key]} {
- set depname [lindex [split [set $key] :] end]
- puts $sd "<item type=\"$type\">"
- putel $sd name $depname
- putel $sd major 0
- putel $sd minor 0
- puts $sd "</item>"
- }
- }
- puts $sd "</requires>"
-
- puts $sd "</xpkg>"
- close $sd
- }
-
# Now create the archive
ui_debug "Creating [file tail $location]"
command_exec archive
@@ -419,64 +299,7 @@
}
proc portinstall::extract_contents {location type} {
- set qflag ${portutil::autoconf::tar_q}
- switch -- $type {
- tbz -
- tbz2 {
- set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xOj${qflag}f $location ./+CONTENTS]
- }
- tgz {
- set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xOz${qflag}f $location ./+CONTENTS]
- }
- tar {
- set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $location ./+CONTENTS]
- }
- txz {
- set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $location --use-compress-program [findBinary xz ""] ./+CONTENTS]
- }
- tlz {
- set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $location --use-compress-program [findBinary lzma ""] ./+CONTENTS]
- }
- xar {
- system "cd ${workpath} && [findBinary xar ${portutil::autoconf::xar_path}] -xf $location +CONTENTS"
- set twostep 1
- }
- xpkg {
- system "cd ${workpath} && [findBinary xar ${portutil::autoconf::xar_path}] -xf $location --compression=bzip2 +CONTENTS"
- set twostep 1
- }
- zip {
- set raw_contents [exec [findBinary unzip ${portutil::autoconf::unzip_path}] -p $location +CONTENTS]
- }
- cpgz {
- system "cd ${workpath} && [findBinary pax ${portutil::autoconf::pax_path}] -rzf $location +CONTENTS"
- set twostep 1
- }
- cpio {
- system "cd ${workpath} && [findBinary pax ${portutil::autoconf::pax_path}] -rf $location +CONTENTS"
- set twostep 1
- }
- }
- if {[info exists twostep]} {
- set fd [open "${workpath}/+CONTENTS"]
- set raw_contents [read $fd]
- close $fd
- }
- set contents {}
- set ignore 0
- set sep [file separator]
- foreach line [split $raw_contents \n] {
- if {$ignore} {
- set ignore 0
- continue
- }
- if {[string index $line 0] != "@"} {
- lappend contents "${sep}${line}"
- } elseif {$line == "@ignore"} {
- set ignore 1
- }
- }
- return $contents
+ return [extract_archive_metadata $location $type contents]
}
proc portinstall::install_main {args} {
@@ -560,32 +383,3 @@
_cd $oldpwd
return 0
}
-
-# apparent usage of pkg_uninstall variable in the (flat) registry
-# the Portfile needs to define a procedure
-# proc pkg_uninstall {portname portver} {
-# body of proc
-# }
-# which gets stored above in the receipt's pkg_uninstall property
-# this is then called by the portuninstall procedure
-# note that the portuninstall procedure is not called within
-# the context of the portfile so many usual port variables do not exist
-# e.g. destroot/workpath/filespath
-
-# this procedure encodes the pkg_uninstall body so that it can be stored in the
-# the receipt file
-proc portinstall::proc_disasm {pname} {
- set p "proc "
- append p $pname " {"
- set space ""
- foreach arg [info args $pname] {
- if {[info default $pname $arg value]} {
- append p "$space{" [list $arg $value] "}"
- } else {
- append p $space $arg
- }
- set space " "
- }
- append p "} {" [string map { \n \\n } [info body $pname] ] " }"
- return $p
-}
Modified: branches/new-help-system/base/src/port1.0/portlint.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portlint.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portlint.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -270,8 +270,8 @@
}
if {!$hashline
- && ![regexp {^PortSystem|^PortGroup|^version} $line]
- && ![regexp {^[a-z0-9]+\.setup} $line]
+ && ![regexp {^\s*PortSystem|^\s*PortGroup|^\s*version} $line]
+ && ![regexp {^\s*[a-z0-9]+\.setup} $line]
&& [string first [option version] $line] != -1} {
ui_warn "Line $lineno seems to hardcode the version number, consider using \${version} instead"
incr warnings
Modified: branches/new-help-system/base/src/port1.0/portlivecheck.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portlivecheck.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portlivecheck.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -60,10 +60,10 @@
default livecheck.ignore_sslcert yes
proc portlivecheck::livecheck_main {args} {
- global livecheck.url livecheck.type livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version
- global livecheck.ignore_sslcert
- global homepage portpath workpath
- global master_sites name subport distfiles
+ global livecheck.url livecheck.type livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version \
+ livecheck.ignore_sslcert \
+ homepage portpath workpath \
+ master_sites name subport distfiles
set updated 0
set updated_version "unknown"
Modified: branches/new-help-system/base/src/port1.0/portmain.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portmain.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portmain.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -101,8 +101,8 @@
default license unknown
default distname {${name}-${version}}
default worksrcdir {$distname}
-default filespath {[file join $portpath $filesdir]}
-default worksrcpath {[file join $workpath $worksrcdir]}
+default filespath {[file join $portpath [join $filesdir]]}
+default worksrcpath {[file join $workpath [join $worksrcdir]]}
# empty list means all archs are supported
default supported_archs {}
default depends_skip_archcheck {}
Modified: branches/new-help-system/base/src/port1.0/portsandbox.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portsandbox.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portsandbox.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,7 +1,7 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$
#
-# Copyright (c) 2012 The MacPorts Project
+# Copyright (c) 2012-2013 The MacPorts Project
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -33,8 +33,9 @@
namespace eval portsandbox {
}
-options portsandbox_supported portsandbox_profile
+options portsandbox_supported portsandbox_active portsandbox_profile
default portsandbox_supported {[file executable $portutil::autoconf::sandbox_exec_path]}
+default portsandbox_active {[expr $portsandbox_supported && $sandbox_enable]}
default portsandbox_profile {}
# set up a suitable profile to pass to sandbox-exec, based on the target
@@ -42,7 +43,7 @@
# sandbox-exec -p '(version 1) (allow default) (deny file-write*) (allow file-write* <filter>)' some-command
proc portsandbox::set_profile {target} {
global os.major portsandbox_profile workpath distpath altprefix \
- package.destpath configure.ccache ccache_dir
+ package.destpath configure.ccache ccache_dir rpm.srcdir rpm.tmpdir
switch $target {
activate -
@@ -64,8 +65,18 @@
set allow_dirs [list $distpath]
}
pkg {
- set allow_dirs [list ${package.destpath}]
+ if {${os.major} == 12} {
+ # FIXME: fails on Mountain Lion with the current profile
+ set portsandbox_profile ""
+ return
+ } else {
+ set allow_dirs [list ${package.destpath}]
+ }
}
+ rpm -
+ srpm {
+ set allow_dirs [list ${rpm.srcdir} ${rpm.tmpdir}]
+ }
}
# TODO: remove altprefix support
Modified: branches/new-help-system/base/src/port1.0/portstartupitem.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portstartupitem.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portstartupitem.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -64,6 +64,9 @@
# - for launchd, generate log messages inside daemondo
# - for systemstarter, generate log messages in our generated script
#
+# startupitem.autostart yes/no
+# Automatically load the startupitem after activating. Defaults to no.
+#
package provide portstartupitem 1.0
package require portutil 1.0
@@ -74,10 +77,10 @@
set_ui_prefix
proc portstartupitem::startupitem_create_rcng {args} {
- global prefix destroot os.platform
- global startupitem.name startupitem.requires
- global startupitem.start startupitem.stop startupitem.restart
- global startupitem.type
+ global prefix destroot os.platform \
+ startupitem.name startupitem.requires \
+ startupitem.start startupitem.stop startupitem.restart \
+ startupitem.type
set scriptdir ${destroot}${prefix}/etc/rc.d
@@ -120,10 +123,11 @@
}
proc portstartupitem::startupitem_create_darwin_systemstarter {args} {
- global UI_PREFIX prefix destroot destroot.keepdirs subport os.platform
- global startupitem.name startupitem.requires startupitem.init
- global startupitem.start startupitem.stop startupitem.restart startupitem.executable
- global startupitem.pidfile startupitem.logfile startupitem.logevents
+ global UI_PREFIX prefix destroot destroot.keepdirs subport os.platform \
+ startupitem.name startupitem.requires startupitem.init \
+ startupitem.start startupitem.stop startupitem.restart startupitem.executable \
+ startupitem.pidfile startupitem.logfile startupitem.logevents \
+ startupitem.autostart
set scriptdir ${prefix}/etc/startup
@@ -385,22 +389,30 @@
close ${para}
# Emit some information for the user
- ui_notice "###########################################################"
- ui_notice "# A startup item has been generated that will aid in"
- ui_notice "# starting ${subport} with SystemStarter. It is disabled"
- ui_notice "# by default. Add the following line to /etc/hostconfig"
- ui_notice "# or ${prefix}/etc/rc.conf to start it at startup:"
- ui_notice "#"
- ui_notice "# ${uppername}=-YES-"
- ui_notice "###########################################################"
+ if {[tbool startupitem.autostart]} {
+ ui_notice "###########################################################"
+ ui_notice "# A startup item has been generated that will aid in"
+ ui_notice "# starting ${subport} with SystemStarter. It will be"
+ ui_notice "# started automatically on activation."
+ ui_notice "###########################################################"
+ } else {
+ ui_notice "###########################################################"
+ ui_notice "# A startup item has been generated that will aid in"
+ ui_notice "# starting ${subport} with SystemStarter. It is disabled"
+ ui_notice "# by default. Add the following line to /etc/hostconfig"
+ ui_notice "# or ${prefix}/etc/rc.conf to start it at startup:"
+ ui_notice "#"
+ ui_notice "# ${uppername}=-YES-"
+ ui_notice "###########################################################"
+ }
}
proc portstartupitem::startupitem_create_darwin_launchd {args} {
- global UI_PREFIX prefix destroot destroot.keepdirs subport macosx_deployment_target
- global startupitem.name startupitem.uniquename startupitem.plist startupitem.location
- global startupitem.init startupitem.start startupitem.stop startupitem.restart startupitem.executable
- global startupitem.pidfile startupitem.logfile startupitem.logevents startupitem.netchange
- global startupitem.install
+ global UI_PREFIX prefix destroot destroot.keepdirs subport macosx_deployment_target \
+ startupitem.name startupitem.uniquename startupitem.plist startupitem.location \
+ startupitem.init startupitem.start startupitem.stop startupitem.restart startupitem.executable \
+ startupitem.pidfile startupitem.logfile startupitem.logevents startupitem.netchange \
+ startupitem.install startupitem.autostart
set scriptdir ${prefix}/etc/startup
@@ -621,19 +633,29 @@
}
# Emit some information for the user
- ui_notice "###########################################################"
- ui_notice "# A startup item has been generated that will aid in"
- ui_notice "# starting ${subport} with launchd. It is disabled"
- ui_notice "# by default. Execute the following command to start it,"
- ui_notice "# and to cause it to launch at startup:"
- ui_notice "#"
- ui_notice "# sudo port load ${subport}"
- ui_notice "###########################################################"
+ if {[tbool startupitem.autostart]} {
+ ui_notice "###########################################################"
+ ui_notice "# A startup item has been generated that will aid in"
+ ui_notice "# starting ${subport} with launchd. It will be enabled"
+ ui_notice "# automatically on activation. Execute the following"
+ ui_notice "# command to manually _disable_ it:"
+ ui_notice "#"
+ ui_notice "# sudo port unload ${subport}"
+ ui_notice "###########################################################"
+ } else {
+ ui_notice "###########################################################"
+ ui_notice "# A startup item has been generated that will aid in"
+ ui_notice "# starting ${subport} with launchd. It is disabled"
+ ui_notice "# by default. Execute the following command to start it,"
+ ui_notice "# and to cause it to launch at startup:"
+ ui_notice "#"
+ ui_notice "# sudo port load ${subport}"
+ ui_notice "###########################################################"
+ }
}
proc portstartupitem::startupitem_create {args} {
- global UI_PREFIX
- global startupitem.type os.platform
+ global UI_PREFIX startupitem.type os.platform
set startupitem.type [string tolower ${startupitem.type}]
Modified: branches/new-help-system/base/src/port1.0/porttrace.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/porttrace.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/porttrace.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -40,7 +40,7 @@
}
proc porttrace::trace_start {workpath} {
- global os.platform
+ global os.platform developer_dir
if {${os.platform} == "darwin"} {
if {[catch {package require Thread} error]} {
ui_warn "trace requires Tcl Thread package ($error)"
@@ -80,13 +80,37 @@
# /Library/Caches/com.apple.Xcode
# $CCACHE_DIR
# $HOMEDIR/.ccache
- 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}"
+ set trace_sandbox [list \
+ $workpath \
+ $portpath \
+ $distpath \
+ /tmp \
+ /private/tmp \
+ /var/tmp \
+ /var/folders \
+ /private/var/tmp \
+ /var/empty \
+ /private/var/empty \
+ /private/var/folders \
+ /dev \
+ /etc/passwd \
+ /etc/groups \
+ /etc/localtime \
+ [file normalize ${developer_dir}/../..] \
+ /Library/Caches/com.apple.Xcode \
+ "$env(HOME)/.ccache"]
if {[info exists env(TMPDIR)]} {
- set trace_sandboxbounds "${trace_sandboxbounds}:$env(TMPDIR)"
+ lappend trace_sandbox $env(TMPDIR)
}
if {[info exists env(CCACHE_DIR)]} {
- set trace_sandboxbounds "${trace_sandboxbounds}:$env(CCACHE_DIR)"
+ lappend trace_sandbox $env(CCACHE_DIR)
}
+
+ ui_debug "Tracelib Sandbox is:"
+ foreach sandbox $trace_sandbox {
+ ui_debug "\t$sandbox"
+ }
+ set trace_sandboxbounds [join $trace_sandbox :]
tracelib setsandbox $trace_sandboxbounds
}
}
@@ -233,8 +257,7 @@
# Private.
# Slave method to read a line from the trace.
proc porttrace::slave_read_line {chan} {
- global ports_list trace_filemap sandbox_violation_list workpath
- global env
+ global ports_list trace_filemap sandbox_violation_list workpath env
while 1 {
# We should never get EOF, actually.
@@ -303,7 +326,7 @@
set sandbox_violation_list {}
tracelib setname $fifo
- if [catch {tracelib opensocket} err] {
+ if {[catch {tracelib opensocket} err]} {
global errorInfo
ui_warn "Error in tracelib: $err"
ui_debug "Backtrace: $errorInfo"
@@ -311,7 +334,7 @@
}
proc porttrace::slave_run {} {
- if [catch {tracelib run} err] {
+ if {[catch {tracelib run} err]} {
global errorInfo
ui_warn "Error in tracelib: $err"
ui_debug "Backtrace: $errorInfo"
Modified: branches/new-help-system/base/src/port1.0/portutil.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portutil.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/port1.0/portutil.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,5 +1,4 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
-# portutil.tcl
# $Id$
#
# Copyright (c) 2002-2003 Apple Inc.
@@ -258,8 +257,8 @@
}
##
-# Mark an option as deprecate
-# If it is set or accessed, it will be mapped it to the new option
+# Mark an option as deprecated
+# If it is set or accessed, it will be mapped to the new option
#
# @param option name of the option
# @param newoption name of a superseding option
@@ -385,6 +384,12 @@
}
}
+ set dir [option ${varprefix}.dir]
+ if {![file exists ${dir}]} {
+ ui_debug "Creating ${varprefix} directory: ${dir}"
+ file mkdir ${dir}
+ }
+
global ${varprefix}.env ${varprefix}.env_array ${varprefix}.nice env macosx_version
# Set the environment.
@@ -819,51 +824,29 @@
}
}
-# Append to the value in the parsed environment.
-# Leave the environment untouched if the value is empty.
-proc append_to_environment_value {command key value} {
- global ${command}.env_array
+# Append one or more items to the key in the parsed environment.
+proc append_to_environment_value {command key args} {
+ upvar #0 ${command}.env_array($key) env_key
+ foreach value $args {
+ if {$value eq {}} {
+ continue
+ }
+ # Parse out any delimiters. Is this even necessary anymore?
+ regexp {^(['"])(.*)\1$} $value -> delim value
- if {[string length $value] == 0} {
- return
+ append env_key " $value"
}
-
- # Parse out any delimiter.
- set append_value $value
- if {[regexp {^("|')(.*)\1$} $append_value matchVar append_delim matchedValue]} {
- set append_value $matchedValue
- }
-
- if {[info exists ${command}.env_array($key)]} {
- set original_value [set ${command}.env_array($key)]
- set ${command}.env_array($key) "${original_value} ${append_value}"
- } else {
- set ${command}.env_array($key) $append_value
- }
+ catch {set env_key [string trimleft $env_key]}
}
-# Append several items to a value in the parsed environment.
-proc append_list_to_environment_value {command key vallist} {
- foreach {value} $vallist {
- append_to_environment_value ${command} $key $value
- }
-}
-
-# Build the environment as a string.
-# Remark: this method is only used for debugging purposes.
+# Return a string representation of the specified environment, for
+# debugging purposes.
proc environment_array_to_string {environment_array} {
upvar 1 ${environment_array} env_array
-
- set theString ""
foreach {key value} [array get env_array] {
- if {$theString == ""} {
- set theString "$key='$value'"
- } else {
- set theString "${theString} $key='$value'"
- }
+ lappend env_list $key='$value'
}
-
- return $theString
+ return [join $env_list]
}
########### Distname utility functions ###########
@@ -915,7 +898,7 @@
# reinplace
# Provides "sed in place" functionality
proc reinplace {args} {
- global env worksrcpath macosx_version
+ global env workpath worksrcpath macosx_version
set extended 0
set suppress 0
set oldlocale_exists 0
@@ -962,12 +945,18 @@
set pattern [lindex $args 0]
set files [lrange $args 1 end]
+ if {[file isdirectory ${workpath}/.tmp]} {
+ set tempdir ${workpath}/.tmp
+ } else {
+ set tempdir /tmp
+ }
+
foreach file $files {
# if $file is an absolute path already, file join will just return the
# absolute path, otherwise it is $dir/$file
set file [file join $dir $file]
- if {[catch {set tmpfile [mkstemp "/tmp/[file tail $file].sed.XXXXXXXX"]} error]} {
+ if {[catch {set tmpfile [mkstemp "${tempdir}/[file tail $file].sed.XXXXXXXX"]} error]} {
global errorInfo
ui_debug "$errorInfo"
ui_error "reinplace: $error"
@@ -1370,6 +1359,11 @@
# otherwise execute the task.
if {$skipped == 0} {
+ # cd somewhere readable in tracemode to avoid error, e.g. with
+ # find. Make sure to use a path that also exists when executing
+ # Portfiles from registry, i.e., _not_ $workpath.
+ set oldpwd [pwd]
+ _cd $portdbpath
# change current phase shown in log
set_phase $target
@@ -1411,7 +1405,6 @@
test -
destroot -
- install -
dmg -
pkg -
portpkg -
@@ -1420,8 +1413,13 @@
srpm -
dpkg -
mdmg -
+ "" { set deptypes "depends_fetch depends_extract depends_lib depends_build depends_run" }
+
+ # install may be run given an archive, which means
+ # depends_fetch, _extract, _build dependencies have
+ # never been installed
activate -
- "" { set deptypes "depends_fetch depends_extract depends_lib depends_build depends_run" }
+ install { set deptypes "depends_lib depends_run" }
}
# Gather the dependencies for deptypes
@@ -1461,7 +1459,7 @@
if {$result == 0} {
foreach pre [ditem_key $ditem pre] {
ui_debug "Executing $pre"
- set result [catch {$pre $targetname} errstr]
+ set result [catch {eval $pre $targetname} errstr]
# Save variables in order to re-throw the same error code.
set errcode $::errorCode
set errinfo $::errorInfo
@@ -1471,7 +1469,7 @@
if {$result == 0} {
ui_debug "Executing $targetname ($portname)"
- set result [catch {$procedure $targetname} errstr]
+ set result [catch {eval $procedure $targetname} errstr]
# Save variables in order to re-throw the same error code.
set errcode $::errorCode
set errinfo $::errorInfo
@@ -1480,7 +1478,7 @@
if {$result == 0} {
foreach post [ditem_key $ditem post] {
ui_debug "Executing $post"
- set result [catch {$post $targetname} errstr]
+ set result [catch {eval $post $targetname} errstr]
# Save variables in order to re-throw the same error code.
set errcode $::errorCode
set errinfo $::errorInfo
@@ -1491,7 +1489,7 @@
if {[ditem_contains $ditem postrun] && $result == 0} {
set postrun [ditem_key $ditem postrun]
ui_debug "Executing $postrun"
- set result [catch {$postrun $targetname} errstr]
+ set result [catch {eval $postrun $targetname} errstr]
# Save variables in order to re-throw the same error code.
set errcode $::errorCode
set errinfo $::errorInfo
@@ -1509,6 +1507,9 @@
# End of trace.
porttrace::trace_stop
}
+ # $oldpwd is deleted while uninstalling a port, changing back
+ # _will_ fail
+ catch {_cd $oldpwd}
}
}
if {[exists copy_log_files]} {
@@ -1828,6 +1829,25 @@
flush $fd
}
+# Change the value of an existing statefile key
+# caller must call open_statefile after this
+proc update_statefile {class name path} {
+ set fd [open $path r]
+ while {[gets $fd line] >= 0} {
+ if {[lindex $line 0] != "${class}:"} {
+ lappend lines $line
+ }
+ }
+ close $fd
+ # truncate
+ set fd [open $path w]
+ puts $fd "$class: $name"
+ foreach line $lines {
+ puts $fd $line
+ }
+ close $fd
+}
+
##
# Check that recorded selection of variants match the current selection
#
@@ -2207,8 +2227,7 @@
}
proc handle_default_variants {option action {value ""}} {
- global PortInfo
- global variations
+ global PortInfo variations
switch -regex $action {
set|append {
# Retrieve the information associated with each variant.
@@ -2435,7 +2454,7 @@
global supported_archive_types
if {![info exists supported_archive_types]} {
set supported_archive_types {}
- foreach type {tbz2 tbz tgz tar txz tlz xar xpkg zip cpgz cpio} {
+ foreach type {tbz2 tbz tgz tar txz tlz xar zip cpgz cpio} {
if {[catch {archiveTypeIsSupported $type}] == 0} {
lappend supported_archive_types $type
}
@@ -2446,7 +2465,7 @@
# return path to a downloaded or installed archive for this port
proc find_portarchive_path {} {
- global portdbpath subport version revision portvariants
+ global portdbpath subport version revision portvariants force_archive_refresh
set installed 0
if {[registry_exists $subport $version $revision $portvariants]} {
set installed 1
@@ -2454,7 +2473,7 @@
set archiverootname [file rootname [get_portimage_name]]
foreach unarchive.type [supportedArchiveTypes] {
set fullarchivename "${archiverootname}.${unarchive.type}"
- if {$installed} {
+ if {$installed && ![tbool force_archive_refresh]} {
set fullarchivepath [file join $portdbpath software $subport $fullarchivename]
} else {
set fullarchivepath [file join $portdbpath incoming/verified $fullarchivename]
@@ -2511,7 +2530,7 @@
}
}
}
- xar|xpkg {
+ xar {
set xar "xar"
if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
return 0
@@ -2533,6 +2552,89 @@
return -code error [format [msgcat::mc "Unsupported port archive type '%s': %s"] $type $errmsg]
}
+# return the specified piece of metadata from the +CONTENTS file in the given archive
+proc extract_archive_metadata {archive_location archive_type metadata_type} {
+ set qflag ${portutil::autoconf::tar_q}
+ set raw_contents ""
+
+ switch -- $archive_type {
+ xar -
+ cpgz -
+ cpio {
+ set twostep 1
+ global workpath
+ if {[file isdirectory ${workpath}/.tmp]} {
+ set tempdir [mkdtemp ${workpath}/.tmp/portarchiveXXXXXXXX]
+ } else {
+ set tempdir [mkdtemp /tmp/portarchiveXXXXXXXX]
+ }
+ }
+ }
+
+ switch -- $archive_type {
+ tbz -
+ tbz2 {
+ set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xOj${qflag}f $archive_location ./+CONTENTS]
+ }
+ tgz {
+ set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xOz${qflag}f $archive_location ./+CONTENTS]
+ }
+ tar {
+ set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $archive_location ./+CONTENTS]
+ }
+ txz {
+ set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $archive_location --use-compress-program [findBinary xz ""] ./+CONTENTS]
+ }
+ tlz {
+ set raw_contents [exec [findBinary tar ${portutil::autoconf::tar_path}] -xO${qflag}f $archive_location --use-compress-program [findBinary lzma ""] ./+CONTENTS]
+ }
+ xar {
+ system -W ${tempdir} "[findBinary xar ${portutil::autoconf::xar_path}] -xf $archive_location +CONTENTS"
+ }
+ zip {
+ set raw_contents [exec [findBinary unzip ${portutil::autoconf::unzip_path}] -p $archive_location +CONTENTS]
+ }
+ cpgz {
+ system -W ${tempdir} "[findBinary pax ${portutil::autoconf::pax_path}] -rzf $archive_location +CONTENTS"
+ }
+ cpio {
+ system -W ${tempdir} "[findBinary pax ${portutil::autoconf::pax_path}] -rf $archive_location +CONTENTS"
+ }
+ }
+ if {[info exists twostep]} {
+ set fd [open "${tempdir}/+CONTENTS"]
+ set raw_contents [read $fd]
+ close $fd
+ file delete -force $tempdir
+ }
+ if {$metadata_type == "contents"} {
+ set contents {}
+ set ignore 0
+ set sep [file separator]
+ foreach line [split $raw_contents \n] {
+ if {$ignore} {
+ set ignore 0
+ continue
+ }
+ if {[string index $line 0] != "@"} {
+ lappend contents "${sep}${line}"
+ } elseif {$line == "@ignore"} {
+ set ignore 1
+ }
+ }
+ return $contents
+ } elseif {$metadata_type == "portname"} {
+ foreach line [split $raw_contents \n] {
+ if {[lindex $line 0] == "@portname"} {
+ return [lindex $line 1]
+ }
+ }
+ return ""
+ } else {
+ return -code error "unknown metadata_type: $metadata_type"
+ }
+}
+
#
# merge function for universal builds
#
@@ -2900,13 +3002,18 @@
# returns the flags that should be passed to the compiler to choose arch(s)
proc get_canonical_archflags {{tool cc}} {
if {![variant_exists universal] || ![variant_isset universal]} {
- return [option configure.${tool}_archflags]
+ if {[catch {option configure.${tool}_archflags} flags]} {
+ return -code error "archflags do not exist for tool '$tool'"
+ }
} else {
- if {$tool == "cc" || $tool == "objc"} {
+ if {$tool == "cc"} {
set tool c
}
- return [option configure.universal_${tool}flags]
+ if {[catch {option configure.universal_${tool}flags} flags]} {
+ return -code error "universal archflags do not exist for tool '$tool'"
+ }
}
+ return $flags
}
# check that the selected archs are supported
@@ -2952,12 +3059,12 @@
10.7 {
set min 4.1
set ok 4.1
- set rec 4.5.2
+ set rec 4.6.2
}
default {
set min 4.4
set ok 4.4
- set rec 4.5.2
+ set rec 4.6.2
}
}
if {$xcodeversion == "none"} {
Modified: branches/new-help-system/base/src/registry2.0/Makefile
===================================================================
--- branches/new-help-system/base/src/registry2.0/Makefile 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/registry2.0/Makefile 2013-09-07 09:48:49 UTC (rev 110832)
@@ -3,8 +3,7 @@
SRCS = registry.tcl registry_autoconf.tcl registry_util.tcl receipt_flat.tcl receipt_sqlite.tcl portimage.tcl portuninstall.tcl
OBJS = registry.o util.o \
entry.o entryobj.o \
- file.o fileobj.o \
- ../cregistry/cregistry.a
+ file.o fileobj.o
#graph.o graphobj.o
SHLIB_NAME= registry${SHLIB_SUFFIX}
@@ -16,8 +15,13 @@
pkgIndex.tcl: $(SRCS)
CFLAGS+= ${SQLITE3_CFLAGS}
-LIBS+= ${SQLITE3_LIBS}
+LIBS+= ${SQLITE3_LIBS} ../cregistry/cregistry.a
+ifeq ($(shell uname), Darwin)
+SHLIB_LDFLAGS+= -install_name @loader_path/../registry2.0/${SHLIB_NAME}
+endif
+${SHLIB_NAME}: ../cregistry/cregistry.a
+
.PHONY: test
test:: ${SHLIB_NAME}
Modified: branches/new-help-system/base/src/registry2.0/portimage.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/portimage.tcl 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/src/registry2.0/portimage.tcl 2013-09-07 09:48:49 UTC (rev 110832)
@@ -372,7 +372,7 @@
throw MACPORTS "No '$tar' was found on this system!"
}
}
- xar|xpkg {
+ xar {
set xar "xar"
if {[catch {set xar [macports::findBinary $xar ${macports::autoconf::xar_path}]} errmsg] == 0} {
ui_debug "Using $xar"
Modified: branches/new-help-system/base/tests/test/checksums-1/master
===================================================================
--- branches/new-help-system/base/tests/test/checksums-1/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/checksums-1/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,5 +1,5 @@
---> Fetching distfiles for checksum
----> Verifying checksum(s) for checksum
+---> Verifying checksums for checksum
---> Extracting checksum
---> Configuring checksum
---> Building checksum
Copied: branches/new-help-system/base/tests/test/dependencies-a/master (from rev 110831, trunk/base/tests/test/dependencies-a/master)
===================================================================
--- branches/new-help-system/base/tests/test/dependencies-a/master (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-a/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -0,0 +1,17 @@
+---> Computing dependencies for dependencies-a
+---> Dependencies to be installed: dependencies-b
+---> Fetching distfiles for dependencies-b
+---> Verifying checksums for dependencies-b
+---> Extracting dependencies-b
+---> Configuring dependencies-b
+---> Building dependencies-b
+---> Staging dependencies-b into destroot
+---> Installing dependencies-b @1_0
+---> Activating dependencies-b @1_0
+---> Cleaning dependencies-b
+---> Fetching distfiles for dependencies-a
+---> Verifying checksums for dependencies-a
+---> Extracting dependencies-a
+---> Configuring dependencies-a
+---> Building dependencies-a
+---> Testing dependencies-a
Copied: branches/new-help-system/base/tests/test/dependencies-b/master (from rev 110831, trunk/base/tests/test/dependencies-b/master)
===================================================================
--- branches/new-help-system/base/tests/test/dependencies-b/master (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-b/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -0,0 +1,6 @@
+---> Fetching distfiles for dependencies-b
+---> Verifying checksums for dependencies-b
+---> Extracting dependencies-b
+---> Configuring dependencies-b
+---> Building dependencies-b
+---> Testing dependencies-b
Modified: branches/new-help-system/base/tests/test/dependencies-c/master
===================================================================
--- branches/new-help-system/base/tests/test/dependencies-c/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/dependencies-c/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,7 +1,7 @@
---> Computing dependencies for dependencies-c
---> Dependencies to be installed: dependencies-a dependencies-b
---> Fetching distfiles for dependencies-b
----> Verifying checksum(s) for dependencies-b
+---> Verifying checksums for dependencies-b
---> Extracting dependencies-b
---> Configuring dependencies-b
---> Building dependencies-b
@@ -10,7 +10,7 @@
---> Activating dependencies-b @1_0
---> Cleaning dependencies-b
---> Fetching distfiles for dependencies-a
----> Verifying checksum(s) for dependencies-a
+---> Verifying checksums for dependencies-a
---> Extracting dependencies-a
---> Configuring dependencies-a
---> Building dependencies-a
@@ -19,7 +19,7 @@
---> Activating dependencies-a @1_0+i_want_b
---> Cleaning dependencies-a
---> Fetching distfiles for dependencies-c
----> Verifying checksum(s) for dependencies-c
+---> Verifying checksums for dependencies-c
---> Extracting dependencies-c
---> Configuring dependencies-c
---> Building dependencies-c
Modified: branches/new-help-system/base/tests/test/dependencies-d/master
===================================================================
--- branches/new-help-system/base/tests/test/dependencies-d/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/dependencies-d/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -3,7 +3,7 @@
---> Computing dependencies for dependencies-d
---> Dependencies to be installed: dependencies-a dependencies-b
---> Fetching distfiles for dependencies-b
----> Verifying checksum(s) for dependencies-b
+---> Verifying checksums for dependencies-b
---> Extracting dependencies-b
---> Configuring dependencies-b
---> Building dependencies-b
@@ -12,7 +12,7 @@
---> Activating dependencies-b @1_0
---> Cleaning dependencies-b
---> Fetching distfiles for dependencies-a
----> Verifying checksum(s) for dependencies-a
+---> Verifying checksums for dependencies-a
---> Extracting dependencies-a
---> Configuring dependencies-a
---> Building dependencies-a
@@ -21,7 +21,7 @@
---> Activating dependencies-a @1_0+i_want_b
---> Cleaning dependencies-a
---> Fetching distfiles for dependencies-d
----> Verifying checksum(s) for dependencies-d
+---> Verifying checksums for dependencies-d
---> Extracting dependencies-d
---> Configuring dependencies-d
---> Building dependencies-d
Modified: branches/new-help-system/base/tests/test/envvariables/master
===================================================================
--- branches/new-help-system/base/tests/test/envvariables/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/envvariables/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,5 +1,5 @@
---> Fetching distfiles for envvariables
----> Verifying checksum(s) for envvariables
+---> Verifying checksums for envvariables
---> Extracting envvariables
---> Configuring envvariables
---> Building envvariables
Modified: branches/new-help-system/base/tests/test/site-tags/master
===================================================================
--- branches/new-help-system/base/tests/test/site-tags/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/site-tags/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,7 +1,7 @@
---> Fetching distfiles for site-tags
---> Attempting to fetch app-bm.tar.gz from http://www.douglas.stebila.ca/files/code/vim/app/
---> Attempting to fetch doc.tar.gz from http://www.douglas.stebila.ca/files/code/vim/doc/
----> Verifying checksum(s) for site-tags
+---> Verifying checksums for site-tags
---> Extracting site-tags
---> Configuring site-tags
---> Building site-tags
Modified: branches/new-help-system/base/tests/test/statefile-version1-outdated/master
===================================================================
--- branches/new-help-system/base/tests/test/statefile-version1-outdated/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/statefile-version1-outdated/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,6 +1,6 @@
Portfile changed since last build; discarding previous state.
---> Fetching distfiles for statefile-version1-outdated
----> Verifying checksum(s) for statefile-version1-outdated
+---> Verifying checksums for statefile-version1-outdated
---> Extracting statefile-version1-outdated
---> Configuring statefile-version1-outdated
---> Building statefile-version1-outdated
Modified: branches/new-help-system/base/tests/test/statefile-version2-invalid/master
===================================================================
--- branches/new-help-system/base/tests/test/statefile-version2-invalid/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/statefile-version2-invalid/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,7 +1,7 @@
Warning: Statefile has version 2 but didn't contain a checksum
Portfile changed since last build; discarding previous state.
---> Fetching distfiles for statefile-version2-invalid
----> Verifying checksum(s) for statefile-version2-invalid
+---> Verifying checksums for statefile-version2-invalid
---> Extracting statefile-version2-invalid
---> Configuring statefile-version2-invalid
---> Building statefile-version2-invalid
Modified: branches/new-help-system/base/tests/test/statefile-version2-outdated/master
===================================================================
--- branches/new-help-system/base/tests/test/statefile-version2-outdated/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/statefile-version2-outdated/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,6 +1,6 @@
Portfile changed since last build; discarding previous state.
---> Fetching distfiles for statefile-version2-outdated
----> Verifying checksum(s) for statefile-version2-outdated
+---> Verifying checksums for statefile-version2-outdated
---> Extracting statefile-version2-outdated
---> Configuring statefile-version2-outdated
---> Building statefile-version2-outdated
Modified: branches/new-help-system/base/tests/test/svn-and-patchsites/master
===================================================================
--- branches/new-help-system/base/tests/test/svn-and-patchsites/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/svn-and-patchsites/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,6 +1,6 @@
---> Fetching distfiles for svn-and-patchsites
---> Attempting to fetch patch-1.5.14.dgc.xlabel_ext.9 from http://home.uchicago.edu/~dgc/sw/mutt/
----> Verifying checksum(s) for svn-and-patchsites
+---> Verifying checksums for svn-and-patchsites
---> Extracting svn-and-patchsites
---> Configuring svn-and-patchsites
---> Building svn-and-patchsites
Modified: branches/new-help-system/base/tests/test/trace/Makefile
===================================================================
--- branches/new-help-system/base/tests/test/trace/Makefile 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/trace/Makefile 2013-09-07 09:48:49 UTC (rev 110832)
@@ -2,36 +2,35 @@
.PHONY: test
+PWD=$(shell dirname `pwd`)
+
$(bindir)/port:
@echo "Please install MacPorts before running this test"
@exit 1
test:
@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
- @touch delete-trace
- @touch rename-trace
- @mkdir -p rmdir-trace
- @rm -f create-trace
- @rm -f create-trace-modenv
- @rm -rf mkdir-trace
+ @mkdir -p ../tracetesttmp
+ @-[ "`id -u`" == "0" ] && chown $(RUNUSR) ../tracetesttmp
+ @([ "`id -u`" == "0" ] && sudo -u $(RUNUSR) touch ../tracetesttmp/delete-trace) || touch ../tracetesttmp/delete-trace
+ @([ "`id -u`" == "0" ] && sudo -u $(RUNUSR) touch ../tracetesttmp/rename-trace) || touch ../tracetesttmp/rename-trace
+ @([ "`id -u`" == "0" ] && sudo -u $(RUNUSR) mkdir -p ../tracetesttmp/rmdir-trace) || mkdir -p ../tracetesttmp/rmdir-trace
@rm -f /tmp/hello-trace
- @rm -f link-trace
- @ln -s /usr/include/unistd.h /tmp/link-trace2
+ @ln -sf /usr/include/unistd.h /tmp/link-trace2
+ @-[ "`id -u`" == "0" ] && chown -h $(RUNUSR) /tmp/link-trace2
@PORTSRC=$(PORTSRC) $(bindir)/port -t test > output 2>&1 || (cat output; exit 1)
- @rm -f link-trace
@rm -f /tmp/link-trace2
- @rm -f delete-trace
- @rm -f rename-trace
- @rm -f rename-new-trace
- @rm -f create-trace
- @rm -f create-trace-modenv
- @rm -rf mkdir-trace
- @rm -rf rmdir-trace
@rm -f /tmp/hello-trace
- @sed -e "s|${PWD}|PWD|g" < output > output.sed
+ @rm -rf ../tracetesttmp
+ @sed -e "s|$(PWD)|PWD|g" < output > output.sed
@diff -u master output.sed 2>&1 | tee difference
@if [ -s difference ]; then \
exit 1; \
else \
rm -f difference output.sed; \
fi
+
+clean::
+ @PORTSRC=$(PORTSRC) $(bindir)/port clean >/dev/null
+ @rm -f output output.sed difference
+ @rm -rf ../tracetesttmp
Modified: branches/new-help-system/base/tests/test/trace/Portfile
===================================================================
--- branches/new-help-system/base/tests/test/trace/Portfile 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/trace/Portfile 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,33 +1,50 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$
-PortSystem 1.0
-name trace
-version 1
-categories test
-maintainers pguyot at kallisys.net
-description Test port for -t
-homepage http://www.macports.org/
-platforms darwin
+PortSystem 1.0
+name trace
+version 1
+categories test
+maintainers pguyot at kallisys.net
+description Test port for -t
+homepage http://www.macports.org/
+platforms darwin
-long_description ${description}
+long_description ${description}
distfiles
-use_configure no
-build {}
-destroot {
- system "touch ${destroot}${prefix}/lib/${name}"
+use_configure no
+build {}
+destroot {
+ system "touch ${destroot}${prefix}/lib/${name}"
}
test {
- catch {system "touch create-trace"}
- catch {system "rm delete-trace"}
- system "touch /tmp/hello-trace"
- system "rm /tmp/hello-trace"
- system "ln -s /usr/include/ link-trace"
- system "rm /tmp/link-trace2"
- catch {system "mkdir mkdir-trace"}
- catch {system "rmdir rmdir-trace"}
- catch {system "mv rename-trace rename-new-trace"}
- catch {system "DYLD_INSERT_LIBRARIES= touch create-trace-modenv"}
- system "mkdir -p /usr/bin"
+ proc fails {operation} {
+ if {![catch $operation]} {
+ ui_error "Operation ${operation} succeeded although it should have failed!"
+ error "test failure"
+ }
+ }
+ # the port directory is outside of the sandbox; make sure files can't be
+ # created, deleted or symlinked into place here
+ fails {system "touch ../tracetesttmp/create-trace"}
+ fails {system "rm ../tracetesttmp/delete-trace"}
+ fails {system "ln -s /usr/include/ ../tracetesttmp/link-trace"}
+ # we also don't want mkdir or rmdir here
+ fails {system "mkdir ../tracetesttmp/mkdir-trace"}
+ fails {system "rmdir ../tracetesttmp/rmdir-trace"}
+ # renaming should also be prohibited
+ fails {system "mv ../tracetesttmp/rename-trace ../tracetesttmp/rename-new-trace"}
+
+ # test access to /tmp
+ system "touch /tmp/hello-trace"
+ system "rm /tmp/hello-trace"
+ system "rm /tmp/link-trace2"
+
+ # overwriting DYLD_INSERT_LIBRARIES should not allow escaping the sandbox (due to env restoring)
+ fails {system "DYLD_INSERT_LIBRARIES= touch ../tracetesttmp/create-trace-modenv"}
+
+ # if the directories already exist, mkdir -p should succeed.
+ system "mkdir -p /usr/bin"
}
Modified: branches/new-help-system/base/tests/test/trace/master
===================================================================
--- branches/new-help-system/base/tests/test/trace/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/trace/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,12 +1,12 @@
---> Fetching distfiles for trace
----> Verifying checksum(s) for trace
+---> Verifying checksums for trace
---> Extracting trace
---> Configuring trace
---> Building trace
---> Testing trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/create-trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/create-trace-modenv
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/delete-trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/mkdir-trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/rename-trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/rmdir-trace
+Warning: An activity was attempted outside sandbox: PWD/tracetesttmp/create-trace
+Warning: An activity was attempted outside sandbox: PWD/tracetesttmp/create-trace-modenv
+Warning: An activity was attempted outside sandbox: PWD/tracetesttmp/delete-trace
+Warning: An activity was attempted outside sandbox: PWD/tracetesttmp/mkdir-trace
+Warning: An activity was attempted outside sandbox: PWD/tracetesttmp/rename-trace
+Warning: An activity was attempted outside sandbox: PWD/tracetesttmp/rmdir-trace
Modified: branches/new-help-system/base/tests/test/variants/master
===================================================================
--- branches/new-help-system/base/tests/test/variants/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/variants/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,7 +1,7 @@
Utopia variant -- 2
Utopia variant -- 2
---> Fetching distfiles for variants
----> Verifying checksum(s) for variants
+---> Verifying checksums for variants
---> Extracting variants
---> Configuring variants
---> Building variants
Modified: branches/new-help-system/base/tests/test/xcodeversion/Portfile
===================================================================
--- branches/new-help-system/base/tests/test/xcodeversion/Portfile 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/xcodeversion/Portfile 2013-09-07 09:48:49 UTC (rev 110832)
@@ -21,7 +21,7 @@
test {
# rpm-vercomp is now deprecated, change it here too when removed
# from all ports and base (but keep this test here, meanwhile...)
- # rpm-vercomp removed from ports r89810, from base r89911
+ # rpm-vercomp removed from ports r89810, from base r89811
if {$xcodeversion != "" && [vercmp $xcodeversion 2.1] >= 0} {
ui_msg "xcodeversion >= 2.1"
} else {
Modified: branches/new-help-system/base/tests/test/xcodeversion/master
===================================================================
--- branches/new-help-system/base/tests/test/xcodeversion/master 2013-09-07 07:49:56 UTC (rev 110831)
+++ branches/new-help-system/base/tests/test/xcodeversion/master 2013-09-07 09:48:49 UTC (rev 110832)
@@ -1,5 +1,5 @@
---> Fetching distfiles for xcodeversion
----> Verifying checksum(s) for xcodeversion
+---> Verifying checksums for xcodeversion
---> Extracting xcodeversion
---> Configuring xcodeversion
---> Building xcodeversion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130907/e63e3a97/attachment-0001.html>
More information about the macports-changes
mailing list