Ticket #46927: record-patchfiles-in-state.diff

File record-patchfiles-in-state.diff, 1.6 KB (added by RJVB (René Bertin), 10 years ago)
  • libexec/macports/lib/port1.0/

    old new  
    6969}
    7070
    7171proc portpatch::patch_main {args} {
    72     global UI_PREFIX usealtworkpath altprefix
     72    global UI_PREFIX usealtworkpath altprefix target_state_fd
    7373
    7474    # First make sure that patchfiles exists and isn't stubbed out.
    7575    if {![exists patchfiles] || [option patchfiles] eq ""} {
     
    9797    set gzcat "[findBinary gzip $portutil::autoconf::gzip_path] -dc"
    9898    set bzcat "[findBinary bzip2 $portutil::autoconf::bzip2_path] -dc"
    9999    foreach patch $patchlist {
    100         ui_info "$UI_PREFIX [format [msgcat::mc "Applying %s"] [file tail $patch]]"
    101         switch -- [file extension $patch] {
    102             .Z -
    103             .gz {command_exec patch "$gzcat \"$patch\" | (" ")"}
    104             .bz2 {command_exec patch "$bzcat \"$patch\" | (" ")"}
    105             default {command_exec patch "" "< '$patch'"}
     100        set pfile [file tail $patch]
     101        if {![check_statefile patch $pfile $target_state_fd]} {
     102            ui_info "$UI_PREFIX [format [msgcat::mc "Applying %s"] $pfile]"
     103            switch -- [file extension $patch] {
     104                .Z -
     105                .gz {command_exec patch "$gzcat \"$patch\" | (" ")"}
     106                .bz2 {command_exec patch "$bzcat \"$patch\" | (" ")"}
     107                default {command_exec patch "" "< '$patch'"}
     108            }
     109            write_statefile patch $pfile $target_state_fd
     110        } else {
     111            ui_info "$UI_PREFIX [format [msgcat::mc "Skipping already applied %s"] $pfile]"
    106112        }
    107113    }
    108114    return 0