Ticket #56957: patch-conditional-ccachedir-creation.diff

File patch-conditional-ccachedir-creation.diff, 1.5 KB (added by RJVB (René Bertin), 6 years ago)
  • src/port1.0/portconfigure.tcl

    diff --git a/src/port1.0/portconfigure.tcl b/src/port1.0/portconfigure.tcl
    index 8591c211119dc72260e03ed538d4a56dd7469e6e..70672e393cd46eb422406b78643966428e566554 100644
    a b proc portconfigure::configure_start {args} { 
    308315    global configure.ccache ccache_dir ccache_size macportsuser
    309316    if {${configure.ccache}} {
    310317        # Create ccache directory with correct permissions with root privileges
    311         elevateToRoot "configure ccache"
    312         if {[catch {
    313                 file mkdir ${ccache_dir}
    314                 file attributes ${ccache_dir} -owner ${macportsuser} -permissions 0755
    315             } result]} {
    316             ui_warn "ccache_dir ${ccache_dir} could not be created; disabling ccache: $result"
    317             set configure.ccache no
     318        if {![file exists ${ccache_dir}] || [file type ${ccache_dir}] ne "directory"} {
     319            elevateToRoot "configure ccache"
     320            if {[catch {
     321                    file mkdir ${ccache_dir}
     322                    file attributes ${ccache_dir} -owner ${macportsuser} -permissions 0755
     323                } result]} {
     324                ui_warn "ccache_dir ${ccache_dir} could not be created; disabling ccache: $result"
     325                set configure.ccache no
     326            }
     327            dropPrivileges
    318328        }
    319         dropPrivileges
    320329
    321330        # Initialize ccache directory with the given maximum size
    322331        if {${configure.ccache}} {