[53504] branches/images-and-archives/base

blb at macports.org blb at macports.org
Mon Jul 6 22:33:03 PDT 2009


Revision: 53504
          http://trac.macports.org/changeset/53504
Author:   blb at macports.org
Date:     2009-07-06 22:33:03 -0700 (Mon, 06 Jul 2009)
Log Message:
-----------
Merge from trunk

Modified Paths:
--------------
    branches/images-and-archives/base/Makefile.in
    branches/images-and-archives/base/Mk/macports.autoconf.mk.in
    branches/images-and-archives/base/aclocal.m4
    branches/images-and-archives/base/configure
    branches/images-and-archives/base/configure.ac
    branches/images-and-archives/base/doc/macports.conf.in
    branches/images-and-archives/base/doc/portfile.7
    branches/images-and-archives/base/portmgr/dmg/InstallationCheck
    branches/images-and-archives/base/portmgr/dmg/InstallationCheck.strings
    branches/images-and-archives/base/src/macports1.0/macports.tcl
    branches/images-and-archives/base/src/package1.0/portpkg.tcl
    branches/images-and-archives/base/src/pextlib1.0/Makefile
    branches/images-and-archives/base/src/pextlib1.0/Pextlib.c
    branches/images-and-archives/base/src/pextlib1.0/filemap.c
    branches/images-and-archives/base/src/pextlib1.0/md5cmd.c
    branches/images-and-archives/base/src/pextlib1.0/md_wrappers.h
    branches/images-and-archives/base/src/pextlib1.0/rmd160cmd.c
    branches/images-and-archives/base/src/pextlib1.0/sha1cmd.c
    branches/images-and-archives/base/src/pextlib1.0/strsed.c
    branches/images-and-archives/base/src/port/port.tcl
    branches/images-and-archives/base/src/port1.0/portbuild.tcl
    branches/images-and-archives/base/src/port1.0/portconfigure.tcl
    branches/images-and-archives/base/src/port1.0/portdestroot.tcl
    branches/images-and-archives/base/src/port1.0/portutil.tcl
    branches/images-and-archives/base/src/tclobjc1.0/Makefile.in

Added Paths:
-----------
    branches/images-and-archives/base/src/pextlib1.0/pipe.c
    branches/images-and-archives/base/src/pextlib1.0/pipe.h
    branches/images-and-archives/base/src/pextlib1.0/readdir.c
    branches/images-and-archives/base/src/pextlib1.0/readdir.h
    branches/images-and-archives/base/src/pextlib1.0/strsed.h
    branches/images-and-archives/base/src/pextlib1.0/sysctl.c
    branches/images-and-archives/base/src/pextlib1.0/sysctl.h

Removed Paths:
-------------
    branches/images-and-archives/base/Mk/macports.upgrade.mk
    branches/images-and-archives/base/portmgr/dmg/preflight

Property Changed:
----------------
    branches/images-and-archives/base/
    branches/images-and-archives/base/portmgr/dmg/InstallationCheck
    branches/images-and-archives/base/portmgr/dmg/InstallationCheck.strings
    branches/images-and-archives/base/portmgr/jobs/mirror_macports.sh
    branches/images-and-archives/base/portmgr/jobs/org.macports.PortIndexRegen.plist
    branches/images-and-archives/base/portmgr/jobs/org.macports.mprsyncup.plist
    branches/images-and-archives/base/portmgr/jobs/portfile_lint.pl
    branches/images-and-archives/base/portmgr/jobs/portfile_mirror.pl
    branches/images-and-archives/base/src/dep_map_clean.tcl
    branches/images-and-archives/base/src/package1.0/portportpkg.tcl
    branches/images-and-archives/base/src/pextlib1.0/tracelib.c
    branches/images-and-archives/base/src/pextlib1.0/tracelib.h
    branches/images-and-archives/base/src/registry2.0/portimage.tcl
    branches/images-and-archives/base/src/registry2.0/portuninstall.tcl
    branches/images-and-archives/base/src/registry2.0/registry_util.tcl
    branches/images-and-archives/base/src/tclobjc1.0/MPMethodSignatureExtensions.h
    branches/images-and-archives/base/src/tclobjc1.0/MPMethodSignatureExtensions.m
    branches/images-and-archives/base/src/tclobjc1.0/Makefile.in
    branches/images-and-archives/base/src/tclobjc1.0/objc_encoding.h
    branches/images-and-archives/base/src/tclobjc1.0/objc_encoding.m
    branches/images-and-archives/base/src/tclobjc1.0/tclobjc.h
    branches/images-and-archives/base/src/tclobjc1.0/tclobjc.m
    branches/images-and-archives/base/src/tclobjc1.0/tclobjc_types.h
    branches/images-and-archives/base/src/tclobjc1.0/tclobjc_types.m
    branches/images-and-archives/base/src/thread2.6.diff
    branches/images-and-archives/base/src/upgrade_sources_conf_default.tcl


Property changes on: branches/images-and-archives/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/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:50249-53050
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/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:50249-53503
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/images-and-archives/base/Makefile.in
===================================================================
--- branches/images-and-archives/base/Makefile.in	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/Makefile.in	2009-07-07 05:33:03 UTC (rev 53504)
@@ -1,5 +1,6 @@
 # $Id$
 
+PATH		= @PATH_CLEANED@
 SUBDIR		= doc src
 DISTDIR		= dist
 DISTVER		=
@@ -28,15 +29,10 @@
 		echo "Source tree not configured. Use ./configure" ; \
 	fi
 
-
-include Mk/macports.upgrade.mk
-
-install:: upgrade
-	[ ! -f ${sysconfdir}/macports/mp_version ] || rm -vf ${sysconfdir}/macports/mp_version
-
 include Mk/macports.subdir.mk
 
 install::
+	[ ! -f ${sysconfdir}/macports/mp_version ] || rm -vf ${sysconfdir}/macports/mp_version
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 setupenv.bash  $(DESTDIR)${datadir}/macports/
 # Only run these scripts when not building in a destroot
 ifeq ($(DESTDIR),)

Modified: branches/images-and-archives/base/Mk/macports.autoconf.mk.in
===================================================================
--- branches/images-and-archives/base/Mk/macports.autoconf.mk.in	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/Mk/macports.autoconf.mk.in	2009-07-07 05:33:03 UTC (rev 53504)
@@ -32,7 +32,7 @@
 TCL_CC			= @TCL_CC@
 SHLIB_LD		= @SHLIB_LD@
 STLIB_LD		= @STLIB_LD@
-LDFLAGS			= -L/usr/local/lib @LDFLAGS@
+LDFLAGS			= @LDFLAGS@
 SHLIB_LDFLAGS		= @SHLIB_LDFLAGS@ ${LDFLAGS}
 SHLIB_SUFFIX		= @SHLIB_SUFFIX@
 TCL_STUB_LIB_SPEC	= @TCL_STUB_LIB_SPEC@

Deleted: branches/images-and-archives/base/Mk/macports.upgrade.mk
===================================================================
--- branches/images-and-archives/base/Mk/macports.upgrade.mk	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/Mk/macports.upgrade.mk	2009-07-07 05:33:03 UTC (rev 53504)
@@ -1,115 +0,0 @@
-# $Id$
-
-UPGRADECHECK    = $(DESTDIR)${localstatedir}/macports/.mprename
-
-
-upgrade::
-	@echo ""; echo "Upgrading your existing MacPorts installation to the new namespace if necessary:"; echo ""
-
-# We can safely delete the ${TCL_PACKAGE_DIR}/darwinports1.0 dir as files in it are always overwritten and will now be installed onto
-# ${TCL_PACKAGE_DIR}/macports1.0 with new names:
-	[ ! -d $(DESTDIR)${TCL_PACKAGE_DIR}/darwinports1.0 ] || rm -rf $(DESTDIR)${TCL_PACKAGE_DIR}/darwinports1.0
-
-# MacPorts base files in ${datadir} are also safely removed as new ones are always installed, and onto a their new location in this case too:
-	[ ! -d $(DESTDIR)${datadir}/darwinports ] || rm -rf $(DESTDIR)${datadir}/darwinports
-
-# Old version file can be safely deleted, as it was already used to start this upgrade and a new one will be installed into the new location:
-	[ ! -f $(DESTDIR)${sysconfdir}/ports/dp_version ] || rm -vf $(DESTDIR)${sysconfdir}/ports/dp_version
-
-# Old ports.conf(5) man page is removed:
-	[ ! -f $(DESTDIR)${prefix}/share/man/man5/ports.conf.5 ] || rm -vf $(DESTDIR)${prefix}/share/man/man5/ports.conf.5
-
-# Conf files directory is renamed:
-	[ ! -d $(DESTDIR)${sysconfdir}/ports ] || mv -v $(DESTDIR)${sysconfdir}/ports $(DESTDIR)${sysconfdir}/macports
-
-# Important directories inside ${localstatedir}/db/dports are moved to their new location, creating it first:
-	[ -d $(DESTDIR)${localstatedir}/macports ] || mkdir -vp $(DESTDIR)${localstatedir}/macports
-	for dir in distfiles images receipts software; do \
-		[ ! -d $(DESTDIR)${localstatedir}/db/dports/$${dir} ] || mv -v $(DESTDIR)${localstatedir}/db/dports/$${dir} $(DESTDIR)${localstatedir}/macports ; \
-	done
-
-# Move the default ports tree to the new layout:
-	[ ! -d $(DESTDIR)${localstatedir}/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports ] || { mkdir -vp \
-		$(DESTDIR)${localstatedir}/macports/sources/rsync.macports.org/release && mv -v \
-		$(DESTDIR)${localstatedir}/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports $(DESTDIR)${localstatedir}/macports/sources/rsync.macports.org/release/ports ; \
-	}
-
-# Open up receipts and upgrade any paths in them containing old conventions to the new namespace:
-	for receipt in $(DESTDIR)${localstatedir}/macports/receipts/*/*/receipt.bz2 ; do [ ! \( -f $${receipt} -a ! -f $${receipt}.mpsaved \) ] || { \
-		cp -v $${receipt} $${receipt}.mpsaved && { \
-			$(BZIP2) -q -dc $${receipt} | sed 's/db\/dports/macports/g' | $(BZIP2) -q -zf > $${receipt}.new ; \
-		} && mv -v $${receipt}.new $${receipt} ; \
-	}; done
-
-# Check for existance of the main configuration file and perform a couple of replacements on it, backing it up first:
-## 1) new default path up to our configuration files (referenced through other variables);
-## 2) new default value for the portdbpath variable;
-## 3) new MacPorts rsync server;
-## 4) new default value for the base tree;
-## 5) new default value for trunk's base sources for users who have it (some do);
-## 6) stray quotes are removed from the value of the rsync_options key in old conf files;
-## 7) useless --delete option is removed from the default rsync flags (--delete is implied by --delete-after);
-## 8) references to the old ports.conf(5) man page are updated to the new macports.conf(5) page;
-	[ ! \( -f $(DESTDIR)${sysconfdir}/macports/ports.conf -a ! -f ${UPGRADECHECK} \) ] || { \
-		mv -v $(DESTDIR)${sysconfdir}/macports/ports.conf $(DESTDIR)${sysconfdir}/macports/macports.conf.mpsaved; \
-		sed 's/etc\/ports/etc\/macports/g' $(DESTDIR)${sysconfdir}/macports/macports.conf.mpsaved > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/db\/dports/macports/g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/darwinports/macports/g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/dpupdate1\/base/release\/base/g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed '/^rsync_options/s/"\(.*\)"/\1/' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/ --delete / /' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/ ports.conf(5)/ macports.conf(5)/g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-	}
-
-# Check for existance of the main sources file and perform a couple of replacements on it, backing it up first:
-## 1) new MacPorts rsync server;
-## 2) new default value for the ports tree.
-	[ ! \( -f $(DESTDIR)${sysconfdir}/macports/sources.conf -a ! -f ${UPGRADECHECK} \) ] || { \
-		cp -v $(DESTDIR)${sysconfdir}/macports/sources.conf $(DESTDIR)${sysconfdir}/macports/sources.conf.mpsaved; \
-		sed 's/darwinports/macports/g' $(DESTDIR)${sysconfdir}/macports/sources.conf > $(DESTDIR)${sysconfdir}/macports/sources.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/sources.conf.tmp $(DESTDIR)${sysconfdir}/macports/sources.conf; \
-		sed 's/dpupdate\/dports/release\/ports\//g' $(DESTDIR)${sysconfdir}/macports/sources.conf > $(DESTDIR)${sysconfdir}/macports/sources.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/sources.conf.tmp $(DESTDIR)${sysconfdir}/macports/sources.conf; \
-	}
-
-# Check for existance of a personal configuration file and perform a couple of replacements on it, backing it up first:
-## 1) new default path up to our configuration files (referenced through other variables);
-## 2) new default value for the portdbpath variable;
-## 3) new MacPorts rsync server;
-## 4) new default value for the base tree;
-## 5) new default value for trunk's base sources for users who have it (some do);
-## 6) stray quotes are removed from the value of the rsync_options key in old conf files;
-## 7) useless --delete option is removed from the default rsync flags (--delete is implied by --delete-after);
-## 8) references to the old ports.conf(5) man page are updated to the new macports.conf(5) page;
-	[ ! \( -f "$(DESTDIR)$${HOME}/.macports/ports.conf" -a ! -f ${UPGRADECHECK} \) ] || { \
-		mv -v "$(DESTDIR)$${HOME}/.macports/ports.conf" "$(DESTDIR)$${HOME}/.macports/macports.conf.mpsaved"; \
-		sed 's/etc\/ports/etc\/macports/g' "$(DESTDIR)$${HOME}/.macports/macports.conf.mpsaved" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/db\/dports/macports/g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/darwinports/macports/g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/dpupdate1\/base/release\/base/g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed '/^rsync_options/s/"\(.*\)"/\1/' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/ --delete / /' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/ ports.conf(5)/ macports.conf(5)/g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-	}
-
-# Upgrade success announcement (meaning we're done ;):
-	@[ -f ${UPGRADECHECK} ] || { echo ""; echo "MacPorts installation successfully upgraded from the old DarwinPorts namespace!"; echo ""; \
-		echo "MacPorts rename update done!" > ${UPGRADECHECK} ; }

Modified: branches/images-and-archives/base/aclocal.m4
===================================================================
--- branches/images-and-archives/base/aclocal.m4	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/aclocal.m4	2009-07-07 05:33:03 UTC (rev 53504)
@@ -288,7 +288,22 @@
 
 	])
 
+# MP_CHECK_OLDLAYOUT
+#---------------------------------------
+AC_DEFUN([MP_CHECK_OLDLAYOUT],[
+	dnl Bail if there is an existing install of DP/MP older than 1.5
 
+	AC_MSG_CHECKING([that any existing MacPorts install can be upgraded])
+
+	eval dpversionfile="${sysconfdir}/ports/dp_version"
+	if test -f $dpversionfile; then
+		AC_MSG_ERROR([Existing MacPorts or DarwinPorts install is too old to be upgraded. Install MacPorts 1.7.1 first.])
+	else
+		AC_MSG_RESULT([yes])
+	fi
+
+	])
+
 # MP_CHECK_NOROOTPRIVILEGES
 #-------------------------------------------------
 AC_DEFUN([MP_CHECK_NOROOTPRIVILEGES],[
@@ -811,6 +826,7 @@
 		fi
 	done
 	PATH=$newPATH; export PATH
+	AC_SUBST(PATH_CLEANED,$newPATH)
 	prefix=$oldprefix
 ])
 

Modified: branches/images-and-archives/base/configure
===================================================================
--- branches/images-and-archives/base/configure	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/configure	2009-07-07 05:33:03 UTC (rev 53504)
@@ -764,6 +764,7 @@
 XCODE_SELECT
 DEFAULTS
 SW_VERS
+PATH_CLEANED
 MACPORTS_VERSION
 target_os
 target_vendor
@@ -2198,6 +2199,8 @@
 		fi
 	done
 	PATH=$newPATH; export PATH
+	PATH_CLEANED=$newPATH
+
 	prefix=$oldprefix
 
 
@@ -11021,6 +11024,24 @@
    prefix=$ac_default_prefix
 fi
 
+# Check if there's an existing DP/MP install too old to upgrade
+
+
+	{ $as_echo "$as_me:$LINENO: checking that any existing MacPorts install can be upgraded" >&5
+$as_echo_n "checking that any existing MacPorts install can be upgraded... " >&6; }
+
+	eval dpversionfile="${sysconfdir}/ports/dp_version"
+	if test -f $dpversionfile; then
+		{ { $as_echo "$as_me:$LINENO: error: Existing MacPorts or DarwinPorts install is too old to be upgraded. Install MacPorts 1.7.1 first." >&5
+$as_echo "$as_me: error: Existing MacPorts or DarwinPorts install is too old to be upgraded. Install MacPorts 1.7.1 first." >&2;}
+   { (exit 1); exit 1; }; }
+	else
+		{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+	fi
+
+
+
 eval "prefix_expanded=$prefix"
 
 # do this twice, since there is a nested variable of

Modified: branches/images-and-archives/base/configure.ac
===================================================================
--- branches/images-and-archives/base/configure.ac	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/configure.ac	2009-07-07 05:33:03 UTC (rev 53504)
@@ -362,6 +362,9 @@
    prefix=$ac_default_prefix
 fi
 
+# Check if there's an existing DP/MP install too old to upgrade
+MP_CHECK_OLDLAYOUT
+
 eval "prefix_expanded=$prefix"
 AC_SUBST(prefix_expanded)
 # do this twice, since there is a nested variable of

Modified: branches/images-and-archives/base/doc/macports.conf.in
===================================================================
--- branches/images-and-archives/base/doc/macports.conf.in	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/doc/macports.conf.in	2009-07-07 05:33:03 UTC (rev 53504)
@@ -33,6 +33,11 @@
 # Where to find global variants definition file (optional)
 variants_conf		@MPCONFIGDIR_EXPANDED@/variants.conf
 
+# 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
+
 # Use ccache (C/C++ compiler cache) - see http://ccache.samba.org/
 configureccache		no
 

Modified: branches/images-and-archives/base/doc/portfile.7
===================================================================
--- branches/images-and-archives/base/doc/portfile.7	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/doc/portfile.7	2009-07-07 05:33:03 UTC (rev 53504)
@@ -1944,13 +1944,12 @@
 .It Ic md5 Ar
 Compute the MD5 hashes of the file(s).
 .It Ic rpm-vercomp Ar versionA Ar versionB
-Compare two RPM-format versions for equality.
-.It Ic sudo Ar password Ar command Ar \&...
-Execute
-.Ar command
-using
-.Cm sudo
-with the provided password.
+Compare two RPM-format versions for equality.  The return value is like
+strcmp(), returning -1, 0, or 1 when versionA is earlier, equal to, or
+later than versionB, respectively.  Note that some comparisions featuring
+floating-point notation may compare incorrectly, eg, 2.101 is considered
+later than 2.2 (101 is larger than 2) which may be incorrect per some
+projects versioning methods (see ticket #11873).
 .It Xo
 .Ic lpush
 .Ar varName

Modified: branches/images-and-archives/base/portmgr/dmg/InstallationCheck
===================================================================
--- branches/images-and-archives/base/portmgr/dmg/InstallationCheck	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/portmgr/dmg/InstallationCheck	2009-07-07 05:33:03 UTC (rev 53504)
@@ -13,5 +13,11 @@
    # like this script
    exit 112
 fi
+
+if [[ -f /opt/local/etc/ports/dp_version ]]; then
+   # message 17 in InstallationCheck.strings
+   exit 113
+fi
+
 exit 0
 


Property changes on: branches/images-and-archives/base/portmgr/dmg/InstallationCheck
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: branches/images-and-archives/base/portmgr/dmg/InstallationCheck.strings
===================================================================
--- branches/images-and-archives/base/portmgr/dmg/InstallationCheck.strings	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/portmgr/dmg/InstallationCheck.strings	2009-07-07 05:33:03 UTC (rev 53504)
@@ -1,2 +1,2 @@
 "16" = "This package is meant to be installed on __XVERS__";
-
+"17" = "Your existing MacPorts or DarwinPorts install is too old to be upgraded by this installer. Please install MacPorts 1.7.1 first."


Property changes on: branches/images-and-archives/base/portmgr/dmg/InstallationCheck.strings
___________________________________________________________________
Added: svn:eol-style
   + native

Deleted: branches/images-and-archives/base/portmgr/dmg/preflight
===================================================================
--- branches/images-and-archives/base/portmgr/dmg/preflight	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/portmgr/dmg/preflight	2009-07-07 05:33:03 UTC (rev 53504)
@@ -1,126 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2007 Juan Manuel Palacios <jmpp at macports.org>, The MacPorts Project.
-# 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 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
-# 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.
-
-
-###
-# dp2mp-move upgrading facility for users installing MacPorts through the pkg installer in the dmg.
-# This script is meant to run as the preflight of the installer, to upgrade an existing MacPorts
-# installation to the MacPorts namespace in the same way the "upgrade" target in base/Makefile
-# does for users installing from source or selfupdate.
-# preflight
-# $Id$
-###
-
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-UPGRADECHECK=/opt/local/var/macports/.mprename
-
-
-[ ! -d /Library/Tcl/darwinports1.0 ] || rm -rf /Library/Tcl/darwinports1.0
-
-[ ! -d /opt/local/share/darwinports ] || rm -rf /opt/local/share/darwinports
-
-[ ! -f /opt/local/etc/ports/dp_version ] || rm -vf /opt/local/etc/ports/dp_version
-
-[ ! -f /opt/local/share/man/man5/ports.conf.5 ] || rm -vf /opt/local/share/man/man5/ports.conf.5
-
-[ ! -d /opt/local/etc/ports ] || mv -v /opt/local/etc/ports /opt/local/etc/macports
-
-[ -d /opt/local/var/macports ] || mkdir -vp /opt/local/var/macports
-for dir in distfiles packages receipts software; do
-    [ ! -d /opt/local/var/db/dports/${dir} ] || mv -v /opt/local/var/db/dports/${dir} /opt/local/var/macports
-done
-
-[ ! -d /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports ] || {
-    mkdir -vp /opt/local/var/macports/sources/rsync.macports.org/release && mv -v \
-      /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports /opt/local/var/macports/sources/rsync.macports.org/release/ports
-}
-
-for receipt in /opt/local/var/macports/receipts/*/*/receipt.bz2; do
-    [ ! \( -f ${receipt} -a ! -f ${receipt}.mpsaved \) ] || { cp -v ${receipt} ${receipt}.mpsaved && {
-        bzip2 -q -dc ${receipt} | sed 's/db\/dports/macports/g' | bzip2 -q -zf > ${receipt}.new
-    } && mv -v ${receipt}.new ${receipt}
-}; done
-
-[ ! \( -f /opt/local/etc/macports/ports.conf -a ! -f ${UPGRADECHECK} \) ] || {
-    mv -v /opt/local/etc/macports/ports.conf /opt/local/etc/macports/macports.conf.mpsaved
-    sed 's/etc\/ports/etc\/macports/g' /opt/local/etc/macports/macports.conf.mpsaved > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/db\/dports/macports/g' /opt/local/etc/macports/macports.conf > /opt/local/etc//macports/macports.conf.tmp && \
-      mv -v /opt/local/etc//macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/darwinports/macports/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/dpupdate1\/base/release\/base/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed '/^rsync_options/s/"\(.*\)"/\1/' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/ --delete / /' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/ ports.conf(5)/ macports.conf(5)/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-}
-
-[ ! \( -f /opt/local/etc/macports/sources.conf -a ! -f ${UPGRADECHECK} \) ] || {
-    cp -v /opt/local/etc/macports/sources.conf /opt/local/etc/macports/sources.conf.mpsaved
-    sed 's/darwinports/macports/g' /opt/local/etc/macports/sources.conf > /opt/local/etc/macports/sources.conf.tmp && \
-      mv -v /opt/local/etc/macports/sources.conf.tmp /opt/local/etc/macports/sources.conf
-    sed 's/dpupdate\/dports/release\/ports\//g' /opt/local/etc/macports/sources.conf > /opt/local/etc/macports/sources.conf.tmp && \
-      mv -v /opt/local/etc/macports/sources.conf.tmp /opt/local/etc/macports/sources.conf
-}
-
-[ ! \( -f "${HOME}/.macports/ports.conf" -a ! -f ${UPGRADECHECK} \) ] || {
-    mv -v "${HOME}/.macports/ports.conf" "${HOME}/.macports/macports.conf.mpsaved"
-    sed 's/etc\/ports/etc\/macports/g' "${HOME}/.macports/macports.conf.mpsaved" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/db\/dports/macports/g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/darwinports/macports/g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/dpupdate1\/base/release\/base/g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed '/^rsync_options/s/"\(.*\)"/\1/' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/ --delete / /' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/ ports.conf(5)/ macports.conf(5)/g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-}
-
-
-[ ! -f /opt/local/etc/macports/mp_version ] || rm -vf /opt/local/etc/macports/mp_version
-
-
-[ -f ${UPGRADECHECK} ] || {
-    echo -e "\nMacPorts installation successfully upgraded from the old DarwinPorts namespace!\n"
-    echo "MacPorts rename update done!" > ${UPGRADECHECK}
-}


Property changes on: branches/images-and-archives/base/portmgr/jobs/mirror_macports.sh
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/portmgr/jobs/org.macports.PortIndexRegen.plist
___________________________________________________________________
Deleted: svn:eol-stype
   - native
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/portmgr/jobs/org.macports.mprsyncup.plist
___________________________________________________________________
Deleted: svn:eol-stype
   - native
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/portmgr/jobs/portfile_lint.pl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/portmgr/jobs/portfile_mirror.pl
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/dep_map_clean.tcl
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: branches/images-and-archives/base/src/macports1.0/macports.tcl
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-07-07 05:33:03 UTC (rev 53504)
@@ -45,7 +45,7 @@
         portverbose destroot_umask variants_conf rsync_server rsync_options \
         rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir frameworks_dir developer_dir universal_archs \
+        applications_dir frameworks_dir developer_dir universal_archs build_arch \
         macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
@@ -54,7 +54,7 @@
         porttrace portverbose destroot_umask rsync_server \
         rsync_options rsync_dir startupitem_type place_worksymlink \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir frameworks_dir developer_dir universal_archs $user_options \
+        applications_dir frameworks_dir developer_dir universal_archs build_arch $user_options \
         os_arch os_endian os_major os_platform os_version"
 
     # deferred options are only computed when needed.
@@ -352,6 +352,7 @@
     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_major
@@ -621,6 +622,27 @@
             set macports::universal_archs {i386 ppc}
         }
     }
+    
+    # Default arch to build for
+    if {![info exists macports::build_arch]} {
+        if {$tcl_platform(os) == "Darwin"} {
+            if {[lindex [split $tcl_platform(osVersion) .] 0] >= 10} {
+                if {[sysctl hw.cpu64bit_capable] == 1} {
+                    set macports::build_arch x86_64
+                } else {
+                    set macports::build_arch i386
+                }
+            } else {
+                if {$tcl_platform(machine) == "Power Macintosh"} {
+                    set macports::build_arch ppc
+                } else {
+                    set macports::build_arch i386
+                }
+            }
+        } else {
+            set macports::build_arch ""
+        }
+    }
 
     # Platform Settings
     set os_arch $tcl_platform(machine)
@@ -728,6 +750,14 @@
 
     # load the quick index
     _mports_load_quickindex
+
+    set default_source_url [lindex ${sources_default} 0]
+    if {[macports::getprotocol $default_source_url] == "file"} {
+        set default_portindex [macports::getindex $default_source_url]
+        if {[file exists $default_portindex] && [expr [clock seconds] - [file mtime $default_portindex]] > 1209600} {
+            ui_warn "port definitions are more than two weeks old, consider using selfupdate"
+        }
+    }
 }
 
 proc macports::worker_init {workername portpath porturl portbuildpath options variations} {
@@ -978,6 +1008,38 @@
     return $proposedpath
 }
 
+
+# mport_filtervariants
+# returns the given list of variants with implicitly-set ones removed
+proc mport_filtervariants {variations {warn yes}} {
+    # Iterate through the variants, filtering out
+    # implicit ones. At the moment, the only implicit variants are
+    # platform variants.
+    set filteredvariations {}
+
+    foreach {variation value} $variations {
+        switch -regexp $variation {
+            ^(pure)?darwin         -
+            ^(free|net|open){1}bsd -
+            ^i386                  -
+            ^linux                 -
+            ^macosx                -
+            ^powerpc               -
+            ^solaris               -
+            ^sunos {
+                if {$warn} {
+                    ui_warn "Implicit variants should not be explicitly set or unset. $variation will be ignored."
+                }
+            }
+            default {
+                lappend filteredvariations $variation $value
+            }
+        }
+    }
+    return $filteredvariations
+}
+
+
 # mportopen
 # Opens a MacPorts portfile specified by a URL.  The Portfile is
 # opened with the given list of options and variations.  The result
@@ -1016,29 +1078,6 @@
         return -code error "Could not find Portfile in $portpath"
     }
 
-    # Iterate through the explicitly set/unset variants, filtering out
-    # implicit variants. At the moment, the only implicit variants are
-    # platform variants.
-    set filteredvariations {}
-
-    foreach {variation value} $variations {
-        switch -regexp $variation {
-            ^(pure)?darwin         -
-            ^(free|net|open){1}bsd -
-            ^i386                  -
-            ^linux                 -
-            ^macosx                -
-            ^powerpc               -
-            ^solaris               -
-            ^sunos {
-                ui_debug "Implicit variants should not be explicitly set or unset. $variation will be ignored."
-            }
-            default {
-                lappend filteredvariations $variation $value
-            }
-        }
-    }
-
     set workername [interp create]
 
     set mport [ditem_create]
@@ -1047,10 +1086,10 @@
     ditem_key $mport portpath $portpath
     ditem_key $mport workername $workername
     ditem_key $mport options $options
-    ditem_key $mport variations $filteredvariations
+    ditem_key $mport variations $variations
     ditem_key $mport refcnt 1
 
-    macports::worker_init $workername $portpath $porturl [macports::getportbuildpath $portpath] $options $filteredvariations
+    macports::worker_init $workername $portpath $porturl [macports::getportbuildpath $portpath] $options $variations
 
     $workername eval source Portfile
 
@@ -1580,7 +1619,8 @@
                         }
                     }
 
-                    if { [catch { system "cd $destdir/.. && tar ${verboseflag} ${extflag} -xf $filename" } error] } {
+                    set tar [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
@@ -2311,21 +2351,28 @@
         set porturl file://./
     }
 
-    # check if the variants is present in $version_in_tree
-    set variant [split $oldvariant +]
+    # will break if we start recording negative variants (#2377)
+    set variant [lrange [split $oldvariant +] 1 end]
     ui_debug "Merging existing variants $variant into variants"
+    set oldvariantlist [list]
+    foreach v $variant {
+        lappend oldvariantlist $v "+"
+    }
+    # remove implicit variants, without printing warnings
+    set oldvariantlist [mport_filtervariants $oldvariantlist no]
+
+    # check if the variants are present in $version_in_tree
     if {[info exists portinfo(variants)]} {
         set avariants $portinfo(variants)
     } else {
         set avariants {}
     }
     ui_debug "available variants are : $avariants"
-    foreach v $variant {
-        if {[lsearch $avariants $v] == -1} {
-        } else {
-            ui_debug "variant $v is present in $portname $version_in_tree"
-            if { ![info exists variations($v)]} {
-                set variations($v) "+"
+    foreach {variation value} $oldvariantlist {
+        if {[lsearch $avariants $variation] != -1} {
+            ui_debug "variant $variation is present in $portname $version_in_tree"
+            if { ![info exists variations($variation)]} {
+                set variations($variation) $value
             }
         }
     }

Modified: branches/images-and-archives/base/src/package1.0/portpkg.tcl
===================================================================
--- branches/images-and-archives/base/src/package1.0/portpkg.tcl	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/package1.0/portpkg.tcl	2009-07-07 05:33:03 UTC (rev 53504)
@@ -157,28 +157,6 @@
     close $infofd
 }
 
-# XXX: deprecated
-proc portpkg::write_info_file {infofile portname portversion description} {
-    set infofd [open ${infofile} w+]
-    puts $infofd "Title ${portname}
-Version ${portversion}
-Description ${description}
-DefaultLocation /
-DeleteWarning
-
-### Package Flags
-
-NeedsAuthorization YES
-Required NO
-Relocatable NO
-RequiresReboot NO
-UseUserMask YES
-OverwritePermissions NO
-InstallFat NO
-RootVolumeOnly NO"
-    close $infofd
-}
-
 proc portpkg::xml_escape {s} {
     regsub -all {&} $s {\&amp;} s
     regsub -all {<} $s {\&lt;} s
@@ -224,7 +202,7 @@
     <key>IFPkgFlagRestartAction</key>
     <string>NoRestart</string>
     <key>IFPkgFlagRootVolumeOnly</key>
-    <false/>
+    <true/>
     <key>IFPkgFlagUpdateInstalledLanguages</key>
     <false/>
     <key>IFPkgFormatVersion</key>


Property changes on: branches/images-and-archives/base/src/package1.0/portportpkg.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: branches/images-and-archives/base/src/pextlib1.0/Makefile
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/Makefile	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/pextlib1.0/Makefile	2009-07-07 05:33:03 UTC (rev 53504)
@@ -1,7 +1,8 @@
 OBJS=		Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
 		fs-traverse.o strcasecmp.o vercomp.o filemap.o \
 		sha1cmd.o curl.o rmd160cmd.o readline.o uid.o\
-		tracelib.o tty.o get_systemconfiguration_proxies.o
+		tracelib.o tty.o get_systemconfiguration_proxies.o\
+		sysctl.o readdir.o pipe.o
 SHLIB_NAME=	Pextlib${SHLIB_SUFFIX}
 INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
 

Modified: branches/images-and-archives/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/Pextlib.c	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/pextlib1.0/Pextlib.c	2009-07-07 05:33:03 UTC (rev 53504)
@@ -48,10 +48,6 @@
 #include <strings.h>
 #endif
 
-#if HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
 #if HAVE_LIMITS_H
 #include <limits.h>
 #endif
@@ -74,10 +70,6 @@
 #include <sys/types.h>
 #endif
 
-#if HAVE_SYS_FCNTL_H
-#include <sys/fcntl.h>
-#endif
-
 #if HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
@@ -113,6 +105,10 @@
 #include "tracelib.h"
 #include "tty.h"
 #include "get_systemconfiguration_proxies.h"
+#include "sysctl.h"
+#include "strsed.h"
+#include "readdir.h"
+#include "pipe.h"
 
 #if HAVE_CRT_EXTERNS_H
 #include <crt_externs.h>
@@ -379,151 +375,6 @@
 	return status;
 }
 
-int SudoCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	char *buf;
-	struct linebuf circbuf[CBUFSIZ];
-	size_t linelen;
-	char *args[4];
-	char *cmdstring, *passwd;
-	FILE *pdes;
-	int fdset[2];
-	int fline, pos, ret;
-	pid_t pid;
-	Tcl_Obj *errbuf;
-	Tcl_Obj *tcl_result;
-
-	if (objc != 3) {
-		Tcl_WrongNumArgs(interp, 1, objv, "password command");
-		return TCL_ERROR;
-	}
-	passwd = Tcl_GetString(objv[1]);
-	cmdstring = Tcl_GetString(objv[2]);
-
-	if (pipe(fdset) == -1)
-		return TCL_ERROR;
-
-	/*
-	 * Fork a child to run the command, in a popen() like fashion -
-	 * popen() itself is not used because stderr is also desired.
-	 */
-	pid = fork();
-	if (pid == -1)
-		return TCL_ERROR;
-	if (pid == 0) {
-		dup2(fdset[0], STDIN_FILENO);
-		dup2(fdset[1], STDOUT_FILENO);
-		dup2(fdset[1], STDERR_FILENO);
-		args[0] = "sudo";
-		args[1] = "-S";
-		args[2] = cmdstring;
-		args[3] = NULL;
-		execve("/usr/bin/sudo", args, environ);
-		/* Now throw away the privs we just acquired */
-		args[1] = "-k";
-		args[2] = NULL;
-		execve("/usr/bin/sudo", args, environ);
-		_exit(1);
-	} else {
-		write(fdset[1], passwd, strlen(passwd));
-		write(fdset[1], "\n", 1);
-		close(fdset[1]);
-	}
-	pdes = fdopen(fdset[0], "r");
-
-	/* read from simulated popen() pipe */
-	pos = 0;
-	bzero(circbuf, sizeof(circbuf));
-	while ((buf = fgetln(pdes, &linelen)) != NULL) {
-		char *sbuf;
-		int slen;
-
-		/*
-		 * Allocate enough space to insert a terminating
-		 * '\0' if the line is not terminated with a '\n'
-		 */
-		if (buf[linelen - 1] == '\n')
-			slen = linelen;
-		else
-			slen = linelen + 1;
-
-		if (circbuf[pos].len == 0)
-			sbuf = malloc(slen);
-		else {
-			sbuf = realloc(circbuf[pos].line, slen);
-		}
-
-		if (sbuf == NULL) {
-			for (fline = pos; pos < fline + CBUFSIZ; pos++) {
-				if (circbuf[pos % CBUFSIZ].len != 0)
-					free(circbuf[pos % CBUFSIZ].line);
-			}
-			return TCL_ERROR;
-		}
-
-		memcpy(sbuf, buf, linelen);
-		/* terminate line with '\0',replacing '\n' if it exists */
-		sbuf[slen - 1] = '\0';
-
-		circbuf[pos].line = sbuf;
-		circbuf[pos].len = slen;
-
-		if (pos++ == CBUFSIZ - 1)
-			pos = 0;
-		ret = ui_info(interp, sbuf);
-		if (ret != TCL_OK) {
-			for (fline = pos; pos < fline + CBUFSIZ; pos++) {
-				if (circbuf[pos % CBUFSIZ].len != 0)
-					free(circbuf[pos % CBUFSIZ].line);
-			}
-			return ret;
-		}
-	}
-	fclose(pdes);
-
-	if (wait(&ret) != pid)
-		return TCL_ERROR;
-	if (WIFEXITED(ret)) {
-		if (WEXITSTATUS(ret) == 0)
-			return TCL_OK;
-		else {
-			/* Copy the contents of the circular buffer to errbuf */
-		  	Tcl_Obj* errorCode;
-			errbuf = Tcl_NewStringObj(NULL, 0);
-			for (fline = pos; pos < fline + CBUFSIZ; pos++) {
-				if (circbuf[pos % CBUFSIZ].len == 0)
-				continue; /* skip empty lines */
-
-				/* Append line, minus trailing NULL */
-				Tcl_AppendToObj(errbuf, circbuf[pos % CBUFSIZ].line,
-						circbuf[pos % CBUFSIZ].len - 1);
-
-				/* Re-add previously stripped newline */
-				Tcl_AppendToObj(errbuf, "\n", 1);
-				free(circbuf[pos % CBUFSIZ].line);
-			}
-
-			/* set errorCode [list CHILDSTATUS <pid> <code>] */
-			errorCode = Tcl_NewListObj(0, NULL);
-			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewStringObj("CHILDSTATUS", -1));
-			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(pid));
-			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(WEXITSTATUS(ret)));
-			Tcl_SetObjErrorCode(interp, errorCode);
-
-			/* set result */
-			tcl_result = Tcl_NewStringObj("sudo command \"", -1);
-			Tcl_AppendToObj(tcl_result, cmdstring, -1);
-			Tcl_AppendToObj(tcl_result, "\" returned error ", -1);
-			Tcl_AppendObjToObj(tcl_result, Tcl_NewIntObj(WEXITSTATUS(ret)));
-			Tcl_AppendToObj(tcl_result, "\nCommand output: ", -1);
-			Tcl_AppendObjToObj(tcl_result, errbuf);
-			Tcl_SetObjResult(interp, tcl_result);
-			return TCL_ERROR;
-		}
-	} else
-		return TCL_ERROR;
-}
-
 int FlockCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	static const char errorstr[] = "use one of \"-shared\", \"-exclusive\", or \"-unlock\", and optionally \"-noblock\"";
@@ -661,52 +512,10 @@
 	return TCL_OK;
 }
 
-/**
- *
- * Return the list of elements in a directory.
- * Since 1.60.4.2, the list doesn't include . and ..
- *
- * Synopsis: readdir directory
- */
-int ReaddirCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	DIR *dirp;
-	struct dirent *mp;
-	Tcl_Obj *tcl_result;
-	char *path;
-
-	if (objc != 2) {
-		Tcl_WrongNumArgs(interp, 1, objv, "directory");
-		return TCL_ERROR;
-	}
-
-	path = Tcl_GetString(objv[1]);
-	dirp = opendir(path);
-	if (!dirp) {
-		Tcl_SetResult(interp, "Cannot read directory", TCL_STATIC);
-		return TCL_ERROR;
-	}
-	tcl_result = Tcl_NewListObj(0, NULL);
-	while ((mp = readdir(dirp))) {
-		/* Skip . and .. */
-		if ((mp->d_name[0] != '.') ||
-			((mp->d_name[1] != 0)	/* "." */
-				&&
-			((mp->d_name[1] != '.') || (mp->d_name[2] != 0)))) /* ".." */ {
-			Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewStringObj(mp->d_name, -1));
-		}
-	}
-	closedir(dirp);
-	Tcl_SetObjResult(interp, tcl_result);
-	
-	return TCL_OK;
-}
-
 int StrsedCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	char *pattern, *string, *res;
 	int range[2];
-	extern char *strsed(char *str, char *pat, int *range);
 	Tcl_Obj *tcl_result;
 
 	if (objc != 3) {
@@ -952,39 +761,6 @@
 }
 
 /**
- * Call pipe(2) to create a pipe.
- * Syntax is:
- * pipe
- *
- * Generate a Tcl error if something goes wrong.
- * Return a list with the file descriptors of the pipe. The first item is the
- * readable fd.
- */
-int PipeCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	Tcl_Obj* result;
-	int fildes[2];
-
-	if (objc != 1) {
-		Tcl_WrongNumArgs(interp, 1, objv, NULL);
-		return TCL_ERROR;
-	}
-	
-	if (pipe(fildes) < 0) {
-		Tcl_AppendResult(interp, "pipe failed: ", strerror(errno), NULL);
-		return TCL_ERROR;
-	}
-	
-	/* build a list out of the couple */
-	result = Tcl_NewListObj(0, NULL);
-	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[0]));
-	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[1]));
-	Tcl_SetObjResult(interp, result);
-
-	return TCL_OK;
-}
-
-/**
  * symlink value target
  * Create a symbolic link at target pointing to value
  * See symlink(2) for possible errors
@@ -1145,12 +921,12 @@
 	Tcl_CreateObjCommand(interp, "rmd160", RMD160Cmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "sha1", SHA1Cmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "umask", UmaskCmd, NULL, NULL);
-	Tcl_CreateObjCommand(interp, "sudo", SudoCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "pipe", PipeCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "curl", CurlCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "symlink", CreateSymlinkCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "unsetenv", UnsetEnvCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "lchown", lchownCmd, NULL, NULL);
+	Tcl_CreateObjCommand(interp, "sysctl", SysctlCmd, NULL, NULL);
 	
 	Tcl_CreateObjCommand(interp, "readline", ReadlineCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "rl_history", RLHistoryCmd, NULL, NULL);

Modified: branches/images-and-archives/base/src/pextlib1.0/filemap.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/filemap.c	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/pextlib1.0/filemap.c	2009-07-07 05:33:03 UTC (rev 53504)
@@ -34,76 +34,17 @@
 #include <config.h>
 #endif
 
-#include <ctype.h>
+#include <sys/stat.h>
 #include <errno.h>
-#include <grp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
-#if HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#if HAVE_PATHS_H
-#include <paths.h>
-#endif
-
-#ifndef _PATH_DEVNULL
-#define _PATH_DEVNULL   "/dev/null"
-#endif
-
-#include <pwd.h>
-
-#if HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if HAVE_SYS_FCNTL_H
-#include <sys/fcntl.h>
-#endif
-
-#if HAVE_FCNTL_H
 #include <fcntl.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#if HAVE_UNISTD_H
+#include <limits.h>
 #include <unistd.h>
-#endif
 
 #include <tcl.h>
 
 #include "filemap.h"
 #include "strcasecmp.h"
 
-/* Avoid a warning with Tcl < 8.4, even if Tcl_GetIndexFromObj's tablePtr
-probably isn't modified. */
-#if (TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION >= 4)
-typedef CONST char* tableEntryString;
-#else
-typedef char* tableEntryString;
-#endif
-
 /* ========================================================================= **
  * Definitions
  * ========================================================================= */
@@ -2020,7 +1961,7 @@
     	kFilemapIsReadOnly
     } EOption;
     
-	static tableEntryString options[] = {
+	static const char *options[] = {
 		"close", "create", "exists", "get", "list", "open", "revert", "save",
 		"set", "unset", "isreadonly", NULL
 	};

Modified: branches/images-and-archives/base/src/pextlib1.0/md5cmd.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/md5cmd.c	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/pextlib1.0/md5cmd.c	2009-07-07 05:33:03 UTC (rev 53504)
@@ -38,6 +38,8 @@
 
 #include <tcl.h>
 
+#include "md5cmd.h"
+
 #if defined(HAVE_LIBCRYPTO) && !defined(HAVE_LIBMD)
 
 /* Minimal wrapper around OpenSSL's libcrypto, as a compatibility
@@ -63,7 +65,6 @@
 #include "md_wrappers.h"
 CHECKSUMEnd(MD5, MD5_CTX, LENGTH)
 CHECKSUMFile(MD5, MD5_CTX)
-CHECKSUMData(MD5, MD5_CTX)
 
 #elif defined(HAVE_LIBMD)
 #include <sys/types.h>

Modified: branches/images-and-archives/base/src/pextlib1.0/md_wrappers.h
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/md_wrappers.h	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/pextlib1.0/md_wrappers.h	2009-07-07 05:33:03 UTC (rev 53504)
@@ -34,13 +34,12 @@
 #define _MD_WRAPPERS_H
 
 /* wrappers for libmd-like functions:
- * char* ALGOData(const unsigned char* data, unsigned int len, char* buf)
  * char* ALGOFile(const char* filename, char* buf)
  * char* ALGOEnd(ALGO_CTX, char* buf)
  */
 
 #define CHECKSUMEnd(algo, ctxtype, digest_length)		\
-char *													\
+static char *													\
 algo##End(ctxtype *ctx, char *buf)						\
 {														\
     int i;												\
@@ -61,7 +60,7 @@
 }
 
 #define CHECKSUMFile(algo, ctxtype)						\
-char *algo##File(const char *filename, char *buf)		\
+static char *algo##File(const char *filename, char *buf)		\
 {														\
     unsigned char buffer[BUFSIZ];						\
     ctxtype ctx;										\
@@ -80,15 +79,5 @@
     return algo##End(&ctx, buf);						\
 }
 
-#define CHECKSUMData(algo, ctxtype)						\
-char *algo##Data(const unsigned char *data, unsigned int len, char *buf)	\
-{														\
-	ctxtype ctx;										\
-	algo##Init(&ctx);									\
-	algo##Update(&ctx, data, len);						\
-	return algo##End(&ctx, buf);						\
-}
-
-
 #endif
-	/* _MD_WRAPPERS_H */
+/* _MD_WRAPPERS_H */

Copied: branches/images-and-archives/base/src/pextlib1.0/pipe.c (from rev 53503, trunk/base/src/pextlib1.0/pipe.c)
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/pipe.c	                        (rev 0)
+++ branches/images-and-archives/base/src/pextlib1.0/pipe.c	2009-07-07 05:33:03 UTC (rev 53504)
@@ -0,0 +1,76 @@
+/*
+ * pipe.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * 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 The MacPorts Project 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.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <tcl.h>
+
+#include "pipe.h"
+
+/**
+ * Call pipe(2) to create a pipe.
+ * Syntax is:
+ * pipe
+ *
+ * Generate a Tcl error if something goes wrong.
+ * Return a list with the file descriptors of the pipe. The first item is the
+ * readable fd.
+ */
+int PipeCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	Tcl_Obj* result;
+	int fildes[2];
+
+	if (objc != 1) {
+		Tcl_WrongNumArgs(interp, 1, objv, NULL);
+		return TCL_ERROR;
+	}
+	
+	if (pipe(fildes) < 0) {
+		Tcl_AppendResult(interp, "pipe failed: ", strerror(errno), NULL);
+		return TCL_ERROR;
+	}
+	
+	/* build a list out of the couple */
+	result = Tcl_NewListObj(0, NULL);
+	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[0]));
+	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[1]));
+	Tcl_SetObjResult(interp, result);
+
+	return TCL_OK;
+}

Copied: branches/images-and-archives/base/src/pextlib1.0/pipe.h (from rev 53503, trunk/base/src/pextlib1.0/pipe.h)
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/pipe.h	                        (rev 0)
+++ branches/images-and-archives/base/src/pextlib1.0/pipe.h	2009-07-07 05:33:03 UTC (rev 53504)
@@ -0,0 +1,33 @@
+/*
+ * pipe.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * 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 The MacPorts Project 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.
+ */
+
+int PipeCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Copied: branches/images-and-archives/base/src/pextlib1.0/readdir.c (from rev 53503, trunk/base/src/pextlib1.0/readdir.c)
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/readdir.c	                        (rev 0)
+++ branches/images-and-archives/base/src/pextlib1.0/readdir.c	2009-07-07 05:33:03 UTC (rev 53504)
@@ -0,0 +1,82 @@
+/*
+ * readdir.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * 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 The MacPorts Project 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.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dirent.h>
+
+#include <tcl.h>
+
+#include "readdir.h"
+
+/**
+ *
+ * Return the list of elements in a directory.
+ * Since 1.60.4.2, the list doesn't include . and ..
+ *
+ * Synopsis: readdir directory
+ */
+int ReaddirCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	DIR *dirp;
+	struct dirent *mp;
+	Tcl_Obj *tcl_result;
+	char *path;
+
+	if (objc != 2) {
+		Tcl_WrongNumArgs(interp, 1, objv, "directory");
+		return TCL_ERROR;
+	}
+
+	path = Tcl_GetString(objv[1]);
+	dirp = opendir(path);
+	if (!dirp) {
+		Tcl_SetResult(interp, "Cannot read directory", TCL_STATIC);
+		return TCL_ERROR;
+	}
+	tcl_result = Tcl_NewListObj(0, NULL);
+	while ((mp = readdir(dirp))) {
+		/* Skip . and .. */
+		if ((mp->d_name[0] != '.') ||
+			((mp->d_name[1] != 0)	/* "." */
+				&&
+			((mp->d_name[1] != '.') || (mp->d_name[2] != 0)))) /* ".." */ {
+			Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewStringObj(mp->d_name, -1));
+		}
+	}
+	closedir(dirp);
+	Tcl_SetObjResult(interp, tcl_result);
+	
+	return TCL_OK;
+}

Copied: branches/images-and-archives/base/src/pextlib1.0/readdir.h (from rev 53503, trunk/base/src/pextlib1.0/readdir.h)
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/readdir.h	                        (rev 0)
+++ branches/images-and-archives/base/src/pextlib1.0/readdir.h	2009-07-07 05:33:03 UTC (rev 53504)
@@ -0,0 +1,33 @@
+/*
+ * readdir.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * 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 The MacPorts Project 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.
+ */
+
+int ReaddirCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Modified: branches/images-and-archives/base/src/pextlib1.0/rmd160cmd.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/rmd160cmd.c	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/pextlib1.0/rmd160cmd.c	2009-07-07 05:33:03 UTC (rev 53504)
@@ -38,6 +38,8 @@
 
 #include <tcl.h>
 
+#include "rmd160cmd.h"
+
 #if !defined(HAVE_LIBMD)
 
 /* We do not have libmd.
@@ -57,7 +59,6 @@
 #include "md_wrappers.h"
 CHECKSUMEnd(RMD160, RMD160_CTX, RIPEMD160_DIGEST_LENGTH)
 CHECKSUMFile(RMD160, RMD160_CTX)
-CHECKSUMData(RMD160, RMD160_CTX)
 
 #elif defined(HAVE_LIBMD)
 #include <sys/types.h>

Modified: branches/images-and-archives/base/src/pextlib1.0/sha1cmd.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/sha1cmd.c	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/pextlib1.0/sha1cmd.c	2009-07-07 05:33:03 UTC (rev 53504)
@@ -39,6 +39,8 @@
 
 #include <tcl.h>
 
+#include "sha1cmd.h"
+
 #if defined(HAVE_LIBCRYPTO) && !defined(HAVE_LIBMD)
 
 /* Minimal wrapper around OpenSSL's libcrypto, as a compatibility
@@ -61,7 +63,6 @@
 #include "md_wrappers.h"
 CHECKSUMEnd(SHA1, SHA_CTX, SHA_DIGEST_LENGTH)
 CHECKSUMFile(SHA1, SHA_CTX)
-CHECKSUMData(SHA1, SHA_CTX)
 
 #elif defined(HAVE_LIBMD)
 #include <sys/types.h>

Modified: branches/images-and-archives/base/src/pextlib1.0/strsed.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/strsed.c	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/pextlib1.0/strsed.c	2009-07-07 05:33:03 UTC (rev 53504)
@@ -129,6 +129,8 @@
 
 #define HS_REGEX	1
 
+#include "strsed.h"
+
 #include <ctype.h>
 #include <string.h>
 #include <stdlib.h>
@@ -215,13 +217,14 @@
 /* ------------------------------------------------------------------------- **
  * Prototypes
  * ------------------------------------------------------------------------- */
-static char *mem();
-static void mem_init();
-static void mem_free();
-static char *build_map();
-static char nextch();
-static void mem_save();
-static int mem_find();
+static char *mem(int, int);
+static void mem_init(void);
+static void mem_free(char *);
+static char *build_map(char *, char *);
+static char nextch(char *, int);
+static void mem_save(int);
+static int mem_find(int);
+char *backslash_eliminate(char *, int, int);
 
 /* ------------------------------------------------------------------------- **
  * strsed
@@ -245,8 +248,6 @@
     static regmatch_t *exp_regs = NULL;
     static regex_t exp;
 #endif
-
-    char *backslash_eliminate();
     
     char *from;
     char *new_str;

Copied: branches/images-and-archives/base/src/pextlib1.0/strsed.h (from rev 53503, trunk/base/src/pextlib1.0/strsed.h)
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/strsed.h	                        (rev 0)
+++ branches/images-and-archives/base/src/pextlib1.0/strsed.h	2009-07-07 05:33:03 UTC (rev 53504)
@@ -0,0 +1 @@
+char *strsed(char *, char *, int *);

Copied: branches/images-and-archives/base/src/pextlib1.0/sysctl.c (from rev 53503, trunk/base/src/pextlib1.0/sysctl.c)
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/sysctl.c	                        (rev 0)
+++ branches/images-and-archives/base/src/pextlib1.0/sysctl.c	2009-07-07 05:33:03 UTC (rev 53504)
@@ -0,0 +1,75 @@
+/*
+ * sysctl.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * 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 The MacPorts Project 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.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tcl.h>
+
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#include "sysctl.h"
+
+/*
+ * Read-only wrapper for sysctlbyname(3). Only works for values of type CTLTYPE_INT.
+ */
+int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+    const char error_message[] = "sysctl failed: ";
+    Tcl_Obj *tcl_result;
+    int res;
+    char *name;
+    int value;
+    size_t len = sizeof(value);
+
+    if (objc != 2) {
+        Tcl_WrongNumArgs(interp, 1, objv, "name");
+        return TCL_ERROR;
+    }
+
+    name = Tcl_GetString(objv[1]);
+    res = sysctlbyname(name, &value, &len, NULL, 0);
+    if (res == -1) {
+        tcl_result = Tcl_NewStringObj(error_message, sizeof(error_message) - 1);
+        Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(strerror(errno), -1));
+        Tcl_SetObjResult(interp, tcl_result);
+        return TCL_ERROR;
+    }
+
+    tcl_result = Tcl_NewIntObj(value);
+    Tcl_SetObjResult(interp, tcl_result);
+    return TCL_OK;
+}

Copied: branches/images-and-archives/base/src/pextlib1.0/sysctl.h (from rev 53503, trunk/base/src/pextlib1.0/sysctl.h)
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/sysctl.h	                        (rev 0)
+++ branches/images-and-archives/base/src/pextlib1.0/sysctl.h	2009-07-07 05:33:03 UTC (rev 53504)
@@ -0,0 +1,34 @@
+/*
+ * sysctl.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * 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 The MacPorts Project 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.
+ */
+
+/* Read-only wrapper for sysctlbyname(3) */
+int SysctlCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);


Property changes on: branches/images-and-archives/base/src/pextlib1.0/tracelib.c
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/pextlib1.0/tracelib.h
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: branches/images-and-archives/base/src/port/port.tcl
===================================================================
--- branches/images-and-archives/base/src/port/port.tcl	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/port/port.tcl	2009-07-07 05:33:03 UTC (rev 53504)
@@ -1980,8 +1980,13 @@
         if {![info exists depscache(port:$portname)]} {
             # Global variations will have to be merged into the specified
             # variations, but perhaps after the installed variations are
-            # merged. So we pass them into upgrade:
-            macports::upgrade $portname "port:$portname" [array get global_variations] [array get variations] [array get options] depscache
+            # merged. So we pass them into upgrade.
+            
+            # First filter out implicit variants from the explicitly set/unset variants.
+            set global_variations_list [mport_filtervariants [array get global_variations] yes]
+            set variations_list [mport_filtervariants [array get variations] yes]
+            
+            macports::upgrade $portname "port:$portname" $global_variations_list $variations_list [array get options] depscache
         }
     }
 
@@ -2806,6 +2811,17 @@
                 set variations($variation) $value
             }
         }
+        # Filter out implicit variants from the explicitly set/unset variants.
+        # Except we need to keep them for some targets to work right...
+        switch -exact $target {
+            distfiles -
+            mirror {}
+            default {
+                set variationslist [mport_filtervariants [array get variations] yes]
+                array unset variations
+                array set variations $variationslist
+            }
+        }
 
         # If version was specified, save it as a version glob for use
         # in port actions (e.g. clean).

Modified: branches/images-and-archives/base/src/port1.0/portbuild.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portbuild.tcl	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/port1.0/portbuild.tcl	2009-07-07 05:33:03 UTC (rev 53504)
@@ -119,7 +119,7 @@
     set jobs $buildmakejobs
     # if set to '0', use the number of cores for the number of jobs
     if {$jobs == 0} {
-        if {[catch {set jobs [exec "/usr/sbin/sysctl" "-n" "hw.availcpu"]}]} {
+        if {[catch {set jobs [sysctl hw.activecpu]}]} {
             set jobs 2
             ui_warn "failed to determine the number of available CPUs (probably not supported on this platform)"
             ui_warn "defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf"

Modified: branches/images-and-archives/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portconfigure.tcl	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/port1.0/portconfigure.tcl	2009-07-07 05:33:03 UTC (rev 53504)
@@ -46,7 +46,7 @@
 commands configure autoreconf automake autoconf xmkmf
 # defaults
 default configure.env       ""
-default configure.pre_args  {[portconfigure::configure_get_pre_args]}
+default configure.pre_args  {--prefix=${prefix}}
 default configure.cmd       ./configure
 default configure.dir       {${worksrcpath}}
 default autoreconf.dir      {${worksrcpath}}
@@ -87,58 +87,17 @@
 options configure.optflags configure.cflags configure.cppflags configure.cxxflags configure.objcflags configure.ldflags configure.libs configure.fflags configure.f90flags configure.fcflags configure.classpath
 default configure.optflags  {-O2}
 # compiler flags section
-default configure.cflags    {[portconfigure::configure_get_cflags]}
-default configure.cppflags  {[portconfigure::configure_get_cppflags]}
-default configure.cxxflags  {[portconfigure::configure_get_cflags]}
-default configure.objcflags {[portconfigure::configure_get_cflags]}
-default configure.ldflags   {[portconfigure::configure_get_ldflags]}
+default configure.cflags    {${configure.optflags}}
+default configure.cppflags  {-I${prefix}/include}
+default configure.cxxflags  {${configure.optflags}}
+default configure.objcflags {${configure.optflags}}
+default configure.ldflags   {-L${prefix}/lib}
 default configure.libs      {}
-default configure.fflags    {[portconfigure::configure_get_cflags]}
-default configure.f90flags  {[portconfigure::configure_get_cflags]}
-default configure.fcflags   {[portconfigure::configure_get_cflags]}
+default configure.fflags    {${configure.optflags}}
+default configure.f90flags  {${configure.optflags}}
+default configure.fcflags   {${configure.optflags}}
 default configure.classpath {}
 
-# internal function to return the system value for CFLAGS/CXXFLAGS/etc
-proc portconfigure::configure_get_cflags {args} {
-    global configure.optflags
-    global configure.m32 configure.m64 configure.march configure.mtune
-    global configure.universal_cflags
-    set flags "${configure.optflags}"
-    if {[tbool configure.m64]} {
-        set flags "-m64 ${flags}"
-    } elseif {[tbool configure.m32]} {
-        set flags "-m32 ${flags}"
-    }
-    if {[info exists configure.march] && ${configure.march} != {}} {
-        set flags "${flags} -march=${configure.march}"
-    }
-    if {[info exists configure.mtune] && ${configure.mtune} != {}} {
-        set flags "${flags} -mtune=${configure.mtune}"
-    }
-    if {[variant_isset universal] && ${configure.universal_cflags} != ""} {
-        set flags "${flags} ${configure.universal_cflags}"
-    }
-    return $flags
-}
-
-proc portconfigure::configure_get_cppflags {args} {
-    global prefix configure.universal_cppflags
-    set flags "-I${prefix}/include"
-    if {[variant_isset universal] && ${configure.universal_cppflags} != ""} {
-        set flags "${flags} ${configure.universal_cppflags}"
-    }
-    return $flags
-}
-
-proc portconfigure::configure_get_ldflags {args} {
-    global prefix configure.universal_ldflags
-    set flags "-L${prefix}/lib"
-    if {[variant_isset universal] && ${configure.universal_ldflags} != ""} {
-        set flags "${flags} ${configure.universal_ldflags}"
-    }
-    return $flags
-}
-
 # tools section
 options configure.perl configure.python configure.ruby configure.install configure.awk configure.bison configure.pkg_config configure.pkg_config_path
 default configure.perl              {}
@@ -150,6 +109,10 @@
 default configure.pkg_config        {}
 default configure.pkg_config_path   {}
 
+options configure.build_arch configure.archflags
+default configure.build_arch {${build_arch}}
+default configure.archflags  {[portconfigure::configure_get_archflags]}
+
 options configure.universal_archs configure.universal_args configure.universal_cflags configure.universal_cppflags configure.universal_cxxflags configure.universal_ldflags
 default configure.universal_archs       {${universal_archs}}
 default configure.universal_args        {--disable-dependency-tracking}
@@ -176,8 +139,10 @@
 set_ui_prefix
 
 proc portconfigure::configure_start {args} {
-    global UI_PREFIX
-    global configure.compiler
+    global UI_PREFIX configure.compiler configure.optflags configure.archflags
+    global configure.march configure.mtune configure.universal_cflags
+    global configure.universal_cxxflags configure.universal_cppflags 
+    global configure.universal_ldflags configure.universal_args
     
     ui_msg "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option name]]"
 
@@ -202,15 +167,48 @@
         default { return -code error "Invalid value for configure.compiler" }
     }
     ui_debug "Using compiler '$name'"
+    
+    # add in extra CFLAGS etc
+    if {[variant_exists universal] && [variant_isset universal]} {
+        foreach flag {cflags objcflags fflags f90flags fcflags} {
+            eval configure.${flag}-append ${configure.universal_cflags}
+        }
+        eval configure.cxxflags-append ${configure.universal_cxxflags}
+        eval configure.cppflags-append ${configure.universal_cppflags}
+        eval configure.ldflags-append ${configure.universal_ldflags}
+        eval configure.pre_args-append ${configure.universal_args}
+    } else {
+        foreach flag {cflags cxxflags objcflags fflags f90flags fcflags} {
+            eval configure.${flag}-append ${configure.archflags}
+            if {${configure.march} != {}} {
+                configure.${flag}-append "-march=${configure.march}"
+            }
+            if {${configure.mtune} != {}} {
+                configure.${flag}-append "-mtune=${configure.mtune}"
+            }
+        }
+        eval configure.ldflags-append ${configure.archflags}
+    }
 }
 
-proc portconfigure::configure_get_pre_args {args} {
-    global prefix configure.universal_args
-    set result "--prefix=${prefix}"
-    if {[variant_isset universal] && ${configure.universal_args} != ""} {
-        set result "$result ${configure.universal_args}"
+# internal function to determine the compiler flags to select an arch
+proc portconfigure::configure_get_archflags {args} {
+    global configure.build_arch configure.m32 configure.m64 configure.compiler
+    set flags ""
+    if {[tbool configure.m64]} {
+        set flags "-m64"
+    } elseif {[tbool configure.m32]} {
+        set flags "-m32"
+    } elseif {${configure.build_arch} != ""} {
+        if {[arch_flag_supported]} {
+            set flags "-arch ${configure.build_arch}"
+        } elseif {${configure.build_arch} == "x86_64" || ${configure.build_arch} == "ppc64"} {
+            set flags "-m64"
+        } elseif {${configure.compiler} != "gcc-3.3"} {
+            set flags "-m32"
+        }
     }
-    return $result
+    return $flags
 }
 
 # internal function to determine the "-arch xy" flags for the compiler
@@ -221,7 +219,7 @@
         if {$flags == ""} {
             set flags "-arch $arch"
         } else {
-            set flags "$flags -arch $arch"
+            append flags " -arch $arch"
         }
     }
     return $flags
@@ -260,6 +258,24 @@
     return $flags
 }
 
+# internal proc to determine if the compiler supports -arch
+proc portconfigure::arch_flag_supported {args} {
+    global configure.compiler
+    switch -exact ${configure.compiler} {
+        gcc-4.0 -
+        gcc-4.2 -
+        llvm-gcc-4.2 -
+        clang -
+        apple-gcc-4.0 -
+        apple-gcc-4.2 {
+            return yes
+        }
+        default {
+            return no
+        }
+    }
+}
+
 # internal function to determine the default compiler
 proc portconfigure::configure_get_default_compiler {args} {
     global os.platform os.major

Modified: branches/images-and-archives/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portdestroot.tcl	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/port1.0/portdestroot.tcl	2009-07-07 05:33:03 UTC (rev 53504)
@@ -95,7 +95,7 @@
     ui_msg "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${name}]"
 
     # start gsoc08-privileges
-    if { [getuid] == 0 && [geteuid] == [name_to_uid "$macportsuser"] } {
+    if { [getuid] == 0 && [geteuid] != 0 } {
     # if started with sudo but have dropped the privileges
         ui_debug "Can't run destroot under sudo without elevated privileges (due to mtree)."
         ui_debug "Run destroot without sudo to avoid root privileges."
@@ -229,11 +229,6 @@
                 set manlinkpath [file join $manpath $manlink]
                 # if link destination is not gzipped, check it
                 set manlinksrc [file readlink $manlinkpath]
-                # if link destination is an absolute path, convert it to a
-                # relative path
-                if {[file pathtype $manlinksrc] eq "absolute"} {
-                    set manlinksrc [file tail $manlinksrc]
-                }
                 if {![regexp "\[.\]gz\$" ${manlinksrc}]} {
                     set mandir [file dirname $manlink]
                     set mandirpath [file join $manpath $mandir]
@@ -242,8 +237,13 @@
                         puts $err
                         return
                     }
+                    # if link source is an absolute path, check for it under destroot
+                    set mls_check "$manlinksrc"
+                    if {[file pathtype $mls_check] eq "absolute"} {
+                        set mls_check "${destroot}${mls_check}"
+                    }
                     # if gzipped destination exists, fix link
-                    if {[file isfile ${manlinksrc}.gz]} {
+                    if {[file isfile ${mls_check}.gz]} {
                         # if actual link name does not end with gz, rename it
                         if {![regexp "\[.\]gz\$" ${manlink}]} {
                             ui_debug "renaming link: $manlink to ${manlink}.gz"

Modified: branches/images-and-archives/base/src/port1.0/portutil.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-07-07 05:33:03 UTC (rev 53504)
@@ -1719,18 +1719,13 @@
     # was turned on or off, a particular instance of the port is uniquely
     # characterized by the set of variants that are *on*. Thus, record those
     # variants in a string in a standard order as +var1+var2 etc.
-    # We can skip the platform and architecture since those are always
-    # requested.  XXX: Is that really true? What if the user explicitly
-    # overrides the platform and architecture variants? Will the registry get
-    # bollixed? It would seem safer to me to just leave in all the variants that
-    # are on, but for now I'm just leaving the skipping code as it was in the
-    # previous version.
+    # XXX: this doesn't quite work because of default variants, see ticket #2377
 proc canonicalize_variants {variants} {
     array set vara $variants
     set result ""
     set vlist [lsort -ascii [array names vara]]
     foreach v $vlist {
-        if {$vara($v) == "+" && $v ne [option os.platform] && $v ne [option os.arch]} {
+        if {$vara($v) == "+"} {
             append result +$v
         }
     }


Property changes on: branches/images-and-archives/base/src/registry2.0/portimage.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/registry2.0/portuninstall.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/registry2.0/registry_util.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/tclobjc1.0/MPMethodSignatureExtensions.h
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/tclobjc1.0/MPMethodSignatureExtensions.m
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: branches/images-and-archives/base/src/tclobjc1.0/Makefile.in
===================================================================
--- branches/images-and-archives/base/src/tclobjc1.0/Makefile.in	2009-07-07 05:17:27 UTC (rev 53503)
+++ branches/images-and-archives/base/src/tclobjc1.0/Makefile.in	2009-07-07 05:33:03 UTC (rev 53504)
@@ -10,7 +10,7 @@
 LIBS+=	${OBJC_FOUNDATION_LIBS}
 
 clean::
-	rm -f *.d
+	rm -f *.o
 
 distclean::
 	rm -f Makefile


Property changes on: branches/images-and-archives/base/src/tclobjc1.0/Makefile.in
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/tclobjc1.0/objc_encoding.h
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/tclobjc1.0/objc_encoding.m
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/tclobjc1.0/tclobjc.h
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/tclobjc1.0/tclobjc.m
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/tclobjc1.0/tclobjc_types.h
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/tclobjc1.0/tclobjc_types.m
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/images-and-archives/base/src/thread2.6.diff
___________________________________________________________________
Deleted: svn:keywords
   - Id


Property changes on: branches/images-and-archives/base/src/upgrade_sources_conf_default.tcl
___________________________________________________________________
Added: svn:eol-style
   + native
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090706/27f8e390/attachment-0001.html>


More information about the macports-changes mailing list