Ignore:
Timestamp:
Jun 21, 2013, 7:46:52 PM (7 years ago)
Author:
snc@…
Message:

gsoc11-statistics/base: rebase /trunk/base

Location:
branches/gsoc11-statistics/base
Files:
45 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc11-statistics/base

  • branches/gsoc11-statistics/base/ChangeLog

    r105085 r107206  
    55
    66Release 2.2.0 (unreleased)
     7    - Fixed ports sometimes being incorrectly cleaned after the unarchive
     8      target is run with newer archives. (jmr in r106717)
     9
     10    - When rebuilding an installed port, fixed the old copy being removed
     11      before the new copy has been built. (jmr in r106668)
     12
     13    - Support deleting selected files and directories before creating a pkg.
     14      (blair in r105575)
     15
    716    - Remove unsupported xpkg package type, xar-based format with XML.
    817      (afb in r105002)
    918
     19    - Support pattern matching in compiler.blacklist.
     20      (larryv in r104174, r104178)
     21
     22    - Workaround for some OS commands hanging on 10.8 when started from a root
     23      login shell. (#34221, jeremyhu in r104118)
     24
     25    - TMPDIR is now set to ${workpath}/.tmp while building ports, to avoid
     26      problems with using /tmp. (#37834, ryandesign in r103518)
     27
    1028    - Remove unimplemented 'port submit', remove XAR source packages.
    1129      (cal in r103400)
    1230
    13     - Remove dependency_libs information from libtool libraries (.la).
    14       (#38010, jmr in r102945)
     31    - Remove dependency_libs information from libtool libraries (.la) in order
     32      to prevent overlinking. (#38010, jmr in r102945)
     33
     34    - Setting configure.compiler will now automatically add a dependency if
     35      the chosen compiler is provided by a port. (#32542, cal in r102932)
    1536
    1637    - Add 'port space --total' which displays the grand total only.
     
    2445    - Fixes bringing trace mode back to a working state. Improvements to reduce
    2546      the number of builds trace mode breaks.
    26       (cal in r100071-100073, r100077, r100126, r100221)
     47      (cal in r100071-100073, r100077, r100126, r100221, r106710)
    2748
    2849    - Began using sandbox-exec(1) on 10.5+ to prevent commands executed using
    2950      the 'system' procedure from writing files outside of the build directory
    3051      and selected other locations like /tmp. (jmr in r98156, r98193, etc.)
     52
     53    - Added ability to sync ports tree with git (jeremyhu in r92410)
    3154
    3255Release 2.1.3 (2013-01-31 by jmr)
  • branches/gsoc11-statistics/base/config/macports_version

    r105085 r107206  
    1 2.1.99
     12.2.99
  • branches/gsoc11-statistics/base/configure

    r105085 r107206  
    11#! /bin/sh
    22# Guess values for system-dependent variables and create Makefiles.
    3 # Generated by GNU Autoconf 2.69 for MacPorts 2.1.99.
     3# Generated by GNU Autoconf 2.69 for MacPorts 2.2.99.
    44#
    55# Report bugs to <macports-dev@lists.macosforge.org>.
     
    581581PACKAGE_NAME='MacPorts'
    582582PACKAGE_TARNAME='macports'
    583 PACKAGE_VERSION='2.1.99'
    584 PACKAGE_STRING='MacPorts 2.1.99'
     583PACKAGE_VERSION='2.2.99'
     584PACKAGE_STRING='MacPorts 2.2.99'
    585585PACKAGE_BUGREPORT='macports-dev@lists.macosforge.org'
    586586PACKAGE_URL=''
     
    639639SHLIB_LD
    640640STLIB_LD
    641 PATHCONF
    642641INCLUDES
    643642subdirs
     
    14151414  # This message is too long to be a string in the A/UX 3.1 sh.
    14161415  cat <<_ACEOF
    1417 \`configure' configures MacPorts 2.1.99 to adapt to many kinds of systems.
     1416\`configure' configures MacPorts 2.2.99 to adapt to many kinds of systems.
    14181417
    14191418Usage: $0 [OPTION]... [VAR=VALUE]...
     
    14811480if test -n "$ac_init_help"; then
    14821481  case $ac_init_help in
    1483      short | recursive ) echo "Configuration of MacPorts 2.1.99:";;
     1482     short | recursive ) echo "Configuration of MacPorts 2.2.99:";;
    14841483   esac
    14851484  cat <<\_ACEOF
     
    16271626if $ac_init_version; then
    16281627  cat <<\_ACEOF
    1629 MacPorts configure 2.1.99
     1628MacPorts configure 2.2.99
    16301629generated by GNU Autoconf 2.69
    16311630
     
    22962295running configure, to aid debugging if configure makes a mistake.
    22972296
    2298 It was created by MacPorts $as_me 2.1.99, which was
     2297It was created by MacPorts $as_me 2.2.99, which was
    22992298generated by GNU Autoconf 2.69.  Invocation command line was
    23002299
     
    27912790{ $as_echo "$as_me:${as_lineno-$LINENO}: checking MacPorts version" >&5
    27922791$as_echo_n "checking MacPorts version... " >&6; }
    2793 MACPORTS_VERSION=2.1.99
     2792MACPORTS_VERSION=2.2.99
    27942793{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACPORTS_VERSION" >&5
    27952794$as_echo "$MACPORTS_VERSION" >&6; }
     
    29572956                  Please upgrade at http://store.apple.com/" "$LINENO" 5
    29582957    ;;
    2959   10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-7]|10.7.[0-4]|10.8.[0-1])
     2958  10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-7]|10.7.[0-4]|10.8.[0-3])
    29602959    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This version of Mac OS X is out of date" >&5
    29612960$as_echo "$as_me: WARNING: This version of Mac OS X is out of date" >&2;}
     
    1007410073
    1007510074
    10076 
    1007710075# misc variables that need to be expanded for substitution into tcl
    1007810076
     
    1062710625# values after options handling.
    1062810626ac_log="
    10629 This file was extended by MacPorts $as_me 2.1.99, which was
     10627This file was extended by MacPorts $as_me 2.2.99, which was
    1063010628generated by GNU Autoconf 2.69.  Invocation command line was
    1063110629
     
    1068910687ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
    1069010688ac_cs_version="\\
    10691 MacPorts config.status 2.1.99
     10689MacPorts config.status 2.2.99
    1069210690configured by $0, generated by GNU Autoconf 2.69,
    1069310691  with options \\"\$ac_cs_config\\"
  • branches/gsoc11-statistics/base/configure.ac

    r105085 r107206  
    3333                  Please upgrade at http://store.apple.com/])
    3434    ;;
    35   10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-1]])
     35  10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-3]])
    3636    AC_MSG_WARN([This version of Mac OS X is out of date])
    3737    AC_MSG_WARN([Please run Software Update to update it])
  • branches/gsoc11-statistics/base/doc/archive_sites.conf

    r105085 r107206  
    1 # Configuration for (binary) archive sources.
    21# $Id$
    32
    4 # Each entry is started by a name line. The only required values are name and
    5 # urls. Other fields are type, prefix, applications_dir and frameworks_dir,
    6 # which have the usual default values:
    7 #    type tbz2
    8 #    prefix /opt/local
    9 #    applications_dir /Applications/MacPorts
    10 #    frameworks_dir ${prefix}/Library/Frameworks
     3# MacPorts configuration file for binary archive sources.
     4
     5# Each source entry consists of one or more fields.
    116#
    12 # type can be any of: tgz, tar, tbz, tbz2, tlz, txz, xar, zip, cpgz, cpio
    13 # Note that some types require a corresponding tool to be installed, and
    14 # entries with an unsupported type will not be used.
     7#   name: A name for the archive source. This field always starts a new
     8#       entry. Required.
     9#
     10#   urls: A space- or tab-delimited list of the source's URLs. Defaults
     11#       to an empty list.
     12#
     13#   type: The filetype of the archives; valid values are "cpgz", "cpio",
     14#       "tar", "tbz", "tbz2", "tgz", "tlz", "txz", "xar", and "zip".
     15#       MacPorts handles each archive type with an appropriate external
     16#       executable; if it cannot find such an executable, or if the
     17#       specified type is invalid, the source is not used. Defaults to
     18#       "tbz2".
     19#
     20#   prefix: The prefix of the MacPorts installation used to create the
     21#       source's archives. This must match the value of "prefix" set in
     22#       macports.conf, or the source is not used. Defaults to
     23#       "/opt/local".
     24#
     25#   applications_dir: The applications directory of the MacPorts
     26#       installation used to create the source's archives. This must
     27#       match the value of "applications_dir" set in macports.conf, or
     28#       the source is not used. Defaults to "/Applications/MacPorts".
     29#
     30#   frameworks_dir: The frameworks directory of the MacPorts
     31#       installation used to create the source's archives. This must
     32#       match the value of "frameworks_dir" set in macports.conf, or the
     33#       source is not used. Defaults to "[prefix]/Library/Frameworks".
    1534
    16 # Example:
    17 #name                mysource
    18 #urls                http://example.com/ ftp://ftp.example.org/
    19 #type                tbz2
    20 #prefix              /opt/mysource
    21 #applications_dir    /opt/mysource/Applications
    22 #frameworks_dir      /opt/mysource/Library/Frameworks
     35# Example source:
     36#name                   My Source
     37#urls                   http://example.com/ ftp://ftp.example.com/packages/
     38#type                   zip
     39#prefix                 /opt/mysource
     40#applications_dir       /opt/mysource/Applications
    2341
    24 # If you want to disable use of the archive sites listed in the ports tree,
    25 # you could do this:
    26 #name                macports_archives
    27 #urls
     42# To disable the default archive source, uncomment the following dummy
     43# entry; it will shadow the one from the ports tree.
     44#name                   macports_archives
  • branches/gsoc11-statistics/base/doc/exampleport/Portfile

    r28671 r107206  
    88# where version is the version of the ports system your port relies upon.
    99# This can NOT be commented out.
    10 PortSystem 1.0
     10PortSystem          1.0
    1111
    1212# The name of the port
    13 name            glib2
     13name                glib2
    1414
    1515# Its version information
    16 version       2.12.11
     16version             2.12.11
    1717
    1818# Supported and tested platforms
    19 platforms       darwin
     19platforms           darwin
    2020
    2121# Categories and identifying keywords
    22 categories      devel
     22categories          devel
    2323
    2424# Email address(es) of the port's Maintainer(s)
    25 maintainers     ryandesign@macports.org
     25maintainers ryandesign@macports.org
    2626
    2727# A short description of this port
    28 description     Library with data structure functions and other constructs
     28description         Library with data structure functions and other constructs
    2929
    3030# A long description, with more details
    31 long_description      Glib is a library which includes support routines for \
    32                       C, such as lists, trees, hashes, memory allocation, and \
    33                       many other things.
     31long_description    Glib is a library which includes support routines for \
     32                    C, such as lists, trees, hashes, memory allocation, and \
     33                    many other things.
    3434
    3535# Homepage for the port:
    36 homepage        http://www.gtk.org/
     36homepage            http://www.gtk.org/
    3737
    3838# Master download sites for port's distribution file(s)
    39 master_sites    ftp://ftp.gtk.org/pub/glib/2.12 \
    40                 gnome:sources/glib/2.12
     39master_sites        ftp://ftp.gtk.org/pub/glib/2.12 \
     40                    gnome:sources/glib/2.12
    4141
    4242# Name of the distribution file, minus extract suffix (see below)
    43 distname        glib-${version}
     43distname            glib-${version}
    4444
    4545# (Optional) Explicitly set suffix (default: .tar.gz)
    46 #extract.suffix .tar.bz2
     46#extract.suffix      .tar.bz2
    4747
    4848# (Optional) Use bzip2 instead of gzip for uncompressing distribution file
    49 use_bzip2       yes
     49use_bzip2           yes
    5050
    5151# List of checksums for files to be fetched
    5252# <file name> <checksum type> <checksum>
    53 checksums       ${distname}${extract.suffix} md5 077a9917b673a9a0bc63f351786dde24 \
    54                 ${distname}${extract.suffix} sha1 02d344295ddaeafeec6bc6824b71e12bbf1b0394 \
    55                 ${distname}${extract.suffix} rmd160 8680d27e630643e6653d88537907d06e3ba6e91a
     53checksums   ${distname}${extract.suffix} md5 077a9917b673a9a0bc63f351786dde24 \
     54        ${distname}${extract.suffix} sha1 02d344295ddaeafeec6bc6824b71e12bbf1b0394 \
     55        ${distname}${extract.suffix} rmd160 8680d27e630643e6653d88537907d06e3ba6e91a
    5656
    5757# Any patches which should be applied after extracting this port.  These
    58 
    5958# should go in the files/ subdirectory of the port.
    60 patchfiles      patch-glib-2.0.pc.in patch-glib__gutils.c
     59patchfiles          patch-glib-2.0.pc.in \
     60                    patch-glib__gutils.c
    6161
    6262# Dependencies are defined by three settings:
    63 #    depends_lib:       installed at build time and at install time
    64 #    depends_run:       installed at install time
    65 #    depends_build:     installed at build time
     63#    depends_lib:   installed at build time and at install time
     64#    depends_run:   installed at install time
     65#    depends_build: installed at build time
    6666#
    6767#    These options accept a list of depspecs. Depspecs are ':' delimited three
    6868#    value lists of type:match:portname. The following types are supported:
    6969#
    70 #       lib     - The lib type requires the match argument in the
    71 #                   format <libraryname>.<major version>
    72 #       bin     - The bin type requires the match argument to be the full
    73 #                   executable name
    74 #       <path>  - If a full path is specified as the type, the math argument
    75 #                   must be a complete regexp.
    76 #       portname must be the name of a valid port to build and install
    77 #       if the depspec is not matched.
    78 #       An alternative dependency depspec is the port:<portname> syntax,
    79 #       used when you want to insure the given dependency is satisfied
    80 #       exclusively by MacPorts.
    81 depends_build       port:pkgconfig
    82 depends_lib         port:gettext
     70#   lib - The lib type requires the match argument in the
     71#           format <libraryname>.<major version>
     72#   bin - The bin type requires the match argument to be the full
     73#           executable name
     74#   <path>  - If a full path is specified as the type, the math argument
     75#           must be a complete regexp.
     76#   portname must be the name of a valid port to build and install
     77#   if the depspec is not matched.
     78#   An alternative dependency depspec is the port:<portname> syntax,
     79#   used when you want to insure the given dependency is satisfied
     80#   exclusively by MacPorts.
     81depends_build       port:pkgconfig
     82depends_lib         port:gettext
    8383
    8484# The type of configuration script this port uses.
    85 #configure.type     gnu
     85#configure.type      gnu
    8686
    8787# A list of configuration time arguments you might want to pass to the configure script:
    88 configure.args   --mandir=${prefix}/share/man
     88configure.args      --mandir=${prefix}/share/man
    8989
    9090# The directory name of the subdirectory of work/ where this port extracts
    91 #worksrcdir     glib
     91#worksrcdir          glib
    9292
    9393# Alternative ways to build the port, packed as 'variants'
  • branches/gsoc11-statistics/base/doc/macports.conf.in

    r105577 r107206  
    1 # MacPorts system wide configuration file
    21# $Id$
    32
    4 # Set the directory in which to install ports. Must match where MacPorts itself is installed.
    5 prefix                  @prefix_expanded@
    6 
    7 # Set the user to run MacPorts compiles, etc as when privileges are dropped during an install
    8 #macportsuser           @RUNUSR@
    9 
    10 # Where to store MacPorts working data
    11 portdbpath              @localstatedir_expanded@/macports
    12 
    13 # PATH settings that are used for external tools (configure, make, etc.) while
    14 # installing ports. The default paths are given in the example; it need not be
    15 # uncommented.  Customizing binpath is unsupported and is intended for
    16 # advanced users only.
    17 #binpath                @prefix_expanded@/bin:@prefix_expanded@/sbin:/bin:/sbin:/usr/bin:/usr/sbin
    18 
    19 # Directory containing Xcode Tools (default is to ask xcode-select)
    20 #developer_dir          @DEVELOPER_DIR@
    21 
    22 # Path to PackageMaker.app
    23 # It may be necessary to set this with Xcode >= 4.3, as that version
    24 # requires PackageMaker to be installed manually from the Auxiliary Tools for
    25 # Xcode disk image. The default is /Applications/PackageMaker.app with Xcode
    26 # 4.3 and ${developer_dir}/Applications/Utilities/PackageMaker.app with older
    27 # versions.
    28 #packagemaker_path /Applications/PackageMaker.app
    29 
    30 # Directory containing Applications from ports.
    31 applications_dir        @MPAPPLICATIONSDIR@
    32 
    33 # Directory containing Frameworks from ports.
    34 frameworks_dir          @MPFRAMEWORKSDIR@
    35 
    36 # Where to find the sources list.
    37 sources_conf            @MPCONFIGDIR_EXPANDED@/sources.conf
    38 
    39 # Where to find global variants definition file (optional)
    40 variants_conf           @MPCONFIGDIR_EXPANDED@/variants.conf
    41 
    42 # When to build ports from source. Default is 'ifneeded', which downloads an
    43 # archive if available or builds from source otherwise. 'always' has the same
    44 # effect as -s on the command line, and 'never' is likewise the same as -b.
    45 #buildfromsource        ifneeded
    46 
    47 # Type of archives to use for port images
    48 #
    49 # Supported types: tgz, tar, tbz, tbz2 (default), tlz, txz, xar, zip, cpgz, cpio
    50 #portarchivetype        tbz2
    51 
    52 # CPU architecture to compile for. Defaults to i386 or ppc on Mac OS X 10.5
    53 # and earlier, depending on the CPU type detected at runtime. On Mac OS X 10.6
    54 # the default is x86_64 if the CPU supports it, i386 otherwise.
    55 #build_arch             i386
    56 
    57 # CPU architectures to use for Universal Binaries (+universal variant)
    58 universal_archs         @UNIVERSAL_ARCHS@
    59 
    60 # Use ccache (C/C++ compiler cache) - see http://ccache.samba.org/
    61 #configureccache        no
    62 
    63 # Location where ccache stores its files
    64 #ccache_dir             @localstatedir_expanded@/macports/build/.ccache
    65 
    66 # Maximum size ccache may use.
    67 # Use 'G', 'M', or 'K' suffix for giga-, mega- or kilobytes.
    68 #ccache_size            2G
    69 
    70 # Use distcc (distributed compiler) - see http://distcc.samba.org/
    71 #configuredistcc        no
    72 
    73 # Use pipes rather than intermediate files when compiling C/C++/etc
    74 #configurepipe          yes
    75 
    76 # Lowered scheduling priority (0-20) to use for make when building ports
    77 #buildnicevalue         0
    78 
    79 # Number of simultaneous make jobs (commands) to use when building ports. This
    80 # value may be set to 0 so the number of simultaneous make jobs will be set to
    81 # the number of CPU cores that are automatically detected, or the number of GB
    82 # of physical memory plus one, whichever is less.
    83 #buildmakejobs          0
    84 
    85 # umask value to use when a port installs its files
    86 #destroot_umask         022
    87 
    88 # Set whether to automatically execute "clean" after "install" of ports
    89 #portautoclean          yes
    90 
    91 # Set to yes if you don't want logs to be deleted after successful builds
    92 #keeplogs               no
    93 
    94 # Rsync server to fetch MacPorts sources from. Note that this is only used
    95 # for selfupdate. The source(s) for the ports tree are set in sources.conf.
    96 # Known mirrors at time of writing (see https://trac.macports.org/wiki/Mirrors
    97 # for the current list):
    98 #   rsync.macports.org        - California, USA (master)
    99 #   trd.no.rsync.macports.org - Trondheim, Norway
    100 #rsync_server           rsync.macports.org
    101 
    102 # Rsync directory from which to pull the base/ component (infrastructure) of MacPorts
    103 # If this points to a .tar file, a signed .rmd160 must exist next to it
    104 # on the server and will be used to verify its integrity.
    105 #rsync_dir              release/tarballs/base.tar
    106 
    107 # Rsync options
    108 #rsync_options          -rtzv --delete-after
    109 
    110 # Options for generated startup items
    111 # startupitem_type may be "default", "systemstarter", "launchd", or "none";
    112 # if the option is empty or "default" then a startupitem type appropriate
    113 # to the platform will be chosen. Mac OS X 10.4 Tiger and above will default to
    114 # launchd, while older Mac OS X systems will default to systemstarter. If
    115 # option "none" is chosen, port startupitems are ignored and no startupitems
    116 # are installed.
    117 #startupitem_type       default
    118 
    119 # Option to install symlinks into /Library/LaunchAgents or /Library/LaunchDaemons
    120 # startupitem_install may be empty, "yes" or "no";
    121 # if the option is NOT "no" then a symlink for the startupitem will be created in
    122 # the appropriate system directory.
     3# MacPorts system-wide configuration file.
     4# Commented-out values are defaults unless otherwise noted.
     5
     6# Directory under which MacPorts should install ports. This must be
     7# where MacPorts itself is installed.
     8prefix                  @prefix_expanded@
     9
     10# User to run operations as when MacPorts drops privileges.
     11#macportsuser           @RUNUSR@
     12
     13# Directory for MacPorts working data.
     14portdbpath              @localstatedir_expanded@/macports
     15
     16# Colon-delimited list of directories to search for external tools
     17# (make(1), pkg-config(1), etc.). While installing ports, MacPorts uses
     18# this list for PATH. Changing this setting is intended for advanced
     19# users only and is unsupported.
     20#binpath                @prefix_expanded@/bin:@prefix_expanded@/sbin:/bin:/sbin:/usr/bin:/usr/sbin
     21
     22# Directory containing Xcode Tools. By default, MacPorts determines this
     23# using xcode-select(1).
     24#developer_dir          @DEVELOPER_DIR@
     25
     26# Location of PackageMaker. Defaults to
     27# "${developer_dir}/Applications/Utilities/PackageMaker.app" with Xcode
     28# 4.2 and earlier and "/Applications/PackageMaker.app" with 4.3 and later.
     29#packagemaker_path      /Applications/PackageMaker.app
     30
     31# Directory for application bundles installed by ports.
     32applications_dir        @MPAPPLICATIONSDIR@
     33
     34# Directory for frameworks installed by ports.
     35frameworks_dir          @MPFRAMEWORKSDIR@
     36
     37# Location of the MacPorts sources list.
     38sources_conf            @MPCONFIGDIR_EXPANDED@/sources.conf
     39
     40# Location of the MacPorts global variants definition file. Optional.
     41variants_conf           @MPCONFIGDIR_EXPANDED@/variants.conf
     42
     43# When MacPorts should build ports from source.
     44# - ifneeded: Download binary archives if available; build from source
     45#   otherwise.
     46# - always: Always build from source; never try fetching archives.
     47# - never: Never build from source; try fetching archives and abort if
     48#   unavailable.
     49#buildfromsource        ifneeded
     50
     51# Type of archive to use for port images. Supported types are cpgz,
     52# cpio, tar, tbz, tbz2, tgz, tlz, txz, xar, zip.
     53#portarchivetype        tbz2
     54
     55# CPU architecture to target. Supported values are "ppc", "ppc64",
     56# "i386", and "x86_64". Defaults to:
     57# - OS X 10.5 and earlier: "ppc" on PowerPC, otherwise "i386".
     58# - OS X 10.6 and later: "x86_64" on Intel 64, otherwise "i386".
     59#build_arch             i386
     60
     61# Space-delimited list of CPU architectures to target when building
     62# universal. Defaults to "i386 ppc" on OS X 10.5 and earlier and
     63# "x64_64 i386" on OS X 10.6 and later.
     64universal_archs         @UNIVERSAL_ARCHS@
     65
     66# Use ccache, a compiler cache for C, C++, Objective-C, and
     67# Objective-C++. (See http://ccache.samba.org.) The "ccache" executable
     68# must exist in one of the directories in binpath.
     69#configureccache        no
     70
     71# Directory for ccache's cached compiler output.
     72#ccache_dir             @localstatedir_expanded@/macports/build/.ccache
     73
     74# Maximum size of files stored in ccache's cache. Append "G", "M", or
     75# "K" for gigabytes, megabytes, or kilobytes.
     76#ccache_size            2G
     77
     78# Use distcc, a distributed compiler for C, C++, Objective-C, and
     79# Objective-C++. (See http://distcc.org.) The "distcc" executable must
     80# exist in one of the directories in binpath.
     81#configuredistcc        no
     82
     83# Use pipes rather than temporary files for communication between the
     84# various stages of C, C++, Objective-C, and Objective-C++ compilation.
     85#configurepipe          yes
     86
     87# Lowered scheduling priority to use for commands run during configure,
     88# build, and destroot. Accepted values are 0 (normal priority) through
     89# 20 (lowest priority).
     90#buildnicevalue         0
     91
     92# Number of simultaneous make(1) jobs to use when building ports. If set
     93# to 0, the number of jobs will be the lesser of:
     94# - number of automatically-detected CPU cores
     95# - gigabytes of physical memory + 1
     96#buildmakejobs          0
     97
     98# umask value to use when a port installs its files.
     99#destroot_umask         022
     100
     101# Automatically execute "clean" after "install" of ports.
     102#portautoclean          yes
     103
     104# Keep logs after successful installations.
     105#keeplogs               no
     106
     107# The rsync server for fetching MacPorts base during selfupdate. This
     108# setting is NOT used when downloading the ports tree; the sources for
     109# the ports tree are set in sources.conf. See
     110# https://trac.macports.org/wiki/Mirrors#MacPortsSource for a list of
     111# available servers.
     112#rsync_server           rsync.macports.org
     113
     114# Location of MacPorts base sources on rsync_server. If this references
     115# a .tar file, a signed .rmd160 file must exist in the same directory
     116# and will be used to verify its integrity. See
     117# https://trac.macports.org/wiki/Mirrors#MacPortsSource to find the
     118# correct rsync_dir for a particular rsync_server.
     119#rsync_dir              release/tarballs/base.tar
     120
     121# Options to pass to rsync when fetching MacPorts base and the ports tree.
     122#rsync_options          -rtzv --delete-after
     123
     124# Type of generated StartupItems.
     125# - launchd: Create StartupItems for use with launchd.
     126# - systemstarter: Create StartupItems for use with SystemStarter.
     127# - rcng: Create StartupItems for use with the rc.d system.
     128# - default: Create StartupItems for launchd on OS X and for rc.d on
     129#   other platforms.
     130# - none: Disable creation of StartupItems.
     131#startupitem_type       default
     132
     133# Create system-level symlinks to generated StartupItems. If set to
     134# "no", symlinks will not be created; otherwise, symlinks will be placed
     135# in /Library/LaunchDaemons or /Library/LaunchAgents as appropriate.
    123136#startupitem_install    yes
    124137
    125 # Extra environment variables to keep. Any variables listed here are added
    126 # to the list of variables that are not removed from the environment used
    127 # while processing ports. As with binpath, setting extra_env is intended for
    128 # advanced users and is unsupported.
    129 # extra_env             KEEP_THIS THIS_TOO
    130 
    131 # Proxy support
    132 # Precedence is: env, macports.conf, System Preferences
    133 # That is, if it's set in the environment, that will be used instead of
    134 # anything here or in System Preferences.  Setting proxy_override_env to yes
    135 # will cause any proxies set here (or in System Preferences if set there but
    136 # not here) to override what's in the environment.
    137 # Note that System Preferences doesn't have an rsync proxy definition.
    138 # Also note, on 10.5, sudo will clear many environment variables including
    139 # those for proxy support.
    140 # Equivalent environment variables: http_proxy, HTTPS_PROXY, FTP_PROXY,
    141 # RSYNC_PROXY, NO_PROXY
    142 #
    143 #proxy_override_env     yes
    144 # HTTP proxy:
    145 #proxy_http             hostname:12345
    146 # HTTPS proxy:
    147 #proxy_https            hostname:12345
    148 # FTP proxy:
    149 #proxy_ftp              hostname:12345
    150 # rsync proxy:
    151 #proxy_rsync            hostname:12345
    152 # hosts not to go through the proxy (comma-separated, applies to HTTP, HTTPS,
    153 # and FTP, but not rsync):
    154 #proxy_skip            internal1, internal2, internal3
     138# Extra environment variables to keep. MacPorts sanitizes its
     139# environment while processing ports, keeping:
     140# - DISPLAY
     141# - DYLD_FALLBACK_FRAMEWORK_PATH, DYLD_FALLBACK_LIBRARY_PATH,
     142#   DYLD_FRAMEWORK_PATH, DYLD_INSERT_LIBRARIES, DYLD_LIBRARY_PATH
     143# - JAVA_HOME
     144# - ARCHIVE_SITE_LOCAL, MASTER_SITE_LOCAL, PATCH_SITE_LOCAL
     145# - PORTSRC
     146# - ALL_PROXY, FTP_PROXY, http_proxy, HTTPS_PROXY, NO_PROXY, RSYNC_PROXY
     147# - GROUP, USER
     148# - COLUMNS, LINES
     149# Variables listed in extra_env are added to this list. This has no
     150# default value; setting it is intended for advanced users and is
     151# unsupported. (Note that sudo(8) sanitizes its environment on OS X 10.5
     152# and later, so it may have to be configured to pass the desired
     153# variables to MacPorts.)
     154#extra_env              KEEP_THIS THIS_TOO
     155
     156# Override proxy-related environment variables. By default, MacPorts
     157# takes proxy settings from the environment, from the proxy_* options
     158# below, and from Network Preferences, in that order. If this is set to
     159# "yes", MacPorts uses proxy_*, then Network Preferences, then the
     160# environment. (Note that Network Preferences does not have a setting
     161# for rsync proxies. Also note that sudo(8) sanitizes its environment on
     162# OS X 10.5 and later, so it may have to be configured to pass desired
     163# variables to MacPorts.)
     164#proxy_override_env     no
    155165
    156166# Options for MacPorts usage statistics collection
     
    165175stats_id        @STATS_UUID@
    166176
    167 # Options 'host_blacklist' and 'preferred_hosts', used for indicating
    168 # space separated lists of download hosts that should not be used or
    169 # should be used preferentially, respectively. These override the usual
    170 # ping time check.
    171 #host_blacklist     badhost1.org badhost2.org
    172 #preferred_hosts    preferredhost1.org preferredhost2.org
    173 
    174 # Set whether to automatically run rev-upgrade after upgrading ports
    175 #revupgrade_autorun yes
    176 # Option controlling action taken by rev-upgrade, which checks for broken
    177 # linking and can rebuild affected ports. Possible values are
    178 #'rebuild' (default) or 'report'.
    179 #revupgrade_mode        rebuild
    180 
    181 # When creating a pkg, specify the files and/or directories in
    182 # ${prefix} to delete after the unarchive stage and before the
    183 # pkg is created.  If not set, nothing is deleted.
    184 #
    185 # Because mpkg's are built from pkg's, any mpkg's will also have
    186 # the specified files and/or directories omitted.
    187 #
    188 # For example
    189 #
    190 #   pkg_post_unarchive_deletions include share/doc share/man
    191 #
    192 # will delete ${prefix}/include, ${prefix}/share/doc and
    193 # ${prefix}/share/man.
    194 #
    195 # This feature is useful when one wants to shrink the size of the
    196 # pkg's and mpkg's for deployment to Macs that will not be used
    197 # for development.  One large mpkg was observed to shrink from
    198 # 504 MB to 271 MB.
    199 #
    200 #pkg_post_unarchive_deletions include share/doc share/man
     177# Proxies. These have no default values. The analagous environment
     178# variables are "http_proxy", "HTTPS_PROXY", "FTP_PROXY", and
     179# "RSYNC_PROXY".
     180#proxy_http             proxy1:12345
     181#proxy_https            proxy2:67890
     182#proxy_ftp              proxy3:02139
     183#proxy_rsync            proxy4:11377
     184
     185# Comma-delimited list of hosts that MacPorts should not access through
     186# the HTTP, HTTPS, and FTP proxies. This does not apply to rsync, and it
     187# has no default value.
     188#proxy_skip             host1, host2, host3
     189
     190# Space-delimited lists of download hosts that MacPorts should not use
     191# and that MacPorts should prefer, respectively, overriding the usual
     192# ping time checks. These have no default values.
     193#host_blacklist         badhost1 badhost2
     194#preferred_hosts        preferredhost1 preferredhost2
     195
     196# Whether MacPorts should automatically run rev-upgrade after upgrading
     197# ports.
     198#revupgrade_autorun     yes
     199
     200# Whether rev-upgrade should automatically rebuild ports with broken
     201# linking or merely report the breakage. Supported values are "report"
     202# and "rebuild".
     203#revupgrade_mode        rebuild
     204
     205# Space-delimited list of files and directories to delete after the
     206# unarchive stage and before creating a pkg. Paths are interpreted
     207# relative to prefix, and there is no default value. This is useful for
     208# removing unnecessary files and directories prior to pkg or mpkg
     209# deployment.
     210#pkg_post_unarchive_deletions   include share/doc share/man
  • branches/gsoc11-statistics/base/doc/port.1

    r105085 r107206  
    523523To remove the distribution files (tarballs, etc), specify
    524524.Fl -dist .
    525 To remove the work files, distribution files and logs, pass
     525To remove any archives of a port that remain in the temporary download directory, pass
     526.Fl -archive .
     527(This does not remove archives from the installed location.)
     528To remove the log files for a port, pass
     529.Fl -logs .
     530To remove the work files, distribution files, temporary archives and logs, pass
    526531.Fl -all .
    527 To remove log files for certain port, pass
    528 .Fl -logs .
    529532For example:
    530533.Pp
     
    532535.Dl "port clean --logs vim"
    533536.Pp
     537To remove only certain version(s) of a port's temporary archives (
     538.Ar version
     539is any valid UNIX glob pattern), you can use:
     540.Pp
     541.Dl "port clean --archive vim 6.2.114"
     542.Pp
     543or:
     544.Pp
     545.Dl "port clean --archive vim '6.*'"
    534546.Ss log
    535547Parses and shows log files for
  • branches/gsoc11-statistics/base/doc/pubkeys.conf.in

    r68996 r107206  
    1 # Downloaded archives will only be used if they can be verified by a public
    2 # key listed here. Use full paths, one per line.
     1# $Id$
     2
     3# MacPorts system-wide public key configuration file.
     4
     5# Downloaded archives will only be used if they can be verified by one
     6# of the public keys listed here. Use absolute paths, one per line.
    37
    48@prefix_expanded@/share/macports/macports-pubkey.pem
    59
    6 # To distribute archives of your own, you need a key pair generated like so:
    7 # openssl genrsa -des3 -out privkey.pem 2048
    8 # openssl rsa -in privkey.pem -pubout -out pubkey.pem
    9 # Then sign the archives like this:
    10 # openssl dgst -ripemd160 -sign privkey.pem -out archive.tbz2.rmd160 archive.tbz2
     10# To distribute archives of your own, generate a key pair:
     11#   openssl genrsa -des3 -out privkey.pem 2048
     12#   openssl rsa -in privkey.pem -pubout -out pubkey.pem
     13#
     14# And sign the archives:
     15#   openssl dgst -ripemd160 -sign privkey.pem -out archive.tbz2.rmd160 archive.tbz2
  • branches/gsoc11-statistics/base/doc/sources.conf

    r79672 r107206  
    1 #  MacPorts system wide sources configuration file
    2 #  $Id$
     1# $Id$
    32
    4 #  To setup a local ports repository, insert a "file://" entry following
    5 #  the example below that points to your local ports directory:
    6 #  Example: file:///Users/landonf/misc/MacPorts/ports
     3# MacPorts system-wide configuration file for ports tree sources.
     4#
     5# To change how MacPorts fetches base, see rsync_server and rsync_dir in
     6# macports.conf.
    77
    8 #  The default MacPorts repository should always be tagged [default]
    9 #  for proper functionality of various resources (port groups, mirror
    10 #  sites, etc).  If you switch it from the rsync:// URL, be sure to keep
    11 #  it tagged [default].
     8# To add a local source, add a "file://" entry.
     9#
     10#   Example: file:///Users/landonf/misc/MacPorts/ports
     11#
     12# To prevent a source from synchronizing when `port sync` is used,
     13# append "[nosync]" at the end.
     14#
     15#   Example: file:///Users/landonf/misc/MacPorts/ports [nosync]
     16#
     17# Note that MacPorts parses source URLs in order; when a port appears in
     18# multiple sources, it installs the first occurrence. For local sources
     19# to shadow remote ones, "file://" URLs must come before other URLs.
    1220
    13 #  To prevent a source from synchronizing when `port sync` is used,
    14 #  append [nosync] at the end as shown in this example:
    15 #  Example: file:///Users/landonf/misc/MacPorts/ports [nosync]
    16 
    17 #  NOTE: The port command parses source URLs in order and installs the
    18 #        first occurrance when a port appears in multiple repositories.
    19 #        So keep "file://" URLs above other URL types.
    20 
    21 
    22 #  To get the ports tree from the master MacPorts server in California, USA use:
    23 #      rsync://rsync.macports.org/release/ports/
    24 #  To get it from the mirror in Trondheim, Norway use:
    25 #      rsync://trd.no.rsync.macports.org/release/ports/
    26 #  A current list of mirrors is available at https://trac.macports.org/wiki/Mirrors
    27 
    28 # If an rsync URL points to a .tar file, a signed .rmd160 must exist next to
    29 # it on the server and will be used to verify its integrity.
     21# A list of rsync mirrors is available at
     22# https://trac.macports.org/wiki/Mirrors#Portfiles.
     23#
     24# If an "rsync://" URL points to a .tar file, a signed .rmd160 file must
     25# exist in the same directory on the server and will be used to verify
     26# its integrity.
     27#
     28# For proper functionality of various resources (port groups, mirror
     29# sites, etc.), the primary MacPorts source must always be tagged
     30# "[default]", even if switched from the default "rsync://" URL.
    3031
    3132rsync://rsync.macports.org/release/tarballs/ports.tar [default]
  • branches/gsoc11-statistics/base/doc/variants.conf

    r63004 r107206  
    1 # To specify global variants to use for all port builds,
    2 # customize this file to list variant settings you want.
     1# $Id$
     2
     3# MacPorts system-wide global variants configuration file.
     4
     5# Any variants listed here are applied to all port builds. As on the
     6# command line, variants may be either enabled (+) or disabled (-), and
     7# unsupported variants are simply ignored.
    38#
    4 # Any variants specified here that are not supported by
    5 # a port will just be ignored. Multiple variants can be
    6 # specified per line, or one per line is also allowed.
     9# Each line must be a space- or tab-delimited list of zero or more
     10# variants.
    711#
    812# Example:
    9 # +ipv6 +no_x11
     13#   -x11 +no_x11 +quartz
     14#   +gcc48
     15#   +universal
  • branches/gsoc11-statistics/base/src/darwintracelib1.0/darwintrace.c

    r105638 r107206  
    33 * Copyright (c) 2005-2006 Paul Guyot <pguyot@kallisys.net>,
    44 * All rights reserved.
     5 * Copyright (c) 2006-2013 The MacPorts Project
    56 *
    67 * $Id$
     
    595596 */
    596597__attribute__((always_inline))
    597 inline int __darwintrace_is_in_sandbox(const char* path, char * newpath) {
     598static inline int __darwintrace_is_in_sandbox(const char* path, char * newpath) {
    598599        char *t, *p, *_;
     600        char *strpos, *normpos;
    599601        char lpath[MAXPATHLEN];
     602        char normalizedpath[MAXPATHLEN];
    600603       
    601604        __darwintrace_setup();
     
    614617                strcat(lpath, path);
    615618        }
    616 
    617619        p = lpath;
     620
     621        normalizedpath[0] = '\0';
     622        strpos = p + 1;
     623        normpos = normalizedpath;
     624        for (;;) {
     625                char *curpos = strsep(&strpos, "/");
     626                if (curpos == NULL) {
     627                        /* reached the end of the path */
     628                        break;
     629                } else if (*curpos == '\0') {
     630                        /* empty entry, ignore */
     631                        continue;
     632                } else if (strcmp(curpos, ".") == 0) {
     633                        /* no-op directory, ignore */
     634                        continue;
     635                } else if (strcmp(curpos, "..") == 0) {
     636                        /* walk up one directory */
     637                        char *lastSep = strrchr(normalizedpath, '/');
     638                        if (lastSep == NULL) {
     639                                /* path is completely empty */
     640                                normpos = normalizedpath;
     641                                *normpos = '\0';
     642                                continue;
     643                        }
     644                        /* remove last component by overwriting the slash with \0, update normpos */
     645                        *lastSep = '\0';
     646                        normpos = lastSep;
     647                }
     648                /* default case: standard path, copy */
     649                strcat(normpos, "/");
     650                normpos++;
     651                strcat(normpos, curpos);
     652                debug_printf("path %s, processing entry %s, normalized %s\n", path, curpos, normalizedpath);
     653        }
     654        if (*normalizedpath == '\0') {
     655                strcat(normalizedpath, "/");
     656        }
    618657
    619658        for (t = filemap; *t;) {
    620659                char state;
    621660               
    622                 if (__darwintrace_strbeginswith(p, t)) {
     661                if (__darwintrace_strbeginswith(normalizedpath, t)) {
    623662                        /* move t to the integer describing how to handle this match */
    624663                        t += strlen(t) + 1;
     
    638677                                                *_ = '/';
    639678                                        }
    640                                         strcpy(_, p);
     679                                        strcpy(_, normalizedpath);
    641680                                        return 1;
    642681                                case 2:
    643682                                        /* ask the socket whether this file is OK */
    644                                         return ask_for_dependency(p);
     683                                        return ask_for_dependency(normalizedpath);
    645684                                default:
    646685                                        fprintf(stderr, "darwintrace: error: unexpected byte in file map: `%x'\n", *t);
     
    675714        }
    676715
    677         __darwintrace_log_op("sandbox_violation", path, 0);
     716        __darwintrace_log_op("sandbox_violation", normalizedpath, 0);
    678717        return 0;
    679718}
  • branches/gsoc11-statistics/base/src/macports1.0/macports.tcl

    r105577 r107206  
    77# Copyright (c) 2004 - 2006 Ole Guldberg Jensen <olegb@opendarwin.org>.
    88# Copyright (c) 2004 - 2005 Robert Shaw <rshaw@opendarwin.org>
    9 # Copyright (c) 2004 - 2012 The MacPorts Project
     9# Copyright (c) 2004 - 2013 The MacPorts Project
    1010# All rights reserved.
    1111#
     
    4040
    4141namespace eval macports {
    42     namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases 
     42    namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases
    4343    variable bootstrap_options "\
    4444        portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat \
     
    5151        master_site_local patch_site_local archive_site_local buildfromsource stats_participate stats_url stats_id \
    5252        revupgrade_autorun revupgrade_mode revupgrade_check_id_loadcmds \
    53         host_blacklist preferred_hosts\
     53        host_blacklist preferred_hosts sandbox_enable \
    5454        packagemaker_path default_compilers pkg_post_unarchive_deletions"
    55     variable user_options ""
     55    variable user_options {}
    5656    variable portinterp_options "\
    5757        portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
     
    6262        applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch \
    6363        os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target \
    64         packagemaker_path default_compilers \
     64        packagemaker_path default_compilers sandbox_enable \
    6565        pkg_post_unarchive_deletions $user_options"
    6666
     
    7474    variable ui_priorities "error warn msg notice info debug any"
    7575    variable port_phases "any fetch checksum"
    76     variable current_phase "main"
     76    variable current_phase main
    7777
    7878    variable ui_prefix "---> "
     
    101101proc macports::ui_isset {val} {
    102102    if {[info exists macports::ui_options($val)]} {
    103         if {$macports::ui_options($val) == "yes"} {
     103        if {$macports::ui_options($val) eq "yes"} {
    104104            return 1
    105105        }
     
    112112proc macports::global_option_isset {val} {
    113113    if {[info exists macports::global_options($val)]} {
    114         if {$macports::global_options($val) == "yes"} {
     114        if {$macports::global_options($val) eq "yes"} {
    115115            return 1
    116116        }
     
    131131    # Add our log-channel to all already initialized channels
    132132    foreach key [array names channels] {
    133         set macports::channels($key) [concat $macports::channels($key) "debuglog"]
     133        set macports::channels($key) [concat $macports::channels($key) debuglog]
    134134    }
    135135    return 0
     
    145145    set logname [macports::getportlogpath $portpath $portname]
    146146    file mkdir $logname
    147     set logname [file join $logname "main.log"]
     147    set logname [file join $logname main.log]
    148148
    149149    set ::debuglogname $logname
     
    151151    # Truncate the file if already exists
    152152    set ::debuglog [open $::debuglogname w]
    153     puts $::debuglog "version:1"
     153    puts $::debuglog version:1
    154154}
    155155proc macports::push_log {mport} {
     
    175175    }
    176176}
     177
    177178proc macports::pop_log {} {
    178179    global ::logenabled ::logstack ::debuglog ::debuglogname
     
    197198    global macports::current_phase
    198199    set macports::current_phase $phase
    199     if {$phase != "main"} {
     200    if {$phase ne "main"} {
    200201        set cur_time [clock format [clock seconds] -format  {%+}]
    201202        ui_debug "$phase phase started at $cur_time"
     
    206207    global macports::channels ::debuglog macports::current_phase
    207208    foreach chan $macports::channels($priority) {
    208         if {[info exists ::debuglog] && ($chan == "debuglog")} {
     209        if {[info exists ::debuglog] && ($chan eq "debuglog")} {
    209210            set chan $::debuglog
    210211            if {[info exists macports::current_phase]} {
    211212                set phase $macports::current_phase
    212213            }
    213             set strprefix ":$priority:$phase "
    214             if {[lindex $args 0] == "-nonewline"} {
    215                 puts -nonewline $chan "$strprefix[lindex $args 1]"
     214            set strprefix ":${priority}:$phase "
     215            if {[lindex $args 0] eq "-nonewline"} {
     216                puts -nonewline $chan $strprefix[lindex $args 1]
    216217            } else {
    217                 puts $chan "$strprefix[lindex $args 0]"
    218             }
    219  
     218                puts $chan $strprefix[lindex $args 0]
     219            }
     220
    220221        } else {
    221             if {[lindex $args 0] == "-nonewline"} {
    222                 puts -nonewline $chan "$prefix[lindex $args 1]"
     222            if {[lindex $args 0] eq "-nonewline"} {
     223                puts -nonewline $chan $prefix[lindex $args 1]
    223224            } else {
    224                 puts $chan "$prefix[lindex $args 0]"
     225                puts $chan $prefix[lindex $args 0]
    225226            }
    226227        }
     
    236237        set channels($priority) $default_channel
    237238    }
    238    
     239
    239240    # if some priority initialized after log file is being created
    240241    if {[info exists ::debuglog]} {
    241         set channels($priority) [concat $channels($priority) "debuglog"]
     242        set channels($priority) [concat $channels($priority) debuglog]
    242243    }
    243244    # Simplify ui_$priority.
     
    251252        eval ::ui_init $priority $prefix $channels($priority) $args
    252253    } catch * {
    253         interp alias {} ui_$priority {} ui_message $priority $prefix ""
     254        interp alias {} ui_$priority {} ui_message $priority $prefix {}
    254255        foreach phase $phases {
    255             interp alias {} ui_${priority}_${phase} {} ui_message $priority $prefix $phase
     256            interp alias {} ui_${priority}_$phase {} ui_message $priority $prefix $phase
    256257        }
    257258    }
     
    260261# Default implementation of ui_prefix
    261262proc macports::ui_prefix_default {priority} {
    262     switch $priority {
     263    switch -- $priority {
    263264        debug {
    264265            return "DEBUG: "
     
    271272        }
    272273        default {
    273             return ""
     274            return {}
    274275        }
    275276    }
     
    281282# ui_options(ports_quiet) - If set, don't output "standard messages"
    282283proc macports::ui_channels_default {priority} {
    283     switch $priority {
     284    switch -- $priority {
    284285        debug {
    285286            if {[ui_isset ports_debug]} {
    286                 return {stderr}
     287                return stderr
    287288            } else {
    288289                return {}
     
    291292        info {
    292293            if {[ui_isset ports_verbose]} {
    293                 return {stdout}
     294                return stdout
    294295            } else {
    295296                return {}
     
    300301                return {}
    301302            } else {
    302                 return {stdout}
     303                return stdout
    303304            }
    304305        }
    305306        msg {
    306             return {stdout}
     307            return stdout
    307308        }
    308309        warn -
    309310        error {
    310             return {stderr}
     311            return stderr
    311312        }
    312313        default {
    313             return {stdout}
     314            return stdout
    314315        }
    315316    }
     
    332333# find a binary either in a path defined at MacPorts' configuration time
    333334# or in the PATH environment variable through macports::binaryInPath (fallback)
    334 proc macports::findBinary {prog {autoconf_hint ""}} {
    335     if {${autoconf_hint} != "" && [file executable ${autoconf_hint}]} {
    336         return ${autoconf_hint}
     335proc macports::findBinary {prog {autoconf_hint {}}} {
     336    if {$autoconf_hint ne {} && [file executable $autoconf_hint]} {
     337        return $autoconf_hint
    337338    } else {
    338         if {[catch {set cmd_path [macports::binaryInPath ${prog}]} result] == 0} {
    339             return ${cmd_path}
     339        if {[catch {set cmd_path [macports::binaryInPath $prog]} result] == 0} {
     340            return $cmd_path
    340341        } else {
    341             return -code error "${result} or at its MacPorts configuration time location, did you move it?"
     342            return -code error "$result or at its MacPorts configuration time location, did you move it?"
    342343        }
    343344    }
     
    359360proc macports::getoption {name} {
    360361    global macports::$name
    361     return [expr $$name]
     362    return [set $name]
    362363}
    363364
    364365# deferred and on-need extraction of xcodeversion and xcodebuildcmd.
    365366proc macports::setxcodeinfo {name1 name2 op} {
    366     global macports::xcodeversion
    367     global macports::xcodebuildcmd
     367    global macports::xcodeversion macports::xcodebuildcmd
    368368
    369369    trace remove variable macports::xcodeversion read macports::setxcodeinfo
     
    373373        if {![info exists xcodeversion]} {
    374374            # Determine xcode version
    375             set macports::xcodeversion "2.0orlower"
     375            set macports::xcodeversion 2.0orlower
    376376            if {[catch {set xcodebuildversion [exec -- $xcodebuild -version 2> /dev/null]}] == 0} {
    377377                if {[regexp {Xcode ([0-9.]+)} $xcodebuildversion - xcode_v] == 1} {
     
    379379                } elseif {[regexp "DevToolsCore-(.*);" $xcodebuildversion - devtoolscore_v] == 1} {
    380380                    if {$devtoolscore_v >= 1809.0} {
    381                         set macports::xcodeversion "3.2.6"
     381                        set macports::xcodeversion 3.2.6
    382382                    } elseif {$devtoolscore_v >= 1204.0} {
    383                         set macports::xcodeversion "3.1.4"
     383                        set macports::xcodeversion 3.1.4
    384384                    } elseif {$devtoolscore_v >= 1100.0} {
    385                         set macports::xcodeversion "3.1"
     385                        set macports::xcodeversion 3.1
    386386                    } elseif {$devtoolscore_v >= 921.0} {
    387                         set macports::xcodeversion "3.0"
     387                        set macports::xcodeversion 3.0
    388388                    } elseif {$devtoolscore_v >= 798.0} {
    389                         set macports::xcodeversion "2.5"
     389                        set macports::xcodeversion 2.5
    390390                    } elseif {$devtoolscore_v >= 762.0} {
    391                         set macports::xcodeversion "2.4.1"
     391                        set macports::xcodeversion 2.4.1
    392392                    } elseif {$devtoolscore_v >= 757.0} {
    393                         set macports::xcodeversion "2.4"
     393                        set macports::xcodeversion 2.4
    394394                    } elseif {$devtoolscore_v > 650.0} {
    395395                        # XXX find actual version corresponding to 2.3
    396                         set macports::xcodeversion "2.3"
     396                        set macports::xcodeversion 2.3
    397397                    } elseif {$devtoolscore_v >= 650.0} {
    398                         set macports::xcodeversion "2.2.1"
     398                        set macports::xcodeversion 2.2.1
    399399                    } elseif {$devtoolscore_v > 620.0} {
    400400                        # XXX find actual version corresponding to 2.2
    401                         set macports::xcodeversion "2.2"
     401                        set macports::xcodeversion 2.2
    402402                    } elseif {$devtoolscore_v >= 620.0} {
    403                         set macports::xcodeversion "2.1"
     403                        set macports::xcodeversion 2.1
    404404                    }
    405405                }
    406406            } else {
    407407                ui_warn "xcodebuild exists but failed to execute"
    408                 set macports::xcodeversion "none"
     408                set macports::xcodeversion none
    409409            }
    410410        }
    411411        if {![info exists xcodebuildcmd]} {
    412             set macports::xcodebuildcmd "$xcodebuild"
     412            set macports::xcodebuildcmd $xcodebuild
    413413        }
    414414    } else {
    415415        if {![info exists xcodeversion]} {
    416             set macports::xcodeversion "none"
     416            set macports::xcodeversion none
    417417        }
    418418        if {![info exists xcodebuildcmd]} {
    419             set macports::xcodebuildcmd "none"
     419            set macports::xcodebuildcmd none
    420420        }
    421421    }
     
    459459
    460460    trace remove variable macports::developer_dir read macports::set_developer_dir
    461    
     461
    462462    # Look for xcodeselect, and make sure it has a valid value
    463463    if {![catch {findBinary xcode-select $macports::autoconf::xcode_select_path} xcodeselect]} {
     
    472472
    473473        # The directory from xcode-select isn't correct.
    474        
     474
    475475        # Ask mdfind where Xcode is and make some suggestions for the user,
    476476        # searching by bundle identifier for various Xcode versions (3.x and 4.x)
     
    479479            set installed_xcodes [exec $mdfind "kMDItemCFBundleIdentifier == 'com.apple.Xcode' || kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"]
    480480        }
    481        
     481
    482482        # In case mdfind metadata wasn't complete, also look in two well-known locations for Xcode.app
    483483        foreach app {/Applications/Xcode.app /Developer/Applications/Xcode.app} {
     
    486486            }
    487487        }
    488        
     488
    489489        # Form a list of unique xcode installations
    490490        set installed_xcodes [lsort -unique $installed_xcodes]
     
    498498            foreach xcode $installed_xcodes {
    499499                set vers [exec $mdls -raw -name kMDItemVersion $xcode]
    500                 if {$vers == "(null)"} { set vers "unknown" }
    501                 if {[_is_valid_developer_dir "${xcode}/Contents/Developer"]} {
     500                if {$vers eq "(null)"} {set vers unknown}
     501                if {[_is_valid_developer_dir ${xcode}/Contents/Developer]} {
    502502                    # Though xcode-select shipped with xcode 4.3 supports and encourages
    503503                    # direct use of the app path, older xcode-select does not.
    504504                    # Specify the Contents/Developer directory if it exists
    505                     ui_error "    sudo xcode-select -switch ${xcode}/Contents/Developer # version ${vers}"
     505                    ui_error "    sudo xcode-select -switch ${xcode}/Contents/Developer # version $vers"
    506506                } elseif {[vercmp $vers 4.3] >= 0} {
    507507                    # Future proofing: fall back to the app-path only for xcode >= 4.3, since Contents/Developer doesn't exist
    508                     ui_error "    sudo xcode-select -switch ${xcode} # version ${vers}"
    509                 } elseif {[_is_valid_developer_dir "${xcode}/../.."]} {
     508                    ui_error "    sudo xcode-select -switch $xcode # version $vers"
     509                } elseif {[_is_valid_developer_dir ${xcode}/../..]} {
    510510                    # Older xcode (< 4.3) is below the developer directory
    511                     ui_error "    sudo xcode-select -switch [file normalize ${xcode}/../..] # version ${vers}"
     511                    ui_error "    sudo xcode-select -switch [file normalize ${xcode}/../..] # version $vers"
    512512                } else {
    513                     ui_error "    # malformed Xcode at ${xcode}, version ${vers}"
     513                    ui_error "    # malformed Xcode at ${xcode}, version $vers"
    514514                }
    515515            }
     
    523523    # Try the default
    524524    if {$os_major >= 11 && [vercmp $xcodeversion 4.3] >= 0} {
    525         set devdir "/Applications/Xcode.app/Contents/Developer"
     525        set devdir /Applications/Xcode.app/Contents/Developer
    526526    } else {
    527         set devdir "/Developer"
     527        set devdir /Developer
    528528    }
    529529
     
    541541    # Verify that the directory has some key subdirectories
    542542    foreach subdir {Library usr} {
    543         if {![file isdirectory "${dir}/${subdir}"]} {
     543        if {![file isdirectory ${dir}/$subdir]} {
    544544            return 0
    545545        }
     
    552552
    553553proc mportinit {{up_ui_options {}} {up_options {}} {up_variations {}}} {
    554     if {$up_ui_options eq ""} {
     554    if {$up_ui_options eq {}} {
    555555        array set macports::ui_options {}
    556556    } else {
     
    558558        array set macports::ui_options [array get temp_ui_options]
    559559    }
    560     if {$up_options eq ""} {
     560    if {$up_options eq {}} {
    561561        array set macports::global_options {}
    562562    } else {
     
    564564        array set macports::global_options [array get temp_options]
    565565    }
    566     if {$up_variations eq ""} {
     566    if {$up_variations eq {}} {
    567567        array set variations {}
    568568    } else {
     
    571571
    572572    # Initialize ui_*
    573     foreach priority ${macports::ui_priorities} {
     573    foreach priority $macports::ui_priorities {
    574574        macports::ui_init $priority
    575575    }
    576576
    577     global auto_path env tcl_platform
    578     global macports::autoconf::macports_conf_path
    579     global macports::macports_user_dir
    580     global macports::bootstrap_options
    581     global macports::user_options
    582     global macports::extra_env
    583     global macports::portconf
    584     global macports::portdbpath
    585     global macports::portsharepath
    586     global macports::registry.format
    587     global macports::registry.path
    588     global macports::sources
    589     global macports::sources_default
    590     global macports::sources_conf
    591     global macports::destroot_umask
    592     global macports::libpath
    593     global macports::prefix
    594     global macports::macportsuser
    595     global macports::prefix_frozen
    596     global macports::rsync_dir
    597     global macports::rsync_options
    598     global macports::rsync_server
    599     global macports::variants_conf
    600     global macports::stats_participate
    601     global macports::stats_url
    602     global macports::stats_id
    603     global macports::xcodebuildcmd
    604     global macports::xcodeversion
    605     global macports::gccversion
    606     global macports::configureccache
    607     global macports::ccache_dir
    608     global macports::ccache_size
    609     global macports::configuredistcc
    610     global macports::configurepipe
    611     global macports::buildnicevalue
    612     global macports::buildmakejobs
    613     global macports::universal_archs
    614     global macports::build_arch
    615     global macports::os_arch
    616     global macports::os_endian
    617     global macports::os_version
    618     global macports::os_major
    619     global macports::os_platform
    620     global macports::macosx_version
    621     global macports::macosx_deployment_target
    622     global macports::archivefetch_pubkeys
    623     global macports::ping_cache
    624     global macports::host_blacklisted
    625     global macports::host_preferred
     577    global auto_path env tcl_platform \
     578        macports::autoconf::macports_conf_path \
     579        macports::macports_user_dir \
     580        macports::bootstrap_options \
     581        macports::user_options \
     582        macports::portconf \
     583        macports::portsharepath \
     584        macports::registry.format \
     585        macports::registry.path \
     586        macports::sources \
     587        macports::sources_default \
     588        macports::destroot_umask \
     589        macports::libpath \
     590        macports::prefix \
     591        macports::macportsuser \
     592        macports::prefix_frozen \
     593        macports::xcodebuildcmd \
     594        macports::xcodeversion \
     595        macports::configureccache \
     596        macports::ccache_dir \
     597        macports::ccache_size \
     598        macports::configuredistcc \
     599        macports::configurepipe \
     600        macports::buildnicevalue \
     601        macports::buildmakejobs \
     602        macports::universal_archs \
     603        macports::build_arch \
     604        macports::os_arch \
     605        macports::os_endian \
     606        macports::os_version \
     607        macports::os_major \
     608        macports::os_platform \
     609        macports::macosx_version \
     610        macports::macosx_deployment_target \
     611        macports::archivefetch_pubkeys \
     612        macports::ping_cache \
     613        macports::host_blacklisted \
     614        macports::host_preferred \
     615        macports::stats_participate \
     616        macports::stats_url \
     617        macports::stats_id
    626618
    627619    # Set the system encoding to utf-8
     
    630622    # set up platform info variables
    631623    set os_arch $tcl_platform(machine)
    632     if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
    633     if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
     624    if {$os_arch eq "Power Macintosh"} {set os_arch "powerpc"}
     625    if {$os_arch eq "i586" || $os_arch eq "i686" || $os_arch eq "x86_64"} {set os_arch "i386"}
    634626    set os_version $tcl_platform(osVersion)
    635627    set os_major [lindex [split $os_version .] 0]
     
    638630    set os_endian [string range $tcl_platform(byteOrder) 0 end-6]
    639631    set macosx_version {}
    640     if {$os_platform == "darwin"} {
     632    if {$os_platform eq "darwin"} {
    641633        # This will probably break when Apple changes versioning
    642         set macosx_version [expr 10.0 + ($os_major - 4) / 10.0]
     634        set macosx_version [expr {10.0 + ($os_major - 4) / 10.0}]
    643635    }
    644636
     
    648640        set macports::user_home $env(HOME)
    649641        set macports::macports_user_dir [file normalize $macports::autoconf::macports_user_dir]
    650     } elseif {[info exists env(SUDO_USER)] && $os_platform == "darwin"} {
     642    } elseif {[info exists env(SUDO_USER)] && $os_platform eq "darwin"} {
    651643        set macports::user_home [exec dscl -q . -read /Users/$env(SUDO_USER) NFSHomeDirectory | cut -d ' ' -f 2]
    652         set macports::macports_user_dir [file join ${macports::user_home} [string range $macports::autoconf::macports_user_dir 2 end]]
    653     } elseif {[exec id -u] != 0 && $os_platform == "darwin"} {
     644        set macports::macports_user_dir [file join $macports::user_home [string range $macports::autoconf::macports_user_dir 2 end]]
     645    } elseif {[exec id -u] != 0 && $os_platform eq "darwin"} {
    654646        set macports::user_home [exec dscl -q . -read /Users/[exec id -un] NFSHomeDirectory | cut -d ' ' -f 2]
    655         set macports::macports_user_dir [file join ${macports::user_home} [string range $macports::autoconf::macports_user_dir 2 end]]
     647        set macports::macports_user_dir [file join $macports::user_home [string range $macports::autoconf::macports_user_dir 2 end]]
    656648    } else {
    657649        # Otherwise define the user directory as a directory that will never exist
    658         set macports::macports_user_dir "/dev/null/NO_HOME_DIR"
    659         set macports::user_home "/dev/null/NO_HOME_DIR"
     650        set macports::macports_user_dir /dev/null/NO_HOME_DIR
     651        set macports::user_home /dev/null/NO_HOME_DIR
    660652    }
    661653
    662654    # Configure the search path for configuration files
    663     set conf_files ""
    664     lappend conf_files "${macports_conf_path}/macports.conf"
    665     if { [file isdirectory $macports_user_dir] } {
    666         lappend conf_files "${macports_user_dir}/macports.conf"
     655    set conf_files {}
     656    lappend conf_files ${macports_conf_path}/macports.conf
     657    if {[file isdirectory $macports_user_dir]} {
     658        lappend conf_files ${macports_user_dir}/macports.conf
    667659    }
    668660    if {[info exists env(PORTSRC)]} {
    669661        set PORTSRC $env(PORTSRC)
    670         lappend conf_files ${PORTSRC}
     662        lappend conf_files $PORTSRC
    671663    }
    672664
    673665    # Process all configuration files we find on conf_files list
    674666    foreach file $conf_files {
    675         if [file exists $file] {
     667        if {[file exists $file]} {
    676668            set portconf $file
    677669            set fd [open $file r]
     
    689681
    690682    # Process per-user only settings
    691     set per_user "${macports_user_dir}/user.conf"
    692     if [file exists $per_user] {
     683    set per_user ${macports_user_dir}/user.conf
     684    if {[file exists $per_user]} {
    693685        set fd [open $per_user r]
    694686        while {[gets $fd line] >= 0} {
     
    716708                        ui_warn "$sources_conf source '$line' specifies invalid flag '$flag'"
    717709                    }
    718                     if {$flag == "default"} {
     710                    if {$flag eq "default"} {
    719711                        if {[info exists sources_default]} {
    720712                            ui_warn "More than one default port source is defined."
     
    734726    # contain _resources.
    735727    if {![info exists sources_default]} {
    736         ui_warn "No default port source specified in $sources_conf, using last source as default"
     728        ui_warn "No default port source specified in ${sources_conf}, using last source as default"
    737729        set sources_default [lindex $sources end]
    738730    }
     
    740732    if {![info exists sources]} {
    741733        if {[file isdirectory ports]} {
    742             set sources "file://[pwd]/ports"
     734            set sources file://[pwd]/ports
    743735        } else {
    744736            return -code error "No sources defined in $sources_conf"
     
    747739
    748740    if {[info exists variants_conf]} {
    749         if {[file exist $variants_conf]} {
     741        if {[file exists $variants_conf]} {
    750742            set fd [open $variants_conf r]
    751743            while {[gets $fd line] >= 0} {
     
    773765    # pubkeys.conf
    774766    set macports::archivefetch_pubkeys {}
    775     if {[file isfile [file join ${macports_conf_path} pubkeys.conf]]} {
    776         set fd [open [file join ${macports_conf_path} pubkeys.conf] r]
     767    if {[file isfile [file join $macports_conf_path pubkeys.conf]]} {
     768        set fd [open [file join $macports_conf_path pubkeys.conf] r]
    777769        while {[gets $fd line] >= 0} {
    778770            set line [string trim $line]
     
    804796    # Format for receipts; currently only "sqlite" is allowed
    805797    # could previously be "flat", so we switch that to sqlite
    806     if {![info exists portdbformat] || $portdbformat == "flat" || $portdbformat == "sqlite"} {
     798    if {![info exists portdbformat] || $portdbformat eq "flat" || $portdbformat eq "sqlite"} {
    807799        set registry.format receipt_sqlite
    808800    } else {
     
    812804    # Autoclean mode, whether to automatically call clean after "install"
    813805    if {![info exists portautoclean]} {
    814         set macports::portautoclean "yes"
     806        set macports::portautoclean yes
    815807        global macports::portautoclean
    816808    }
    817809    # whether to keep logs after successful builds
    818810    if {![info exists keeplogs]} {
    819         set macports::keeplogs "no"
     811        set macports::keeplogs no
    820812        global macports::keeplogs
    821813    }
    822    
     814
    823815    # Check command line override for autoclean
    824816    if {[info exists macports::global_options(ports_autoclean)]} {
    825         if {![string equal $macports::global_options(ports_autoclean) $portautoclean]} {
     817        if {$macports::global_options(ports_autoclean) ne $portautoclean} {
    826818            set macports::portautoclean $macports::global_options(ports_autoclean)
    827819        }
     
    829821    # Trace mode, whether to use darwintrace to debug ports.
    830822    if {![info exists porttrace]} {
    831         set macports::porttrace "no"
     823        set macports::porttrace no
    832824        global macports::porttrace
    833825    }
    834826    # Check command line override for trace
    835827    if {[info exists macports::global_options(ports_trace)]} {
    836         if {![string equal $macports::global_options(ports_trace) $porttrace]} {
     828        if {$macports::global_options(ports_trace) ne $porttrace} {
    837829            set macports::porttrace $macports::global_options(ports_trace)
    838830        }
     
    842834        && ![info exists macports::global_options(ports_source_only)]
    843835        && [info exists macports::buildfromsource]} {
    844         if {${macports::buildfromsource} == "never"} {
     836        if {$macports::buildfromsource eq "never"} {
    845837            set macports::global_options(ports_binary_only) yes
    846838            set temp_options(ports_binary_only) yes
    847         } elseif {${macports::buildfromsource} == "always"} {
     839        } elseif {$macports::buildfromsource eq "always"} {
    848840            set macports::global_options(ports_source_only) yes
    849841            set temp_options(ports_source_only) yes
    850         } elseif {${macports::buildfromsource} != "ifneeded"} {
    851             ui_warn "'buildfromsource' set to unknown value '${macports::buildfromsource}', using 'ifneeded' instead"
     842        } elseif {$macports::buildfromsource ne "ifneeded"} {
     843            ui_warn "'buildfromsource' set to unknown value '$macports::buildfromsource', using 'ifneeded' instead"
    852844        }
    853845    }
     
    863855    # Export verbosity.
    864856    if {![info exists portverbose]} {
    865         set macports::portverbose "no"
     857        set macports::portverbose no
    866858        global macports::portverbose
    867859    }
    868860    if {[info exists macports::ui_options(ports_verbose)]} {
    869         if {![string equal $macports::ui_options(ports_verbose) $portverbose]} {
     861        if {$macports::ui_options(ports_verbose) ne $portverbose} {
    870862            set macports::portverbose $macports::ui_options(ports_verbose)
    871863        }
     
    876868    global macports::portarchivetype
    877869    if {![info exists portarchivetype]} {
    878         set macports::portarchivetype "tbz2"
     870        set macports::portarchivetype tbz2
    879871    } else {
    880872        set macports::portarchivetype [lindex $portarchivetype 0]
     
    883875    # Set rync options
    884876    if {![info exists rsync_server]} {
     877        global macports::rsync_server
    885878        set macports::rsync_server rsync.macports.org
    886         global macports::rsync_server
    887879    }
    888880    if {![info exists rsync_dir]} {
     881        global macports::rsync_dir
    889882        set macports::rsync_dir release/tarballs/base.tar
    890         global macports::rsync_dir
    891883    }
    892884    if {![info exists rsync_options]} {
     885        global macports::rsync_options
    893886        set rsync_options "-rtzv --delete-after"
    894         global macports::rsync_options
    895887    }
    896888
     
    901893
    902894    if {![info exists libpath]} {
    903         set libpath "${prefix}/share/macports/Tcl"
     895        set libpath ${prefix}/share/macports/Tcl
    904896    }
    905897
    906898    if {![info exists binpath]} {
    907         set env(PATH) "${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin"
     899        set env(PATH) ${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
    908900    } else {
    909         set env(PATH) "$binpath"
     901        set env(PATH) $binpath
    910902    }
    911903
    912904    # Set startupitem default type (can be overridden by portfile)
    913905    if {![info exists macports::startupitem_type]} {
    914         set macports::startupitem_type "default"
     906        set macports::startupitem_type default
    915907    }
    916908
     
    933925    }
    934926    if {![info exists macports::ccache_size]} {
    935         set macports::ccache_size "2G"
     927        set macports::ccache_size 2G
    936928    }
    937929    if {![info exists macports::configuredistcc]} {
     
    965957        ui_warn "invalid universal_archs configured (should contain at least 2 archs)"
    966958    }
    967    
     959
    968960    # Default arch to build for
    969961    if {![info exists macports::build_arch]} {
    970         if {$os_platform == "darwin"} {
     962        if {$os_platform eq "darwin"} {
    971963            if {$os_major >= 10} {
    972964                if {[sysctl hw.cpu64bit_capable] == 1} {
     
    976968                }
    977969            } else {
    978                 if {$os_arch == "powerpc"} {
     970                if {$os_arch eq "powerpc"} {
    979971                    set macports::build_arch ppc
    980972                } else {
     
    983975            }
    984976        } else {
    985             set macports::build_arch ""
     977            set macports::build_arch {}
    986978        }
    987979    } else {
     
    997989    }
    998990    if {![info exists macports::revupgrade_mode]} {
    999         set macports::revupgrade_mode "rebuild"
     991        set macports::revupgrade_mode rebuild
    1000992    }
    1001993    if {![info exists macports::global_options(ports_rev-upgrade_id-loadcmd-check)]
    1002994         && [info exists macports::revupgrade_check_id_loadcmds]} {
    1003         set macports::global_options(ports_rev-upgrade_id-loadcmd-check) ${macports::revupgrade_check_id_loadcmds}
    1004         set temp_options(ports_rev-upgrade_id-loadcmd-check) ${macports::revupgrade_check_id_loadcmds}
     995        set macports::global_options(ports_rev-upgrade_id-loadcmd-check) $macports::revupgrade_check_id_loadcmds
     996        set temp_options(ports_rev-upgrade_id-loadcmd-check) $macports::revupgrade_check_id_loadcmds
     997    }
     998
     999    if {![info exists macports::sandbox_enable]} {
     1000        set macports::sandbox_enable yes
    10051001    }
    10061002
     
    10201016    }
    10211017    if {[info exists extra_env]} {
    1022         set keepenvkeys [concat ${keepenvkeys} ${extra_env}]
     1018        set keepenvkeys [concat $keepenvkeys $extra_env]
    10231019    }
    10241020
     
    10401036    # don't keep unusable TMPDIR/TMP values
    10411037    foreach var {TMP TMPDIR} {
    1042         if {[info exists env($var)] && [file writable $env($var)] && 
    1043             ([getuid] != 0 || $macportsuser == "root" ||
    1044              [file attributes $env($var) -owner] == $macportsuser)} {
     1038        if {[info exists env($var)] && [file writable $env($var)] &&
     1039            ([getuid] != 0 || $macportsuser eq "root" ||
     1040             [file attributes $env($var) -owner] eq $macportsuser)} {
    10451041            lappend keepenvkeys $var
    10461042        }
     
    10551051
    10561052    # unset environment an extra time, to work around bugs in Leopard Tcl
    1057     if {$macosx_version == "10.5"} {
     1053    if {$macosx_version eq "10.5"} {
    10581054        foreach envkey $env_names {
    10591055            if {[lsearch -exact $keepenvkeys $envkey] == -1} {
     
    10761072
    10771073    if {![info exists developer_dir]} {
    1078         if {$os_platform == "darwin"} {
     1074        if {$os_platform eq "darwin"} {
    10791075            trace add variable macports::developer_dir read macports::set_developer_dir
    10801076        } else {
    1081             set macports::developer_dir ""
     1077            set macports::developer_dir {}
    10821078        }
    10831079    } else {
    1084         if {$os_platform == "darwin" && ![file isdirectory $developer_dir]} {
     1080        if {$os_platform eq "darwin" && ![file isdirectory $developer_dir]} {
    10851081            ui_warn "Your developer_dir setting in macports.conf points to a non-existing directory.\
    10861082                Since this is known to cause problems, please correct the setting or comment it and let\
     
    10891085    }
    10901086
    1091     if {[getuid] == 0 && $os_major >= 11 && $os_platform == "darwin" &&
     1087    if {[getuid] == 0 && $os_major >= 11 && $os_platform eq "darwin" &&
    10921088            [file isfile "${macports::user_home}/Library/Preferences/com.apple.dt.Xcode.plist"]} {
    10931089        macports::copy_xcode_plist $env(HOME)
     
    11001096
    11011097    if {[info exists master_site_local] && ![info exists env(MASTER_SITE_LOCAL)]} {
    1102         set env(MASTER_SITE_LOCAL) "$master_site_local"
     1098        set env(MASTER_SITE_LOCAL) $master_site_local
    11031099    }
    11041100    if {[info exists patch_site_local] && ![info exists env(PATCH_SITE_LOCAL)]} {
    1105         set env(PATCH_SITE_LOCAL) "$patch_site_local"
     1101        set env(PATCH_SITE_LOCAL) $patch_site_local
    11061102    }
    11071103    if {[info exists archive_site_local] && ![info exists env(ARCHIVE_SITE_LOCAL)]} {
    1108         set env(ARCHIVE_SITE_LOCAL) "$archive_site_local"
     1104        set env(ARCHIVE_SITE_LOCAL) $archive_site_local
    11091105    }
    11101106
    11111107    # Proxy handling (done this late since Pextlib is needed)
    1112     if {![info exists proxy_override_env] } {
    1113         set proxy_override_env "no"
     1108    if {![info exists proxy_override_env]} {
     1109        set proxy_override_env no
    11141110    }
    11151111    if {[catch {array set sysConfProxies [get_systemconfiguration_proxies]} result]} {
    11161112        return -code error "Unable to get proxy configuration from system: $result"
    11171113    }
    1118     if {![info exists env(http_proxy)] || $proxy_override_env == "yes" } {
     1114    if {![info exists env(http_proxy)] || $proxy_override_env eq "yes"} {
    11191115        if {[info exists proxy_http]} {
    11201116            set env(http_proxy) $proxy_http
     
    11231119        }
    11241120    }
    1125     if {![info exists env(HTTPS_PROXY)] || $proxy_override_env == "yes" } {
     1121    if {![info exists env(HTTPS_PROXY)] || $proxy_override_env eq "yes"} {
    11261122        if {[info exists proxy_https]} {
    11271123            set env(HTTPS_PROXY) $proxy_https
     
    11301126        }
    11311127    }
    1132     if {![info exists env(FTP_PROXY)] || $proxy_override_env == "yes" } {
     1128    if {![info exists env(FTP_PROXY)] || $proxy_override_env eq "yes"} {
    11331129        if {[info exists proxy_ftp]} {
    11341130            set env(FTP_PROXY) $proxy_ftp
     
    11371133        }
    11381134    }
    1139     if {![info exists env(RSYNC_PROXY)] || $proxy_override_env == "yes" } {
     1135    if {![info exists env(RSYNC_PROXY)] || $proxy_override_env eq "yes"} {
    11401136        if {[info exists proxy_rsync]} {
    11411137            set env(RSYNC_PROXY) $proxy_rsync
    11421138        }
    11431139    }
    1144     if {![info exists env(NO_PROXY)] || $proxy_override_env == "yes" } {
     1140    if {![info exists env(NO_PROXY)] || $proxy_override_env eq "yes"} {
    11451141        if {[info exists proxy_skip]} {
    11461142            set env(NO_PROXY) $proxy_skip
     
    11511147
    11521148    # add ccache to environment
    1153     set env(CCACHE_DIR) ${macports::ccache_dir}
     1149    set env(CCACHE_DIR) $macports::ccache_dir
    11541150
    11551151    # load cached ping times
     
    11581154        array set macports::ping_cache [gets $pingfile]
    11591155        close $pingfile
    1160     }]} { array set macports::ping_cache {} }
     1156    }]} {array set macports::ping_cache {}}
    11611157    # set up arrays of blacklisted and preferred hosts
    11621158    if {[info exists macports::host_blacklist]} {
    1163         foreach host ${macports::host_blacklist} {
     1159        foreach host $macports::host_blacklist {
    11641160            set macports::host_blacklisted($host) 1
    11651161        }
    11661162    }
    11671163    if {[info exists macports::preferred_hosts]} {
    1168         foreach host ${macports::preferred_hosts} {
     1164        foreach host $macports::preferred_hosts {
    11691165            set macports::host_preferred($host) 1
    11701166        }
     
    11751171
    11761172    if {![info exists macports::ui_options(ports_no_old_index_warning)]} {
    1177         set default_source_url [lindex ${sources_default} 0]
    1178         if {[macports::getprotocol $default_source_url] == "file" || [macports::getprotocol $default_source_url] == "rsync"} {
     1173        set default_source_url [lindex $sources_default 0]
     1174        if {[macports::getprotocol $default_source_url] eq "file" || [macports::getprotocol $default_source_url] eq "rsync"} {
    11791175            set default_portindex [macports::getindex $default_source_url]
    1180             if {[file exists $default_portindex] && [expr [clock seconds] - [file mtime $default_portindex]] > 1209600} {
     1176            if {[file exists $default_portindex] && [clock seconds] - [file mtime $default_portindex] > 1209600} {
    11811177                ui_warn "port definitions are more than two weeks old, consider updating them by running 'port selfupdate'."
    11821178            }
     
    11951191        ui_warn "Converting your registry to sqlite format, this might take a while..."
    11961192        if {[catch {registry::convert_to_sqlite}]} {
    1197             ui_debug "$::errorInfo"
     1193            ui_debug $::errorInfo
    11981194            file delete -force $db_path
    11991195            error "Failed to convert your registry to sqlite!"
     
    12081204    # save ping times
    12091205    global macports::ping_cache macports::portdbpath
    1210     if {[file writable ${macports::portdbpath}]} {
     1206    if {[file writable $macports::portdbpath]} {
    12111207        catch {
    12121208            foreach host [array names ping_cache] {
    12131209                # don't save expired entries
    1214                 if {[expr [clock seconds] - [lindex $ping_cache($host) 1]] < 86400} {
     1210                if {[clock seconds] - [lindex $ping_cache($host) 1] < 86400} {
    12151211                    lappend pinglist_fresh $host $ping_cache($host)
    12161212                }
     
    12321228    file delete -force "${target_dir}/com.apple.dt.Xcode.plist"
    12331229    if {[file isfile $user_plist]} {
    1234         if {![file isdirectory "${target_dir}"]} {
    1235             if {[catch {file mkdir "${target_dir}"} result]} {
     1230        if {![file isdirectory $target_dir]} {
     1231            if {[catch {file mkdir $target_dir} result]} {
    12361232                ui_warn "Failed to create Library/Preferences in ${target_homedir}: $result"
    12371233                return
    12381234            }
    12391235        }
    1240         if {[file writable ${target_dir}] && [catch {
    1241             ui_debug "Copying $user_plist to ${target_dir}"
     1236        if {[file writable $target_dir] && [catch {
     1237            ui_debug "Copying $user_plist to $target_dir"
    12421238            file copy -force $user_plist $target_dir
    1243             file attributes "${target_dir}/com.apple.dt.Xcode.plist" -owner $macportsuser -permissions 0644
     1239            file attributes ${target_dir}/com.apple.dt.Xcode.plist -owner $macportsuser -permissions 0644
    12441240        } result]} {
    12451241            ui_warn "Failed to copy com.apple.dt.Xcode.plist to ${target_dir}: $result"
     
    12801276
    12811277    # instantiate the UI call-backs
    1282     foreach priority ${macports::ui_priorities} {
     1278    foreach priority $macports::ui_priorities {
    12831279        $workername alias ui_$priority ui_$priority
    1284         foreach phase ${macports::port_phases} {
    1285             $workername alias ui_${priority}_${phase} ui_${priority}_${phase}
    1286         }
    1287  
     1280        foreach phase $macports::port_phases {
     1281            $workername alias ui_${priority}_$phase ui_${priority}_$phase
     1282        }
     1283
    12881284    }
    12891285
    12901286    $workername alias ui_prefix ui_prefix
    12911287    $workername alias ui_channels ui_channels
    1292    
     1288
    12931289    $workername alias ui_warn_once ui_warn_once
    12941290
     
    14141410        .tbz -
    14151411        .tbz2 {
    1416             return "-j"
     1412            return -j
    14171413        }
    14181414        .tgz {
    1419             return "-z"
     1415            return -z
    14201416        }
    14211417        .txz {
     
    14261422        }
    14271423        default {
    1428             return "-"
     1424            return -
    14291425        }
    14301426    }
     
    14511447    set tarcmd [findBinary tar $macports::autoconf::tar_path]
    14521448    set tarflags [get_tar_flags [file extension $fetchfile]]
    1453     set qflag ${macports::autoconf::tar_q}
     1449    set qflag $macports::autoconf::tar_q
    14541450    set cmdline "$tarcmd ${tarflags}${qflag}xOf \"$fetchfile\" +CONTENTS"
    1455     ui_debug "$cmdline"
     1451    ui_debug $cmdline
    14561452    if {![catch {set contents [eval exec $cmdline]}]} {
    14571453        set binary 1
    14581454        ui_debug "getting port name from binary archive"
    14591455        # get the portname from the contents file
    1460         foreach line [split $contents "\n"] {
    1461             if {[lindex $line 0] == "@name"} {
    1462                 # actually ${name}-${version}_${revision}
     1456        foreach line [split $contents \n] {
     1457            if {[lindex $line 0] eq "@name"} {
     1458                # actually ${name}-${version}_$revision
    14631459                set portname [lindex $line 1]
    14641460            }
     
    14791475        set cmdline "$tarcmd ${tarflags}xf \"$fetchfile\""
    14801476    }
    1481     ui_debug "$cmdline"
     1477    ui_debug $cmdline
    14821478    if {[catch {eval exec $cmdline} result]} {
    14831479        return -code error "Port extract failed: $result"
     
    14901486proc macports::getprotocol {url} {
    14911487    if {[regexp {(?x)([^:]+)://.+} $url match protocol] == 1} {
    1492         return ${protocol}
     1488        return $protocol
    14931489    } else {
    14941490        return -code error "Can't parse url $url"
     
    15001496# fetched port will be downloaded to (currently only applies to
    15011497# mports:// sources).
    1502 proc macports::getportdir {url {destdir "."}} {
     1498proc macports::getportdir {url {destdir .}} {
    15031499    global macports::extracted_portdirs
    15041500    set protocol [macports::getprotocol $url]
    1505     switch ${protocol} {
     1501    switch -- $protocol {
    15061502        file {
    1507             set path [file normalize [string range $url [expr [string length $protocol] + 3] end]]
     1503            set path [file normalize [string range $url [expr {[string length $protocol] + 3}] end]]
    15081504            if {![file isfile $path]} {
    15091505                return $path
     
    15431539# @param fallback fall back to the default source tree
    15441540# @return path to the _resources directory or the path to the fallback
    1545 proc macports::getportresourcepath {url {path ""} {fallback yes}} {
     1541proc macports::getportresourcepath {url {path {}} {fallback yes}} {
    15461542    global macports::sources_default
    15471543
    15481544    set protocol [getprotocol $url]
    15491545
    1550     switch -- ${protocol} {
     1546    switch -- $protocol {
    15511547        file {
    15521548            set proposedpath [file normalize [file join [getportdir $url] .. ..]]
     
    15601556    set proposedpath [file join $proposedpath _resources $path]
    15611557
    1562     if {$fallback == "yes" && ![file exists $proposedpath]} {
     1558    if {$fallback eq "yes" && ![file exists $proposedpath]} {
    15631559        return [getdefaultportresourcepath $path]
    15641560    }
     
    15721568# @param path path in _resources we are interested in
    15731569# @return path to the _resources directory of the default source
    1574 proc macports::getdefaultportresourcepath {{path ""}} {
     1570proc macports::getdefaultportresourcepath {{path {}}} {
    15751571    global macports::sources_default
    15761572
    1577     set default_source_url [lindex ${sources_default} 0]
    1578     if {[getprotocol $default_source_url] == "file"} {
     1573    set default_source_url [lindex $sources_default 0]
     1574    if {[getprotocol $default_source_url] eq "file"} {
    15791575        set proposedpath [getportdir $default_source_url]
    15801576    } else {
     
    15951591# MacPorts Portfile.
    15961592
    1597 proc mportopen {porturl {options ""} {variations ""} {nocache ""}} {
     1593proc mportopen {porturl {options {}} {variations {}} {nocache {}}} {
    15981594    global macports::portdbpath macports::portconf macports::open_mports auto_path
    15991595
    16001596    # Look for an already-open MPort with the same URL.
    16011597    # if found, return the existing reference and bump the refcount.
    1602     if {$nocache != ""} {
     1598    if {$nocache ne {}} {
    16031599        set mport {}
    16041600    } else {
    16051601        set mport [dlist_match_multi $macports::open_mports [list porturl $porturl variations $variations options $options]]
    16061602    }
    1607     if {$mport != {}} {
     1603    if {$mport ne {}} {
    16081604        # just in case more than one somehow matches
    16091605        set mport [lindex $mport 0]
     
    16181614        set portdir $options_array(portdir)
    16191615    } else {
    1620         set portdir ""
     1616        set portdir {}
    16211617    }
    16221618
     
    16651661    global macports::registry.path
    16661662    set regref [lindex [registry::entry imaged $name $version $revision $variants] 0]
    1667     set portfile_dir [file join ${registry.path} registry portfiles $name "${version}_${revision}${variants}"]
     1663    set portfile_dir [file join ${registry.path} registry portfiles $name ${version}_${revision}$variants]
    16681664    file mkdir $portfile_dir
    1669     set fd [open "${portfile_dir}/Portfile" w]
     1665    set fd [open ${portfile_dir}/Portfile w]
    16701666    puts $fd [$regref portfile]
    16711667    close $fd
    1672     file mtime "${portfile_dir}/Portfile" [$regref date]
     1668    file mtime ${portfile_dir}/Portfile [$regref date]
    16731669
    16741670    set variations {}
     
    16761672    set plusvariant [lrange [split [$regref variants] +] 1 end]
    16771673    foreach v $plusvariant {
    1678         lappend variations $v "+"
     1674        lappend variations $v +
    16791675    }
    16801676    foreach v $minusvariant {
    1681         lappend variations $v "-"
     1677        lappend variations $v -
    16821678    }
    16831679    lappend options subport $name
    1684     return [mportopen "file://${portfile_dir}/" $options $variations]
     1680    return [mportopen file://${portfile_dir}/ $options $variations]
    16851681}
    16861682
     
    16941690    mportclose $mport
    16951691    set portfiles_dir [file join ${registry.path} registry portfiles $subport]
    1696     set portfile [file join $portfiles_dir "${version}_${revision}${portvariants}" Portfile]
     1692    set portfile [file join $portfiles_dir ${version}_${revision}$portvariants Portfile]
    16971693    file delete -force $portfile [file dirname $portfile]
    16981694    if {[llength [glob -nocomplain -directory $portfiles_dir *]] == 0} {
     
    17231719        set pathToCategory [file join $root $category]
    17241720        # process the category dirs but not _resources
    1725         if {[file isdirectory $pathToCategory] && [string index [file tail $pathToCategory] 0] != "_"} {
     1721        if {[file isdirectory $pathToCategory] && [string index [file tail $pathToCategory] 0] ne "_"} {
    17261722            # Iterate on port directories.
    17271723            foreach port [lsort -increasing -unique [readdir $pathToCategory]] {
    17281724                set pathToPort [file join $pathToCategory $port]
    17291725                if {[file isdirectory $pathToPort] &&
    1730                   [file exists [file join $pathToPort "Portfile"]]} {
     1726                  [file exists [file join $pathToPort Portfile]]} {
    17311727                    # Call the function.
    17321728                    $func [file join $category $port]
     
    17781774            return [file join $path $filename]
    17791775        } else {
    1780             return ""
     1776            return {}
    17811777        }
    17821778    } else {
     
    17921788    # Check for the presence of the port in the registry
    17931789    set workername [ditem_key $mport workername]
    1794     return [$workername eval registry_exists_for_name \${subport}]
     1790    return [$workername eval registry_exists_for_name \$subport]
    17951791}
    17961792
     
    17981794proc _mportactive {mport} {
    17991795    set workername [ditem_key $mport workername]
    1800     if {![catch {set reslist [$workername eval registry_active \${subport}]}] && [llength $reslist] > 0} {
     1796    if {![catch {set reslist [$workername eval registry_active \$subport]}] && [llength $reslist] > 0} {
    18011797        set i [lindex $reslist 0]
    18021798        set name [lindex $i 0]
     
    18051801        set variants [lindex $i 3]
    18061802        array set portinfo [mportinfo $mport]
    1807         if {$name == $portinfo(name) && $version == $portinfo(version)
     1803        if {$name eq $portinfo(name) && $version == $portinfo(version)
    18081804            && $revision == $portinfo(revision) && $variants == $portinfo(canonical_active_variants)} {
    18091805            return 1
     
    18181814        return 0
    18191815    } else {
    1820         return [expr [llength $reslist] > 0]
     1816        return [expr {[llength $reslist] > 0}]
    18211817    }
    18221818}
     
    18421838        set workername [ditem_key $mport workername]
    18431839        set type [lindex [split $depspec :] 0]
    1844         switch $type {
    1845             lib { return [$workername eval _libtest $depspec] }
    1846             bin { return [$workername eval _bintest $depspec] }
    1847             path { return [$workername eval _pathtest $depspec] }
    1848             port { return 0 }
     1840        switch -- $type {
     1841            lib {return [$workername eval _libtest $depspec]}
     1842            bin {return [$workername eval _bintest $depspec]}
     1843            path {return [$workername eval _pathtest $depspec]}
     1844            port {return 0}
    18491845            default {return -code error "unknown depspec type: $type"}
    18501846        }
     
    18681864        ui_debug "Checking for conflicts against [_mportkey $mport subport]"
    18691865        foreach conflictport $portinfo(conflicts) {
    1870             if {[_mportispresent $mport port:${conflictport}]} {
     1866            if {[_mportispresent $mport port:$conflictport]} {
    18711867                lappend conflictlist $conflictport
    18721868            }
     
    18761872    }
    18771873
    1878     if {[llength ${conflictlist}] != 0} {
     1874    if {[llength $conflictlist] != 0} {
    18791875        if {[macports::global_option_isset ports_force]} {
    1880             ui_warn "Force option set; installing $portinfo(name) despite conflicts with: ${conflictlist}"
     1876            ui_warn "Force option set; installing $portinfo(name) despite conflicts with: $conflictlist"
    18811877        } else {
    18821878            if {![macports::ui_isset ports_debug]} {
    1883                 ui_msg ""
    1884             }
    1885             return -code error "Can't install $portinfo(name) because conflicting ports are installed: ${conflictlist}"
     1879                ui_msg {}
     1880            }
     1881            return -code error "Can't install $portinfo(name) because conflicting ports are installed: $conflictlist"
    18861882        }
    18871883    }
     
    19001896        ![catch {$workername eval eval_targets $target} result] && $result == 0} {
    19011897        # If auto-clean mode, clean-up after dependency install
    1902         if {[string equal ${macports::portautoclean} "yes"]} {
     1898        if {$macports::portautoclean eq "yes"} {
    19031899            # Make sure we are back in the port path before clean
    19041900            # otherwise if the current directory had been changed to
     
    19181914        global ::logenabled ::debuglogname
    19191915        ui_error "Failed to install $portname"
    1920         ui_debug "$::errorInfo"
     1916        ui_debug $::errorInfo
    19211917        if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
    19221918            ui_notice "Please see the log file for port $portname for details:\n    $::debuglogname"
     
    19391935    }
    19401936    set portname [_mportkey $mport subport]
    1941     if {$target != "clean"} {
     1937    if {$target ne "clean"} {
    19421938        macports::push_log $mport
    19431939    }
     
    19621958        registry::exclusive_lock
    19631959        # see if we actually need to build this port
    1964         if {($target != "activate" && $target != "install") ||
     1960        if {($target ne "activate" && $target ne "install") ||
    19651961            ![$workername eval registry_exists \$subport \$version \$revision \$portvariants]} {
    1966    
     1962
    19671963            # upgrade dependencies that are already installed
    19681964            if {![macports::global_option_isset ports_nodeps]} {
     
    19741970        if {[macports::ui_isset ports_debug]} {
    19751971            # play nice with debug messages
    1976             ui_msg ""
     1972            ui_msg {}
    19771973        }
    19781974        if {[mportdepends $mport $target] != 0} {
     
    19801976        }
    19811977        if {![macports::ui_isset ports_debug]} {
    1982             ui_msg ""
     1978            ui_msg {}
    19831979        }
    19841980
     
    19881984
    19891985        dlist_delete dlist $mport
    1990        
     1986
    19911987        # print the dep list
    19921988        if {[llength $dlist] > 0} {
     
    19991995
    20001996        # install them
    2001         set result [dlist_eval $dlist _mportactive [list _mportexec "activate"]]
     1997        set result [dlist_eval $dlist _mportactive [list _mportexec activate]]
    20021998
    20031999        registry::exclusive_unlock
    20042000
    2005         if {$result != {}} {
     2001        if {$result ne {}} {
    20062002            set errstring "The following dependencies were not installed:"
    20072003            foreach ditem $result {
     
    20212017    } else {
    20222018        # No dependencies, but we still need to check for conflicts.
    2023         if {$target == "" || $target == "install" || $target == "activate"} {
     2019        if {$target eq {} || $target eq "install" || $target eq "activate"} {
    20242020            _mporterrorifconflictsinstalled $mport
    20252021        }
     
    20272023
    20282024    set clean 0
    2029     if {[string equal ${macports::portautoclean} "yes"] && ([string equal $target "install"] || [string equal $target "activate"])} {
     2025    if {$macports::portautoclean eq "yes" && ($target eq "install" || $target eq "activate")} {
    20302026        # If we're doing an install, check if we should clean after
    20312027        set clean 1
     
    20422038        $workername eval eval_targets clean
    20432039    }
    2044    
     2040
    20452041    global ::logenabled ::debuglogname
    20462042    if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
     
    20732069        foreach depspec $portinfo($deptype) {
    20742070            set dep_portname [$workername eval _get_dep_port $depspec]
    2075             if {$dep_portname != "" && ![info exists depscache(port:$dep_portname)] && [$test $dep_portname]} {
     2071            if {$dep_portname ne {} && ![info exists depscache(port:$dep_portname)] && [$test $dep_portname]} {
    20762072                set variants {}
    2077    
     2073
    20782074                # check that the dep has the required archs
    20792075                set active_archs [_get_registry_archs $dep_portname]
    2080                 if {$deptype != "depends_fetch" && $deptype != "depends_extract"
    2081                     && $active_archs != "" && $active_archs != "noarch" && $required_archs != "noarch"
     2076                if {$deptype ne "depends_fetch" && $deptype ne "depends_extract"
     2077                    && $active_archs ne {} && $active_archs ne "noarch" && $required_archs ne "noarch"
    20822078                    && [lsearch -exact $depends_skip_archcheck $dep_portname] == -1} {
    20832079                    set missing {}
     
    21312127                    }
    21322128                }
    2133    
    2134                 set status [macports::upgrade $dep_portname "port:$dep_portname" $variants $options depscache]
     2129
     2130                set status [macports::upgrade $dep_portname port:$dep_portname $variants $options depscache]
    21352131                # status 2 means the port was not found in the index
    21362132                if {$status != 0 && $status != 2 && ![macports::ui_isset ports_processall]} {
     
    21492145    set archs [registry::property_retrieve $regref archs]
    21502146    if {$archs == 0} {
    2151         set archs ""
     2147        set archs {}
    21522148    }
    21532149    return $archs
     
    21732169# @param url source URL to check
    21742170# @return a list containing filename and extension or an empty list
    2175 proc _source_is_snapshot {url {filename ""} {extension ""}} {
     2171proc _source_is_snapshot {url {filename {}} {extension {}}} {
    21762172    upvar $filename myfilename
    21772173    upvar $extension myextension
     
    21872183}
    21882184
    2189 proc macports::getportbuildpath {id {portname ""}} {
     2185proc macports::getportbuildpath {id {portname {}}} {
    21902186    global macports::portdbpath
    21912187    regsub {://} $id {.} port_path
     
    21942190}
    21952191
    2196 proc macports::getportlogpath {id {portname ""}} {
     2192proc macports::getportlogpath {id {portname {}}} {
    21972193    global macports::portdbpath
    21982194    regsub {://} $id {.} port_path
     
    22052201}
    22062202
    2207 proc macports::getportworkpath_from_portdir {portpath {portname ""}} {
     2203proc macports::getportworkpath_from_portdir {portpath {portname {}}} {
    22082204    return [macports::getportworkpath_from_buildpath [macports::getportbuildpath $portpath $portname]]
    22092205}
     
    22112207proc macports::getindex {source} {
    22122208    # Special case file:// sources
    2213     if {[macports::getprotocol $source] == "file"} {
     2209    if {[macports::getprotocol $source] eq "file"} {
    22142210        return [file join [macports::getportdir $source] PortIndex]
    22152211    }
     
    22192215
    22202216proc mportsync {{optionslist {}}} {
    2221     global macports::sources macports::portdbpath macports::rsync_options tcl_platform
    2222     global macports::portverbose
    2223     global macports::autoconf::rsync_path macports::autoconf::tar_path macports::autoconf::openssl_path
     2217    global macports::sources macports::portdbpath macports::rsync_options \
     2218           tcl_platform macports::portverbose macports::autoconf::rsync_path \
     2219          macports::autoconf::tar_path macports::autoconf::openssl_path
    22242220    array set options $optionslist
    22252221    if {[info exists options(no_reindex)]} {
     
    22422238            {^file$} {
    22432239                set portdir [macports::getportdir $source]
    2244                 set svn_cmd ""
     2240                set svn_cmd {}
    22452241                catch {set svn_cmd [macports::findBinary svn]}
    2246                 set git_cmd ""
     2242                set git_cmd {}
    22472243                catch {set git_cmd [macports::findBinary git]}
    2248                 if {$svn_cmd != "" && ([file exists $portdir/.svn] || ![catch {exec $svn_cmd info $portdir > /dev/null 2>@1}])} {
    2249                     set svn_commandline "$svn_cmd update --non-interactive ${portdir}"
     2244                if {$svn_cmd ne {} && ([file exists ${portdir}/.svn] || ![catch {exec $svn_cmd info $portdir > /dev/null 2>@1}])} {
     2245                    set svn_commandline "$svn_cmd update --non-interactive $portdir"
    22502246                    ui_debug $svn_commandline
    22512247                    if {
     
    22652261                        }]
    22662262                    } {
    2267                         ui_debug "$::errorInfo"
     2263                        ui_debug $::errorInfo
    22682264                        ui_error "Synchronization of the local ports tree failed doing an svn update"
    22692265                        incr numfailed
    22702266                        continue
    22712267                    }
    2272                 } elseif {$git_cmd != "" && [file exists $portdir/.git]} {
     2268                } elseif {$git_cmd ne {} && [file exists ${portdir}/.git]} {
    22732269                    set git_commandline "pushd $portdir ; $git_cmd pull --rebase ; popd"
    22742270                    ui_debug $git_commandline
     
    22892285                        }]
    22902286                    } {
    2291                         ui_debug "$::errorInfo"
     2287                        ui_debug $::errorInfo
    22922288                        ui_error "Synchronization of the local ports tree failed doing a git pull --rebase"
    22932289                        incr numfailed
     
    23082304
    23092305                if {$is_tarball} {
    2310                     set exclude_option ""
     2306                    set exclude_option {}
    23112307                    # need to do a few things before replacing the ports tree in this case
    23122308                    set destdir [file dirname $destdir]
    23132309                } else {
    23142310                    # Keep rsync happy with a trailing slash
    2315                     if {[string index $source end] != "/"} {
    2316                         append source "/"
     2311                    if {[string index $source end] ne "/"} {
     2312                        append source /
    23172313                    }
    23182314                    # don't sync PortIndex yet; we grab the platform specific one afterwards
    2319                     set exclude_option "'--exclude=/PortIndex*'"
     2315                    set exclude_option '--exclude=/PortIndex*'
    23202316                }
    23212317                # Do rsync fetch
    2322                 set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${exclude_option} ${source} ${destdir}"
     2318                set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $exclude_option $source $destdir"
    23232319                ui_debug $rsync_commandline
    23242320                if {[catch {system $rsync_commandline}]} {
     
    23312327                    # verify signature for tarball
    23322328                    global macports::archivefetch_pubkeys
    2333                     set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${exclude_option} ${source}.rmd160 ${destdir}"
     2329                    set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $exclude_option ${source}.rmd160 $destdir"
    23342330                    ui_debug $rsync_commandline
    23352331                    if {[catch {system $rsync_commandline}]} {
     
    23382334                        continue
    23392335                    }
    2340                     set tarball "${destdir}/[file tail $source]"
    2341                     set signature "${tarball}.rmd160"
     2336                    set tarball ${destdir}/[file tail $source]
     2337                    set signature ${tarball}.rmd160
    23422338                    set openssl [macports::findBinary openssl $macports::autoconf::openssl_path]
    23432339                    set verified 0
    2344                     foreach pubkey ${macports::archivefetch_pubkeys} {
     2340                    foreach pubkey $macports::archivefetch_pubkeys {
    23452341                        if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball} result]} {
    23462342                            set verified 1
     
    23612357                    set tar [macports::findBinary tar $macports::autoconf::tar_path]
    23622358                    file mkdir ${destdir}/tmp
    2363                     set tar_cmd "$tar -C ${destdir}/tmp -xf ${tarball}"
     2359                    set tar_cmd "$tar -C ${destdir}/tmp -xf $tarball"
    23642360                    ui_debug $tar_cmd
    23652361                    if {[catch {system $tar_cmd}]} {
     
    23832379                set needs_portindex 1
    23842380                # now sync the index if the local file is missing or older than a day
    2385                 if {![file isfile $indexfile] || [expr [clock seconds] - [file mtime $indexfile]] > 86400
     2381                if {![file isfile $indexfile] || [clock seconds] - [file mtime $indexfile] > 86400
    23862382                      || [info exists options(no_reindex)]} {
    23872383                    if {$is_tarball} {
     
    23892385                        set index_source [string range $source 0 end-[string length [file tail $source]]]
    23902386                    } else {
    2391                         set index_source $source 
     2387                        set index_source $source
    23922388                    }
    23932389                    set remote_indexfile "${index_source}PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex"
    2394                     set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} $remote_indexfile ${destdir}"
     2390                    set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $remote_indexfile $destdir"
    23952391                    ui_debug $rsync_commandline
    23962392                    if {[catch {system $rsync_commandline}]} {
     
    24032399                            set needs_portindex 1
    24042400                            # verify signature for PortIndex
    2405                             set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${remote_indexfile}.rmd160 ${destdir}"
     2401                            set rsync_commandline "$macports::autoconf::rsync_path $rsync_options ${remote_indexfile}.rmd160 $destdir"
    24062402                            ui_debug $rsync_commandline
    24072403                            if {![catch {system $rsync_commandline}]} {
    2408                                 foreach pubkey ${macports::archivefetch_pubkeys} {
     2404                                foreach pubkey $macports::archivefetch_pubkeys {
    24092405                                    if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature ${destdir}/PortIndex.rmd160 ${destdir}/PortIndex} result]} {
    24102406                                        set ok 1
     
    24472443                    }
    24482444
    2449                     if {(![info exists options(ports_force)] || $options(ports_force) != "yes") && $updated <= 0} {
     2445                    if {(![info exists options(ports_force)] || $options(ports_force) ne "yes") && $updated <= 0} {
    24502446                        ui_info "No updates for $source"
    24512447                        continue
     
    24552451
    24562452                    set verboseflag {}
    2457                     if {$macports::portverbose == "yes"} {
    2458                         set verboseflag "-v"
     2453                    if {$macports::portverbose eq "yes"} {
     2454                        set verboseflag -v
    24592455                    }
    24602456
     
    24662462
    24672463                    set extflag {}
    2468                     switch $extension {
     2464                    switch -- $extension {
    24692465                        {tar.gz} {
    2470                             set extflag "-z"
     2466                            set extflag -z
    24712467                        }
    24722468                        {tar.bz2} {
    2473                             set extflag "-j"
     2469                            set extflag -j
    24742470                        }
    24752471                    }
    24762472
    24772473                    set tar [macports::findBinary tar $macports::autoconf::tar_path]
    2478                     if { [catch { system "cd $destdir/.. && $tar ${verboseflag} ${extflag} -xf $filename" } error] } {
     2474                    if {[catch {system "cd ${destdir}/.. && $tar $verboseflag $extflag -xf $filename"} error]} {
    24792475                        ui_error "Extracting $source failed ($error)"
    24802476                        incr numfailed
     
    24872483
    24882484                    set platindex "PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex"
    2489                     if {[file isfile ${destdir}/${platindex}] && [file isfile ${destdir}/${platindex}.quick]} {
    2490                         file rename -force "${destdir}/${platindex}" "${destdir}/${platindex}.quick" $destdir
     2485                    if {[file isfile ${destdir}/$platindex] && [file isfile ${destdir}/${platindex}.quick]} {
     2486                        file rename -force ${destdir}/$platindex ${destdir}/${platindex}.quick $destdir
    24912487                    }
    24922488
     
    25042500            }
    25052501        }
    2506        
     2502
    25072503        if {$needs_portindex} {
    25082504            set any_needed_portindex 1
     
    25302526    global macports::portdbpath macports::sources
    25312527    set matches [list]
    2532     set easy [expr { $field == "name" }]
     2528    set easy [expr {$field eq "name"}]
    25332529
    25342530    set found 0
     
    25362532        set source [lindex $source 0]
    25372533        set protocol [macports::getprotocol $source]
    2538         if {$protocol == "mports"} {
     2534        if {$protocol eq "mports"} {
    25392535            set res [macports::index::search $macports::portdbpath $source [list name $pattern]]
    25402536            eval lappend matches $res
     
    25592555                        }
    25602556
    2561                         switch $matchstyle {
     2557                        switch -- $matchstyle {
    25622558                            exact {
    2563                                 set matchres [expr 0 == ( {$case_sensitive == "yes"} ? [string compare $pattern $target] : [string compare -nocase $pattern $target] )]
     2559                                set matchres [expr {0 == ($case_sensitive eq "yes" ? [string compare $pattern $target] : [string compare -nocase $pattern $target])}]
    25642560                            }
    25652561                            glob {
    2566                                 set matchres [expr {$case_sensitive == "yes"} ? [string match $pattern $target] : [string match -nocase $pattern $target]]
     2562                                set matchres [expr {$case_sensitive eq "yes" ? [string match $pattern $target] : [string match -nocase $pattern $target]}]
    25672563                            }
    25682564                            regexp -
    25692565                            default {
    2570                                 set matchres [expr {$case_sensitive == "yes"} ? [regexp -- $pattern $target] : [regexp -nocase -- $pattern $target]]
     2566                                set matchres [expr {$case_sensitive eq "yes" ? [regexp -- $pattern $target] : [regexp -nocase -- $pattern $target]}]
    25712567                            }
    25722568                        }
     
    25762572                                array set portinfo $line
    25772573                            }
    2578                             switch $protocol {
     2574                            switch -- $protocol {
    25792575                                rsync {
    25802576                                    # Rsync files are local
    2581                                     set source_url "file://[macports::getsourcepath $source]"
     2577                                    set source_url file://[macports::getsourcepath $source]
    25822578                                }
    25832579                                https -
     
    25862582                                    if {[_source_is_snapshot $source filename extension]} {
    25872583                                        # daily snapshot tarball
    2588                                         set source_url "file://[macports::getsourcepath $source]"
     2584                                        set source_url file://[macports::getsourcepath $source]
    25892585                                    } else {
    25902586                                        # default action
     
    26112607                        }
    26122608                    }
    2613                 } catch {*} {
     2609                } catch * {
    26142610                    ui_warn "It looks like your PortIndex file for $source may be corrupt."
    26152611                    throw
     
    26402636        set source [lindex $source 0]
    26412637        set protocol [macports::getprotocol $source]
    2642         if {$protocol != "mports"} {
     2638        if {$protocol ne "mports"} {
    26432639            global macports::quick_index
    2644             if {![info exists quick_index($sourceno,[string tolower $name])]} {
     2640            if {![info exists quick_index(${sourceno},[string tolower $name])]} {
    26452641                incr sourceno 1
    26462642                continue
     
    26492645            # offset in the main PortIndex where the given port's PortInfo
    26502646            # line can be found.
    2651             set offset $quick_index($sourceno,[string tolower $name])
     2647            set offset $quick_index(${sourceno},[string tolower $name])
    26522648            incr sourceno 1
    26532649            if {[catch {set fd [open [macports::getindex $source] r]} result]} {
     
    26632659                    array set portinfo $line
    26642660
    2665                     switch $protocol {
     2661                    switch -- $protocol {
    26662662                        rsync {
    2667                             set source_url "file://[macports::getsourcepath $source]"
     2663                            set source_url file://[macports::getsourcepath $source]
    26682664                        }
    26692665                        https -
     
    26712667                        ftp {
    26722668                            if {[_source_is_snapshot $source filename extension]} {
    2673                                 set source_url "file://[macports::getsourcepath $source]"
     2669                                set source_url file://[macports::getsourcepath $source]
    26742670                             } else {
    26752671                                set source_url $source
     
    26922688                    close $fd
    26932689                    set fd -1
    2694                 } catch {*} {
     2690                } catch * {
    26952691                    ui_warn "It looks like your PortIndex file for $source may be corrupt."
    26962692                } finally {
     
    27242720        set source [lindex $source 0]
    27252721        set protocol [macports::getprotocol $source]
    2726         if {$protocol != "mports"} {
     2722        if {$protocol ne "mports"} {
    27272723            if {![catch {set fd [open [macports::getindex $source] r]} result]} {
    27282724                try {
     
    27362732                        array set portinfo $line
    27372733
    2738                         switch $protocol {
     2734                        switch -- $protocol {
    27392735                            rsync {
    2740                                 set source_url "file://[macports::getsourcepath $source]"
     2736                                set source_url file://[macports::getsourcepath $source]
    27412737                            }
    27422738                            https -
     
    27442740                            ftp {
    27452741                                if {[_source_is_snapshot $source filename extension]} {
    2746                                     set source_url "file://[macports::getsourcepath $source]"
     2742                                    set source_url file://[macports::getsourcepath $source]
    27472743                                } else {
    27482744                                    set source_url $source
     
    27632759                        lappend matches $name $line
    27642760                    }
    2765                 } catch {*} {
     2761                } catch * {
    27662762                    ui_warn "It looks like your PortIndex file for $source may be corrupt."
    27672763                    throw
     
    27982794        set source [lindex $source 0]
    27992795        set index [macports::getindex $source]
    2800         if {![file exists ${index}]} {
     2796        if {![file exists $index]} {
    28012797            incr sourceno
    28022798            continue
     
    28042800        if {![file exists ${index}.quick]} {
    28052801            ui_warn "No quick index file found, attempting to generate one for source: $source"
    2806             if {[catch {set quicklist [mports_generate_quickindex ${index}]}]} {
     2802            if {[catch {set quicklist [mports_generate_quickindex $index]}]} {
    28072803                incr sourceno
    28082804                continue
     
    28202816            }
    28212817        }
    2822         foreach entry [split $quicklist "\n"] {
    2823             set quick_index($sourceno,[lindex $entry 0]) [lindex $entry 1]
     2818        foreach entry [split $quicklist \n] {
     2819            set quick_index(${sourceno},[lindex $entry 0]) [lindex $entry 1]
    28242820        }
    28252821        incr sourceno 1
     
    28312827
    28322828proc mports_generate_quickindex {index} {
    2833     if {[catch {set indexfd [open ${index} r]} result] || [catch {set quickfd [open ${index}.quick w]} result]} {
     2829    if {[catch {set indexfd [open $index r]} result] || [catch {set quickfd [open ${index}.quick w]} result]} {
    28342830        ui_warn "Can't open index file: $index"
    28352831        return -code error
     
    28372833        try {
    28382834            set offset [tell $indexfd]
    2839             set quicklist ""
     2835            set quicklist {}
    28402836            while {[gets $indexfd line] >= 0} {
    28412837                if {[llength $line] != 2} {
     
    28432839                }
    28442840                set name [lindex $line 0]
    2845                 append quicklist "[string tolower $name] ${offset}\n"
     2841                append quicklist "[string tolower $name] $offset\n"
    28462842
    28472843                set len [lindex $line 1]
     
    28502846            }
    28512847            puts -nonewline $quickfd $quicklist
    2852         } catch {*} {
     2848        } catch * {
    28532849            ui_warn "It looks like your PortIndex file $index may be corrupt."
    28542850            throw
     
    28962892proc _mportkey {mport key} {
    28972893    set workername [ditem_key $mport workername]
    2898     return [$workername eval "return \$${key}"]
     2894    return [$workername eval "return \$$key"]
    28992895}
    29002896
     
    29142910# accDeps -> accumulator for recursive calls
    29152911# return 0 if everything was ok, an non zero integer otherwise.
    2916 proc mportdepends {mport {target ""} {recurseDeps 1} {skipSatisfied 1} {accDeps 0}} {
     2912proc mportdepends {mport {target {}} {recurseDeps 1} {skipSatisfied 1} {accDeps 0}} {
    29172913
    29182914    array set portinfo [mportinfo $mport]
     
    29252921    # progress indicator
    29262922    if {![macports::ui_isset ports_debug]} {
    2927         ui_info -nonewline "."
     2923        ui_info -nonewline .
    29282924        flush stdout
    29292925    }
    2930    
    2931     if {$target == "" || $target == "install" || $target == "activate"} {
     2926
     2927    if {$target eq {} || $target eq "install" || $target eq "activate"} {
    29322928        _mporterrorifconflictsinstalled $mport
    29332929    }
     
    29582954            set dep_portname [$workername eval _get_dep_port $depspec]
    29592955            # skip port/archs combos we've already seen, and ones with the same port but less archs than ones we've seen (or noarch)
    2960             set seenkey "${dep_portname},[join $required_archs ,]"
     2956            set seenkey ${dep_portname},[join $required_archs ,]
    29612957            set seen 0
    29622958            if {[info exists port_seen($seenkey)]} {
     
    29672963                foreach key $prev_seenkeys {
    29682964                    set key_archs [lrange [split $key ,] 1 end]
    2969                     if {$key_archs == "noarch" || $required_archs == "noarch" || [llength $key_archs] > $nrequired} {
     2965                    if {$key_archs eq "noarch" || $required_archs eq "noarch" || [llength $key_archs] > $nrequired} {
    29702966                        set seen 1
    29712967                        set seenkey $key
     
    29812977                continue
    29822978            }
    2983            
     2979
    29842980            # Is that dependency satisfied or this port installed?
    29852981            # If we don't skip or if it is not, add it to the list.
    29862982            set present [_mportispresent $mport $depspec]
    29872983
    2988             if {!$skipSatisfied && $dep_portname == ""} {
     2984            if {!$skipSatisfied && $dep_portname eq {}} {
    29892985                set dep_portname [lindex [split $depspec :] end]
    29902986            }
    29912987
    29922988            set check_archs 0
    2993             if {$dep_portname != "" && $deptype != "depends_fetch" && $deptype != "depends_extract" && [lsearch -exact $depends_skip_archcheck $dep_portname] == -1} {
     2989            if {$dep_portname ne {} && $deptype ne "depends_fetch" && $deptype ne "depends_extract" && [lsearch -exact $depends_skip_archcheck $dep_portname] == -1} {
    29942990                set check_archs 1
    29952991            }
     
    30043000                if {[catch {set res [mportlookup $dep_portname]} error]} {
    30053001                    global errorInfo
    3006                     ui_msg ""
    3007                     ui_debug "$errorInfo"
     3002                    ui_msg {}
     3003                    ui_debug $errorInfo
    30083004                    ui_error "Internal error: port lookup failed: $error"
    30093005                    return 1
     
    30143010                if {![info exists dep_portinfo(porturl)]} {
    30153011                    if {![macports::ui_isset ports_debug]} {
    3016                         ui_msg ""
     3012                        ui_msg {}
    30173013                    }
    30183014                    ui_error "Dependency '$dep_portname' not found."
     
    30283024                set depport [dlist_match_multi $macports::open_mports [list porturl $dep_portinfo(porturl) options $dep_options]]
    30293025
    3030                 if {$depport == {}} {
     3026                if {$depport eq {}} {
    30313027                    # We haven't opened this one yet.
    30323028                    set depport [mportopen $dep_portinfo(porturl) $dep_options $variations]
     
    30473043                    # a universal variant is offered
    30483044                    set has_universal 1
    3049                     if {![info exists variation_array(universal)] || $variation_array(universal) != "+"} {
     3045                    if {![info exists variation_array(universal)] || $variation_array(universal) ne "+"} {
    30503046                        set variation_array(universal) +
    30513047                        # try again with +universal
     
    30693065
    30703066                # Append the sub-port's provides to the port's requirements list.
    3071                 set depport_provides "[ditem_key $depport provides]"
     3067                set depport_provides [ditem_key $depport provides]
    30723068                ditem_append_unique $mport requires $depport_provides
    30733069                # record actual archs we ended up getting
    30743070                set port_seen(${dep_portname},[join [macports::_mport_archs $depport] ,]) $depport_provides
    3075             } elseif {$present && $dep_portname != ""} {
     3071            } elseif {$present && $dep_portname ne {}} {
    30763072                # record actual installed archs
    30773073                set port_seen(${dep_portname},[join [macports::_active_archs $dep_portname] ,]) 0
     
    30843080        foreach depport $depPorts {
    30853081            # Sub ports should be installed (all dependencies must be satisfied).
    3086             set res [mportdepends $depport "" $recurseDeps $skipSatisfied 1]
     3082            set res [mportdepends $depport {} $recurseDeps $skipSatisfied 1]
    30873083            if {$res != 0} {
    30883084                return $res
     
    30963092# check if the given mport can support dependents with the given archs
    30973093proc macports::_mport_supports_archs {mport required_archs} {
    3098     if {$required_archs == "noarch"} {
     3094    if {$required_archs eq "noarch"} {
    30993095        return 1
    31003096    }
    31013097    set provided_archs [_mport_archs $mport]
    3102     if {$provided_archs == "noarch"} {
     3098    if {$provided_archs eq "noarch"} {
    31033099        return 1
    31043100    }
     
    31193115# check if the active version of a port supports the given archs
    31203116proc macports::_active_supports_archs {portname required_archs} {
    3121     if {$required_archs == "noarch"} {
     3117    if {$required_archs eq "noarch"} {
    31223118        return 1
    31233119    }
     
    31263122    }
    31273123    set provided_archs [_active_archs $portname]
    3128     if {$provided_archs == "noarch" || $provided_archs == "" || $provided_archs == 0} {
     3124    if {$provided_archs eq "noarch" || $provided_archs eq {} || $provided_archs == 0} {
    31293125        return 1
    31303126    }
     
    31403136proc macports::_active_archs {portname} {
    31413137    if {[catch {set ilist [registry::active $portname]}]} {
    3142         return ""
     3138        return {}
    31433139    }
    31443140    set i [lindex $ilist 0]
     
    31513147    global macports::universal_archs
    31523148    if {![macports::ui_isset ports_debug]} {
    3153         ui_msg ""
     3149        ui_msg {}
    31543150    }
    31553151    ui_error "Cannot install $port for the arch(s) '$required_archs' because"
    3156     if {$supported_archs != ""} {
     3152    if {$supported_archs ne {}} {
    31573153        foreach arch $required_archs {
    31583154            if {[lsearch -exact $supported_archs $arch] == -1} {
     
    31813177    array set portinfo [mportinfo $mport]
    31823178    foreach type $deptypes {
    3183         if {[info exists portinfo($type)] && $portinfo($type) != ""} {
     3179        if {[info exists portinfo($type)] && $portinfo($type) ne {}} {
    31843180            return 1
    31853181        }
     
    32083204        rpm -
    32093205        dpkg -
    3210         srpm { return 1 }
    3211         default { return 0 }
     3206        srpm {return 1}
     3207        default {return 0}
    32123208    }
    32133209}
     
    32153211# Determine dependency types required for target
    32163212proc macports::_deptypes_for_target {target workername} {
    3217     switch $target {
     3213    switch -- $target {
    32183214        fetch       -
    3219         checksum    { return "depends_fetch" }
     3215        checksum    {return depends_fetch}
    32203216        extract     -
    3221         patch       { return "depends_fetch depends_extract" }
     3217        patch       {return "depends_fetch depends_extract"}
    32223218        configure   -
    3223         build       { return "depends_fetch depends_extract depends_build depends_lib" }
     3219        build       {return "depends_fetch depends_extract depends_build depends_lib"}
    32243220        test        -
    32253221        srpm        -
    3226         destroot    { return "depends_fetch depends_extract depends_build depends_lib depends_run" }
     3222        destroot    {return "depends_fetch depends_extract depends_build depends_lib depends_run"}
    32273223        dmg         -
    32283224        pkg         -
     
    32403236        install     -
    32413237        activate    -
    3242         ""          {
     3238        {}          {
    32433239            if {[global_option_isset ports_binary_only] ||
    32443240                [$workername eval registry_exists \$subport \$version \$revision \$portvariants]
     
    32503246        }
    32513247    }
    3252     return ""
     3248    return {}
    32533249}
    32543250
    32553251# selfupdate procedure
    3256 proc macports::selfupdate {{optionslist {}} {updatestatusvar ""}} {
    3257     global macports::prefix macports::portdbpath macports::libpath macports::rsync_server macports::rsync_dir macports::rsync_options
    3258     global macports::autoconf::macports_version macports::autoconf::rsync_path tcl_platform
    3259     global macports::autoconf::openssl_path macports::autoconf::tar_path
     3252proc macports::selfupdate {{optionslist {}} {updatestatusvar {}}} {
     3253    global macports::prefix macports::portdbpath macports::libpath \
     3254           macports::rsync_server macports::rsync_dir macports::rsync_options \
     3255           macports::autoconf::macports_version macports::autoconf::rsync_path \
     3256           tcl_platform macports::autoconf::openssl_path macports::autoconf::tar_path
    32603257    array set options $optionslist
    3261    
     3258
    32623259    # variable that indicates whether we actually updated base
    3263     if {$updatestatusvar != ""} {
     3260    if {$updatestatusvar ne {}} {
    32643261        upvar $updatestatusvar updatestatus
    32653262        set updatestatus no
     
    32683265    # are we syncing a tarball? (implies detached signature)
    32693266    set is_tarball 0
    3270     if {[string range ${rsync_dir} end-3 end] == ".tar"} {
     3267    if {[string range $rsync_dir end-3 end] eq ".tar"} {
    32713268        set is_tarball 1
    3272         set mp_source_path [file join $portdbpath sources ${rsync_server} [file dirname ${rsync_dir}]]
     3269        set mp_source_path [file join $portdbpath sources $rsync_server [file dirname $rsync_dir]]
    32733270    } else {
    3274         if {[string index $rsync_dir end] != "/"} {
    3275             append rsync_dir "/"
    3276         }
    3277         set mp_source_path [file join $portdbpath sources ${rsync_server} ${rsync_dir}]
     3271        if {[string index $rsync_dir end] ne "/"} {
     3272            append rsync_dir /
     3273        }
     3274        set mp_source_path [file join $portdbpath sources $rsync_server $rsync_dir]
    32783275    }
    32793276    # create the path to the to be downloaded sources if it doesn't exist
     
    32853282    # sync the MacPorts sources
    32863283    ui_msg "$macports::ui_prefix Updating MacPorts base sources using rsync"
    3287     if { [catch { system "$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir} $mp_source_path" } result ] } {
     3284    if {[catch {system "$rsync_path $rsync_options rsync://${rsync_server}/$rsync_dir $mp_source_path"} result]} {
    32883285       return -code error "Error synchronizing MacPorts sources: $result"
    32893286    }
     
    32923289        # verify signature for tarball
    32933290        global macports::archivefetch_pubkeys
    3294         if { [catch { system "$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir}.rmd160 $mp_source_path" } result ] } {
     3291        if {[catch {system "$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir}.rmd160 $mp_source_path"} result]} {
    32953292            return -code error "Error synchronizing MacPorts source signature: $result"
    32963293        }
    32973294        set openssl [findBinary openssl $macports::autoconf::openssl_path]
    3298         set tarball "${mp_source_path}/[file tail $rsync_dir]"
    3299         set signature "${tarball}.rmd160"
     3295        set tarball ${mp_source_path}/[file tail $rsync_dir]
     3296        set signature ${tarball}.rmd160
    33003297        set verified 0
    3301         foreach pubkey ${macports::archivefetch_pubkeys} {
     3298        foreach pubkey $macports::archivefetch_pubkeys {
    33023299            if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball} result]} {
    33033300                set verified 1
     
    33123309            return -code error "Failed to verify signature for MacPorts source!"
    33133310        }
    3314        
     3311
    33153312        # extract tarball and move into place
    33163313        set tar [macports::findBinary tar $macports::autoconf::tar_path]
    33173314        file mkdir ${mp_source_path}/tmp
    3318         set tar_cmd "$tar -C ${mp_source_path}/tmp -xf ${tarball}"
     3315        set tar_cmd "$tar -C ${mp_source_path}/tmp -xf $tarball"
    33193316        ui_debug $tar_cmd
    33203317        if {[catch {system $tar_cmd}]} {
     
    33313328    ui_msg "MacPorts base version $macports::autoconf::macports_version installed,"
    33323329
    3333     if { [info exists options(ports_force)] && $options(ports_force) == "yes" } {
     3330    if {[info exists options(ports_force)] && $options(ports_force) eq "yes"} {
    33343331        set use_the_force_luke yes
    33353332        ui_debug "Forcing a rebuild and reinstallation of MacPorts"
     
    33563353
    33573354    # syncing ports tree.
    3358     if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) != "yes"} {
     3355    if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) ne "yes"} {
    33593356        if {$comp > 0} {
    3360             # updated portfiles potentially need new base to parse - tell sync to try to 
     3357            # updated portfiles potentially need new base to parse - tell sync to try to
    33613358            # use prefabricated PortIndex files and signal if it couldn't
    33623359            lappend optionslist no_reindex 1 needed_portindex_var needed_portindex
     
    33673364    }
    33683365
    3369     if {$use_the_force_luke == "yes" || $comp > 0} {
    3370         if {[info exists options(ports_dryrun)] && $options(ports_dryrun) == "yes"} {
     3366    if {$use_the_force_luke eq "yes" || $comp > 0} {
     3367        if {[info exists options(ports_dryrun)] && $options(ports_dryrun) eq "yes"} {
    33713368            ui_msg "$macports::ui_prefix MacPorts base is outdated, selfupdate would install $macports_version_new (dry run)"
    33723369        } else {
     
    33743371
    33753372            # get installation user/group and permissions
    3376             set owner [file attributes ${prefix} -owner]
    3377             set group [file attributes ${prefix} -group]
    3378             set perms [string range [file attributes ${prefix} -permissions] end-3 end]
    3379             if {$tcl_platform(user) != "root" && ![string equal $tcl_platform(user) $owner]} {
    3380                 return -code error "User $tcl_platform(user) does not own ${prefix} - try using sudo"
     3373            set owner [file attributes $prefix -owner]
     3374            set group [file attributes $prefix -group]
     3375            set perms [string range [file attributes $prefix -permissions] end-3 end]
     3376            if {$tcl_platform(user) ne "root" && $tcl_platform(user) ne $owner} {
     3377                return -code error "User $tcl_platform(user) does not own $prefix - try using sudo"
    33813378            }
    33823379            ui_debug "Permissions OK"
     
    33843381            # where to install a link to our macports1.0 tcl package
    33853382            set mp_tclpackage_path [file join $portdbpath .tclpackage]
    3386             if { [file exists $mp_tclpackage_path]} {
     3383            if {[file exists $mp_tclpackage_path]} {
    33873384                set fd [open $mp_tclpackage_path r]
    33883385                gets $fd tclpackage
     
    33943391            set configure_args "--prefix=$prefix --with-tclpackage=$tclpackage --with-install-user=$owner --with-install-group=$group --with-directory-mode=$perms"
    33953392            # too many users have an incompatible readline in /usr/local, see ticket #10651
    3396             if {$tcl_platform(os) != "Darwin" || $prefix == "/usr/local"
    3397                 || ([glob -nocomplain "/usr/local/lib/lib{readline,history}*"] == "" && [glob -nocomplain "/usr/local/include/readline/*.h"] == "")} {
     3393            if {$tcl_platform(os) ne "Darwin" || $prefix eq "/usr/local"
     3394                || ([glob -nocomplain /usr/local/lib/lib{readline,history}*] eq {} && [glob -nocomplain /usr/local/include/readline/*.h] eq {})} {
    33983395                append configure_args " --enable-readline"
    33993396            } else {
     
    34013398            }
    34023399
    3403             if {$prefix == "/usr/local" || $prefix == "/usr"} {
     3400            if {$prefix eq "/usr/local" || $prefix eq "/usr"} {
    34043401                append configure_args " --with-unsupported-prefix"
    34053402            }
    34063403
    34073404            # Choose a sane compiler
    3408             set cc_arg ""
    3409             if {$::macports::os_platform == "darwin"} {
     3405            set cc_arg {}
     3406            if {$::macports::os_platform eq "darwin"} {
    34103407                set cc_arg "CC=/usr/bin/cc OBJC=/usr/bin/cc "
    34113408            }
    34123409
    34133410            # do the actual configure, build and installation of new base
    3414             ui_msg "Installing new MacPorts release in $prefix as $owner:$group; permissions $perms; Tcl-Package in $tclpackage\n"
    3415             if { [catch { system "cd $mp_source_path && ${cc_arg}./configure $configure_args && make SELFUPDATING=1 && make install SELFUPDATING=1" } result] } {
     3411            ui_msg "Installing new MacPorts release in $prefix as ${owner}:${group}; permissions ${perms}; Tcl-Package in $tclpackage\n"
     3412            if {[catch {system "cd $mp_source_path && ${cc_arg}./configure $configure_args && make SELFUPDATING=1 && make install SELFUPDATING=1"} result]} {
    34163413                return -code error "Error installing new MacPorts base: $result"
    34173414            }
     
    34293426    set sources_owner [file attributes [file join $portdbpath sources/] -owner]
    34303427    ui_debug "Setting MacPorts sources ownership to $sources_owner"
    3431     if { [catch { exec [findBinary chown $macports::autoconf::chown_path] -R $sources_owner [file join $portdbpath sources/] } result] } {
    3432         return -code error "Couldn't change permissions of the MacPorts sources at $mp_source_path to $sources_owner: $result"
    3433     }
    3434 
    3435     if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) != "yes"} {
     3428    if {[catch {exec [findBinary chown $macports::autoconf::chown_path] -R $sources_owner [file join $portdbpath sources/]} result]} {
     3429        return -code error "Couldn't change permissions of the MacPorts sources at $mp_source_path to ${sources_owner}: $result"
     3430    }
     3431
     3432    if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) ne "yes"} {
    34363433        if {[info exists needed_portindex]} {
    34373434            ui_msg "Not all sources could be fully synced using the old version of MacPorts."
     
    34523449#   2 = port name not found in index
    34533450#   3 = port not installed
    3454 proc macports::upgrade {portname dspec variationslist optionslist {depscachename ""}} {
     3451proc macports::upgrade {portname dspec variationslist optionslist {depscachename {}}} {
    34553452    # only installed ports can be upgraded
    34563453    if {![registry::entry_exists_for_name $portname]} {
     
    34583455        return 3
    34593456    }
    3460     if {![string match "" $depscachename]} {
     3457    if {$depscachename ne {}} {
    34613458        upvar $depscachename depscache
    34623459    } else {
     
    34693466        set orig_nodeps no
    34703467    }
    3471    
     3468
    34723469    # run the actual upgrade
    34733470    set status [macports::_upgrade $portname $dspec $variationslist $optionslist depscache]
    3474    
     3471
    34753472    if {!$orig_nodeps} {
    34763473        unset -nocomplain macports::global_options(ports_nodeps)
     
    34813478
    34823479# main internal upgrade procedure
    3483 proc macports::_upgrade {portname dspec variationslist optionslist {depscachename ""}} {
     3480proc macports::_upgrade {portname dspec variationslist optionslist {depscachename {}}} {
    34843481    global macports::global_variations
    34853482    array set options $optionslist
    34863483
    3487     if {![string match "" $depscachename]} {
     3484    if {$depscachename ne {}} {
    34883485        upvar $depscachename depscache
    34893486    }
     
    35083505    if {[catch {mportlookup $portname} result]} {
    35093506        global errorInfo
    3510         ui_debug "$errorInfo"
     3507        ui_debug $errorInfo
    35113508        ui_error "port lookup failed: $result"
    35123509        return 1
    35133510    }
    35143511    # argh! port doesnt exist!
    3515     if {$result == ""} {
     3512    if {$result eq {}} {
    35163513        ui_warn "No port $portname found in the index."
    35173514        return 2
     
    35243521
    35253522    set ilist {}
    3526     if { [catch {set ilist [registry::installed $portname ""]} result] } {
    3527         if {$result == "Registry error: $portname not registered as installed." } {
     3523    if {[catch {set ilist [registry::installed $portname {}]} result]} {
     3524        if {$result eq "Registry error: $portname not registered as installed."} {
    35283525            ui_debug "$portname is *not* installed by MacPorts"
    35293526
     
    35313528            # actually declaring the dependency on the one we're checking for.
    35323529            # We got here via _upgrade_dependencies, so we grab it from 2 levels up.
    3533             upvar 2 workername parentworker
    3534             if {![_mportispresent $parentworker $dspec ] } {
     3530            upvar 2 mport parentmport
     3531            if {![_mportispresent $parentmport $dspec]} {
    35353532                # open porthandle
    35363533                set porturl $portinfo(porturl)
     
    35413538                upvar 2 variations variations
    35423539
    3543                 if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result]} {
     3540                if {[catch {set mport [mportopen $porturl [array get options] [array get variations]]} result]} {
    35443541                    global errorInfo
    3545                     ui_debug "$errorInfo"
     3542                    ui_debug $errorInfo
    35463543                    ui_error "Unable to open port: $result"
    35473544                    return 1
     
    35493546                # While we're at it, update the portinfo
    35503547                array unset portinfo
    3551                 array set portinfo [mportinfo $workername]
    3552                
     3548                array set portinfo [mportinfo $mport]
     3549
    35533550                # upgrade its dependencies first
    35543551                set status [_upgrade_dependencies portinfo depscache variationslist options]
    35553552                if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
    3556                     catch {mportclose $workername}
     3553                    catch {mportclose $mport}
    35573554                    return $status
    35583555                }
    35593556                # now install it
    3560                 if {[catch {set result [mportexec $workername activate]} result]} {
     3557                if {[catch {set result [mportexec $mport activate]} result]} {
    35613558                    global errorInfo
    3562                     ui_debug "$errorInfo"
     3559                    ui_debug $errorInfo
    35633560                    ui_error "Unable to exec port: $result"
    3564                     catch {mportclose $workername}
     3561                    catch {mportclose $mport}
    35653562                    return 1
    35663563                }
    35673564                if {$result > 0} {
    35683565                    ui_error "Problem while installing $portname"
    3569                     catch {mportclose $workername}
     3566                    catch {mportclose $mport}
    35703567                    return $result
    35713568                }
    35723569                # we just installed it, so mark it done in the cache
    3573                 set depscache(port:${portname}) 1
    3574                 mportclose $workername
     3570                set depscache(port:$portname) 1
     3571                mportclose $mport
    35753572            } else {
    35763573                # dependency is satisfied by something other than the named port
     
    35883585    } else {
    35893586        # we'll now take care of upgrading it, so we can add it to the cache
    3590         set depscache(port:${portname}) 1
    3591     }
    3592    
     3587        set depscache(port:$portname) 1
     3588    }
     3589
    35933590    # set version_in_tree and revision_in_tree
    35943591    if {![info exists portinfo(version)]} {
    3595         ui_error "Invalid port entry for $portname, missing version"
     3592        ui_error "Invalid port entry for ${portname}, missing version"
    35963593        return 1
    35973594    }
    3598     set version_in_tree "$portinfo(version)"
    3599     set revision_in_tree "$portinfo(revision)"
    3600     set epoch_in_tree "$portinfo(epoch)"
     3595    set version_in_tree $portinfo(version)
     3596    set revision_in_tree $portinfo(revision)
     3597    set epoch_in_tree $portinfo(epoch)
    36013598
    36023599    # find latest version installed and active version (if any)
     
    36083605        set revision [lindex $i 2]
    36093606        set epoch [lindex $i 5]
    3610         if { $version_installed == {} || ($epoch > $epoch_installed && $version != $version_installed) ||
     3607        if {$version_installed eq {} || ($epoch > $epoch_installed && $version != $version_installed) ||
    36113608                ($epoch >= $epoch_installed && [vercmp $version $version_installed] > 0)
    36123609                || ($epoch >= $epoch_installed
     
    36313628    # output version numbers
    36323629    ui_debug "epoch: in tree: $epoch_in_tree installed: $epoch_installed"
    3633     ui_debug "$portname ${version_in_tree}_${revision_in_tree} exists in the ports tree"
    3634     ui_debug "$portname ${version_installed}_${revision_installed} $variant_installed is the latest installed"
     3630    ui_debug "$portname ${version_in_tree}_$revision_in_tree exists in the ports tree"
     3631    ui_debug "$portname ${version_installed}_$revision_installed $variant_installed is the latest installed"
    36353632    if {$anyactive} {
    3636         ui_debug "$portname ${version_active}_${revision_active} $variant_active is active"
     3633        ui_debug "$portname ${version_active}_$revision_active $variant_active is active"
    36373634        # save existing variant for later use
    36383635        set oldvariant $variant_active
     
    36643661    # merged in later on, so it applies only to this port's upgrade
    36653662    array set variations $variationslist
    3666    
     3663
    36673664    set globalvarlist [array get macports::global_variations]
    36683665
    36693666    set minusvariant [lrange [split $oldnegatedvariant -] 1 end]
    36703667    set plusvariant [lrange [split $oldvariant +] 1 end]
    3671     ui_debug "Merging existing variants '${oldvariant}${oldnegatedvariant}' into variants"
     3668    ui_debug "Merging existing variants '${oldvariant}$oldnegatedvariant' into variants"
    36723669    set oldvariantlist [list]
    36733670    foreach v $plusvariant {
    3674         lappend oldvariantlist $v "+"
     3671        lappend oldvariantlist $v +
    36753672    }
    36763673    foreach v $minusvariant {
    3677         lappend oldvariantlist $v "-"
     3674        lappend oldvariantlist $v -
    36783675    }
    36793676
    36803677    # merge in the old variants
    36813678    foreach {variation value} $oldvariantlist {
    3682         if { ![info exists variations($variation)]} {
     3679        if {![info exists variations($variation)]} {
    36833680            set variations($variation) $value
    36843681        }
     
    36883685    # We wait until now so that existing variants for this port
    36893686    # override global variations
    3690     foreach { variation value } $globalvarlist {
    3691         if { ![info exists variations($variation)] } {
     3687    foreach {variation value} $globalvarlist {
     3688        if {![info exists variations($variation)]} {
    36923689            set variations($variation) $value
    36933690        }
     
    36953692
    36963693    ui_debug "new fully merged portvariants: [array get variations]"
    3697    
     3694
    36983695    # at this point we need to check if a different port will be replacing this one
    36993696    if {[info exists portinfo(replaced_by)] && ![info exists options(ports_upgrade_no-replace)]} {
     
    37013698        if {[catch {mportlookup $portinfo(replaced_by)} result]} {
    37023699            global errorInfo
    3703             ui_debug "$errorInfo"
     3700            ui_debug $errorInfo
    37043701            ui_error "port lookup failed: $result"
    37053702            return 1
    37063703        }
    3707         if {$result == ""} {
     3704        if {$result eq {}} {
    37083705            ui_error "No port $portinfo(replaced_by) found."
    37093706            return 1
     
    37173714            set porturl file://./
    37183715        }
    3719         set depscache(port:${newname}) 1
     3716        set depscache(port:$newname) 1
    37203717    } else {
    37213718        set newname $portname
     
    37263723    set interp_options(subport) $newname
    37273724
    3728     if {[catch {set workername [mportopen $porturl [array get interp_options] [array get variations]]} result]} {
     3725    if {[catch {set mport [mportopen $porturl [array get interp_options] [array get variations]]} result]} {
    37293726        global errorInfo
    3730         ui_debug "$errorInfo"
     3727        ui_debug $errorInfo
    37313728        ui_error "Unable to open port: $result"
    37323729        return 1
     
    37353732
    37363733    array unset portinfo
    3737     array set portinfo [mportinfo $workername]
    3738     set version_in_tree "$portinfo(version)"
    3739     set revision_in_tree "$portinfo(revision)"
    3740     set epoch_in_tree "$portinfo(epoch)"
     3734    array set portinfo [mportinfo $mport]
     3735    set version_in_tree $portinfo(version)
     3736    set revision_in_tree $portinfo(revision)
     3737    set epoch_in_tree $portinfo(epoch)
    37413738
    37423739    set build_override 0
    37433740    set will_install yes
    37443741    # check installed version against version in ports
    3745     if { ( [vercmp $version_installed $version_in_tree] > 0
     3742    if {([vercmp $version_installed $version_in_tree] > 0
    37463743            || ([vercmp $version_installed $version_in_tree] == 0
    3747                 && [vercmp $revision_installed $revision_in_tree] >= 0 ))
    3748         && ![info exists options(ports_upgrade_force)] } {
    3749         if {$portname != $newname} {
     3744                && [vercmp $revision_installed $revision_in_tree] >= 0))
     3745        && ![info exists options(ports_upgrade_force)]} {
     3746        if {$portname ne $newname} {
    37503747            ui_debug "ignoring versions, installing replacement port"
    3751         } elseif { $epoch_installed < $epoch_in_tree } {
     3748        } elseif {$epoch_installed < $epoch_in_tree && $version_installed != $version_in_tree} {
    37523749            set build_override 1
    37533750            ui_debug "epoch override ... upgrading!"
     
    37553752                  && [info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
    37563753            ui_debug "variant override ... upgrading!"
    3757         } elseif {$os_platform_installed != "" && $os_major_installed != "" && $os_platform_installed != 0
    3758                   && ([_mportkey $workername "{os.platform}"] != $os_platform_installed
    3759                   || [_mportkey $workername "{os.major}"] != $os_major_installed)} {
     3754        } elseif {$os_platform_installed ne {} && $os_major_installed ne {} && $os_platform_installed != 0
     3755                  && ([_mportkey $mport "{os.platform}"] != $os_platform_installed
     3756                  || [_mportkey $mport "{os.major}"] != $os_major_installed)} {
    37603757            ui_debug "platform mismatch ... upgrading!"
    37613758            set build_override 1
     
    37703767            if {[info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
    37713768                if {[llength $variationslist] > 0} {
    3772                     ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\". Use 'upgrade --enforce-variants' to switch to the requested variants."
     3769                    ui_warn "Skipping upgrade since $portname ${version_installed}_$revision_installed >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\". Use 'upgrade --enforce-variants' to switch to the requested variants."
    37733770                } else {
    3774                     ui_debug "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\"."
     3771                    ui_debug "Skipping upgrade since $portname ${version_installed}_$revision_installed >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\"."
    37753772                }
    37763773            } else {
    3777                 ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
     3774                ui_debug "No need to upgrade! $portname ${version_installed}_$revision_installed >= $portname ${version_in_tree}_$revision_in_tree"
    37783775            }
    37793776            set will_install no
     
    37943791    if {![info exists options(ports_nodeps)] && !$is_revupgrade} {
    37953792        # the last arg is because we might have to build from source if a rebuild is being forced
    3796         set status [_upgrade_dependencies portinfo depscache variationslist options [expr $will_build && $already_installed]]
     3793        set status [_upgrade_dependencies portinfo depscache variationslist options [expr {$will_build && $already_installed}]]
    37973794        if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
    3798             catch {mportclose $workername}
     3795            catch {mportclose $mport}
    37993796            return $status
    38003797        }
     
    38163813            }
    38173814
    3818             if { [llength deplist] > 0 } {
     3815            if {[llength deplist] > 0} {
    38193816                foreach dep $deplist {
    38203817                    set mpname [lindex $dep 2]
    3821                     if {![llength [array get depscache port:${mpname}]]} {
    3822                         set status [macports::_upgrade $mpname port:${mpname} $variationslist [array get options] depscache]
     3818                    if {![llength [array get depscache port:$mpname]]} {
     3819                        set status [macports::_upgrade $mpname port:$mpname $variationslist [array get options] depscache]
    38233820                        if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
    3824                             catch {mportclose $workername}
     3821                            catch {mportclose $mport}
    38253822                            return $status
    38263823                        }
     
    38293826            }
    38303827        }
    3831         mportclose $workername
     3828        mportclose $mport
    38323829        return 0
    38333830    }
    38343831
    38353832    if {$will_build} {
    3836         # install version_in_tree (but don't activate yet)
    3837         if {[catch {set result [mportexec $workername install]} result] || $result != 0} {
    3838             if {[info exists ::errorInfo]} {
    3839                 ui_debug "$::errorInfo"
    3840             }
    3841             ui_error "Unable to upgrade port: $result"
    3842             catch {mportclose $workername}
    3843             return 1
     3833        if {$already_installed
     3834            && ([info exists options(ports_upgrade_force)] || $build_override == 1)} {
     3835            # Tell archivefetch/unarchive not to use the installed archive, i.e. a
     3836            # fresh one will be either fetched or built locally.
     3837            # Ideally this would be done in the interp_options when we mportopen,
     3838            # but we don't know if we want to do this at that point.
     3839            set workername [ditem_key $mport workername]
     3840            $workername eval "set force_archive_refresh yes"
     3841
     3842            # run archivefetch and destroot for version_in_tree
     3843            # doing this instead of just running install ensures that we have the
     3844            # new copy ready but not yet installed, so we can safely uninstall the
     3845            # existing one.
     3846            if {[catch {set result [mportexec $mport archivefetch]} result] || $result != 0} {
     3847                if {[info exists ::errorInfo]} {
     3848                    ui_debug $::errorInfo
     3849                }
     3850                ui_error "Unable to upgrade port: $result"
     3851                catch {mportclose $mport}
     3852                return 1
     3853            }
     3854            # the following is a noop if archivefetch found an archive
     3855            if {[catch {set result [mportexec $mport destroot]} result] || $result != 0} {
     3856                if {[info exists ::errorInfo]} {
     3857                    ui_debug $::errorInfo
     3858                }
     3859                ui_error "Unable to upgrade port: $result"
     3860                catch {mportclose $mport}
     3861                return 1
     3862            }
     3863        } else {
     3864            # Normal non-forced case
     3865            # install version_in_tree (but don't activate yet)
     3866            if {[catch {set result [mportexec $mport install]} result] || $result != 0} {
     3867                if {[info exists ::errorInfo]} {
     3868                    ui_debug $::errorInfo
     3869                }
     3870                ui_error "Unable to upgrade port: $result"
     3871                catch {mportclose $mport}
     3872                return 1
     3873            }
    38443874        }
    38453875    }
     
    38593889                  && [catch {registry_uninstall::uninstall $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) [array get options]} result]} {
    38603890            global errorInfo
    3861             ui_debug "$errorInfo"
     3891            ui_debug $errorInfo
    38623892            ui_error "Uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
    3863             catch {mportclose $workername}
     3893            catch {mportclose $mport}
    38643894            return 1
    38653895        }
     
    38683898        }
    38693899        if {$anyactive && $version_in_tree == $version_active && $revision_in_tree == $revision_active
    3870             && $portinfo(canonical_active_variants) == $variant_active && $portname == $newname} {
     3900            && $portinfo(canonical_active_variants) == $variant_active && $portname eq $newname} {
    38713901            set anyactive no
    38723902        }
    38733903    }
    3874     if {$anyactive && $portname != $newname} {
     3904    if {$anyactive && $portname ne $newname} {
    38753905        # replaced_by in effect, deactivate the old port
    38763906        # we have to force the deactivate in case of dependents
     
    38783908        set options(ports_force) yes
    38793909        if {$is_dryrun eq "yes"} {
    3880             ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}${variant_active} (dry run)"
     3910            ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}$variant_active (dry run)"
    38813911        } elseif {![catch {registry::active $portname}] &&
    38823912                  ![registry::run_target $regref deactivate [array get options]]
    38833913                  && [catch {portimage::deactivate $portname $version_active $revision_active $variant_active [array get options]} result]} {
    38843914            global errorInfo
    3885             ui_debug "$errorInfo"
    3886             ui_error "Deactivating $portname @${version_active}_${revision_active}${variant_active} failed: $result"
    3887             catch {mportclose $workername}
     3915            ui_debug $errorInfo
     3916            ui_error "Deactivating $portname @${version_active}_${revision_active}$variant_active failed: $result"
     3917            catch {mportclose $mport}
    38883918            return 1
    38893919        }
     
    38933923        set anyactive no
    38943924    }
    3895     if {[info exists options(port_uninstall_old)] && $portname == $newname} {
     3925    if {[info exists options(port_uninstall_old)] && $portname eq $newname} {
    38963926        # uninstalling now could fail due to dependents when not forced,
    38973927        # because the new version is not installed
     
    39013931    if {$is_dryrun eq "yes"} {
    39023932        if {$anyactive} {
    3903             ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}${variant_active} (dry run)"
     3933            ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}$variant_active (dry run)"
    39043934        }
    39053935        ui_msg "Skipping activate $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
    3906     } elseif {[catch {set result [mportexec $workername activate]} result]} {
     3936    } elseif {[catch {set result [mportexec $mport activate]} result]} {
    39073937        global errorInfo
    3908         ui_debug "$errorInfo"
     3938        ui_debug $errorInfo
    39093939        ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants): $result"
    3910         catch {mportclose $workername}
     3940        catch {mportclose $mport}
    39113941        return 1
    39123942    }
     
    39183948
    39193949        registry::open_dep_map
    3920         if {$portname != $newname} {
     3950        if {$portname ne $newname} {
    39213951            set deplist [registry::list_dependents $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
    39223952        } else {
     
    39293959        }
    39303960
    3931         if { [llength deplist] > 0 } {
     3961        if {[llength deplist] > 0} {
    39323962            foreach dep $deplist {
    39333963                set mpname [lindex $dep 2]
    3934                 if {![llength [array get depscache port:${mpname}]]} {
    3935                     set status [macports::_upgrade $mpname port:${mpname} $variationslist [array get options] depscache]
     3964                if {![llength [array get depscache port:$mpname]]} {
     3965                    set status [macports::_upgrade $mpname port:$mpname $variationslist [array get options] depscache]
    39363966                    if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
    3937                         catch {mportclose $workername}
     3967                        catch {mportclose $mport}
    39383968                        return $status
    39393969                    }
     
    39433973    }
    39443974
    3945     if {[info exists uninstall_later] && $uninstall_later == yes} {
     3975    if {[info exists uninstall_later] && $uninstall_later eq yes} {
    39463976        foreach i $ilist {
    39473977            set version [lindex $i 1]
    39483978            set revision [lindex $i 2]
    39493979            set variant [lindex $i 3]
    3950             if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants) && $portname == $newname} {
     3980            if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants) && $portname eq $newname} {
    39513981                continue
    39523982            }
    39533983            set epoch [lindex $i 5]
    3954             ui_debug "Uninstalling $portname ${version}_${revision}${variant}"
     3984            ui_debug "Uninstalling $portname ${version}_${revision}$variant"
    39553985            set regref [registry::open_entry $portname $version $revision $variant $epoch]
    39563986            if {$is_dryrun eq "yes"} {
    3957                 ui_msg "Skipping uninstall $portname @${version}_${revision}${variant} (dry run)"
     3987                ui_msg "Skipping uninstall $portname @${version}_${revision}$variant (dry run)"
    39583988            } elseif {![registry::run_target $regref uninstall $optionslist]
    39593989                      && [catch {registry_uninstall::uninstall $portname $version $revision $variant $optionslist} result]} {
    39603990                global errorInfo
    3961                 ui_debug "$errorInfo"
     3991                ui_debug $errorInfo
    39623992                # replaced_by can mean that we try to uninstall all versions of the old port, so handle errors due to dependents
    3963                 if {$result != "Please uninstall the ports that depend on $portname first." && ![ui_isset ports_processall]} {
    3964                     ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
    3965                     catch {mportclose $workername}
     3993                if {$result ne "Please uninstall the ports that depend on $portname first." && ![ui_isset ports_processall]} {
     3994                    ui_error "Uninstall $portname @${version}_${revision}$variant failed: $result"
     3995                    catch {mportclose $mport}
    39663996                    return 1
    39673997                }
     
    39714001
    39724002    # close the port handle
    3973     mportclose $workername
     4003    mportclose $mport
    39744004    return 0
    39754005}
     
    39824012          $variationslistname variationslist \
    39834013          $optionsname options
    3984     upvar workername parentworker
     4014    upvar mport parentmport
    39854015
    39864016    # If we're following dependents, we only want to follow this port's
     
    39964026    unset -nocomplain options(ports_do_dependents)
    39974027
    3998     set parent_interp [ditem_key $parentworker workername]
     4028    set parentworker [ditem_key $parentmport workername]
    39994029    # each required dep type is upgraded
    40004030    if {$build_needed && ![global_option_isset ports_binary_only]} {
    4001         set dtypes [_deptypes_for_target destroot $parent_interp]
     4031        set dtypes [_deptypes_for_target destroot $parentworker]
    40024032    } else {
    4003         set dtypes [_deptypes_for_target install $parent_interp]
     4033        set dtypes [_deptypes_for_target install $parentworker]
    40044034    }
    40054035
     
    40084038        if {[info exists portinfo($dtype)]} {
    40094039            foreach i $portinfo($dtype) {
    4010                 set d [$parent_interp eval _get_dep_port $i]
    4011                 if {![llength [array get depscache port:${d}]] && ![llength [array get depscache $i]]} {
    4012                     if {$d != ""} {
     4040                set d [$parentworker eval _get_dep_port $i]
     4041                if {![llength [array get depscache port:$d]] && ![llength [array get depscache $i]]} {
     4042                    if {$d ne {}} {
    40134043                        set dspec port:$d
    40144044                    } else {
     
    40334063#   * command: The only valid commands are list, set and show
    40344064#   * group: This argument should correspond to a directory under
    4035 #            $macports::prefix/etc/select.
     4065#            ${macports::prefix}/etc/select.
    40364066#   * version: This argument is only used by the 'set' command.
    40374067# On error mportselect returns with the code 'error'.
    4038 proc mportselect {command group {version ""}} {
     4068proc mportselect {command group {version {}}} {
    40394069    ui_debug "mportselect \[$command] \[$group] \[$version]"
    40404070
    4041     set conf_path "$macports::prefix/etc/select/$group"
     4071    set conf_path ${macports::prefix}/etc/select/$group
    40424072    if {![file isdirectory $conf_path]} {
    40434073        return -code error "The specified group '$group' does not exist."
     
    40484078            if {[catch {set versions [glob -directory $conf_path *]} result]} {
    40494079                global errorInfo
    4050                 ui_debug "$result: $errorInfo"
    4051                 return -code error [concat "No configurations associated " \
     4080                ui_debug "${result}: $errorInfo"
     4081                return -code error [concat "No configurations associated" \
    40524082                                           "with '$group' were found."]
    40534083            }
     
    40664096        }
    40674097        set {
    4068             # Use $conf_path/$version to read in sources.
    4069             if {$version == "" || $version == "base" || $version == "current"
    4070                     || [catch {set src_file [open "$conf_path/$version"]} result]} {
     4098            # Use ${conf_path}/$version to read in sources.
     4099            if {$version eq {} || $version eq "base" || $version eq "current"
     4100                    || [catch {set src_file [open "${conf_path}/$version"]} result]} {
    40714101                global errorInfo
    4072                 ui_debug "$result: $errorInfo"
     4102                ui_debug "${result}: $errorInfo"
    40734103                return -code error "The specified version '$version' is not valid."
    40744104            }
     
    40764106            close $src_file
    40774107
    4078             # Use $conf_path/base to read in targets.
    4079             if {[catch {set tgt_file [open "$conf_path/base"]} result]} {
     4108            # Use ${conf_path}/base to read in targets.
     4109            if {[catch {set tgt_file [open ${conf_path}/base]} result]} {
    40804110                global errorInfo
    4081                 ui_debug "$result: $errorInfo"
    4082                 return -code error [concat "The configuration file " \
    4083                                            "'$conf_path/base' could not be " \
     4111                ui_debug "${result}: $errorInfo"
     4112                return -code error [concat "The configuration file" \
     4113                                           "'${conf_path}/base' could not be" \
    40844114                                           "opened."]
    40854115            }
    4086             set tgts [split [read -nonewline $tgt_file] "\n"]
     4116            set tgts [split [read -nonewline $tgt_file] \n]
    40874117            close $tgt_file
    40884118
     
    41164146                    }
    41174147                }
    4118                 set i [expr $i+1]
     4148                incr i
    41194149            }
    41204150
    41214151            # Update the selected version.
    4122             set selected_version "$conf_path/current"
     4152            set selected_version ${conf_path}/current
    41234153            if {[file exists $selected_version]} {
    41244154                file delete $selected_version
     
    41284158        }
    41294159        show {
    4130             set selected_version "$conf_path/current"
     4160            set selected_version ${conf_path}/current
    41314161
    41324162            if {![file exists $selected_version]} {
    4133                 return "none"
     4163                return none
    41344164            } else {
    41354165                return [file readlink $selected_version]
     
    41484178        return $env(TMPDIR)
    41494179    } else {
    4150         return "/tmp"
     4180        return /tmp
    41514181    }
    41524182}
     
    41554185proc macports::arch_runnable {arch} {
    41564186    global macports::os_major macports::os_arch macports::os_platform
    4157     if {${macports::os_platform} == "darwin"} {
    4158         if {${macports::os_major} >= 11 && [string first "ppc" $arch] == 0} {
     4187    if {$macports::os_platform eq "darwin"} {
     4188        if {$macports::os_major >= 11 && [string first "ppc" $arch] == 0} {
    41594189            return no
    4160         } elseif {${macports::os_arch} == "i386" && $arch == "ppc64"} {
     4190        } elseif {$macports::os_arch eq "i386" && $arch eq "ppc64"} {
    41614191            return no
    4162         } elseif {${macports::os_major} <= 8 && $arch == "x86_64"} {
     4192        } elseif {$macports::os_major <= 8 && $arch eq "x86_64"} {
    41634193            return no
    41644194        }
     
    41834213    set files [registry::file search active 1 binary -null]
    41844214    set files_count [llength $files]
    4185     set fancy_output [expr ![macports::ui_isset ports_debug] && [isatty stdout]]
     4215    set fancy_output [expr {![macports::ui_isset ports_debug] && [isatty stdout]}]
    41864216    if {$files_count > 0} {
    41874217        registry::write {
     
    41924222                    if {$fancy_output} {
    41934223                        if {$files_count < 10000 || $i % 10 == 1 || $i == $files_count} {
    4194                             ui_msg -nonewline "\r$macports::ui_prefix Updating database of binaries: [expr ($i * 1000 / $files_count) / 10.0]%"
     4224                            ui_msg -nonewline "\r$macports::ui_prefix Updating database of binaries: [expr {($i * 1000 / $files_count) / 10.0}]%"
    41954225                            flush stdout
    41964226                        }
    41974227                    }
    41984228                    set fpath [$f actual_path]
    4199                     ui_debug "Updating binary flag for file $i of $files_count: $fpath"
     4229                    ui_debug "Updating binary flag for file $i of ${files_count}: $fpath"
    42004230                    incr i
    42014231
     
    42034233                        # handle errors (e.g. file not found, permission denied) gracefully
    42044234                        if {$fancy_output} {
    4205                             ui_msg ""
     4235                            ui_msg {}
    42064236                        }
    42074237                        ui_warn "Error determining file type of `$fpath': $fileIsBinaryError"
     
    42144244            }
    42154245        }
    4216         ui_msg ""
     4246        ui_msg {}
    42174247    }
    42184248
     
    42234253        ui_msg -nonewline "$macports::ui_prefix Scanning binaries for linking errors"
    42244254        set handle [machista::create_handle]
    4225         if {$handle == "NULL"} {
     4255        if {$handle eq "NULL"} {
    42264256            error "Error creating libmachista handle"
    42274257        }
     
    42334263            if {$fancy_output} {
    42344264                if {$binary_count < 10000 || $i % 10 == 1 || $i == $binary_count} {
    4235                     ui_msg -nonewline "\r$macports::ui_prefix Scanning binaries for linking errors: [expr ($i * 1000 / $binary_count) / 10.0]%"
     4265                    ui_msg -nonewline "\r$macports::ui_prefix Scanning binaries for linking errors: [expr {($i * 1000 / $binary_count) / 10.0}]%"
    42364266                    flush stdout
    42374267                }
    42384268            }
    42394269            set bpath [$b actual_path]
    4240             #ui_debug "$i/$binary_count: $bpath"
     4270            #ui_debug "${i}/${binary_count}: $bpath"
    42414271            incr i
    42424272
     
    42524282                } else {
    42534283                    if {$fancy_output} {
    4254                         ui_msg ""
     4284                        ui_msg {}
    42554285                    }
    42564286                    ui_warn "Error parsing file ${bpath}: [machista::strerror $returncode]"
     
    42604290
    42614291            set architecture [$result cget -mt_archs]
    4262             while {$architecture != "NULL"} {
    4263                 if {[info exists options(ports_rev-upgrade_id-loadcmd-check)] && $options(ports_rev-upgrade_id-loadcmd-check) == "yes"} {
    4264                     if {[$architecture cget -mat_install_name] != "NULL" && [$architecture cget -mat_install_name] != ""} {
     4292            while {$architecture ne "NULL"} {
     4293                if {[info exists options(ports_rev-upgrade_id-loadcmd-check)] && $options(ports_rev-upgrade_id-loadcmd-check) eq "yes"} {
     4294                    if {[$architecture cget -mat_install_name] ne "NULL" && [$architecture cget -mat_install_name] ne {}} {
    42654295                        # check if this lib's install name actually refers to this file itself
    42664296                        # if this is not the case software linking against this library might have erroneous load commands
    42674297                        if {0 == [catch {set idloadcmdpath [revupgrade_handle_special_paths $bpath [$architecture cget -mat_install_name]]}]} {
    4268                             if {[string index $idloadcmdpath 0] != "/"} {
     4298                            if {[string index $idloadcmdpath 0] ne "/"} {
    42694299                                set port [registry::entry owner $bpath]
    4270                                 if {$port != ""} {
     4300                                if {$port ne {}} {
    42714301                                    set portname [$port name]
    42724302                                } else {
    4273                                     set portname "<unknown-port>"
     4303                                    set portname <unknown-port>
    42744304                                }
    42754305                                if {$fancy_output} {
    4276                                     ui_msg ""
     4306                                    ui_msg {}
    42774307                                }
    42784308                                ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] (belonging to port $portname) contains relative path"
    42794309                            } elseif {![file exists $idloadcmdpath]} {
    42804310                                set port [registry::entry owner $bpath]
    4281                                 if {$port != ""} {
     4311                                if {$port ne {}} {
    42824312                                    set portname [$port name]
    42834313                                } else {
    4284                                     set portname "<unknown-port>"
     4314                                    set portname <unknown-port>
    42854315                                }
    42864316                                if {$fancy_output} {
    4287                                     ui_msg ""
     4317                                    ui_msg {}
    42884318                                }
    42894319                                ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to non-existant file $idloadcmdpath"
    42904320                                ui_warn "This is probably a bug in the $portname port and might cause problems in libraries linking against this file"
    42914321                            } else {
    4292    
     4322
    42934323                                set hash_this [sha256 file $bpath]
    42944324                                set hash_idloadcmd [sha256 file $idloadcmdpath]
    4295    
    4296                                 if {$hash_this != $hash_idloadcmd} {
     4325
     4326                                if {$hash_this ne $hash_idloadcmd} {
    42974327                                    set port [registry::entry owner $bpath]
    4298                                     if {$port != ""} {
     4328                                    if {$port ne {}} {
    42994329                                        set portname [$port name]
    43004330                                    } else {
    4301                                         set portname "<unknown-port>"
     4331                                        set portname <unknown-port>
    43024332                                    }
    43034333                                    if {$fancy_output} {
    4304                                         ui_msg ""
     4334                                        ui_msg {}
    43054335                                    }
    4306                                     ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file $idloadcmdpath, which is a different file"
     4336                                    ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file ${idloadcmdpath}, which is a different file"
    43074337                                    ui_warn "This is probably a bug in the $portname port and might cause problems in libraries linking against this file"
    43084338                                }
     
    43214351                set loadcommand [$architecture cget -mat_loadcmds]
    43224352
    4323                 while {$loadcommand != "NULL"} {
     4353                while {$loadcommand ne "NULL"} {
    43244354                    if {0 != [catch {set filepath [revupgrade_handle_special_paths $bpath [$loadcommand cget -mlt_install_name]]}]} {
    43254355                        set loadcommand [$loadcommand cget -next]
     
    43344364                        if {![info exists files_warned_about($filepath)]} {
    43354365                            if {[macports::ui_isset ports_verbose]} {
    4336                                 ui_msg ""
     4366                                ui_msg {}
    43374367                            }
    4338                             ui_info "Could not open $filepath: [machista::strerror $libreturncode] (referenced from $bpath)"
     4368                            ui_info "Could not open ${filepath}: [machista::strerror $libreturncode] (referenced from $bpath)"
    43394369                            set files_warned_about($filepath) yes
    43404370                        }
     
    43494379                    set libarchitecture [$libresult cget -mt_archs]
    43504380                    set libarch_found false;
    4351                     while {$libarchitecture != "NULL"} {
    4352                         if {[$architecture cget -mat_arch] != [$libarchitecture cget -mat_arch]} {
     4381                    while {$libarchitecture ne "NULL"} {
     4382                        if {[$architecture cget -mat_arch] ne [$libarchitecture cget -mat_arch]} {
    43534383                            set libarchitecture [$libarchitecture cget -next]
    43544384                            continue;
    43554385                        }
    43564386
    4357                         if {[$loadcommand cget -mlt_version] != [$libarchitecture cget -mat_version] && [$loadcommand cget -mlt_comp_version] > [$libarchitecture cget -mat_comp_version]} {
     4387                        if {[$loadcommand cget -mlt_version] ne [$libarchitecture cget -mat_version] && [$loadcommand cget -mlt_comp_version] > [$libarchitecture cget -mat_comp_version]} {
    43584388                            if {[macports::ui_isset ports_verbose]} {
    4359                                 ui_msg ""
     4389                                ui_msg {}
    43604390                            }
    43614391                            ui_info "Incompatible library version: $bpath requires version [machista::format_dylib_version [$loadcommand cget -mlt_comp_version]] or later, but $filepath provides version [machista::format_dylib_version [$libarchitecture cget -mat_comp_version]]"
     
    43684398                    }
    43694399
    4370                     if {$libarch_found == false} {
     4400                    if {$libarch_found eq false} {
    43714401                        ui_debug "Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file $filepath"
    43724402                        if {[path_is_in_prefix $filepath]} {
     
    43844414            }
    43854415        }
    4386         ui_msg ""
     4416        ui_msg {}
    43874417
    43884418        machista::destroy_handle $handle
     
    43974427        foreach file $broken_files {
    43984428            set port [registry::entry owner $file]
    4399             if {$port != ""} {
     4429            if {$port ne {}} {
    44004430                lappend broken_ports $port
    44014431                lappend broken_files_by_port($port) $file
     
    44064436        set broken_ports [lsort -unique $broken_ports]
    44074437
    4408         if {${macports::revupgrade_mode} == "rebuild"} {
     4438        if {$macports::revupgrade_mode eq "rebuild"} {
    44094439            # don't try to rebuild ports that don't exist in the tree
    44104440            set temp_broken_ports {}
     
    44124442                set portname [$port name]
    44134443                if {[catch {mportlookup $portname} result]} {
    4414                     ui_debug "$::errorInfo"
     4444                    ui_debug $::errorInfo
    44154445                    error "lookup of portname $portname failed: $result"
    44164446                }
     
    44444474                    ui_error "Please run port -d -y rev-upgrade and use the output to report a bug."
    44454475                }
    4446                 error "Port $portname still broken after rebuilding [expr $broken_port_counts($portname) - 1] time(s)"
     4476                error "Port $portname still broken after rebuilding [expr {$broken_port_counts($portname) - 1}] time(s)"
    44474477            } elseif {$broken_port_counts($portname) > 1 && [global_option_isset ports_binary_only]} {
    44484478                error "Port $portname still broken after reinstalling -- can't rebuild due to binary-only mode"
     
    44524482        unset temp_broken_ports
    44534483
    4454         if {${macports::revupgrade_mode} != "rebuild"} {
     4484        if {$macports::revupgrade_mode ne "rebuild"} {
    44554485            ui_msg "$macports::ui_prefix Found [llength $broken_ports] broken port(s):"
    44564486            foreach port $broken_ports {
     
    45054535                    set unsorted_ports [lreplace $unsorted_ports $index $index]
    45064536
    4507                     # remove edges 
     4537                    # remove edges
    45084538                    foreach target $revadjlist($port) {
    45094539                        set index [lsearch -exact $adjlist($target) $port]
     
    45444574            if {![info exists depscache(port:$portname)]} {
    45454575                # set rev-upgrade options and nodeps if this is not the first run
    4546                 set my_options(ports_revupgrade) "yes"
     4576                set my_options(ports_revupgrade) yes
    45474577                unset -nocomplain my_options(ports_nodeps)
    45484578                unset -nocomplain my_options(ports_revupgrade_second_run)
     
    45554585
    45564586                # call macports::upgrade with ports_revupgrade option to rebuild the port
    4557                 set status [macports::upgrade $portname "port:$portname" \
     4587                set status [macports::upgrade $portname port:$portname \
    45584588                    {} [array get my_options] depscache]
    45594589                ui_debug "Rebuilding port $portname finished with status $status"
     
    45644594        }
    45654595
    4566         if {[info exists options(ports_dryrun)] && $options(ports_dryrun) == "yes"} {
     4596        if {[info exists options(ports_dryrun)] && $options(ports_dryrun) eq "yes"} {
    45674597            ui_warn "If this was no dry run, rev-upgrade would now run the checks again to find unresolved and newly created problems"
    45684598            return 0
     
    45974627    set corrected_path $path
    45984628
    4599     set loaderpath_idx [string first "@loader_path" $corrected_path]
     4629    set loaderpath_idx [string first @loader_path $corrected_path]
    46004630    if {$loaderpath_idx != -1} {
    4601         set corrected_path [string replace $corrected_path $loaderpath_idx $loaderpath_idx+11 [file dirname $fname]]
    4602     }
    4603 
    4604     set executablepath_idx [string first "@executable_path" $corrected_path]
     4631        set corrected_path [string replace $corrected_path $loaderpath_idx ${loaderpath_idx}+11 [file dirname $fname]]
     4632    }
     4633
     4634    set executablepath_idx [string first @executable_path $corrected_path]
    46054635    if {$executablepath_idx != -1} {
    46064636        ui_debug "Ignoring loadcommand containing @executable_path in $fname"
     
    46084638    }
    46094639
    4610     set rpath_idx [string first "@rpath" $corrected_path]
     4640    set rpath_idx [string first @rpath $corrected_path]
    46114641    if {$rpath_idx != -1} {
    46124642        ui_debug "Ignoring loadcommand containing @rpath in $fname"
     
    46414671            # make this port the new last broken port by prepending it to the stack
    46424672            set stack [linsert $stack 0 $dep]
    4643            
     4673
    46444674            set is_broken_port true
    46454675        }
     
    46644694    } elseif {[info exists ping_cache($host)]} {
    46654695        # expire entries after 1 day
    4666         if {[expr [clock seconds] - [lindex $ping_cache($host) 1]] <= 86400} {
     4696        if {[clock seconds] - [lindex $ping_cache($host) 1] <= 86400} {
    46674697            return [lindex $ping_cache($host) 0]
    46684698        }
     
    46844714        set all_names {}
    46854715        array set defaults {applications_dir /Applications/MacPorts prefix /opt/local type tbz2}
    4686         set conf_file "${macports_conf_path}/archive_sites.conf"
     4716        set conf_file ${macports_conf_path}/archive_sites.conf
    46874717        set conf_options {applications_dir frameworks_dir name prefix type urls}
    46884718        if {[file isfile $conf_file]} {
     
    46914721                if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
    46924722                    if {[lsearch -exact $conf_options $option] >= 0} {
    4693                         if {$option == "name"} {
     4723                        if {$option eq "name"} {
    46944724                            set cur_name $val
    46954725                            lappend all_names $val
    46964726                        } elseif {[info exists cur_name]} {
    46974727                            set trimmedval [string trim $val]
    4698                             if {$option == "urls"} {
     4728                            if {$option eq "urls"} {
    46994729                                set processed_urls {}
    47004730                                foreach url $trimmedval {
     
    47314761                if {![info exists sites($cur_name)]} {
    47324762                    ui_warn "archive_sites.conf: no urls set for $cur_name"
    4733                     set sites($cur_name) ""
    4734                     lappend archive_sites_conf_values portfetch::mirror_sites::sites($cur_name) ""
     4763                    set sites($cur_name) {}
     4764                    lappend archive_sites_conf_values portfetch::mirror_sites::sites($cur_name) {}
    47354765                }
    47364766            }
  • branches/gsoc11-statistics/base/src/package1.0/portarchivefetch.tcl

    r105085 r107206  
    33#
    44# Copyright (c) 2002 - 2003 Apple Inc.
    5 # Copyright (c) 2004 - 2012 The MacPorts Project
     5# Copyright (c) 2004 - 2013 The MacPorts Project
    66# All rights reserved.
    77#
     
    9494            continue
    9595        }
    96         if {$portfetch::mirror_sites::archive_prefix($site) == $prefix &&
     96        if {$portfetch::mirror_sites::sites($site) ne {} &&
     97            $portfetch::mirror_sites::archive_prefix($site) == $prefix &&
    9798            $portfetch::mirror_sites::archive_frameworks_dir($site) == $frameworks_dir &&
    9899            $portfetch::mirror_sites::archive_applications_dir($site) == $applications_dir &&
     
    153154# the listed url variable and associated archive file
    154155proc portarchivefetch::fetchfiles {args} {
    155     global archivefetch.fulldestpath UI_PREFIX
    156     global archivefetch.user archivefetch.password archivefetch.use_epsv \
    157            archivefetch.ignore_sslcert
    158     global portverbose ports_binary_only
     156    global archivefetch.fulldestpath UI_PREFIX \
     157          archivefetch.user archivefetch.password archivefetch.use_epsv \
     158           archivefetch.ignore_sslcert \
     159          portverbose ports_binary_only
    159160    variable archivefetch_urls
    160161    variable ::portfetch::urlmap
  • branches/gsoc11-statistics/base/src/package1.0/portdmg.tcl

    r105085 r107206  
    5858
    5959proc portdmg::package_dmg {portname portversion portrevision} {
    60     global UI_PREFIX package.destpath portpath
    61     global os.platform os.arch os.version os.major
     60    global UI_PREFIX package.destpath portpath \
     61          os.platform os.arch os.version os.major
    6262
    6363    if {[expr (${portrevision} > 0)]} {
  • branches/gsoc11-statistics/base/src/package1.0/portdpkg.tcl

    r105085 r107206  
    4545
    4646# Options
    47 options dpkg.asroot
    48 options package.destpath
     47options dpkg.asroot \
     48        package.destpath
    4949
    5050# Set up defaults
  • branches/gsoc11-statistics/base/src/package1.0/portmdmg.tcl

    r105085 r107206  
    33# $Id$
    44#
    5 # Copyright (c) 2005, 2007-2011 The MacPorts Project
     5# Copyright (c) 2005, 2007-2013 The MacPorts Project
    66# Copyright (c) 2003-2004 Apple Inc.
    77# All rights reserved.
     
    5858
    5959proc portmdmg::package_mdmg {portname portepoch portversion portrevision} {
    60     global UI_PREFIX package.destpath portpath
    61     global os.platform os.arch os.version os.major
     60    global UI_PREFIX package.destpath portpath \
     61          os.platform os.arch os.version os.major
    6262
    6363    if {[expr (${portrevision} > 0)]} {
  • branches/gsoc11-statistics/base/src/package1.0/portmpkg.tcl

    r105085 r107206  
    33# $Id$
    44#
    5 # Copyright (c) 2005, 2007 - 2012 The MacPorts Project
     5# Copyright (c) 2005, 2007 - 2013 The MacPorts Project
    66# Copyright (c) 2002 - 2004 Apple Inc.
    77# All rights reserved.
  • branches/gsoc11-statistics/base/src/package1.0/portpkg.tcl

    r105577 r107206  
    33# $Id$
    44#
    5 # Copyright (c) 2005, 2007 - 2012 The MacPorts Project
     5# Copyright (c) 2005, 2007 - 2013 The MacPorts Project
    66# Copyright (c) 2002 - 2003 Apple Inc.
    77# All rights reserved.
  • branches/gsoc11-statistics/base/src/package1.0/portrpm.tcl

    r105085 r107206  
    33# $Id$
    44#
    5 # Copyright (c) 2005 - 2007, 2009 - 2011 The MacPorts Project
     5# Copyright (c) 2005 - 2007, 2009 - 2011, 2013 The MacPorts Project
    66# Copyright (c) 2002 - 2003 Apple Inc.
    77# All rights reserved.
     
    4444
    4545# Options
    46 options rpm.asroot
    47 options package.destpath
     46options rpm.asroot \
     47        package.destpath
    4848
    4949# Set up defaults
     
    6464
    6565proc portrpm::rpm_pkg {portname portversion portrevision} {
    66     global UI_PREFIX rpm.asroot package.destpath portdbpath destpath workpath prefix categories maintainers description long_description homepage epoch portpath
    67         global os.platform os.arch os.version os.major supported_archs configure.build_arch license
     66    global UI_PREFIX rpm.asroot package.destpath portdbpath destpath workpath \
     67           prefix categories maintainers description long_description \
     68           homepage epoch portpath os.platform os.arch os.version os.major \
     69           supported_archs configure.build_arch license
    6870
    6971    set rpmdestpath ""
  • branches/gsoc11-statistics/base/src/package1.0/portsrpm.tcl

    r105085 r107206  
    33# $Id$
    44#
    5 # Copyright (c) 2007, 2009, 2011 The MacPorts Project
     5# Copyright (c) 2007, 2009, 2011, 2013 The MacPorts Project
    66# Copyright (c) 2002 - 2003 Apple Inc.
    77# All rights reserved.
     
    6060
    6161proc portsrpm::srpm_pkg {portname portversion portrevision} {
    62     global UI_PREFIX package.destpath portdbpath destpath workpath distpath prefix categories maintainers description long_description homepage epoch portpath distfiles
    63         global os.platform os.arch os.version os.major
     62    global UI_PREFIX package.destpath portdbpath destpath workpath distpath \
     63           prefix categories maintainers description long_description \
     64           homepage epoch portpath distfiles os.platform os.arch os.version \
     65           os.major
    6466
    6567    set fetch_urls {}
  • branches/gsoc11-statistics/base/src/package1.0/portunarchive.tcl

    r105085 r107206  
    279279        file mtime $statefile [clock seconds]
    280280        chownAsRoot $statefile
     281        update_statefile checksum [sha256 file [option portpath]/Portfile] $statefile
    281282        set newstate 1
    282283    } else {
  • branches/gsoc11-statistics/base/src/pextlib1.0/system.c

    r105085 r107206  
    8181{
    8282    Tcl_Obj *tcl_result;
    83     int supported;
     83    int active;
    8484    int len;
    8585
    86     tcl_result = Tcl_GetVar2Ex(interp, "portsandbox_supported", NULL, TCL_GLOBAL_ONLY);
    87     if (!tcl_result || Tcl_GetBooleanFromObj(interp, tcl_result, &supported) != TCL_OK || !supported) {
     86    tcl_result = Tcl_GetVar2Ex(interp, "portsandbox_active", NULL, TCL_GLOBAL_ONLY);
     87    if (!tcl_result || Tcl_GetBooleanFromObj(interp, tcl_result, &active) != TCL_OK || !active) {
    8888        return 0;
    8989    }
  • branches/gsoc11-statistics/base/src/pextlib1.0/tracelib.c

    r105814 r107206  
    33 * $Id$
    44 *
    5  * Copyright (c) 2007 Eugene Pimenov (GSoC), The MacPorts Project.
     5 * Copyright (c) 2007-2008 Eugene Pimenov (GSoC)
     6 * Copyright (c) 2008-2010, 2012-2013 The MacPorts Project
    67 * All rights reserved.
    78 *
  • branches/gsoc11-statistics/base/src/port/port-help.tcl

    r105085 r107206  
    4343Removes files associated with the given ports
    4444
     45--archive     Removes temporary archives
    4546--dist        Removes downloaded distfiles
    4647--logs        Removes log files
  • branches/gsoc11-statistics/base/src/port/port.tcl

    r105577 r107206  
    66# $Id$
    77#
    8 # Copyright (c) 2004-2012 The MacPorts Project
     8# Copyright (c) 2004-2013 The MacPorts Project
    99# Copyright (c) 2004 Robert Shaw <rshaw@opendarwin.org>
    1010# Copyright (c) 2002-2003 Apple Inc.
     
    39463946proc action_portcmds { action portlist opts } {
    39473947    # Operations on the port's directory and Portfile
    3948     global env boot_env
    3949     global current_portdir
     3948    global env boot_env current_portdir
    39503949
    39513950    array set local_options $opts
     
    44654464    uninstall   {follow-dependents follow-dependencies no-exec}
    44664465    variants    {index}
    4467     clean       {all dist work logs}
     4466    clean       {all archive dist work logs}
    44684467    mirror      {new}
    44694468    lint        {nitpick}
     
    46634662
    46644663proc process_cmd { argv } {
    4665     global cmd_argc cmd_argv cmd_argn
    4666     global global_options global_options_base private_options ui_options
    4667     global current_portdir
     4664    global cmd_argc cmd_argv cmd_argn \
     4665           global_options global_options_base private_options ui_options \
     4666          current_portdir
    46684667    set cmd_argv $argv
    46694668    set cmd_argc [llength $argv]
     
    47984797# return text action beginning with $text
    47994798proc complete_action { text state } {   
    4800     global action_array
    4801     global complete_choices complete_position
     4799    global action_array complete_choices complete_position
    48024800
    48034801    if {$state == 0} {
     
    49904988term_init_size
    49914989
     4990global env boot_env argv0 cmdname argc argv cmd_argc cmd_argv cmd_argn \
     4991       current_portdir global_options_base exit_status
     4992
    49924993# Save off a copy of the environment before mportinit monkeys with it
    4993 global env boot_env
    49944994array set boot_env [array get env]
    49954995
    4996 global argv0
    4997 global cmdname
    49984996set cmdname [file tail $argv0]
    49994997
    50004998# Setp cmd_argv to match argv
    5001 global argc argv
    5002 global cmd_argc cmd_argv cmd_argn
    50034999set cmd_argv $argv
    50045000set cmd_argc $argc
     
    50455041
    50465042# Set up some global state for our code
    5047 global current_portdir
    50485043set current_portdir [pwd]
    50495044
    50505045# Freeze global_options into global_options_base; global_options
    50515046# will be reset to global_options_base prior to processing each command.
    5052 global global_options_base
    50535047set global_options_base [array get global_options]
    50545048
    50555049# First process any remaining args as action(s)
    5056 global exit_status
    50575050set exit_status 0
    50585051if { [llength $remaining_args] > 0 } {
  • branches/gsoc11-statistics/base/src/port1.0/fetch_common.tcl

    r105085 r107206  
    33#
    44# Copyright (c) 2002 - 2003 Apple Inc.
    5 # Copyright (c) 2004 - 2012 The MacPorts Project
     5# Copyright (c) 2004 - 2013 The MacPorts Project
    66# All rights reserved.
    77#
     
    8585# pre-registered set of sites, and if so, return them.
    8686proc portfetch::mirror_sites {mirrors tag subdir mirrorfile} {
    87     global UI_PREFIX name dist_subdir
    88     global global_mirror_site fallback_mirror_site
     87    global UI_PREFIX name dist_subdir \
     88          global_mirror_site fallback_mirror_site
    8989
    9090    if {[file exists $mirrorfile]} {
     
    344344    # check_broken_dns returns true at most once, so we don't have to worry about spamming this message
    345345    if {[check_broken_dns]} {
    346         ui_warn "Your DNS server(s) incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports."
    347     }
    348 }
     346        ui_warn "Your DNS servers incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports."
     347    }
     348}
  • branches/gsoc11-statistics/base/src/port1.0/portactivate.tcl

    r79672 r107206  
    6060
    6161proc portactivate::activate_main {args} {
    62     global env subport version revision portvariants user_options PortInfo
     62    global env subport version revision portvariants user_options PortInfo startupitem.autostart UI_PREFIX
    6363
    6464    registry_activate $subport $version $revision $portvariants [array get user_options]
     
    9898    }
    9999
     100    if {[tbool startupitem.autostart]} {
     101        ui_notice "$UI_PREFIX [format [msgcat::mc "Loading %s"] [option subport]]"
     102        if {[eval_targets "load"]} {
     103            ui_error [format [msgcat::mc "Failed to load %s"] [option subport]]
     104            return 1
     105        }
     106    }
     107
    100108    return 0
    101109}
  • branches/gsoc11-statistics/base/src/port1.0/portbuild.tcl

    r105085 r107206  
    33# $Id$
    44#
    5 # Copyright (c) 2007 - 2012 The MacPorts Project
     5# Copyright (c) 2007 - 2013 The MacPorts Project
    66# Copyright (c) 2002 - 2004 Apple Inc.
    77# All rights reserved.
     
    4444
    4545# define options
    46 options build.asroot
    47 options build.jobs
    48 options build.target
    49 options build.type
    50 options use_parallel_build
     46options build.asroot \
     47        build.jobs \
     48        build.target \
     49        build.type \
     50        use_parallel_build
    5151commands build
    5252# defaults
     
    6767# dependency.
    6868proc portbuild::add_automatic_buildsystem_dependencies {} {
     69    global build.type.add_deps
     70    if {!${build.type.add_deps}} {
     71        return
     72    }
    6973    if {[option build.type] == "bsd" && [option os.platform] == "darwin"} {
    7074        ui_debug "build.type is BSD, adding bin:bsdmake:bsdmake build dependency"
     
    8084# Register the above procedure as a callback after Portfile evaluation
    8185port::register_callback portbuild::add_automatic_buildsystem_dependencies
     86# and an option to turn it off if required
     87options build.type.add_deps
     88default build.type.add_deps yes
    8289
    8390proc portbuild::build_getmaketype {args} {
  • branches/gsoc11-statistics/base/src/port1.0/portchecksum.tcl

    r105085 r107206  
    201201#
    202202proc portchecksum::checksum_main {args} {
    203     global UI_PREFIX all_dist_files checksum_types checksums_array portverbose checksum.skip
    204     global usealtworkpath altprefix default_checksum_types
     203    global UI_PREFIX all_dist_files checksum_types checksums_array portverbose checksum.skip \
     204          usealtworkpath altprefix default_checksum_types
    205205
    206206    # If no files have been downloaded, there is nothing to checksum.
  • branches/gsoc11-statistics/base/src/port1.0/portclean.tcl

    r82923 r107206  
    11# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
    2 # portclean.tcl
    32# $Id$
    43#
    5 # Copyright (c) 2005-2007, 2009-2011 The MacPorts Project
     4# Copyright (c) 2005-2007, 2009-2011, 2013 The MacPorts Project
    65# Copyright (c) 2004 Robert Shaw <rshaw@opendarwin.org>
    76# Copyright (c) 2002 - 2003 Apple Inc.
     
    6261
    6362proc portclean::clean_main {args} {
    64     global UI_PREFIX
    65     global ports_clean_dist ports_clean_work ports_clean_logs
    66     global ports_clean_all keeplogs usealtworkpath
     63    global UI_PREFIX ports_clean_dist ports_clean_work ports_clean_logs \
     64           ports_clean_archive ports_clean_all keeplogs usealtworkpath
    6765
    6866    if {$usealtworkpath} {
     
    7573        clean_dist
    7674    }
     75    if {([info exists ports_clean_all] && $ports_clean_all == "yes" || \
     76        [info exists ports_clean_archive] && $ports_clean_archive == "yes")
     77        && !$usealtworkpath} {
     78        ui_info "$UI_PREFIX [format [msgcat::mc "Removing temporary archives for %s"] [option subport]]"
     79        clean_archive
     80    }
    7781    if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
    7882        [info exists ports_clean_work] && $ports_clean_work == "yes" || \
     83        [info exists ports_clean_archive] && $ports_clean_archive == "yes" || \
     84        [info exists ports_clean_dist] && $ports_clean_dist == "yes" || \
    7985        !([info exists ports_clean_logs] && $ports_clean_logs == "yes")} {
    8086         ui_info "$UI_PREFIX [format [msgcat::mc "Removing work directory for %s"] [option subport]]"
     
    260266    return 0
    261267}
     268
     269proc portclean::clean_archive {args} {
     270    global subport ports_version_glob portdbpath
     271
     272    # Define archive destination directory, target filename, regex for archive name
     273    set archivepath [file join $portdbpath incoming]
     274
     275    if {[info exists ports_version_glob]} {
     276        # Match all possible archive variants that match the version
     277        # glob specified by the user.
     278        set fileglob "$subport-[option ports_version_glob]*.*.*.*"
     279    } else {
     280        # Match all possible archives for this port.
     281        set fileglob "$subport-*_*.*.*.*"
     282    }
     283
     284    # Remove the archive files
     285    set count 0
     286    foreach dir [list $archivepath ${archivepath}/verified] {
     287        set archivelist [glob -nocomplain -directory $dir $fileglob]
     288        foreach path $archivelist {
     289            # Make sure file is truly an archive file for this port, and not
     290            # an accidental match with some other file that might exist. Also
     291            # delete anything ending in .TMP since those are incomplete and
     292            # thus can't be checked and aren't useful anyway.
     293            set archivetype [string range [file extension $path] 1 end]
     294            if {[file isfile $path] && ($archivetype == "TMP"
     295                || [extract_archive_metadata $path $archivetype portname] == $subport)} {
     296                ui_debug "Removing archive: $path"
     297                if {[catch {delete $path} result]} {
     298                    ui_debug "$::errorInfo"
     299                    ui_error "$result"
     300                }
     301                if {[file isfile ${path}.rmd160]} {
     302                    ui_debug "Removing archive signature: ${path}.rmd160"
     303                    if {[catch {delete ${path}.rmd160} result]} {
     304                        ui_debug "$::errorInfo"
     305                        ui_error "$result"
     306                    }
     307                }
     308                incr count
     309            }
     310        }
     311    }
     312    if {$count > 0} {
     313        ui_debug "$count archive(s) removed."
     314    } else {
     315        ui_debug "No archives found to remove at $archivepath"
     316    }
     317
     318    return 0
     319}
  • branches/gsoc11-statistics/base/src/port1.0/portconfigure.tcl

    r105577 r107206  
    128128default configure.mtune     {}
    129129# We could have debug/optimizations be global configurable at some point.
    130 options configure.optflags
    131 options configure.cflags configure.cxxflags configure.objcflags
    132 options configure.cppflags configure.ldflags configure.libs
    133 options configure.fflags configure.f90flags configure.fcflags
    134 options configure.classpath
     130options configure.optflags \
     131        configure.cflags configure.cxxflags configure.objcflags \
     132        configure.cppflags configure.ldflags configure.libs \
     133        configure.fflags configure.f90flags configure.fcflags \
     134        configure.classpath
    135135# compiler flags section
    136136default configure.optflags  {-Os}
     
    147147
    148148# tools section
    149 options configure.perl configure.python configure.ruby
    150 options configure.install configure.awk configure.bison
    151 options configure.pkg_config configure.pkg_config_path
     149options configure.perl configure.python configure.ruby \
     150        configure.install configure.awk configure.bison \
     151        configure.pkg_config configure.pkg_config_path
    152152default configure.perl              {}
    153153default configure.python            {}