Changeset 2070 for trunk/base


Ignore:
Timestamp:
Feb 23, 2003, 7:18:42 AM (21 years ago)
Author:
kevin
Message:

Discard statefile if Portfile changed since last build.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portutil.tcl

    r1790 r2070  
    640640# open file to store name of completed targets
    641641proc open_statefile {args} {
    642     global workpath portname
     642    global workpath portname portpath
    643643   
    644644    if ![file isdirectory $workpath ] {
     
    647647    # flock Portfile
    648648    set statefile [file join $workpath .darwinports.${portname}.state]
    649     if {[file exists $statefile] && ![file writable $statefile]} {
    650         return -code error "$statefile is not writable - check permission on port directory"
    651     }
     649    if {[file exists $statefile]} {
     650                if {![file writable $statefile]} {
     651                        return -code error "$statefile is not writable - check permission on port directory"
     652                }
     653                if {[file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
     654                        ui_msg "Portfile changed since last build; discarding previous state."
     655                        file delete $statefile
     656                }
     657        }
     658       
    652659    set fd [open $statefile a+]
    653660    if [catch {flock $fd -exclusive -noblock} result] {
     
    669676proc check_statefile {class name fd} {
    670677    global portpath workdir
    671    
     678       
    672679    seek $fd 0
    673680    while {[gets $fd line] >= 0} {
Note: See TracChangeset for help on using the changeset viewer.