Changeset 38096


Ignore:
Timestamp:
Jul 6, 2008, 3:21:25 PM (11 years ago)
Author:
pmagrath@…
Message:

Merged revisions 38033,38037-38038,38040 via svnmerge from
https://svn.macosforge.org/repository/macports/trunk/base

........

r38033 | raimue@… | 2008-07-04 00:49:00 +0100 (Fri, 04 Jul 2008) | 3 lines


port/port.tcl:
Document depends: and depends_*: from r37909

........

r38037 | raimue@… | 2008-07-04 03:58:10 +0100 (Fri, 04 Jul 2008) | 3 lines


portmgr/dmg/postflight:
Copy the postflight script from the release_1_6 branch so the changes will not be lost or forgotten

........

r38038 | raimue@… | 2008-07-04 05:30:56 +0100 (Fri, 04 Jul 2008) | 4 lines


port1.0/portextract.tcl:
If the $distfile exists in $filespath, use it from there as it was not fetched
to the distpath in this case.

........

r38040 | raimue@… | 2008-07-04 05:59:54 +0100 (Fri, 04 Jul 2008) | 3 lines


portmgr/dmg/postflight:
Remove old non-compressed man pages on install

........

Location:
branches/gsoc08-privileges/base
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc08-privileges/base

  • branches/gsoc08-privileges/base/portmgr/dmg/postflight

    r31681 r38096  
    11#!/bin/bash
     2# -*- coding: utf-8; mode: shell-script-mode; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=sh:et:sw=4:ts=4:sts=4
    23#
    3 # Copyright (c) 2007 Juan Manuel Palacios <jmpp@macports.org>
    4 # Copyright (c) 2005 Ole Guldberg Jensen <olegb@opendarwin.org>
    5 # Copyright (c) 2005 Dr. Ernie Prabhakar <drernir@opendarwin.org>
    6 # Copyright (c) 2005 Matt Anton <matt@opendarwin.org>
     4# Copyright (c) 2002-2007 Juan Manuel Palacios <jmpp@macports.org>, The MacPorts Project.
    75# All rights reserved.
    86#
     
    1513#    notice, this list of conditions and the following disclaimer in the
    1614#    documentation and/or other materials provided with the distribution.
     15# 3. Neither the name of Apple, Inc., The MacPorts Project nor the
     16#    names of its contributors may be used to endorse or promote products
     17#    derived from this software without specific prior written permission.
    1718#
    18 # THIS SOFTWARE IS PROVIDED BY Eric Melville AND CONTRIBUTORS ``AS IS'' AND
     19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    1920# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    2021# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    21 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     22# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
    2223# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    2324# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     
    3233
    3334
    34 BINPATH=/opt/local/bin
    35 SBINPATH=/opt/local/sbin
     35#set -x
     36
     37# Script identification ('cause more often than not the svn Id is not expanded):
     38VERSION=1.7.0
     39
     40# Abstraction variables:
     41PREFIX=/opt/local
     42BINPATH=${PREFIX}/bin
     43SBINPATH=${PREFIX}/sbin
     44MANPAGES=${PREFIX}/share/man
     45TIMESTAMP=$(date +"%Y-%m-%d_at_%H:%M:%S")
     46BACKUP_SUFFIX=macports-saved_${TIMESTAMP}
     47OUR_STRING="MacPorts Installer addition on ${TIMESTAMP}"
    3648
    3749
    38 echo -e "\nChecking the PATH variable for $USER...\n"
     50# Command to update the MacPorts installation through "selfupdate":
     51function update_macports {
     52    echo "Synchronizing the MacPorts installation with the project's rsync server..."
     53    if ! ${BINPATH}/port -v selfupdate; then
     54        echo "An attempt to synchronize your recent MacPorts installation with the project's rsync server failed!"
     55        echo "Please run 'sudo port -d selfupdate' manually to find out the cause of the error."
     56    else
     57        echo "Successful!"
     58    fi
     59}
    3960
    40 # No need to do any path adjustments if we're on Leopard, as we already install our path configs into /etc/paths.d/ and /etc/manpaths.d/
    41 if [ $(sw_vers -productVersion | awk -F . '{print $2}') -eq 5 ]; then
    42     echo "No need to adjust the PATH and MANPATH environment variables on Leopard!"
    43     exit 0
     61# Through this command we write an environment variable to an appropriate shell configuration file,
     62# backing up the original only if it exists and if it doesn't contain the ${OUR_STRING} identification string,
     63# which hints that we've already tweaked it and therefore already baked it up.
     64function write_setting () {
     65    if [ -f ${HOME}/.${CONF_FILE} ] && ! grep "${OUR_STRING}" ${HOME}/.${CONF_FILE} > /dev/null; then
     66        echo "Backing up your ${HOME}/.${CONF_FILE} shell confguration file as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX} before adapting it for MacPorts."
     67        /bin/cp -fp ${HOME}/.${CONF_FILE} "${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}" || {
     68            echo "An attempt to backup your original configuration file failed! Please set your MacPorts compatible environment manually."
     69            update_macports
     70            exit 1
     71        }
     72        echo -e "\n##\n# Your previous ${HOME}/.${CONF_FILE} file was backed up as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}\n##" >> ${HOME}/.${CONF_FILE}
     73    fi
     74    echo -e "\n# ${OUR_STRING}: adding an appropriate ${1} variable for use with MacPorts." >> ${HOME}/.${CONF_FILE}
     75    echo "${ENV_COMMAND} ${1}${ASSIGN}${2}" >> ${HOME}/.${CONF_FILE}
     76    echo -e "# Finished adapting your ${1} environment variable for use with MacPorts.\n" >> ${HOME}/.${CONF_FILE}
     77    chown ${USER} ${HOME}/.${CONF_FILE} || echo "Warning: unable to adapt permissions on your ${HOME}/.${CONF_FILE} shell configuration file!"
     78    echo "An appropriate ${1} variable has been added to your shell environment by the MacPorts installer."
     79}
     80
     81function cleanup_man () {
     82    # Remove old non-compressed man pages
     83    echo -e "\nRemoving old man pages..."
     84    MAN1="port.1"
     85    MAN5="macports.conf.5"
     86    MAN7="portfile.7 portstyle.7 porthier.7 portgroup.7"
     87    for m in ${MAN1}; do rm -vf ${MANPAGES}/man1/$m ; done
     88    for m in ${MAN5}; do rm -vf ${MANPAGES}/man5/$m ; done
     89    for m in ${MAN7}; do rm -vf ${MANPAGES}/man7/$m ; done
     90    echo -e "Done.\n"
     91}
     92
     93
     94echo "The MacPorts Project, postflight script version ${VERSION}: checking the shell environment for user \"${USER}\"."
     95
     96# Remove old stuff
     97cleanup_man
     98
     99# Determine the user's shell, in order to choose an appropriate configuration file we'll be tweaking.
     100# Exit nicely if the shell is any other than bash or tcsh, as that's considered non-standard.
     101USHELL=$(dscl . -read /users/${USER} shell | awk -F'/' '{print $NF}') || {
     102    echo "An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually."
     103    update_macports
     104    exit 1
     105}
     106case "${USHELL}" in
     107    tcsh)
     108        echo "Detected the tcsh shell."
     109        LOGIN_FLAG=""
     110        ENV_COMMAND="setenv"
     111        ASSIGN=" "
     112        CONF_FILE=tcshrc
     113        ;;
     114    bash)
     115        echo "Detected the bash shell."
     116        LOGIN_FLAG="-l"
     117        ENV_COMMAND="export"
     118        ASSIGN="="
     119        CONF_FILE=profile
     120        ;;
     121    *)
     122        echo "Unknown shell ($USHELL)! Please set your MacPorts compatible environment manually."
     123        update_macports
     124        exit 0
     125        ;;
     126esac
     127
     128
     129# Adding our setting to the PATH variable if not already there:
     130if ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv PATH" | grep ${PREFIX} > /dev/null; then
     131    echo "Your shell already has the right PATH environment variable for use with MacPorts!"
     132else
     133    write_setting PATH "${BINPATH}:${SBINPATH}:\$PATH"
    44134fi
    45135
    46 if $SHELL -c "/usr/bin/printenv PATH" | grep -c $BINPATH > /dev/null; then
    47     echo "You already have the right PATH!"
     136# We gather the path into a variable of our own for faster operation:
     137ORIGINAL_MANPATH="$(${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv MANPATH")"
     138# Adding out setting to the MANPATH variable only if it exists:
     139if ! ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep MANPATH" > /dev/null || \
     140# and following that, if it's not empty:
     141  [ -z "${ORIGINAL_MANPATH}" ] || \
     142# or if it doesn't already contain our path:
     143  echo "${ORIGINAL_MANPATH}" | grep ${MANPAGES} > /dev/null || \
     144# or if there's no empty component somewhere in the middle of it:
     145  echo "${ORIGINAL_MANPATH}" | grep :: > /dev/null || \
     146# or at the start of it:
     147  [ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $1}')" ] || \
     148# or at the end of it:
     149  [ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $NF}')" ]; then
     150    echo "Your shell already has the right MANPATH environment variable for use with MacPorts!"
    48151else
    49     USHELL=`basename $SHELL`
    50     echo "Setting the PATH of $USHELL for $USER in ${HOME:=/Users/$USER}..."
    51     case $USHELL in
    52         *csh)
    53             # we backup the original
    54             /bin/cp -fp $HOME/.cshrc $HOME/.cshrc.mpsaved
    55             echo "#" >> $HOME/.cshrc
    56             echo "# Your previous .cshrc (if any) is saved as .cshrc.mpsaved" >> $HOME/.cshrc
    57             echo "# Setting the path for MacPorts." >> $HOME/.cshrc
    58             echo "set path=($BINPATH $SBINPATH" '$path'")" >> $HOME/.cshrc
    59             chown $USER $HOME/.cshrc
    60             echo "Finished modifying $HOME/.cshrc"
    61         ;;
    62         *sh)
    63             # we backup the original
    64             /bin/cp -fp $HOME/.profile $HOME/.profile.mpsaved
    65             echo "#" >> $HOME/.profile
    66             echo "# Your previous .profile  (if any) is saved as .profile.mpsaved" >> $HOME/.profile
    67             echo "# Setting the path for MacPorts." >> $HOME/.profile
    68             echo "export PATH=$BINPATH:$SBINPATH:\$PATH" >> $HOME/.profile
    69             chown $USER $HOME/.profile
    70             echo "Finished modifying $HOME/.profile"
    71         ;;
    72         *)
    73             echo "Unknown shell! Please set your own PATH manually."
    74         ;;
    75     esac
     152    write_setting MANPATH "${MANPAGES}:\$MANPATH"
     153fi
     154
     155# Adding a DISPLAY variable only if we're running on Tiger or less and if it doesn't already exist:
     156if (($(sw_vers -productVersion | awk -F . '{print $2}') >= 5)) || ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep DISPLAY" > /dev/null; then
     157    echo "Your shell already has the right DISPLAY environment variable for use with MacPorts!"
     158else
     159    write_setting DISPLAY ":0"
    76160fi
    77161
    78162
    79 # Run selfupdate:
    80 export PATH=$BINPATH:$PATH
    81 echo -e "\nSelfupdating The MacPorts system...\n"
    82 port -d selfupdate
    83 if [ $? != 0 ]; then
    84     echo "An attempt to synchronize your recent MacPorts installation with the rsync server failed, please run 'port -d selfupdate' manually to find out the cause of the error."
    85     exit 1
    86 fi
    87 
    88 
    89 # Postflight script is done with its job!
    90 echo -e "\nYou have succesfully installed the MacPorts system.\n"
    91 echo "Launch a terminal and try it out!"
    92 echo -e "Read the port manual page for help.\n"
     163# Postflight script is done with its job, update MacPorts and exit gracefully!
     164update_macports
     165echo "You have succesfully installed the MacPorts system, launch a terminal and try it out!"
     166echo "Read the port(1) manual page and http://guide.macports.org for help, http://www.macports.org/contact.php if you need to get in touch with The MacPorts Project."
     167exit 0
  • branches/gsoc08-privileges/base/src/port/port.tcl

    r37922 r38096  
    5656}
    5757
    58 
    5958proc print_help {args} {
    6059    global cmdname
     
    9897
    9998Additional pseudo-portnames start with...
    100 variants:, variant:, description:, portdir:, homepage:, epoch:,
    101 platforms:, platform:, name:, long_description:, maintainers:,
    102 maintainer:, categories:, category:, version:, and revision:.
     99variants:, variant:, description:, depends:, depends_lib:, depends_run:,
     100depends_build:, portdir:, homepage:, epoch:, platforms:, platform:, name:,
     101long_description:, maintainers:, maintainer:, categories:, category:, version:,
     102and revision:.
    103103These each select a set of ports based on a regex search of metadata
    104104about the ports. In all such cases, a standard regex pattern following
  • branches/gsoc08-privileges/base/src/port1.0/portextract.tcl

    r37794 r38096  
    9494proc extract_main {args} {
    9595    global UI_PREFIX euid egid worksrcpath macportsuser
     96    global filespath
    9697   
    9798    if {![exists distfiles] && ![exists extract.only]} {
     
    102103    foreach distfile [option extract.only] {
    103104        ui_info "$UI_PREFIX [format [msgcat::mc "Extracting %s"] $distfile]"
    104         option extract.args "[option distpath]/$distfile"
     105        if {[file exists $filespath/$distfile]} {
     106                option extract.args "$filespath/$distfile"
     107        } else {
     108                option extract.args "[option distpath]/$distfile"
     109        }
    105110        if {[catch {command_exec extract} result]} {
    106111            return -code error "$result"
Note: See TracChangeset for help on using the changeset viewer.