Changeset 14736


Ignore:
Timestamp:
Oct 20, 2005, 9:26:43 PM (15 years ago)
Author:
jberry
Message:
  • Handle some issues with the fact that dportopen sets the current directory, and that relative urls for subsequent ports to be processed can break when it does. So we now save and restore the cd in foreachport, and during a few other operations. The best solution down the road would be to stop dportopen from setting the current directory...I have a feeling this isn't used anywhere...but I don't want to risk it so close to shipping 1.2.
  • Add action "url" to return the URL to a given port. This is suitable for feeding back into port to specify the port in the future.
  • Fix errors in parsing D and U (directory and url) options. These should be deprecated, as there is little reason to have them anymore.
  • Option "u" was apparently duplicated, unless I messed that up somewhere up the road, so I changed it to "U".
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/port.tcl

    r14667 r14736  
    33exec @TCLSH@ "$0" "$@"
    44# port.tcl
    5 # $Id: port.tcl,v 1.136 2005/10/17 00:45:14 jberry Exp $
     5# $Id: port.tcl,v 1.137 2005/10/20 21:26:43 jberry Exp $
    66#
    77# Copyright (c) 2004 Robert Shaw <rshaw@opendarwin.org>
     
    155155       
    156156Valid actions are:
    157         help, info, location, provides, activate, deactivate, selfupdate,
    158         upgrade, version, compact, uncompact, uninstall, installed, outdated,
    159         contents, deps, variants, search, list, echo, sync, dir, file, cat, edit,
     157        help, info, location, provides, activate, deactivate, selfupdate, upgrade,
     158        version, compact, uncompact, uninstall, installed, outdated, contents, deps,
     159        variants, search, list, echo, sync, dir, url, file, cat, edit,
    160160        fetch, patch, extract, build, destroot, install, test.
    161161       
     
    343343
    344344proc url_to_portname { url } {
     345        # Save directory and restore the directory, since dportopen changes it
     346        set savedir [pwd]
     347        set portname ""
    345348        if {[catch {set ctx [dportopen $url]} result]} {
    346349                puts stderr "Can't map the URL '$url' to a port description file (${result}). Please verify that the directory and portfile syntax are correct."
    347                 return ""
    348350        } else {
    349351                array set portinfo [dportinfo $ctx]
    350352                set portname $portinfo(name)
    351353                dportclose $ctx
    352                 return $portname
    353         }
     354        }
     355        cd $savedir
     356        return $portname
    354357}
    355358
     
    381384# will have been set
    382385proc foreachport {portlist block} {
     386        # Restore cwd after each port, since dportopen changes it, and relative
     387        # urls will break on subsequent passes
     388        set savedir [pwd]
    383389        foreach portspec $portlist {
    384390                uplevel 1 "array set portspec { $portspec }"
     
    393399                }
    394400                uplevel 1 $block
     401                cd $savedir
    395402        }
    396403}
     
    11061113                                D { advance
    11071114                                        set global_porturl "file://[lookahead]"
     1115                                        break
    11081116                                  }
    1109                                 u { advance
     1117                                U { advance
    11101118                                        set global_porturl [lookahead]
     1119                                        break
    11111120                                  }
    11121121                                default {
     
    17131722        cat -
    17141723        dir -
     1724        url -
    17151725        file {
    17161726                # Operations on the port's directory and Portfile
     
    17331743                        }
    17341744                       
    1735                         set portdir [darwinports::getportdir $porturl $portdir]
     1745                        set portdir [file normalize [darwinports::getportdir $porturl $portdir]]
     1746                        set porturl "file://${portdir}";        # Rebuild url so it's fully qualified
    17361747                        set portfile "${portdir}/Portfile"
    17371748                       
     
    17851796                                        }
    17861797
     1798                                        url {
     1799                                                # output the url of the port's directory, suitable to feed back in later as a port descriptor
     1800                                                puts $porturl
     1801                                        }
     1802
    17871803                                        file {
    17881804                                                # output the path to the port's portfile
Note: See TracChangeset for help on using the changeset viewer.