Skip to content
Permalink
Browse files

Discard statefile if Portfile changed since last build.

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@2070 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Kevin Van Vechten
Kevin Van Vechten committed Feb 23, 2003
1 parent 961fe94 commit 76011e9cc496cab46023c5c308cae5d7a0756f0c
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/port1.0/portutil.tcl
@@ -639,16 +639,23 @@ proc dlist_append_dependents {dlist obj result} {
# open_statefile
# open file to store name of completed targets
proc open_statefile {args} {
global workpath portname
global workpath portname portpath

if ![file isdirectory $workpath ] {
file mkdir $workpath
}
# flock Portfile
set statefile [file join $workpath .darwinports.${portname}.state]
if {[file exists $statefile] && ![file writable $statefile]} {
return -code error "$statefile is not writable - check permission on port directory"
}
if {[file exists $statefile]} {
if {![file writable $statefile]} {
return -code error "$statefile is not writable - check permission on port directory"
}
if {[file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
ui_msg "Portfile changed since last build; discarding previous state."
file delete $statefile
}
}

set fd [open $statefile a+]
if [catch {flock $fd -exclusive -noblock} result] {
if {"$result" == "EAGAIN"} {
@@ -668,7 +675,7 @@ proc open_statefile {args} {
# Check completed/selected state of target/variant $name
proc check_statefile {class name fd} {
global portpath workdir

seek $fd 0
while {[gets $fd line] >= 0} {
if {$line == "$class: $name"} {

0 comments on commit 76011e9

Please sign in to comment.
You can’t perform that action at this time.