Ticket #46927: patch-record-patches-in-statefile.diff

File patch-record-patches-in-statefile.diff, 2.2 KB (added by RJVB (René Bertin), 6 years ago)
  • src/port1.0/portpatch.tcl

    diff --git a/src/port1.0/portpatch.tcl b/src/port1.0/portpatch.tcl
    index 70dcced5..48f7d685 100644
    a b proc portpatch::build_getpatchtype {args} { 
    6868}
    6969
    7070proc portpatch::patch_main {args} {
    71     global UI_PREFIX
     71    global UI_PREFIX target_state_fd
    7272
    7373    # First make sure that patchfiles exists and isn't stubbed out.
    7474    if {![exists patchfiles] || [option patchfiles] eq ""} {
    proc portpatch::patch_main {args} { 
    9696    catch {set xzcat "[findBinary xz $portutil::autoconf::xz_path] -dc"}
    9797
    9898    foreach patch $patchlist {
    99         ui_info "$UI_PREFIX [format [msgcat::mc "Applying %s"] [file tail $patch]]"
    100         switch -- [file extension $patch] {
    101             .Z -
    102             .gz {command_exec patch "$gzcat \"$patch\" | (" ")"}
    103             .bz2 {command_exec patch "$bzcat \"$patch\" | (" ")"}
    104             .xz {
    105                 if {[info exists xzcat]} {
    106                     command_exec patch "$xzcat \"$patch\" | (" ")"
    107                 } else {
    108                     return -code error [msgcat::mc "xz binary not found; port needs to add 'depends_patch bin:xz:xz'"]
    109                 }}
    110             default {command_exec patch "" "< '$patch'"}
     99        set pfile [file tail $patch]
     100        if {![check_statefile patch $pfile $target_state_fd]} {
     101            ui_info "$UI_PREFIX [format [msgcat::mc "Applying %s"] [file tail $patch]]"
     102            switch -- [file extension $patch] {
     103                .Z -
     104                .gz {command_exec patch "$gzcat \"$patch\" | (" ")"}
     105                .bz2 {command_exec patch "$bzcat \"$patch\" | (" ")"}
     106                .xz {
     107                    if {[info exists xzcat]} {
     108                        command_exec patch "$xzcat \"$patch\" | (" ")"
     109                    } else {
     110                        return -code error [msgcat::mc "xz binary not found; port needs to add 'depends_patch bin:xz:xz'"]
     111                    }}
     112                default {command_exec patch "" "< '$patch'"}
     113            }
     114            write_statefile patch $pfile $target_state_fd
     115        } else {
     116            ui_info "$UI_PREFIX [format [msgcat::mc "Skipping already applied %s"] $pfile]"
    111117        }
    112118    }
    113119    return 0