Changeset 55506


Ignore:
Timestamp:
Aug 12, 2009, 12:26:30 PM (11 years ago)
Author:
enl@…
Message:

Merge from trunk

Location:
branches/gsoc09-logging/base/src
Files:
4 deleted
27 edited
9 copied

Legend:

Unmodified
Added
Removed
  • branches/gsoc09-logging/base/src/config.h.in

    r51384 r55506  
    212212#undef PACKAGE_TARNAME
    213213
     214/* Define to the home page for this package. */
     215#undef PACKAGE_URL
     216
    214217/* Define to the version of this package. */
    215218#undef PACKAGE_VERSION
  • branches/gsoc09-logging/base/src/cregistry/Makefile

    r52218 r55506  
    1212
    1313.c.o:
    14         ${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${SHLIB_CFLAGS} $< -o $@
     14        ${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
    1515
    1616${STLIB_NAME}:: ${OBJS}
  • branches/gsoc09-logging/base/src/macports1.0/Makefile

    r52218 r55506  
    11SRCS=           macports.tcl macports_dlist.tcl macports_util.tcl \
    22                macports_autoconf.tcl macports_index.tcl macports_fastload.tcl
    3 OBJS=           macports.o
     3OBJS=           macports.o get_systemconfiguration_proxies.o sysctl.o
    44SHLIB_NAME=     MacPorts${SHLIB_SUFFIX}
    55
     
    88include ../../Mk/macports.autoconf.mk
    99include ../../Mk/macports.tea.mk
     10
     11ifeq ($(OBJC_RUNTIME), APPLE_RUNTIME)
     12        LIBS+= -framework CoreFoundation -framework SystemConfiguration
     13endif
    1014
    1115test::
  • branches/gsoc09-logging/base/src/macports1.0/macports.c

    r51121 r55506  
    3838#include <tcl.h>
    3939
     40#include "get_systemconfiguration_proxies.h"
     41#include "sysctl.h"
     42
    4043static int
    4144macports__version(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
     
    5558                return TCL_ERROR;
    5659        Tcl_CreateObjCommand(interp, "macports::version", macports__version, NULL, NULL);
     60        Tcl_CreateObjCommand(interp, "get_systemconfiguration_proxies", GetSystemConfigurationProxiesCmd, NULL, NULL);
     61        Tcl_CreateObjCommand(interp, "sysctl", SysctlCmd, NULL, NULL);
    5762        if (Tcl_PkgProvide(interp, "macports", "1.0") != TCL_OK)
    5863                return TCL_ERROR;
  • branches/gsoc09-logging/base/src/macports1.0/macports.tcl

    r55414 r55506  
    165165    set default_channel [macports::ui_channels_default $priority]
    166166    # Get the list of channels.
    167     try {
     167    if {[llength [info commands ui_channels]] > 0} {
    168168        set channels($priority) [ui_channels $priority]
    169     } catch * {
     169    } else {
    170170        set channels($priority) $default_channel
    171171    }
     
    511511        }
    512512    }
     513    global macports::global_variations
     514    array set macports::global_variations [mport_filtervariants [array get variations] yes]
    513515
    514516    if {![info exists portdbpath]} {
     
    882884    $workername alias findBinary macports::findBinary
    883885    $workername alias binaryInPath macports::binaryInPath
     886    $workername alias sysctl sysctl
    884887
    885888    # New Registry/Receipts stuff
     
    10511054            set proposedpath [file normalize [file join [getportdir $url] .. ..]]
    10521055        }
     1056        default {
     1057            set proposedpath [getsourcepath $url]
     1058        }
    10531059    }
    10541060
     
    11691175    $workername eval source Portfile
    11701176
    1171     # add the default universal variant, but only if
    1172     # it will work and another one isn't already present
    1173     if {[$workername eval default_universal_variant_allowed]} {
    1174         $workername eval add_default_universal_variant
    1175     }
     1177    # add the default universal variant if appropriate, and set up flags that
     1178    # are conditional on whether universal is set
     1179    $workername eval universal_setup
    11761180
    11771181    # evaluate the variants
     
    14851489        || $target == "srpm"|| $target == "portpkg" } {
    14861490
     1491        # upgrade dependencies that are already installed
     1492        if {![macports::global_option_isset ports_nodeps]} {
     1493            macports::_upgrade_mport_deps $mport $target
     1494        }
     1495
    14871496        ui_msg -nonewline "--->  Computing dependencies for [_mportkey $mport name]"
    14881497        if {[macports::ui_isset ports_debug]} {
     
    14931502            return 1
    14941503        }
    1495         ui_msg ""
     1504        if {![macports::ui_isset ports_debug]} {
     1505            ui_msg ""
     1506        }
    14961507
    14971508        # Select out the dependents along the critical path,
     
    15491560
    15501561    return $result
     1562}
     1563
     1564# upgrade any dependencies of mport that are installed and needed for target
     1565proc macports::_upgrade_mport_deps {mport target} {
     1566    set options [ditem_key $mport options]
     1567    set deptypes [macports::_deptypes_for_target $target]
     1568    array set portinfo [mportinfo $mport]
     1569    set depends {}
     1570    array set depscache {}
     1571
     1572    foreach deptype $deptypes {
     1573        # Add to the list of dependencies if the option exists and isn't empty.
     1574        if {[info exists portinfo($deptype)] && $portinfo($deptype) != ""} {
     1575            set depends [concat $depends $portinfo($deptype)]
     1576        }
     1577    }
     1578   
     1579    foreach depspec $depends {
     1580        set dep_portname [lindex [split $depspec :] end]
     1581        if {![info exists depscache(port:$dep_portname)] && [registry::entry_exists_for_name $dep_portname]} {
     1582            set status [macports::upgrade $dep_portname "port:$dep_portname" {} $options depscache]
     1583            # status 2 means the port was not found in the index
     1584            if {$status != 0 && $status != 2 && ![macports::ui_isset ports_processall]} {
     1585                return -code error "upgrade $dep_portname failed"
     1586            }
     1587        }
     1588    }
    15511589}
    15521590
     
    17321770                    set indexfile [macports::getindex $source]
    17331771                    file mkdir [file dirname $indexfile]
    1734                     curl $source/PortIndex $indexfile
     1772                    curl fetch ${source}/PortIndex $indexfile
     1773                    curl fetch ${source}/PortIndex.quick ${indexfile}.quick
    17351774                }
    17361775            }
     
    19121951                    lappend matches $line
    19131952                    close $fd
    1914                     break
     1953                    set fd -1
    19151954                } catch {*} {
    19161955                    ui_warn "It looks like your PortIndex file may be corrupt."
    1917                     throw
    19181956                } finally {
    1919                     catch {close $fd}
     1957                    if {$fd != -1} {
     1958                        close $fd
     1959                    }
     1960                }
     1961                if {[llength $matches] > 0} {
     1962                    break
    19201963                }
    19211964            }
     
    19471990            continue
    19481991        }
    1949         if {![file exists ${index}.quick] || [file mtime ${index}] > [file mtime ${index}.quick]} {
    1950             # stale or nonexistent quick index file, so generate a new one
     1992        if {![file exists ${index}.quick]} {
     1993            ui_warn "No quick index file found, attempting to generate one for source: $source"
    19511994            if {[catch {set quicklist [mports_generate_quickindex ${index}]}]} {
    19521995                continue
     
    20772120    }
    20782121
    2079     # Determine deptypes to look for based on target
     2122    set deptypes [macports::_deptypes_for_target $target]
     2123
     2124    # Gather the dependencies for deptypes
     2125    foreach deptype $deptypes {
     2126        # Add to the list of dependencies if the option exists and isn't empty.
     2127        if {[info exists portinfo($deptype)] && $portinfo($deptype) != ""} {
     2128            set depends [concat $depends $portinfo($deptype)]
     2129        }
     2130    }
     2131
     2132    set subPorts {}
     2133    set options [ditem_key $mport options]
     2134    set variations [ditem_key $mport variations]
     2135
     2136    foreach depspec $depends {
     2137        # Is that dependency satisfied or this port installed?
     2138        # If we don't skip or if it is not, add it to the list.
     2139        if {!$skipSatisfied || ![_mportispresent $mport $depspec]} {
     2140            # grab the portname portion of the depspec
     2141            set dep_portname [lindex [split $depspec :] end]
     2142
     2143            # Find the porturl
     2144            if {[catch {set res [mportlookup $dep_portname]} error]} {
     2145                global errorInfo
     2146                ui_debug "$errorInfo"
     2147                ui_error "Internal error: port lookup failed: $error"
     2148                return 1
     2149            }
     2150
     2151            array unset portinfo
     2152            array set portinfo [lindex $res 1]
     2153            if {![info exists portinfo(porturl)]} {
     2154                ui_error "Dependency '$dep_portname' not found."
     2155                return 1
     2156            }
     2157
     2158            # Figure out the subport. Check the open_mports list first, since
     2159            # we potentially leak mport references if we mportopen each time,
     2160            # because mportexec only closes each open mport once.
     2161            set subport [dlist_search $macports::open_mports porturl $portinfo(porturl)]
     2162            if {$subport == {}} {
     2163                # We haven't opened this one yet.
     2164                set subport [mportopen $portinfo(porturl) $options $variations]
     2165                if {$recurseDeps} {
     2166                    # Add to the list we need to recurse on.
     2167                    lappend subPorts $subport
     2168                }
     2169            }
     2170
     2171            # Append the sub-port's provides to the port's requirements list.
     2172            ditem_append_unique $mport requires "[ditem_key $subport provides]"
     2173        }
     2174    }
     2175
     2176    # Loop on the subports.
     2177    if {$recurseDeps} {
     2178        foreach subport $subPorts {
     2179            # Sub ports should be installed (all dependencies must be satisfied).
     2180            set res [mportdepends $subport "" $recurseDeps $skipSatisfied]
     2181            if {$res != 0} {
     2182                return $res
     2183            }
     2184        }
     2185    }
     2186
     2187    return 0
     2188}
     2189
     2190# Determine dependency types required for target
     2191proc macports::_deptypes_for_target {target} {
    20802192    switch $target {
    20812193        fetch       -
     
    21002212        ""          { set deptypes "depends_fetch depends_extract depends_lib depends_build depends_run" }
    21012213    }
    2102 
    2103     # Gather the dependencies for deptypes
    2104     foreach deptype $deptypes {
    2105         # Add to the list of dependencies if the option exists and isn't empty.
    2106         if {[info exists portinfo($deptype)] && $portinfo($deptype) != ""} {
    2107             set depends [concat $depends $portinfo($deptype)]
    2108         }
    2109     }
    2110 
    2111     set subPorts {}
    2112     set options [ditem_key $mport options]
    2113     set variations [ditem_key $mport variations]
    2114 
    2115     foreach depspec $depends {
    2116         # Is that dependency satisfied or this port installed?
    2117         # If we don't skip or if it is not, add it to the list.
    2118         if {!$skipSatisfied || ![_mportispresent $mport $depspec]} {
    2119             # grab the portname portion of the depspec
    2120             set dep_portname [lindex [split $depspec :] end]
    2121 
    2122             # Find the porturl
    2123             if {[catch {set res [mportlookup $dep_portname]} error]} {
    2124                 global errorInfo
    2125                 ui_debug "$errorInfo"
    2126                 ui_error "Internal error: port lookup failed: $error"
    2127                 return 1
    2128             }
    2129 
    2130             array unset portinfo
    2131             array set portinfo [lindex $res 1]
    2132             if {![info exists portinfo(porturl)]} {
    2133                 ui_error "Dependency '$dep_portname' not found."
    2134                 return 1
    2135             }
    2136 
    2137             # Figure out the subport. Check the open_mports list first, since
    2138             # we potentially leak mport references if we mportopen each time,
    2139             # because mportexec only closes each open mport once.
    2140             set subport [dlist_search $macports::open_mports porturl $portinfo(porturl)]
    2141             if {$subport == {}} {
    2142                 # We haven't opened this one yet.
    2143                 set subport [mportopen $portinfo(porturl) $options $variations]
    2144                 if {$recurseDeps} {
    2145                     # Add to the list we need to recurse on.
    2146                     lappend subPorts $subport
    2147                 }
    2148             }
    2149 
    2150             # Append the sub-port's provides to the port's requirements list.
    2151             ditem_append_unique $mport requires "[ditem_key $subport provides]"
    2152         }
    2153     }
    2154 
    2155     # Loop on the subports.
    2156     if {$recurseDeps} {
    2157         foreach subport $subPorts {
    2158             # Sub ports should be installed (all dependencies must be satisfied).
    2159             set res [mportdepends $subport "" $recurseDeps $skipSatisfied]
    2160             if {$res != 0} {
    2161                 return $res
    2162             }
    2163         }
    2164     }
    2165 
    2166     return 0
     2214    return $deptypes
    21672215}
    21682216
     
    22812329}
    22822330
    2283 # upgrade procedure
    2284 proc macports::upgrade {portname dspec globalvarlist variationslist optionslist {depscachename ""}} {
     2331# upgrade API wrapper procedure
     2332# return codes: 0 = success, 1 = general failure, 2 = port name not found in index
     2333proc macports::upgrade {portname dspec variationslist optionslist {depscachename ""}} {
     2334    # only installed ports can be upgraded
     2335    if {![registry::entry_exists_for_name $portname]} {
     2336        ui_error "$portname is not installed"
     2337        return 1
     2338    }
     2339    if {![string match "" $depscachename]} {
     2340        upvar $depscachename depscache
     2341    } else {
     2342        array set depscache {}
     2343    }
     2344    # stop upgrade from being called via mportexec as well
     2345    set orig_nodeps yes
     2346    if {![info exists macports::global_options(ports_nodeps)]} {
     2347        set macports::global_options(ports_nodeps) yes
     2348        set orig_nodeps no
     2349    }
     2350    # filter out implicit variants from the explicitly set/unset variants.
     2351    set variationslist [mport_filtervariants $variationslist yes]
     2352   
     2353    # run the actual upgrade
     2354    set status [macports::_upgrade $portname $dspec $variationslist $optionslist depscache]
     2355   
     2356    if {!$orig_nodeps} {
     2357        unset -nocomplain macports::global_options(ports_nodeps)
     2358    }
     2359    return $status
     2360}
     2361
     2362# main internal upgrade procedure
     2363proc macports::_upgrade {portname dspec variationslist optionslist {depscachename ""}} {
    22852364    global macports::registry.installtype
    22862365    global macports::portarchivemode
     2366    global macports::global_variations
    22872367    array set options $optionslist
    22882368
     
    22922372    # merged in later on, so it applies only to this port's upgrade
    22932373    array set variations $variationslist
     2374   
     2375    set globalvarlist [array get macports::global_variations]
    22942376
    22952377    if {![string match "" $depscachename]} {
     
    23122394    # argh! port doesnt exist!
    23132395    if {$result == ""} {
    2314         ui_error "No port $portname found."
    2315         return 1
     2396        ui_warn "No port $portname found in the index."
     2397        return 2
    23162398    }
    23172399    # fill array with information
     
    23622444               
    23632445                # upgrade its dependencies first
    2364                 _upgrade_dependencies portinfo depscache globalvarlist variationslist options
     2446                set status [_upgrade_dependencies portinfo depscache variationslist options]
     2447                if {$status != 0 && ![ui_isset ports_processall]} {
     2448                    catch {mportclose $workername}
     2449                    return $status
     2450                }
    23652451                # now install it
    23662452                if {[catch {set result [mportexec $workername install]} result]} {
     
    23902476        } else {
    23912477            ui_error "Checking installed version failed: $result"
    2392             exit 1
     2478            return 1
    23932479        }
    23942480    } else {
     
    24642550    set oldvariantlist [mport_filtervariants $oldvariantlist no]
    24652551
    2466     # check if the variants are present in $version_in_tree
    2467     if {[info exists portinfo(variants)]} {
    2468         set avariants $portinfo(variants)
    2469     } else {
    2470         set avariants {}
    2471     }
    2472     ui_debug "available variants are : $avariants"
     2552    # merge in the old variants
    24732553    foreach {variation value} $oldvariantlist {
    2474         if {[lsearch $avariants $variation] != -1} {
    2475             ui_debug "variant $variation is present in $portname $version_in_tree"
    2476             if { ![info exists variations($variation)]} {
    2477                 set variations($variation) $value
    2478             }
     2554        if { ![info exists variations($variation)]} {
     2555            set variations($variation) $value
    24792556        }
    24802557    }
     
    24902567
    24912568    ui_debug "new fully merged portvariants: [array get variations]"
     2569   
     2570    # at this point we need to check if a different port will be replacing this one
     2571    if {[info exists portinfo(replaced_by)] && ![info exists options(ports_upgrade_no-replace)]} {
     2572        ui_debug "$portname is replaced by $portinfo(replaced_by)"
     2573        if {[catch {mportlookup $portinfo(replaced_by)} result]} {
     2574            global errorInfo
     2575            ui_debug "$errorInfo"
     2576            ui_error "port lookup failed: $result"
     2577            return 1
     2578        }
     2579        if {$result == ""} {
     2580            ui_error "No port $portinfo(replaced_by) found."
     2581            return 1
     2582        }
     2583        array unset portinfo
     2584        array set portinfo [lindex $result 1]
     2585        set newname $portinfo(name)
     2586
     2587        set porturl $portinfo(porturl)
     2588        if {![info exists porturl]} {
     2589            set porturl file://./
     2590        }
     2591        set depscache(port:${newname}) 1
     2592    } else {
     2593        set newname $portname
     2594    }
    24922595
    24932596    if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result]} {
     
    25002603    array unset portinfo
    25012604    array set portinfo [mportinfo $workername]
    2502     set portwasopened 1
    25032605    set version_in_tree "$portinfo(version)"
    25042606    set revision_in_tree "$portinfo(revision)"
     
    25082610    # first upgrade dependencies
    25092611    if {![info exists options(ports_nodeps)]} {
    2510         _upgrade_dependencies portinfo depscache globalvarlist variationslist options
     2612        set status [_upgrade_dependencies portinfo depscache variationslist options]
     2613        if {$status != 0 && ![ui_isset ports_processall]} {
     2614            catch {mportclose $workername}
     2615            return $status
     2616        }
    25112617    } else {
    25122618        ui_debug "Not following dependencies"
     
    25182624            || ([rpm-vercomp $version_installed $version_in_tree] == 0
    25192625                && [rpm-vercomp $revision_installed $revision_in_tree] >= 0 ))
    2520         && ![info exists options(ports_force)] } {
    2521         ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
    2522         if {[info exists portinfo(canonical_active_variants)]
    2523             && $portinfo(canonical_active_variants) != $oldvariant} {
    2524             ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variant $oldvariant does not match $portinfo(canonical_active_variants). Specify -f to force upgrade."
    2525         }
    2526         if { $epoch_installed >= $epoch_in_tree } {
     2626        && ![info exists options(ports_upgrade_force)] } {
     2627        if {$portname != $newname} {
     2628            ui_debug "ignoring versions, installing replacement port"
     2629        } elseif { $epoch_installed < $epoch_in_tree } {
     2630            set epoch_override 1
     2631            ui_debug "epoch override ... upgrading!"
     2632        } elseif {[info exists options(ports_upgrade_enforce-variants)] && $options(ports_upgrade_enforce-variants) eq "yes"
     2633                  && [info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
     2634            ui_debug "variant override ... upgrading!"
     2635        } else {
     2636            if {[info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
     2637                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."
     2638            } else {
     2639                ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
     2640            }
    25272641            # Check if we have to do dependents
    25282642            if {[info exists options(ports_do_dependents)]} {
     
    25372651                        set mpname [lindex $dep 2]
    25382652                        if {![llength [array get depscache port:${mpname}]]} {
    2539                             macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache
     2653                            set status [macports::_upgrade $mpname port:${mpname} $variationslist [array get options] depscache]
     2654                            if {$status != 0 && ![ui_isset ports_processall]} {
     2655                                catch {mportclose $workername}
     2656                                return $status
     2657                            }
    25402658                        }
    25412659                    }
     
    25442662            mportclose $workername
    25452663            return 0
    2546         } else {
    2547             set epoch_override 1
    2548             ui_debug "epoch override ... upgrading!"
    25492664        }
    25502665    }
     
    25592674
    25602675    # avoid building again unnecessarily
    2561     if {[info exists options(ports_force)] || $epoch_override == 1
    2562         || ![registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
     2676    if {[info exists options(ports_upgrade_force)] || $epoch_override == 1
     2677        || ![registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
    25632678        if {[catch {set result [mportexec $workername $upgrade_action]} result] || $result != 0} {
    2564             global errorInfo
    2565             ui_debug "$errorInfo"
     2679            if {[info exists ::errorInfo]} {
     2680                ui_debug "$::errorInfo"
     2681            }
    25662682            ui_error "Unable to upgrade port: $result"
    25672683            catch {mportclose $workername}
     
    25912707    } else {
    25922708        # are we installing an existing version due to force or epoch override?
    2593         if {[registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
    2594              ui_debug "Uninstalling $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
     2709        if {[registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
     2710            && ([info exists options(ports_upgrade_force)] || $epoch_override == 1)} {
     2711             ui_debug "Uninstalling $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
    25952712            # we have to force the uninstall in case of dependents
    25962713            set force_cur [info exists options(ports_force)]
    25972714            set options(ports_force) yes
    25982715            if {$is_dryrun eq "yes"} {
    2599                 ui_msg "Skipping uninstall $portname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
    2600             } elseif {[catch {portuninstall::uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {
     2716                ui_msg "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
     2717            } elseif {[catch {portuninstall::uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {
    26012718                global errorInfo
    26022719                ui_debug "$errorInfo"
    2603                 ui_error "Uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
     2720                ui_error "Uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
    26042721                catch {mportclose $workername}
    26052722                return 1
     
    26092726            }
    26102727            if {$anyactive && $version_in_tree == $version_active && $revision_in_tree == $revision_active
    2611                 && $portinfo(canonical_active_variants) == $variant_active} {
     2728                && $portinfo(canonical_active_variants) == $variant_active && $portname == $newname} {
    26122729                set anyactive no
    26132730            }
     
    26332750
    26342751    if {$is_dryrun eq "yes"} {
    2635         ui_msg "Skipping activate $portname @${version_in_tree}_${revision_in_tree} (dry run)"
     2752        ui_msg "Skipping activate $newname @${version_in_tree}_${revision_in_tree} (dry run)"
    26362753    } elseif {[catch {set result [mportexec $workername install]} result]} {
    26372754        global errorInfo
    26382755        ui_debug "$errorInfo"
    2639         ui_error "Couldn't activate $portname ${version_in_tree}_${revision_in_tree}: $result"
     2756        ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}: $result"
    26402757        catch {mportclose $workername}
    26412758        return 1
     
    26472764            set revision [lindex $i 2]
    26482765            set variant [lindex $i 3]
    2649             if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants)} {
     2766            if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants) && $portname == $newname} {
    26502767                continue
    26512768            }
     
    26562773                global errorInfo
    26572774                ui_debug "$errorInfo"
    2658                 ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
    2659                 catch {mportclose $workername}
    2660                 return 1
     2775                # replaced_by can mean that we try to uninstall all versions of the old port, so handle errors due to dependents
     2776                if {$result != "Please uninstall the ports that depend on $portname first." && ![ui_isset ports_processall]} {
     2777                    ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
     2778                    catch {mportclose $workername}
     2779                    return 1
     2780                }
    26612781            }
    26622782        }
     
    26692789
    26702790        registry::open_dep_map
    2671         set deplist [registry::list_dependents $portname]
     2791        set deplist [registry::list_dependents $newname]
     2792        if {$portname != $newname} {
     2793            set deplist [concat $deplist [registry::list_dependents $portname]]
     2794        }
    26722795
    26732796        if { [llength deplist] > 0 } {
     
    26752798                set mpname [lindex $dep 2]
    26762799                if {![llength [array get depscache port:${mpname}]]} {
    2677                     macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache
     2800                    set status [macports::_upgrade $mpname port:${mpname} $variationslist [array get options] depscache]
     2801                    if {$status != 0 && ![ui_isset ports_processall]} {
     2802                        catch {mportclose $workername}
     2803                        return $status
     2804                    }
    26782805                }
    26792806            }
     
    26842811    # close the port handle
    26852812    mportclose $workername
     2813    return 0
    26862814}
    26872815
     
    26892817# Calls upgrade on each dependency listed in the PortInfo.
    26902818# Uses upvar to access the variables.
    2691 proc macports::_upgrade_dependencies {portinfoname depscachename globalvarlistname variationslistname optionsname} {
     2819proc macports::_upgrade_dependencies {portinfoname depscachename variationslistname optionsname} {
    26922820    upvar $portinfoname portinfo $depscachename depscache \
    2693           $globalvarlistname globalvarlist $variationslistname variationslist \
     2821          $variationslistname variationslist \
    26942822          $optionsname options
    26952823
     
    27062834    unset -nocomplain options(ports_do_dependents)
    27072835
     2836    set status 0
    27082837    # each dep type is upgraded
    27092838    foreach dtype {depends_fetch depends_extract depends_build depends_lib depends_run} {
     
    27122841                set d [lindex [split $i :] end]
    27132842                if {![llength [array get depscache port:${d}]] && ![llength [array get depscache $i]]} {
    2714                     upgrade $d $i $globalvarlist $variationslist [array get options] depscache
    2715                 }
    2716             }
    2717         }
     2843                    set status [macports::_upgrade $d $i $variationslist [array get options] depscache]
     2844                    if {$status != 0 && ![ui_isset ports_processall]} break
     2845                }
     2846            }
     2847        }
     2848        if {$status != 0 && ![ui_isset ports_processall]} break
    27182849    }
    27192850    # restore dependent-following to its former value
     
    27212852        set options(ports_do_dependents) yes
    27222853    }
     2854    return $status
    27232855}
    27242856
  • branches/gsoc09-logging/base/src/pextlib1.0/Makefile

    r53509 r55506  
    1 OBJS=           Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
    2                 fs-traverse.o strcasecmp.o vercomp.o filemap.o \
    3                 sha1cmd.o curl.o rmd160cmd.o readline.o uid.o\
    4                 tracelib.o tty.o get_systemconfiguration_proxies.o\
    5                 sysctl.o readdir.o pipe.o
    6 SHLIB_NAME=     Pextlib${SHLIB_SUFFIX}
     1OBJS= \
     2        Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
     3        fs-traverse.o strcasecmp.o vercomp.o filemap.o \
     4        sha1cmd.o curl.o rmd160cmd.o readline.o uid.o \
     5        tracelib.o tty.o readdir.o pipe.o flock.o \
     6        system.o
     7SHLIB_NAME= Pextlib${SHLIB_SUFFIX}
    78INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
    89
     
    1213CFLAGS+= ${CURL_CFLAGS} ${MD5_CFLAGS} ${READLINE_CFLAGS}
    1314LIBS+= ${CURL_LIBS} ${MD5_LIBS} ${READLINE_LIBS}
    14 ifeq ($(OBJC_RUNTIME), APPLE_RUNTIME)
    15    LIBS+= -framework CoreFoundation -framework SystemConfiguration
    16 endif
    1715
    1816.PHONY: test
  • branches/gsoc09-logging/base/src/pextlib1.0/Pextlib.c

    r53509 r55506  
    5353#endif
    5454
    55 #if HAVE_PATHS_H
    56 #include <paths.h>
    57 #endif
    58 
    59 #ifndef _PATH_DEVNULL
    60 #define _PATH_DEVNULL   "/dev/null"
    61 #endif
    62 
    6355#include <pwd.h>
    64 
    65 #if HAVE_SYS_FILE_H
    66 #include <sys/file.h>
    67 #endif
    6856
    6957#if HAVE_SYS_TYPES_H
     
    9280
    9381#include <tcl.h>
     82
     83#include "Pextlib.h"
    9484
    9585#include "md5cmd.h"
     
    10595#include "tracelib.h"
    10696#include "tty.h"
    107 #include "get_systemconfiguration_proxies.h"
    108 #include "sysctl.h"
    10997#include "strsed.h"
    11098#include "readdir.h"
    11199#include "pipe.h"
     100#include "flock.h"
     101#include "system.h"
    112102
    113103#if HAVE_CRT_EXTERNS_H
     
    127117char *fgetln(FILE *stream, size_t *len);
    128118#endif
    129 
    130 #define CBUFSIZ 30
    131119
    132120static char *
     
    197185}
    198186
    199 struct linebuf {
    200         size_t len;
    201         char *line;
    202 };
    203 
    204 int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
    205 {
    206         char *buf;
    207         struct linebuf circbuf[CBUFSIZ];
    208         size_t linelen;
    209         char *args[4];
    210         char *cmdstring;
    211         FILE *pdes;
    212         int fdset[2], nullfd;
    213         int fline, pos, ret;
    214         int osetsid = 0;
    215         pid_t pid;
    216         Tcl_Obj *errbuf;
    217         Tcl_Obj *tcl_result;
    218         int read_failed, status;
    219 
    220         /* usage: system [-notty] command */
    221         if (objc == 2) {
    222                 cmdstring = Tcl_GetString(objv[1]);
    223         } else if (objc == 3) {
    224                 char *arg = Tcl_GetString(objv[1]);
    225                 cmdstring = Tcl_GetString(objv[2]);
    226 
    227                 if (strcmp(arg, "-notty") == 0) {
    228                         osetsid = 1;
    229                 } else {
    230                         tcl_result = Tcl_NewStringObj("bad option ", -1);
    231                         Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(arg, -1));
    232                         Tcl_SetObjResult(interp, tcl_result);
    233                         return TCL_ERROR;
    234                 }
    235         } else {
    236                 Tcl_WrongNumArgs(interp, 1, objv, "command");
    237                 return TCL_ERROR;
    238         }
    239 
    240         /*
    241          * Fork a child to run the command, in a popen() like fashion -
    242          * popen() itself is not used because stderr is also desired.
    243          */
    244         if (pipe(fdset) != 0) {
    245                 return TCL_ERROR;
    246         }
    247 
    248         pid = fork();
    249         switch (pid) {
    250         case -1: /* error */
    251                 return TCL_ERROR;
    252                 break;
    253         case 0: /* child */
    254                 close(fdset[0]);
    255 
    256                 if ((nullfd = open(_PATH_DEVNULL, O_RDONLY)) == -1)
    257                         _exit(1);
    258                 dup2(nullfd, STDIN_FILENO);
    259                 dup2(fdset[1], STDOUT_FILENO);
    260                 dup2(fdset[1], STDERR_FILENO);
    261                 /* drop the controlling terminal if requested */
    262                 if (osetsid) {
    263                         if (setsid() == -1)
    264                                 _exit(1);
    265                 }
    266                 /* XXX ugly string constants */
    267                 args[0] = "sh";
    268                 args[1] = "-c";
    269                 args[2] = cmdstring;
    270                 args[3] = NULL;
    271                 execve("/bin/sh", args, environ);
    272                 _exit(1);
    273                 break;
    274         default: /* parent */
    275                 break;
    276         }
    277 
    278         close(fdset[1]);
    279 
    280         /* read from simulated popen() pipe */
    281         read_failed = 0;
    282         pos = 0;
    283         bzero(circbuf, sizeof(circbuf));
    284         pdes = fdopen(fdset[0], "r");
    285         while ((buf = fgetln(pdes, &linelen)) != NULL) {
    286                 char *sbuf;
    287                 int slen;
    288 
    289                 /*
    290                  * Allocate enough space to insert a terminating
    291                  * '\0' if the line is not terminated with a '\n'
    292                  */
    293                 if (buf[linelen - 1] == '\n')
    294                         slen = linelen;
    295                 else
    296                         slen = linelen + 1;
    297 
    298                 if (circbuf[pos].len == 0)
    299                         sbuf = malloc(slen);
    300                 else {
    301                         sbuf = realloc(circbuf[pos].line, slen);
    302                 }
    303 
    304                 if (sbuf == NULL) {
    305                         read_failed = 1;
    306                         break;
    307                 }
    308 
    309                 memcpy(sbuf, buf, linelen);
    310                 /* terminate line with '\0',replacing '\n' if it exists */
    311                 sbuf[slen - 1] = '\0';
    312 
    313                 circbuf[pos].line = sbuf;
    314                 circbuf[pos].len = slen;
    315 
    316                 if (pos++ == CBUFSIZ - 1) {
    317                         pos = 0;
    318                 }
    319 
    320                 if (ui_info(interp, sbuf) != TCL_OK) {
    321                         read_failed = 1;
    322                         break;
    323                 }
    324         }
    325         fclose(pdes);
    326 
    327         status = TCL_ERROR;
    328 
    329         if (wait(&ret) == pid && WIFEXITED(ret) && !read_failed) {
    330                 /* Normal exit, and reading from the pipe didn't fail. */
    331                 if (WEXITSTATUS(ret) == 0) {
    332                         status = TCL_OK;
    333                 } else {
    334                         /* Copy the contents of the circular buffer to errbuf */
    335                         Tcl_Obj* errorCode;
    336                         errbuf = Tcl_NewStringObj(NULL, 0);
    337                         for (fline = pos; pos < fline + CBUFSIZ; pos++) {
    338                                 if (circbuf[pos % CBUFSIZ].len == 0)
    339                                 continue; /* skip empty lines */
    340 
    341                                 /* Append line, minus trailing NULL */
    342                                 Tcl_AppendToObj(errbuf, circbuf[pos % CBUFSIZ].line,
    343                                                 circbuf[pos % CBUFSIZ].len - 1);
    344 
    345                                 /* Re-add previously stripped newline */
    346                                 Tcl_AppendToObj(errbuf, "\n", 1);
    347                         }
    348 
    349                         /* set errorCode [list CHILDSTATUS <pid> <code>] */
    350                         errorCode = Tcl_NewListObj(0, NULL);
    351                         Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewStringObj("CHILDSTATUS", -1));
    352                         Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(pid));
    353                         Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(WEXITSTATUS(ret)));
    354                         Tcl_SetObjErrorCode(interp, errorCode);
    355 
    356                         /* set result */
    357                         tcl_result = Tcl_NewStringObj("shell command \"", -1);
    358                         Tcl_AppendToObj(tcl_result, cmdstring, -1);
    359                         Tcl_AppendToObj(tcl_result, "\" returned error ", -1);
    360                         Tcl_AppendObjToObj(tcl_result, Tcl_NewIntObj(WEXITSTATUS(ret)));
    361                         Tcl_AppendToObj(tcl_result, "\nCommand output: ", -1);
    362                         Tcl_AppendObjToObj(tcl_result, errbuf);
    363                         Tcl_SetObjResult(interp, tcl_result);
    364                 }
    365         }
    366 
    367         /* Cleanup. */
    368         close(fdset[0]);
    369         for (fline = 0; fline < CBUFSIZ; fline++) {
    370                 if (circbuf[fline].len != 0) {
    371                         free(circbuf[fline].line);
    372                 }
    373         }
    374 
    375         return status;
    376 }
    377 
    378 int FlockCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
    379 {
    380         static const char errorstr[] = "use one of \"-shared\", \"-exclusive\", or \"-unlock\", and optionally \"-noblock\"";
    381         int operation = 0, fd, i, ret;
    382         int errnoval = 0;
    383         int oshared = 0, oexclusive = 0, ounlock = 0, onoblock = 0;
    384 #if defined(HAVE_LOCKF) && !defined(HAVE_FLOCK)
    385         off_t curpos;
    386 #endif
    387         char *res;
    388         Tcl_Channel channel;
    389         ClientData handle;
    390 
    391         if (objc < 3 || objc > 4) {
    392                 Tcl_WrongNumArgs(interp, 1, objv, "channelId switches");
    393                 return TCL_ERROR;
    394         }
    395 
    396         if ((channel = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL)) == NULL)
    397                 return TCL_ERROR;
    398 
    399         if (Tcl_GetChannelHandle(channel, TCL_READABLE|TCL_WRITABLE, &handle) != TCL_OK) {
    400                 Tcl_SetResult(interp, "error getting channel handle", TCL_STATIC);
    401                 return TCL_ERROR;
    402         }
    403         fd = (int)(intptr_t)handle;
    404 
    405         for (i = 2; i < objc; i++) {
    406                 char *arg = Tcl_GetString(objv[i]);
    407                 if (!strcmp(arg, "-shared")) {
    408                   oshared = 1;
    409                 } else if (!strcmp(arg, "-exclusive")) {
    410                   oexclusive = 1;
    411                 } else if (!strcmp(arg, "-unlock")) {
    412                   ounlock = 1;
    413                 } else if (!strcmp(arg, "-noblock")) {
    414                   onoblock = 1;
    415                 }
    416         }
    417 
    418         /* verify the arguments */
    419 
    420         if((oshared + oexclusive + ounlock) != 1) {
    421           /* only one of the options should have been specified */
    422           Tcl_SetResult(interp, (void *) &errorstr, TCL_STATIC);
    423           return TCL_ERROR;
    424         }
    425 
    426         if(onoblock && ounlock) {
    427           /* should not be specified together */
    428           Tcl_SetResult(interp, "-noblock cannot be used with -unlock", TCL_STATIC);
    429           return TCL_ERROR;
    430         }
    431          
    432 #if HAVE_FLOCK
    433         /* prefer flock if present */
    434         if(oshared) operation |= LOCK_SH;
    435 
    436         if(oexclusive) operation |= LOCK_EX;
    437 
    438         if(ounlock) operation |= LOCK_UN;
    439 
    440         if(onoblock) operation |= LOCK_NB;
    441 
    442         ret = flock(fd, operation);
    443         if(ret == -1) {
    444           errnoval = errno;
    445         }
    446 #else
    447 #if HAVE_LOCKF
    448         if(ounlock) operation = F_ULOCK;
    449 
    450         /* lockf semantics don't map to shared locks. */
    451         if(oshared || oexclusive) {
    452           if(onoblock) {
    453             operation = F_TLOCK;
    454           } else {
    455             operation = F_LOCK;
    456           }
    457         }
    458 
    459         curpos = lseek(fd, 0, SEEK_CUR);
    460         if(curpos == -1) {
    461                 Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
    462                 return TCL_ERROR;
    463         }
    464 
    465         ret = lockf(fd, operation, 0); /* lock entire file */
    466 
    467         curpos = lseek(fd, curpos, SEEK_SET);
    468         if(curpos == -1) {
    469                 Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
    470                 return TCL_ERROR;
    471         }
    472 
    473         if(ret == -1) {
    474           errnoval = errno;
    475           if((oshared || oexclusive)) {
    476             /* map the errno val to what we would expect for flock */
    477             if(onoblock && errnoval == EAGAIN) {
    478               /* on some systems, EAGAIN=EWOULDBLOCK, but lets be safe */
    479               errnoval = EWOULDBLOCK;
    480             } else if(errnoval == EINVAL) {
    481               errnoval = EOPNOTSUPP;
    482             }
    483           }
    484         }
    485 #else
    486 #error no available locking implementation
    487 #endif /* HAVE_LOCKF */
    488 #endif /* HAVE_FLOCK */
    489 
    490         if (ret != 0)
    491         {
    492                 switch(errnoval) {
    493                         case EAGAIN:
    494                                 res = "EAGAIN";
    495                                 break;
    496                         case EBADF:
    497                                 res = "EBADF";
    498                                 break;
    499                         case EINVAL:
    500                                 res = "EINVAL";
    501                                 break;
    502                         case EOPNOTSUPP:
    503                                 res = "EOPNOTSUPP";
    504                                 break;
    505                         default:
    506                                 res = strerror(errno);
    507                                 break;
    508                 }
    509                 Tcl_SetResult(interp, (void *) res, TCL_STATIC);
    510                 return TCL_ERROR;
    511         }
    512         return TCL_OK;
    513 }
    514 
    515187int StrsedCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
    516188{
     
    681353
    682354        cur = MIN_USABLE_UID;
    683        
     355
    684356        while (getpwuid(cur) != NULL) {
    685357                cur++;
    686358        }
    687        
     359
    688360        tcl_result = Tcl_NewIntObj(cur);
    689361        Tcl_SetObjResult(interp, tcl_result);
     
    704376                cur++;
    705377        }
    706        
     378
    707379        tcl_result = Tcl_NewIntObj(cur);
    708380        Tcl_SetObjResult(interp, tcl_result);
     
    769441{
    770442    char *value, *target;
    771    
     443
    772444    if (objc != 3) {
    773445        Tcl_WrongNumArgs(interp, 1, objv, "value target");
    774446        return TCL_ERROR;
    775447    }
    776    
     448
    777449    value = Tcl_GetString(objv[1]);
    778450    target = Tcl_GetString(objv[2]);
    779    
     451
    780452    if (symlink(value, target) != 0) {
    781453        Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC);
     
    801473    Tcl_Obj **listArray;
    802474    int loopCounter;
    803    
     475
    804476    if (objc != 2) {
    805477        Tcl_WrongNumArgs(interp, 1, objv, "name");
     
    927599        Tcl_CreateObjCommand(interp, "unsetenv", UnsetEnvCmd, NULL, NULL);
    928600        Tcl_CreateObjCommand(interp, "lchown", lchownCmd, NULL, NULL);
    929         Tcl_CreateObjCommand(interp, "sysctl", SysctlCmd, NULL, NULL);
    930        
     601
    931602        Tcl_CreateObjCommand(interp, "readline", ReadlineCmd, NULL, NULL);
    932603        Tcl_CreateObjCommand(interp, "rl_history", RLHistoryCmd, NULL, NULL);
    933        
     604
    934605        Tcl_CreateObjCommand(interp, "getuid", getuidCmd, NULL, NULL);
    935606        Tcl_CreateObjCommand(interp, "geteuid", geteuidCmd, NULL, NULL);
     
    945616        Tcl_CreateObjCommand(interp, "name_to_gid", name_to_gidCmd, NULL, NULL);
    946617        Tcl_CreateObjCommand(interp, "gid_to_name", gid_to_nameCmd, NULL, NULL);
    947        
     618
    948619        Tcl_CreateObjCommand(interp, "tracelib", TracelibCmd, NULL, NULL);
    949620        Tcl_CreateObjCommand(interp, "isatty", IsattyCmd, NULL, NULL);
    950621        Tcl_CreateObjCommand(interp, "term_get_size", TermGetSizeCmd, NULL, NULL);
    951         Tcl_CreateObjCommand(interp, "get_systemconfiguration_proxies", GetSystemConfigurationProxiesCmd, NULL, NULL);
    952622
    953623        if (Tcl_PkgProvide(interp, "Pextlib", "1.0") != TCL_OK)
  • branches/gsoc09-logging/base/src/pextlib1.0/strsed.h

    • Property svn:keywords set to Id
    r53509 r55506  
     1/*
     2 * strsed.h
     3 * $Id$
     4 *
     5 * Copyright (c) 2009 The MacPorts Project
     6 * All rights reserved.
     7 *
     8 * Redistribution and use in source and binary forms, with or without
     9 * modification, are permitted provided that the following conditions
     10 * are met:
     11 * 1. Redistributions of source code must retain the above copyright
     12 *    notice, this list of conditions and the following disclaimer.
     13 * 2. Redistributions in binary form must reproduce the above copyright
     14 *    notice, this list of conditions and the following disclaimer in the
     15 *    documentation and/or other materials provided with the distribution.
     16 * 3. Neither the name of The MacPorts Project nor the names of its contributors
     17 *    may be used to endorse or promote products derived from this software
     18 *    without specific prior written permission.
     19 *
     20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30 * POSSIBILITY OF SUCH DAMAGE.
     31 */
     32
    133char *strsed(char *, char *, int *);
  • branches/gsoc09-logging/base/src/pextlib1.0/xinstall.c

    r51384 r55506  
    7171#include <tcl.h>
    7272
     73#include "Pextlib.h"
     74
    7375#if HAVE_PATHS_H
    7476#include <paths.h>
     
    139141static int      trymmap(int);
    140142static void     usage(Tcl_Interp *interp);
    141 
    142 extern int      ui_info(Tcl_Interp *interp, char *mesg);
    143143
    144144int
  • branches/gsoc09-logging/base/src/port/port-help.tcl

    r52218 r55506  
    4141--work        Removes work directory (default)
    4242--all         Removes everything from above
    43 }
    44 
    45 set porthelp(compact) {
    46 Compact the given ports (unimplemented)
    4743}
    4844
     
    274270}
    275271
    276 set porthelp(uncompact) {
    277 Uncompact a port (unimplemented)
    278 }
    279 
    280272set porthelp(uninstall) {
    281273Uninstall the given ports
     
    286278set porthelp(upgrade) {
    287279Upgrades the given ports to the latest version. Respects global options
    288 -n, -R, -u, and -f (see the port man page).  Note that in selecting variants
     280-n, -R, and -u (see the port man page).  Note that in selecting variants
    289281to use in the upgraded build of the port, the order of precedence is variants
    290282specified on the command line, then variants active in the latest installed
    291283version of the port, then the variants.conf file.
     284
     285--force             Ignore circumstances that would normally cause ports to be
     286                    skipped (e.g. not outdated).
     287--enforce-variants  If the installed variants do not match those requested,
     288                    upgrade even if the port is not outdated.
     289--no-replace        Do not replace one port with another according to the
     290                    replaced_by field
    292291}
    293292
  • branches/gsoc09-logging/base/src/port/port.tcl

    r55416 r55506  
    260260    #   version         (version_revision)
    261261    #   variants array  (variant=>+-)
     262    #   requested_variants array  (variant=>+-)
    262263    #   options array   (key=>value)
    263264    #   fullname        (name/version_revision+-variants)
     
    268269    if {![info exists port(version)]}   { set port(version) "" }
    269270    if {![info exists port(variants)]}  { set port(variants) "" }
     271    if {![info exists port(requested_variants)]}  { set port(requested_variants) "" }
    270272    if {![info exists port(options)]}   { set port(options) [array get global_options] }
    271273
     
    300302        array set port $portentry
    301303        if ([info exists overrides(version)])   { set port(version) $overrides(version) }
    302         if ([info exists overrides(variants)])  { set port(variants) $overrides(variants)   }
     304        if ([info exists overrides(variants)])  { set port(variants) $overrides(variants) }
     305        if ([info exists overrides(requested_variants)])  { set port(requested_variants) $overrides(requested_variants) }
    303306        if ([info exists overrides(options)])   { set port(options) $overrides(options) }
    304307        add_to_portlist portlist [array get port]
     
    364367            array unset variations
    365368            array set variations $portspec(variants)
     369            array unset requested_variations
     370            array set requested_variations $portspec(requested_variants)
    366371            array unset options
    367372            array set options $portspec(options)
     
    880885    set name ""
    881886    set version ""
    882     array unset variants
     887    array unset requested_variants
    883888    array unset options
    884889   
     
    974979            set name [url_to_portname $token]
    975980            if {$name != ""} {
    976                 parsePortSpec version variants options
     981                parsePortSpec version requested_variants options
    977982                add_to_portlist reslist [list url $token \
    978983                  name $name \
    979984                  version $version \
    980                   variants [array get variants] \
     985                  requested_variants [array get requested_variants] \
     986                  variants [array get requested_variants] \
    981987                  options [array get options]]
    982988            } else {
     
    989995        default             { # Treat anything else as a portspec (portname, version, variants, options
    990996            # or some combination thereof).
    991             parseFullPortSpec url name version variants options
     997            parseFullPortSpec url name version requested_variants options
    992998            add_to_portlist reslist [list url $url \
    993999              name $name \
    9941000              version $version \
    995               variants [array get variants] \
     1001              requested_variants [array get requested_variants] \
     1002              variants [array get requested_variants] \
    9961003              options [array get options]]
    9971004            set el 1
     
    10131020    array unset overrides
    10141021    if {$version != ""} { set overrides(version) $version }
    1015     if {[array size variants]} { set overrides(variants) [array get variants] }
     1022    if {[array size variants]} {
     1023        # we always record the requested variants separately,
     1024        # but requested ones always override existing ones
     1025        set overrides(requested_variants) [array get variants]
     1026        set overrides(variants) [array get variants]
     1027    }
    10161028    if {[array size options]} { set overrides(options) [array get options] }
    10171029
     
    13321344        }
    13331345    }
     1346    return 0
    13341347}
    13351348
     
    15671580            license     License
    15681581            conflicts   "Conflicts with"
     1582            replaced_by "Replaced by"
    15691583        }
    15701584
     
    15721586        array set pretty_wrap {
    15731587            heading 0
     1588            replaced_by 22
    15741589            variants 22
    15751590            depends_fetch 22
     
    16351650        set fields_tried {}
    16361651        if {![llength $opts_todo]} {
    1637             set opts_todo {ports_info_heading ports_info_variants
     1652            set opts_todo {ports_info_heading
     1653                ports_info_replaced_by
     1654                ports_info_variants
    16381655                ports_info_skip_line
    16391656                ports_info_long_description ports_info_homepage
     
    18311848    }
    18321849
     1850    set status 0
    18331851    foreachport $portlist {
    18341852        if {$porturl eq ""} {
     
    18481866            set porturl $portinfo(porturl)
    18491867        }
     1868       
     1869        # Add any global_variations to the variations
     1870        # specified for the port
     1871        array unset merged_variations
     1872        array set merged_variations [array get variations]
     1873        foreach { variation value } [array get global_variations] {
     1874            if { ![info exists merged_variations($variation)] } {
     1875                set merged_variations($variation) $value
     1876            }
     1877        }
    18501878
    18511879        # Open the Portfile associated with this port.
     
    18811909        }
    18821910    }
     1911    return $status
    18831912}
    18841913
     
    20652094
    20662095proc action_upgrade { action portlist opts } {
    2067     global global_variations
    20682096    if {[require_portlist portlist]} {
    20692097        return 1
     
    20712099    # shared depscache for all ports in the list
    20722100    array set depscache {}
     2101    set status 0
    20732102    foreachport $portlist {
    2074         if {![registry::entry_exists_for_name $portname]} {
    2075             ui_error "$portname is not installed"
    2076             return 1
    2077         }
    20782103        if {![info exists depscache(port:$portname)]} {
    2079             # Global variations will have to be merged into the specified
    2080             # variations, but perhaps after the installed variations are
    2081             # merged. So we pass them into upgrade.
    2082            
    2083             # First filter out implicit variants from the explicitly set/unset variants.
    2084             set global_variations_list [mport_filtervariants [array get global_variations] yes]
    2085             set variations_list [mport_filtervariants [array get variations] yes]
    2086            
    2087             macports::upgrade $portname "port:$portname" $global_variations_list $variations_list [array get options] depscache
    2088         }
    2089     }
    2090 
    2091     return 0
     2104            set status [macports::upgrade $portname "port:$portname" [array get requested_variations] [array get options] depscache]
     2105            if {$status != 0 && ![macports::ui_isset ports_processall]} {
     2106                return $status
     2107            }
     2108        }
     2109    }
     2110
     2111    return $status
    20922112}
    20932113
     
    21142134
    21152135
    2116 proc action_compact { action portlist opts } {
    2117     set status 0
    2118     if {[require_portlist portlist]} {
    2119         return 1
    2120     }
    2121     foreachport $portlist {
    2122         if { [catch {portimage::compact $portname [composite_version $portversion [array get variations]]} result] } {
    2123             global errorInfo
    2124             ui_debug "$errorInfo"
    2125             break_softcontinue "port compact failed: $result" 1 status
    2126         }
    2127     }
    2128 
    2129     return $status
    2130 }
    2131 
    2132 
    2133 proc action_uncompact { action portlist opts } {
    2134     set status 0
    2135     if {[require_portlist portlist]} {
    2136         return 1
    2137     }
    2138     foreachport $portlist {
    2139         if { [catch {portimage::uncompact $portname [composite_version $portversion [array get variations]]} result] } {
    2140             global errorInfo
    2141             ui_debug "$errorInfo"
    2142             break_softcontinue "port uncompact failed: $result" 1 status
    2143         }
    2144     }
    2145    
    2146     return $status
    2147 }
    2148 
    2149 
    21502136proc action_dependents { action portlist opts } {
    21512137    if {[require_portlist portlist]} {
     
    21562142    registry::open_dep_map
    21572143
     2144    set status 0
    21582145    foreachport $portlist {
    21592146        set composite_version [composite_version $portversion [array get variations]]
     
    21832170        }
    21842171    }
    2185     return 0
     2172    return $status
    21862173}
    21872174
     
    22012188
    22022189    foreachport $portlist {
     2190        if {![registry::entry_exists_for_name $portname]} {
     2191            ui_info "$portname is already uninstalled"
     2192            continue
     2193        }
    22032194        if { [catch {portuninstall::uninstall $portname [composite_version $portversion [array get variations]] [array get options]} result] } {
    22042195            global errorInfo
     
    22082199    }
    22092200
    2210     return 0
     2201    return $status
    22112202}
    22122203
     
    23322323           
    23332324            # Get information about latest available version and revision
     2325            if {![info exists portinfo(version)]} {
     2326                ui_warn "$portname has no version field"
     2327                continue
     2328            }
    23342329            set latest_version $portinfo(version)
    23352330            set latest_revision 0
     
    29492944        }
    29502945       
    2951         # Add any global_variations to the variations
    2952         # specified for the port
    2953         foreach { variation value } [array get global_variations] {
    2954             if { ![info exists variations($variation)] } {
    2955                 set variations($variation) $value
    2956             }
     2946        # use existing variants iff none were explicitly requested
     2947        if {[array get requested_variations] == "" && [array get variations] != ""} {
     2948            array unset requested_variations
     2949            array set requested_variations [array get variations]
     2950            set filtered_variations [mport_filtervariants [array get variations] no]
     2951        } else {
     2952            set filtered_variations [mport_filtervariants [array get requested_variations] yes]
    29572953        }
    29582954        # Filter out implicit variants from the explicitly set/unset variants.
     
    29622958            mirror {}
    29632959            default {
    2964                 set variationslist [mport_filtervariants [array get variations] yes]
    2965                 array unset variations
    2966                 array set variations $variationslist
     2960                array unset requested_variations
     2961                array set requested_variations $filtered_variations
     2962            }
     2963        }
     2964       
     2965        # Add any global_variations to the variations
     2966        # specified for the port
     2967        foreach { variation value } [array get global_variations] {
     2968            if { ![info exists requested_variations($variation)] } {
     2969                set requested_variations($variation) $value
    29672970            }
    29682971        }
     
    29732976            set options(ports_version_glob) $portversion
    29742977        }
    2975         if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result]} {
     2978        if {[catch {set workername [mportopen $porturl [array get options] [array get requested_variations]]} result]} {
    29762979            global errorInfo
    29772980            ui_debug "$errorInfo"
     
    30833086    version     [list action_version        [action_args_const none]] \
    30843087    platform    [list action_platform       [action_args_const none]] \
    3085     compact     [list action_compact        [action_args_const ports]] \
    3086     uncompact   [list action_uncompact      [action_args_const ports]] \
    30873088    \
    30883089    uninstall   [list action_uninstall      [action_args_const ports]] \
     
    31863187                 line long_description
    31873188                 maintainer maintainers name platform platforms portdir pretty
    3188                  revision variant variants version}
     3189                 replaced_by revision variant variants version}
    31893190    search      {case-sensitive category categories depends_fetch
    31903191                 depends_extract depends_build depends_lib depends_run
     
    32003201    select      {list set show}
    32013202    log         {{phase 1} {verbosity 1}}
     3203    upgrade     {force enforce-variants no-replace}
    32023204}
    32033205
     
    33123314                        set ui_options(ports_processall) yes
    33133315                    }
    3314                     x {
    3315                         # Exit with error from any command while in batch/interactive mode
    3316                         set ui_options(ports_exit) yes
    3317                     }
    3318 
    33193316                    f {
    33203317                        set global_options(ports_force) yes
     
    33883385
    33893386    # Process an action if there is one
    3390     while {$action_status == 0 && [moreargs]} {
     3387    while {($action_status == 0 || [macports::ui_isset ports_processall]) && [moreargs]} {
    33913388        set action [lookahead]
    33923389        advance
     
    34713468        # semaphore to exit
    34723469        if {$action_status == -999} break
    3473 
    3474         # If we're not in exit mode then ignore the status from the command
    3475         if { ![macports::ui_isset ports_exit] } {
    3476             set action_status 0
    3477         }
    34783470    }
    34793471   
     
    35983590    # Main command loop
    35993591    set exit_status 0
    3600     while { $exit_status == 0 } {
     3592    while { $exit_status == 0 || [macports::ui_isset ports_processall] } {
    36013593
    36023594        # Calculate our prompt
     
    36183610       
    36193611        # Check for semaphore to exit
    3620         if {$exit_status == -999} break
    3621        
    3622         # Ignore status unless we're in error-exit mode
    3623         if { ![macports::ui_isset ports_exit] } {
     3612        if {$exit_status == -999} {
    36243613            set exit_status 0
     3614            break
    36253615        }
    36263616    }
     
    36643654        }
    36653655
    3666         # Check for semaphore to exit
    3667         if {$exit_status == -999} {
    3668             set exit_status 0
    3669             break
    3670         }
    3671 
    3672         # Ignore status unless we're in error-exit mode
    3673         if { ![macports::ui_isset ports_exit] } {
    3674             set exit_status 0
     3656        # Exit on first failure unless -p was given
     3657        if {$exit_status != 0 && ![macports::ui_isset ports_processall]} {
     3658            return $exit_status
    36753659        }
    36763660    }
     
    37593743
    37603744    # If there are remaining arguments, process those as a command
    3761 
    3762     # Exit immediately, by default, unless we're going to be processing command files
    3763     if {![info exists ui_options(ports_commandfiles)]} {
    3764         set ui_options(ports_exit) yes
    3765     }
    37663745    set exit_status [process_cmd $remaining_args]
    37673746}
    37683747
    37693748# Process any prescribed command files, including standard input
    3770 if { $exit_status == 0 && [info exists ui_options(ports_commandfiles)] } {
     3749if { ($exit_status == 0 || [macports::ui_isset ports_processall]) && [info exists ui_options(ports_commandfiles)] } {
    37713750    set exit_status [process_command_files $ui_options(ports_commandfiles)]
    37723751}
  • branches/gsoc09-logging/base/src/port/portindex.tcl

    r52218 r55506  
    6161            cd [file join $directory [file dirname $portinfo(portdir)]]
    6262            puts "Archiving port $portinfo(name) to [file join $outdir $portinfo(portarchive)]"
    63             set tar [findBinary tar $macports::autoconf::tar_path]
    64             set gzip [findBinary gzip $macports::autoconf::gzip_path]
     63            set tar [macports::findBinary tar $macports::autoconf::tar_path]
     64            set gzip [macports::findBinary gzip $macports::autoconf::gzip_path]
    6565            if {[catch {exec $tar -cf - [file tail $portdir] | $gzip -c >[file join $outdir $portinfo(portarchive)]} result]} {
    6666                puts stderr "Failed to create port archive $portinfo(portarchive): $result"
     
    6969        }
    7070
    71         set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir}
     71        set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir portarchive replaced_by}
    7272        foreach availkey [array names portinfo] {
    7373            if {[lsearch -exact ${keepkeys} $availkey] == -1} {
  • branches/gsoc09-logging/base/src/port1.0/portbuild.tcl

    r53509 r55506  
    120120    # if set to '0', use the number of cores for the number of jobs
    121121    if {$jobs == 0} {
    122         if {[catch {set jobs [sysctl hw.activecpu]}]} {
     122        if {[catch {set jobs [sysctl hw.activecpu]}] || [catch {set memsize [sysctl hw.memsize]}]} {
    123123            set jobs 2
    124124            ui_warn "failed to determine the number of available CPUs (probably not supported on this platform)"
    125125            ui_warn "defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf"
     126        }
     127        if {$jobs > $memsize / 1000000000 + 1} {
     128            set jobs [expr $memsize / 1000000000 + 1]
    126129        }
    127130    }
  • branches/gsoc09-logging/base/src/port1.0/portclean.tcl

    r52853 r55506  
    246246            # Make sure file is truly a port archive file, and not
    247247            # and accidental match with some other file that might exist.
    248             if {[regexp "^$name-\[-_a-zA-Z0-9\.\]+_\[0-9\]*\[+-_a-zA-Z0-9\]*\[\.\][option os.arch]\[\.\]\[a-z\]+\$" $file]} {
     248            if {[regexp "^$name-\[-_a-zA-Z0-9\.\]+_\[0-9\]*\[+-_a-zA-Z0-9\]*\[\.\][option os.arch]\[\.\]\[a-z2\]+\$" $file]} {
    249249                if {[file isfile $path]} {
    250250                    ui_debug "Removing archive: $path"
  • branches/gsoc09-logging/base/src/port1.0/portconfigure.tcl

    r53509 r55506  
    6363option_proc use_xmkmf       portconfigure::set_configure_type
    6464
     65option_proc autoreconf.cmd  portconfigure::set_configure_type
     66option_proc automake.cmd    portconfigure::set_configure_type
     67option_proc autoconf.cmd    portconfigure::set_configure_type
     68option_proc xmkmf.cmd       portconfigure::set_configure_type
     69
     70##
     71# Local helper proc
     72proc portconfigure::add_build_dep { type dep } {
     73    global ${type}.cmd option_defaults
     74
     75    if {![info exists ${type}.cmd] || (
     76        ([info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] == $option_defaults(${type}.cmd)) ||
     77        (![info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] == "${type}")
     78        )} {
     79            eval depends_build-append $dep
     80    }
     81}
     82
     83##
     84# Adds dependencies for the binaries which will be called, but only if it is
     85# the default. If .cmd was overwritten the port has to care for deps itself.
    6586proc portconfigure::set_configure_type {option action args} {
    66     if {[string equal ${action} "set"] && [tbool args]} {
     87    global autoreconf.cmd automake.cmd autoconf.cmd xmkmf.cmd
     88
     89    array set configure_map {
     90        autoconf    {port:autoconf port:automake port:libtool}
     91        xmkmf       port:imake
     92    }
     93
     94    if {[string equal ${action} "set"]} {
    6795        switch $option {
     96            autoreconf.cmd  -
     97            automake.cmd    -
     98            autoconf.cmd {
     99                eval depends_build-delete $configure_map(autoconf)
     100            }
     101            xmkmf.cmd {
     102                depends_build-delete $configure_map(xmkmf)
     103            }
    68104            use_xmkmf {
    69                 depends_build-append port:imake
     105                if {[tbool args]} {
     106                    depends_build-append $configure_map(xmkmf)
     107                }
    70108            }
    71109            default {
    72                 depends_build-append port:autoconf port:automake port:libtool
     110                # strip "use_"
     111                set type [string range $option 4 end]
     112                if {[tbool args]} {
     113                    add_build_dep $type $configure_map(autoconf)
     114                }
    73115            }
    74116        }
     
    110152default configure.pkg_config_path   {}
    111153
    112 options configure.build_arch configure.archflags
     154options configure.build_arch
    113155default configure.build_arch {${build_arch}}
    114 default configure.archflags  {[portconfigure::configure_get_archflags]}
     156foreach tool {cc cxx objc f77 f90 fc} {
     157    options configure.${tool}_archflags
     158    default configure.${tool}_archflags  "\[portconfigure::configure_get_archflags $tool\]"
     159}
    115160
    116161options configure.universal_archs configure.universal_args configure.universal_cflags configure.universal_cppflags configure.universal_cxxflags configure.universal_ldflags
     
    140185
    141186proc portconfigure::configure_start {args} {
    142     global UI_PREFIX configure.compiler configure.optflags configure.archflags
    143     global configure.march configure.mtune configure.universal_cflags
    144     global configure.universal_cxxflags configure.universal_cppflags
    145     global configure.universal_ldflags configure.universal_args
     187    global UI_PREFIX configure.compiler
    146188   
    147189    ui_msg "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option name]]"
     
    168210    }
    169211    ui_debug "Using compiler '$name'"
    170    
    171     # add in extra CFLAGS etc
    172     if {[variant_exists universal] && [variant_isset universal]} {
    173         foreach flag {cflags objcflags fflags f90flags fcflags} {
    174             eval configure.${flag}-append ${configure.universal_cflags}
    175         }
    176         eval configure.cxxflags-append ${configure.universal_cxxflags}
    177         eval configure.cppflags-append ${configure.universal_cppflags}
    178         eval configure.ldflags-append ${configure.universal_ldflags}
    179         eval configure.pre_args-append ${configure.universal_args}
    180     } else {
    181         foreach flag {cflags cxxflags objcflags fflags f90flags fcflags} {
    182             eval configure.${flag}-append ${configure.archflags}
    183             if {${configure.march} != {}} {
    184                 configure.${flag}-append "-march=${configure.march}"
    185             }
    186             if {${configure.mtune} != {}} {
    187                 configure.${flag}-append "-mtune=${configure.mtune}"
    188             }
    189         }
    190         eval configure.ldflags-append ${configure.archflags}
    191     }
    192212}
    193213
    194214# internal function to determine the compiler flags to select an arch
    195 proc portconfigure::configure_get_archflags {args} {
     215proc portconfigure::configure_get_archflags {tool} {
    196216    global configure.build_arch configure.m32 configure.m64 configure.compiler
    197217    set flags ""
     
    201221        set flags "-m32"
    202222    } elseif {${configure.build_arch} != ""} {
    203         if {[arch_flag_supported]} {
     223        if {[arch_flag_supported] && $tool == "cc" || $tool == "cxx" || $tool == "objc"} {
    204224            set flags "-arch ${configure.build_arch}"
    205225        } elseif {${configure.build_arch} == "x86_64" || ${configure.build_arch} == "ppc64"} {
     
    325345                objc { set ret /usr/bin/gcc-4.2 }
    326346                cxx  { set ret /usr/bin/g++-4.2 }
     347                cpp  { set ret /usr/bin/cpp-4.2 }
    327348            }
    328349        }
     
    436457    global [info globals]
    437458    global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf
    438     global configure.env configure.pipe configure.cflags configure.cppflags configure.cxxflags configure.objcflags configure.ldflags configure.libs configure.fflags configure.f90flags configure.fcflags configure.classpath
     459    global configure.env configure.pipe configure.libs configure.classpath configure.universal_args
    439460    global configure.perl configure.python configure.ruby configure.install configure.awk configure.bison configure.pkg_config configure.pkg_config_path
    440     global configure.ccache configure.distcc configure.cc configure.cxx configure.cpp configure.objc configure.f77 configure.f90 configure.fc configure.javac
     461    global configure.ccache configure.distcc configure.cpp configure.javac configure.march configure.mtune
     462    foreach tool {cc cxx objc f77 f90 fc} {
     463        global configure.${tool} configure.${tool}_archflags
     464    }
     465    foreach flags {cflags cppflags cxxflags objcflags ldflags fflags f90flags fcflags} {
     466        global configure.${flags} configure.universal_${flags}
     467    }
    441468   
    442469    if {[tbool use_autoreconf]} {
     
    491518        # Append configure flags.
    492519        append_list_to_environment_value configure "CC" ${filter}${configure.cc}
    493         append_list_to_environment_value configure "CPP" ${filter}${configure.cpp}
    494520        append_list_to_environment_value configure "CXX" ${filter}${configure.cxx}
    495521        append_list_to_environment_value configure "OBJC" ${filter}${configure.objc}
     
    516542        append_list_to_environment_value configure "PKG_CONFIG" ${configure.pkg_config}
    517543        append_list_to_environment_value configure "PKG_CONFIG_PATH" ${configure.pkg_config_path}
     544       
     545        # add extra flags that are conditional on whether we're building universal
     546        if {[variant_exists universal] && [variant_isset universal]} {
     547            foreach flags {CFLAGS OBJCFLAGS} {
     548                append_list_to_environment_value configure $flags ${configure.universal_cflags}
     549            }
     550            append_list_to_environment_value configure "CXXFLAGS" ${configure.universal_cxxflags}
     551            append_list_to_environment_value configure "CPPFLAGS" ${configure.universal_cppflags}
     552            append_list_to_environment_value configure "LDFLAGS" ${configure.universal_ldflags}
     553            eval configure.pre_args-append ${configure.universal_args}
     554        } else {
     555            foreach {tool flags} {cc CFLAGS cxx CXXFLAGS objc OBJCFLAGS f77 FFLAGS f90 F90FLAGS fc FCFLAGS} {
     556                append_list_to_environment_value configure $flags [set configure.${tool}_archflags]
     557                if {${configure.march} != {}} {
     558                    append_list_to_environment_value configure $flags "-march=${configure.march}"
     559                }
     560                if {${configure.mtune} != {}} {
     561                    append_list_to_environment_value configure $flags "-mtune=${configure.mtune}"
     562                }
     563            }
     564        }
    518565
    519566        # Execute the command (with the new environment).
  • branches/gsoc09-logging/base/src/port1.0/portdestroot.tcl

    r53509 r55506  
    8989proc portdestroot::destroot_start {args} {
    9090    global UI_PREFIX prefix name porturl destroot os.platform destroot.clean portsharepath
    91     global destroot.umask destroot.asroot macportsuser euid egid usealtworkpath altprefix
     91    global destroot.umask destroot.asroot macportsuser euid egid
    9292    global applications_dir frameworks_dir
    9393    variable oldmask
     
    108108    if { [tbool destroot.asroot] && [getuid] != 0 } {
    109109        return -code error "You cannot run this port without root privileges. You need to re-run with 'sudo port'.";
    110     }
    111 
    112     if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
    113         # rewrite destroot.args
    114         set argprefix "=[option prefix]"
    115         set newargprefix "=${altprefix}[option prefix]"
    116         set newdestrootargs [string map [list $argprefix $newargprefix] [option destroot.args]]
    117         option destroot.args $newdestrootargs
    118110    }
    119111
  • branches/gsoc09-logging/base/src/port1.0/portfetch.tcl

    r53509 r55506  
    8585default cvs.post_args {"${cvs.module}"}
    8686
    87 default svn.cmd {[findBinary svn $portutil::autoconf::svn_path]}
     87# we want the svn port so we know --trust-server-cert will work
     88default svn.cmd {${prefix}/bin/svn}
    8889default svn.dir {${workpath}}
    8990default svn.method {export}
    9091default svn.revision ""
    9192default svn.env {}
    92 default svn.pre_args {"--non-interactive"}
     93default svn.pre_args {"--non-interactive --trust-server-cert"}
    9394default svn.args ""
    9495default svn.post_args {"${svn.url}"}
     
    166167            }
    167168            svn {
    168                 depends_fetch-append bin:svn:subversion
     169                depends_fetch-append port:subversion
    169170            }
    170171            git {
     
    649650                    # Special hack to check for sourceforge mirrors, which don't return a proper error code on failure
    650651                    if {![string equal $effectiveURL $file_url] &&
    651                         [string match "*sourceforge*" $file_url] &&
    652                         [string match "*failedmirror*" $effectiveURL]} {
     652                        [string match "http://*sourceforge.net/*" $file_url] &&
     653                        [string match "http://*sourceforge.net/projects/*/files/" $effectiveURL]} {
    653654
    654655                        # *SourceForge hackage in effect*
     
    704705proc portfetch::fetch_init {args} {
    705706    global distfiles distname distpath all_dist_files dist_subdir fetch.type fetch_init_done
    706     global altprefix usealtworkpath
    707707    variable fetch_urls
    708708
    709709    if {[info exists distpath] && [info exists dist_subdir] && ![info exists fetch_init_done]} {
    710 
    711         # start gsoc08-privileges
    712         if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
    713             # I have removed ![file writable $distpath] from the if condition as
    714             # the writable condition seems to get confused by effective uids.
    715             set distpath "$altprefix/[ string range $distpath 1 end ]"
    716             ui_debug "Going to use $distpath for fetch."
    717         }
    718         # end gsoc08-privileges
    719710        set distpath ${distpath}/${dist_subdir}
    720711        set fetch_init_done yes
  • branches/gsoc09-logging/base/src/port1.0/portlint.tcl

    r53509 r55506  
    329329        }
    330330    }
     331   
     332    if {[info exists name]} {
     333        if {[regexp {[^[:alnum:]_.-]} $name]} {
     334            ui_error "Port name '$name' contains unsafe characters. Names should only contain alphanumeric characters, underscores, dashes or dots."
     335            incr errors
     336        }
     337    }
    331338
    332339    if {[info exists platforms]} {
     
    441448    }
    442449
     450    # Check for multiple dependencies
     451    foreach deptype {depends_extract depends_lib depends_build depends_run} {
     452        if {[info exists $deptype]} {
     453            array set depwarned {}
     454            foreach depspec [set $deptype] {
     455                if {![info exists depwarned($depspec)]
     456                        && [llength [lsearch -exact -all [set $deptype] $depspec]] > 1} {
     457                    ui_warn "Dependency $depspec specified multiple times in $deptype"
     458                    incr warnings
     459                    # Report each depspec only once
     460                    set depwarned($depspec) yes
     461                }
     462            }
     463        }
     464    }
     465
    443466    if {[regexp "^(.+)nomaintainer(@macports.org)?(.+)$" $maintainers] } {
    444467        ui_error "Using nomaintainer together with other maintainer"
  • branches/gsoc09-logging/base/src/port1.0/portmain.tcl

    r54738 r55506  
    4646# define options
    4747options prefix macportsuser name version revision epoch categories maintainers
    48 options long_description description homepage license provides conflicts
     48options long_description description homepage license provides conflicts replaced_by
    4949options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
    5050options universal_variant os.universal_supported
    5151options copy_log_files
     52options compiler.cpath compiler.library_path
    5253# Export options via PortInfo
    53 options_export name version revision epoch categories maintainers platforms description long_description homepage license provides conflicts
     54options_export name version revision epoch categories maintainers platforms description long_description homepage license provides conflicts replaced_by
    5455
    5556# Assign option procedure to default_variants
    5657option_proc default_variants handle_default_variants
    5758
    58 default distpath {[file join $portdbpath distfiles]}
    5959default workpath {[getportworkpath_from_buildpath $portbuildpath]}
    60 default worksymlink {[file join $portpath work]}
    6160default prefix /opt/local
    6261default applications_dir /Applications/MacPorts
     
    8483set os_arch $tcl_platform(machine)
    8584if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
    86 if {$os_arch == "i586" || $os_arch == "i686"} { set os_arch "i386" }
     85if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
    8786set os_version $tcl_platform(osVersion)
    8887set os_major [lindex [split $os_version .] 0]
     
    114113default universal_variant yes
    115114
     115default compiler.cpath {${prefix}/include}
     116default compiler.library_path {${prefix}/lib}
     117
    116118# Select implicit variants
    117119if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
     
    125127}
    126128
     129# start gsoc08-privileges
     130
    127131# Record initial euid/egid
    128132set euid [geteuid]
    129133set egid [getegid]
    130134
     135# if unable to write to workpath, implies running without either root privileges
     136# or a shared directory owned by the group so use ~/.macports
     137if { $euid != 0 && (([info exists workpath] && [file exists $workpath] && ![file writable $workpath]) || ([info exists portdbpath] && ![file writable [file join $portdbpath build]])) } {
     138
     139    set username [uid_to_name [getuid]]
     140
     141    # set global variable indicating to other functions to use ~/.macports as well
     142    set usealtworkpath yes
     143
     144    # do tilde expansion manually - Tcl won't expand tildes automatically for curl, etc.
     145    if {[info exists env(HOME)]} {
     146        # HOME environment var is set, use it.
     147        set userhome "$env(HOME)"
     148    } else {
     149        # the environment var isn't set, expand ~user instead
     150        set userhome [file normalize "~${username}"]
     151    }
     152
     153    # set alternative prefix global variable
     154    set altprefix [file join $userhome .macports]
     155
     156    default worksymlink {[file join ${altprefix}${portpath} work]}
     157    default distpath {[file join ${altprefix}${portdbpath} distfiles]}
     158    set portbuildpath "${altprefix}${portbuildpath}"
     159
     160    ui_debug "Going to use alternate build prefix: $altprefix"
     161    ui_debug "workpath = $workpath"
     162} else {
     163    set usealtworkpath no
     164    default worksymlink {[file join $portpath work]}
     165    default distpath {[file join $portdbpath distfiles]}
     166}
     167# end gsoc08-privileges
     168
    131169proc portmain::main {args} {
    132170    return 0
  • branches/gsoc09-logging/base/src/port1.0/porttrace.tcl

    r53509 r55506  
    4545            ui_warn "trace requires Tcl Thread package ($error)"
    4646        } else {
    47             global env trace_fifo trace_sandboxbounds portpath distpath
     47            global env trace_fifo trace_sandboxbounds portpath distpath altprefix
    4848            # Create a fifo.
    4949            # path in unix socket limited to 109 chars
  • branches/gsoc09-logging/base/src/port1.0/portutil.tcl

    r54739 r55506  
    359359        set ${command}.env_array(MACOSX_DEPLOYMENT_TARGET) [option macosx_deployment_target]
    360360    }
     361    if {[option compiler.cpath] ne ""} {
     362        set ${command}.env_array(CPATH) [join [option compiler.cpath] :]
     363    }
     364    if {[option compiler.library_path] ne ""} {
     365        set ${command}.env_array(LIBRARY_PATH) [join [option compiler.library_path] :]
     366    }
    361367
    362368    # Debug that.
     
    912918        }
    913919
    914         eval file attributes {$file} $attributes
     920        fileAttrsAsRoot $file $attributes
    915921
    916922        file delete "$tmpfile"
     
    12201226    if {$procedure != ""} {
    12211227        set targetname [ditem_key $ditem name]
    1222         if { [tbool ${targetname}.asroot] } {
     1228        set target [ditem_key $ditem provides]
     1229        global ${target}.asroot
     1230        if { [tbool ${target}.asroot] } {
    12231231            elevateToRoot $targetname
    12241232        }
     
    15031511proc open_statefile {args} {
    15041512    global workpath worksymlink place_worksymlink name portpath ports_ignore_older
    1505     global altprefix usealtworkpath env applications_dir portbuildpath distpath
    1506 
    1507     # start gsoc08-privileges
    1508     if { ![file exists $workpath] } {
    1509         if {[catch {set result [file mkdir $workpath]} result]} {
    1510             global errorInfo
    1511             ui_debug "mkdir $workpath: $errorInfo"
    1512         }
    1513     }
    1514 
    1515     # if unable to write to workpath, implies running without either root privileges
    1516     # or a shared directory owned by the group so use ~/.macports
    1517     if { ![file writable $workpath] } {
    1518 
    1519         set userid [getuid]
    1520         set username [uid_to_name $userid]
    1521 
    1522         if { $userid !=0 } {
    1523             ui_msg "MacPorts running without privileges.\
    1524                     You may be unable to complete certain actions (eg install)."
    1525         }
    1526 
    1527         # set global variable indicating to other functions to use ~/.macports as well
    1528         set usealtworkpath yes
    1529 
    1530         # do tilde expansion manually - tcl won't expand tildes automatically for curl, etc.
    1531         if {[info exists env(HOME)]} {
    1532             # HOME environment var is set, use it.
    1533             set userhome "$env(HOME)"
    1534         } else {
    1535             # the environment var isn't set, expand ~user instead
    1536             set userhome [file normalize "~${username}"]
    1537         }
    1538 
    1539         # set alternative prefix global variables
    1540         set altprefix "$userhome/.macports"
    1541 
    1542         # get alternative paths
    1543         set newworkpath "$altprefix$workpath"
    1544         set newworksymlink "$altprefix$worksymlink"
    1545         set newportbuildpath "$altprefix$portbuildpath"
    1546         set newdistpath "$altprefix$distpath"
    1547 
    1548         set sourcepath [string map {"work" ""} $worksymlink]
    1549         set newsourcepath "$altprefix/[ string range $sourcepath 1 end ]"
    1550 
     1513    global usealtworkpath altprefix env applications_dir portbuildpath
     1514
     1515    if {![file isdirectory $workpath]} {
     1516        file mkdir $workpath
     1517        chownAsRoot $portbuildpath
     1518    }
     1519   
     1520    if { [getuid] != 0 } {
     1521        ui_msg "MacPorts running without privileges.\
     1522                You may be unable to complete certain actions (eg install)."
     1523    }
     1524   
     1525    # de-escalate privileges if MacPorts was started with sudo
     1526    dropPrivileges
     1527   
     1528    if {$usealtworkpath} {
     1529        set newsourcepath "$altprefix/$portpath"
     1530   
    15511531        # copy Portfile (and patch files) if not there already
    15521532        # note to maintainers/devs: the original portfile in /opt/local is ALWAYS the one that will be
     
    15541534        #    historically by macports from the portfile directory to the work directory.
    15551535        #    It is NOT read by MacPorts.
    1556         if {![file exists ${newsourcepath}Portfile] } {
     1536        if {![file exists ${newsourcepath}/Portfile] } {
    15571537            file mkdir $newsourcepath
    15581538            ui_debug "$newsourcepath created"
    1559             ui_debug "Going to copy: ${sourcepath}Portfile"
    1560             file copy ${sourcepath}Portfile $newsourcepath
    1561             if {[file exists ${sourcepath}files] } {
    1562                 ui_debug "Going to copy: ${sourcepath}files"
    1563                 file copy ${sourcepath}files $newsourcepath
    1564             }
    1565         }
    1566 
    1567         set workpath $newworkpath
    1568         set worksymlink $newworksymlink
    1569         set portbuildpath $newportbuildpath
    1570         set distpath $newdistpath
    1571 
    1572         ui_debug "Going to use $newworkpath for statefile."
    1573     } else {
    1574         set usealtworkpath no
    1575     }
    1576     # end gsoc08-privileges
    1577 
    1578     if {![file isdirectory $workpath]} {
    1579         file mkdir $workpath
     1539            ui_debug "Going to copy: ${portpath}/Portfile"
     1540            file copy ${portpath}/Portfile $newsourcepath
     1541            if {[file exists ${portpath}/files] } {
     1542                ui_debug "Going to copy: ${portpath}/files"
     1543                file copy ${portpath}/files $newsourcepath
     1544            }
     1545        }
    15801546    }
    15811547
     
    15871553        }
    15881554        if {!([info exists ports_ignore_older] && $ports_ignore_older == "yes") && [file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
    1589             ui_msg "Portfile changed since last build; discarding previous state."
    1590             #file delete $statefile
    1591             delete [file join $workpath]
    1592             file mkdir [file join $workpath]
    1593         }
    1594     }
    1595     chownAsRoot $workpath
     1555            if {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
     1556                ui_msg "Portfile changed since last build; discarding previous state."
     1557                delete $workpath
     1558                file mkdir $workpath
     1559            } else {
     1560                ui_msg "Portfile changed since last build but not discarding previous state (dry run)"
     1561            }
     1562        }
     1563    }
    15961564
    15971565    # Create a symlink to the workpath for port authors
     
    16001568        ln -sf $workpath $worksymlink
    16011569    }
    1602     # de-escalate privileges - only run if MacPorts was started with sudo
    1603     dropPrivileges
    16041570
    16051571    set fd [open $statefile a+]
     
    16411607}
    16421608
    1643 # check_statefile_variants
     1609##
    16441610# Check that recorded selection of variants match the current selection
    1645 proc check_statefile_variants {variations fd} {
     1611#
     1612# @param variations input array name of new variants
     1613# @param oldvariations output array name of old variants
     1614# @param fd file descriptor of the state file
     1615# @return 0 if variants match, 1 otherwise
     1616proc check_statefile_variants {variations oldvariations fd} {
    16461617    upvar $variations upvariations
     1618    upvar $oldvariations upoldvariations
     1619
     1620    array set upoldvariations {}
     1621
     1622    seek $fd 0 end
     1623    if {[tell $fd] == 0} {
     1624        # Statefile is empty, skipping further tests
     1625        return 0
     1626    }
    16471627
    16481628    seek $fd 0
    16491629    while {[gets $fd line] >= 0} {
    16501630        if {[regexp "variant: (.*)" $line match name]} {
    1651             set oldvariations([string range $name 1 end]) [string range $name 0 0]
     1631            set upoldvariations([string range $name 1 end]) [string range $name 0 0]
    16521632        }
    16531633    }
    16541634
    16551635    set mismatch 0
    1656     if {[array size oldvariations] > 0} {
    1657         if {[array size oldvariations] != [array size upvariations]} {
    1658             set mismatch 1
    1659         } else {
    1660             foreach key [array names upvariations *] {
    1661                 if {![info exists oldvariations($key)] || $upvariations($key) != $oldvariations($key)} {
     1636    if {[array size upoldvariations] != [array size upvariations]} {
     1637        set mismatch 1
     1638    } else {
     1639        foreach key [array names upvariations *] {
     1640            if {![info exists upoldvariations($key)] || $upvariations($key) != $upoldvariations($key)} {
    16621641                set mismatch 1
    16631642                break
    1664                 }
    16651643            }
    16661644        }
     
    18491827        set state_fd [open_statefile]
    18501828
    1851         if {[check_statefile_variants upvariations $state_fd]} {
    1852             ui_error "Requested variants do not match original selection.\nPlease perform 'port clean $portname' or specify the force option."
     1829        array set oldvariations {}
     1830        if {[check_statefile_variants upvariations oldvariations $state_fd]} {
     1831            ui_error "Requested variants \"[canonicalize_variants [array get upvariations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\".\nPlease use the same variants again, perform 'port clean $portname' or specify the force option (-f)."
    18531832            set result 1
    18541833        } elseif {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
     
    18651844}
    18661845
    1867 proc default_universal_variant_allowed {args} {
    1868 
     1846# add the default universal variant if appropriate
     1847proc universal_setup {args} {
    18691848    if {[variant_exists universal]} {
    18701849        ui_debug "universal variant already exists, so not adding the default one"
    1871         return no
    18721850    } elseif {[exists universal_variant] && ![option universal_variant]} {
    18731851        ui_debug "'universal_variant no' specified, so not adding the default universal variant"
    1874         return no
    18751852    } elseif {[exists use_xmkmf] && [option use_xmkmf]} {
    18761853        ui_debug "using xmkmf, so not adding the default universal variant"
    1877         return no
    18781854    } elseif {[exists use_configure] && ![option use_configure] && ![exists xcode.project]} {
    18791855        # Allow +universal if port uses xcode portgroup.
    18801856        ui_debug "not using configure, so not adding the default universal variant"
    1881         return no
    18821857    } elseif {![exists os.universal_supported] || ![option os.universal_supported]} {
    18831858        ui_debug "OS doesn't support universal builds, so not adding the default universal variant"
    1884         return no
    18851859    } else {
    18861860        ui_debug "adding the default universal variant"
    1887         return yes
    1888     }
    1889 }
    1890 
    1891 proc add_default_universal_variant {args} {
    1892     # Declare default universal variant (all the magic happens in portconfigure now)
    1893     variant universal {}
     1861        variant universal {}
     1862    }
    18941863}
    18951864
     
    23652334
    23662335##
     2336# Change attributes of file while running as root
     2337#
     2338# @param file the file in question
     2339# @param attributes the attributes for the file
     2340proc fileAttrsAsRoot {file attributes} {
     2341    global euid macportsuser
     2342    if {[getuid] == 0 && [geteuid] != 0} {
     2343        # Started as root, but not root now
     2344        seteuid $euid
     2345        ui_debug "euid changed to: [geteuid]"
     2346        ui_debug "setting attributes on $file"
     2347        eval file attributes {$file} $attributes
     2348        seteuid [name_to_uid "$macportsuser"]
     2349        ui_debug "euid changed to: [geteuid]"
     2350    } else {
     2351        eval file attributes {$file} $attributes
     2352    }
     2353}
     2354
     2355##
    23672356# Elevate privileges back to root.
    23682357#
  • branches/gsoc09-logging/base/src/programs/daemondo/Makefile.in

    r43335 r55506  
    99mandircat8=     ${mandir}/cat8
    1010
    11 CFLAGS_QUICHEEATERS     = -W -Wall -Wno-unused-parameter
     11CFLAGS_QUICHEEATERS     = -W -Wall
     12CPPFLAGS        += -I../..
    1213SRCS            = main.c
    1314OBJS            = main.o
     
    3334        rm -f Makefile
    3435
    35 install:
     36install: daemondo
    3637        ${INSTALL} -o ${DSTUSR} -g ${DSTGRP} -m 555 ${PROGRAM} ${DESTDIR}${bindir}
    3738
  • branches/gsoc09-logging/base/src/programs/daemondo/main.c

    r49091 r55506  
    4848        com.apple.system.config.network_change
    4949*/
    50    
     50
     51#if HAVE_CONFIG_H
     52#include <config.h>
     53#endif
     54
    5155#include <stdio.h>
    5256#include <unistd.h>
     
    708712
    709713void
    710 ScheduledRestartCallback(CFRunLoopTimerRef timer, void *info)
     714ScheduledRestartCallback(CFRunLoopTimerRef timer UNUSED, void *info UNUSED)
    711715{
    712716    if (verbosity >= 3)
     
    760764void
    761765DynamicStoreChanged(
    762                     SCDynamicStoreRef   store,
     766                    SCDynamicStoreRef   store UNUSED,
    763767                    CFArrayRef          changedKeys,
    764                     void                *info
     768                    void                *info UNUSED
    765769                    )
    766770{
     
    790794
    791795void
    792 PowerCallBack(void *x, io_service_t y, natural_t messageType, void *messageArgument)
     796PowerCallBack(void *x UNUSED, io_service_t y UNUSED, natural_t messageType, void *messageArgument)
    793797{
    794798    switch (messageType)
     
    815819void
    816820NotificationCenterCallback(
    817                                 CFNotificationCenterRef center,
    818                                 void *observer,
    819                                 CFStringRef name, 
    820                                 const void *object,
    821                                 CFDictionaryRef userInfo)
     821                                CFNotificationCenterRef center UNUSED,
     822                                void *observer UNUSED,
     823                                CFStringRef name,
     824                                const void *object UNUSED,
     825                                CFDictionaryRef userInfo UNUSED)
    822826{
    823827    if (verbosity >= 3)
     
    833837
    834838void
    835 SignalCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
     839SignalCallback(CFMachPortRef port UNUSED, void *msg, CFIndex size UNUSED, void *info UNUSED)
    836840{
    837841    mach_msg_header_t* hdr = (mach_msg_header_t*)msg;
     
    866870
    867871
    868 void KQueueCallBack (CFSocketRef socketRef, CFSocketCallBackType type,
    869              CFDataRef address, const void *data, void *context)
     872void KQueueCallBack (CFSocketRef socketRef, CFSocketCallBackType type UNUSED,
     873             CFDataRef address UNUSED, const void *data UNUSED, void *context UNUSED)
    870874{
    871875    int fd = CFSocketGetNative(socketRef);
  • branches/gsoc09-logging/base/src/registry1.0/portimage.tcl

    r53509 r55506  
    5656# file_map
    5757#
    58 # Compacting and Uncompacting of port images to save space will be implemented
    59 # at some point.
    60 #
    6158# For the creating and removing of links during activation and deactivation,
    6259# code very similar to what is used in portinstall is used.
     
    8683        set revision [lindex $ilist 2]
    8784        set     variants [lindex $ilist 3]
    88        
    89     if {$v != ""} {
    90         ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $v]"
    91     } else {
    92         ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]"
    93     }
    94 
     85
     86        # if another version of this port is active, deactivate it first
    9587        set ilist [registry::installed $name]
    9688        if { [llength $ilist] > 1 } {
     
    10294                        set iactive [lindex $i 4]
    10395                        if { ![string equal ${iversion}_${irevision}${ivariants} ${version}_${revision}${variants}] && $iactive == 1 } {
    104                                 return -code error "Image error: Another version of this port ($iname @${iversion}_${irevision}${ivariants}) is already active."
    105                         }
    106                 }
    107         }
     96                                deactivate $iname ${iversion}_${irevision}${ivariants} $optionslist
     97                        }
     98                }
     99        }
     100       
     101    if {$v != ""} {
     102        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $v]"
     103    } else {
     104        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]"
     105    }
    108106
    109107        set ref [registry::open_entry $name $version $revision $variants]
     
    114112        if { [registry::property_retrieve $ref active] != 0 } {
    115113                return -code error "Image error: ${name} @${version}_${revision}${variants} is already active."
    116         }
    117         if { [registry::property_retrieve $ref compact] != 0 } {
    118                 return -code error "Image error: ${name} @${version}_${revision}${variants} is compactd."
    119114        }
    120115
     
    180175        if { [registry::property_retrieve $ref active] != 1 } {
    181176                return -code error "Image error: ${name} @${fqversion} is not active."
    182         }
    183         if { [registry::property_retrieve $ref compact] != 0 } {
    184                 return -code error "Image error: ${name} @${fqversion} is compactd."
    185         }
     177        }
    186178
    187179        set imagedir [registry::property_retrieve $ref imagedir]
     
    201193
    202194        registry::write_entry $ref
    203 
    204 }
    205 
    206 proc compact {name v} {
    207         global UI_PREFIX
    208 
    209         return -code error "Image error: compact/uncompact not yet implemented."
    210 
    211 }
    212 
    213 proc uncompact {name v} {
    214         global UI_PREFIX
    215 
    216         return -code error "Image error: compact/uncompact not yet implemented."
    217195
    218196}
  • branches/gsoc09-logging/base/src/registry1.0/registry.tcl

    r51133 r55506  
    6767                        property_store $ref imagedir $imagedir
    6868                        property_store $ref active 0
    69                         property_store $ref compact 0
    7069                }
    7170
  • branches/gsoc09-logging/base/src/registry2.0/portimage.tcl

    r53509 r55506  
    5757# will also remove all of the references of the files from the registry's
    5858# file_map
    59 #
    60 # Compacting and Uncompacting of port images to save space will be implemented
    61 # at some point.
    6259#
    6360# For the creating and removing of links during activation and deactivation,
     
    115112            return -code error "Image error: ${name} @${version}_${revision}${variants} is already active."
    116113        }
    117 
    118         # compaction is not yet supported
    119         #if { [$requested compact] != 0 } {
    120         #    return -code error "Image error: ${name} @${version}_${revision}${variants} is compacted."
    121         #}
    122114    }
    123115
     
    167159    }
    168160
    169     # compaction not yet supported
    170     #if { [registry::property_retrieve $ref compact] != 0 } {
    171     #    return -code error "Image error: ${name} @${specifier} is compacted."
    172     #}
    173 
    174161    registry::check_dependents $port $force
    175162
     
    179166    _deactivate_contents $requested $force
    180167    $requested state imaged
    181 }
    182 
    183 proc compact {name v} {
    184     global UI_PREFIX
    185 
    186     throw registry::image-error "Image error: compact/uncompact not yet implemented."
    187 }
    188 
    189 proc uncompact {name v} {
    190     global UI_PREFIX
    191 
    192     throw registry::image-error "Image error: compact/uncompact not yet implemented."
    193168}
    194169
  • branches/gsoc09-logging/base/src/upgrade_sources_conf_default.tcl

    r53509 r55506  
    4242            set addDefault true
    4343         } elseif {[regexp {file://(/.+)} $url -> filepath]} {
    44             if {[file exists [file join ${filepath} .svn]] && ![catch {set svnChannel [open "|svn info ${filepath}" r]}]} {
    45                set svnURL {}
    46                while {[gets $svnChannel svnLine] >= 0} {
    47                   regexp {^URL: (.*)} $svnLine -> svnURL
    48                }
    49                close $svnChannel
    50                if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
    51                   set addDefault true
     44            if {[file exists [file join ${filepath} .svn]]} {
     45               if {![catch {set svnChannel [open "|svn info ${filepath}" r]} err]} {
     46                  set svnURL {}
     47                  while {[gets $svnChannel svnLine] >= 0} {
     48                     regexp {^URL: (.*)} $svnLine -> svnURL
     49                  }
     50                  if {[catch {close $svnChannel} err]} {
     51                     if {![string match "*This client is too old to work with working copy*" $err]} {
     52                        return -code error $err
     53                     } else {
     54                        puts $err
     55                        puts "WARNING: Unable to check svn URL for '$filepath' as it has been checked out with a newer Subversion client; please manually verify $sourcesConf!"
     56                     }
     57                  }
     58                  if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
     59                     set addDefault true
     60                  }
     61               } else {
     62                  return -code error $err
    5263               }
    5364            }
Note: See TracChangeset for help on using the changeset viewer.