<pre style='margin:0'>
Clemens Lang (neverpanic) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/9c91a297c3847afcc5e26c6c1dacad5398e5453e">https://github.com/macports/macports-base/commit/9c91a297c3847afcc5e26c6c1dacad5398e5453e</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 9c91a29 port1.0: add portbump.tcl
</span>9c91a29 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 9c91a297c3847afcc5e26c6c1dacad5398e5453e
</span>Author: satraul <satraul@gmail.com>
AuthorDate: Tue Apr 2 00:26:27 2019 +0700
<span style='display:block; white-space:pre;color:#404040;'> port1.0: add portbump.tcl
</span>---
src/port/port.tcl | 2 +
src/port1.0/Makefile.in | 2 +-
src/port1.0/port.tcl | 1 +
src/port1.0/portbump.tcl | 263 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 267 insertions(+), 1 deletion(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port/port.tcl b/src/port/port.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 9da4450..18fe1b2 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4319,6 +4319,7 @@ array set action_array [list \
</span> lint [list action_target [ACTION_ARGS_PORTS]] \
livecheck [list action_target [ACTION_ARGS_PORTS]] \
distcheck [list action_target [ACTION_ARGS_PORTS]] \
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ bump [list action_target [ACTION_ARGS_PORTS]] \
</span> load [list action_target [ACTION_ARGS_PORTS]] \
unload [list action_target [ACTION_ARGS_PORTS]] \
reload [list action_target [ACTION_ARGS_PORTS]] \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4430,6 +4431,7 @@ array set cmd_opts_array {
</span> diagnose {quiet}
reclaim {enable-reminders disable-reminders}
fetch {no-mirrors}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ bump {patch}
</span> }
##
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/Makefile.in b/src/port1.0/Makefile.in
</span><span style='display:block; white-space:pre;color:#808080;'>index eb5cd42..3ae95fc 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/Makefile.in
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/Makefile.in
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -9,7 +9,7 @@ SRCS_AUTOCONF= port_autoconf.tcl
</span> SRCS= port.tcl portchecksum.tcl portconfigure.tcl portextract.tcl \
portfetch.tcl portmain.tcl portbuild.tcl portpatch.tcl portutil.tcl \
portinstall.tcl portuninstall.tcl portdepends.tcl portdestroot.tcl \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- portlint.tcl portclean.tcl porttest.tcl portactivate.tcl \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ portlint.tcl portclean.tcl porttest.tcl portactivate.tcl portbump.tcl \
</span> portdeactivate.tcl portstartupitem.tcl porttrace.tcl portlivecheck.tcl \
portdistcheck.tcl portmirror.tcl portload.tcl portunload.tcl portreload.tcl \
portdistfiles.tcl fetch_common.tcl portsandbox.tcl
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/port.tcl b/src/port1.0/port.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 7be94b3..1ec2de3 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -83,6 +83,7 @@ package require porttrace 1.0
</span> package require portdistcheck 1.0
package require portlivecheck 1.0
package require portmirror 1.0
<span style='display:block; white-space:pre;background:#e0ffe0;'>+package require portbump 1.0
</span>
package require portstartupitem 1.0
package require portload 1.0
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/portbump.tcl b/src/port1.0/portbump.tcl
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..7892c67
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/portbump.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,263 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# portbump.tcl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Copyright (c) 2019 The MacPorts Project
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# All rights reserved.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Redistribution and use in source and binary forms, with or without
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# modification, are permitted provided that the following conditions
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# are met:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 1. Redistributions of source code must retain the above copyright
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# notice, this list of conditions and the following disclaimer.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 2. Redistributions in binary form must reproduce the above copyright
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# notice, this list of conditions and the following disclaimer in the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# documentation and/or other materials provided with the distribution.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 3. Neither the name of Apple Inc. nor the names of its contributors
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# may be used to endorse or promote products derived from this software
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# without specific prior written permission.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# POSSIBILITY OF SUCH DAMAGE.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+package provide portbump 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+package require portutil 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+package require portchecksum 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set org.macports.bump [target_new org.macports.bump portbump::bump_main]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+target_provides ${org.macports.bump} bump
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+target_runtype ${org.macports.bump} always
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+target_requires ${org.macports.bump} main fetch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+target_prerun ${org.macports.bump} portbump::bump_start
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+namespace eval portbump {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# bump_start
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Target prerun procedure; simply prints a message about what we're doing.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc portbump::bump_start {args} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global UI_PREFIX
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_notice "$UI_PREFIX [format [msgcat::mc "Bumping checksums for %s"] [option subport]]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# bump_main
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Target main procedure. Bumps the checksums for distfiles.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc portbump::bump_main {args} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global UI_PREFIX all_dist_files checksums_array portpath ports_bump_patch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portfile "${portpath}/Portfile"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # If no files have been downloaded, there is nothing to bump.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists all_dist_files]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # So far, no mismatches yet.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set mismatch no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Set the list of checksums as the option checksums.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set checksums_str [option checksums]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Store the calculated checksums to avoid repeated calculations
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array set calculated_checksums_array {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # If everything is fine with the syntax, keep on and check the checksum of
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # the distfiles.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[portchecksum::parse_checksums $checksums_str] eq "yes"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set distpath [option distpath]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach distfile $all_dist_files {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_info "$UI_PREFIX [format [msgcat::mc "Checksumming %s"] $distfile]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Get the full path of the distfile.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set fullpath [file join $distpath $distfile]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file isfile $fullpath]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -code error "$distfile does not exist in $distpath"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Check that there is at least one checksum for the distfile.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists checksums_array($distfile)] || [llength $checksums_array($distfile)] < 1} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "[format [msgcat::mc "No checksum set for %s"] $distfile]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set mismatch yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Retrieve the list of types/values from the array.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portfile_checksums $checksums_array($distfile)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set calculated_checksums {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set both_checksums {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Iterate on this list to check the actual values.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach {type sum} $portfile_checksums {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set calculated_sum [portchecksum::calc_$type $fullpath]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend calculated_checksums $type
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend calculated_checksums $calculated_sum
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend both_checksums $type $sum $calculated_sum
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$sum eq $calculated_sum} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "[format [msgcat::mc "Correct (%s) bump for %s"] $type $distfile]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_info "[format [msgcat::mc "Portfile bump: %s %s %s"] $distfile $type $sum]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_info "[format [msgcat::mc "Distfile bump: %s %s %s"] $distfile $type $calculated_sum]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Raise the failure flag
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set mismatch yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Save our calculated checksums in case we need them later
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set calculated_checksums_array($distfile) $calculated_checksums
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![regexp {\.html?$} ${distfile}] &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ![catch {strsed [exec [findBinary file $portutil::autoconf::file_path] $fullpath --brief --mime] {s/;.*$//}} mimetype]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && "text/html" eq $mimetype} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # file --mime-type would be preferable to file --mime and strsed, but is only available as of Snow Leopard
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set wrong_mimetype yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set htmlfile_path ${fullpath}.html
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file rename -force $fullpath $htmlfile_path
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Something went wrong with the syntax.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -code error "[msgcat::mc "Unable to verify file checksums"]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![tbool mismatch]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "No changes needed."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[tbool wrong_mimetype]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # We got an HTML file, though the distfile name does not suggest that one was
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # expected. Probably a helpful DNS server sent us to its search results page
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # instead of admitting that the server we asked for doesn't exist, or a mirror that
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # no longer has the file served its error page with a 200 response.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_notice "***"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_notice "The non-matching file appears to be HTML. See this page for possible reasons"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_notice "for the bump mismatch:"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_notice "<https://trac.macports.org/wiki/MisbehavingServers>"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_notice "***"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_notice "The file has been moved to: $htmlfile_path"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -code error "[msgcat::mc "Unable to verify file checksums"]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Show the desired checksum line for easy cut-paste
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # based on the previously calculated values, plus our default types
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set sums {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global version revision
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "We will bump these:"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach {type sum calculated_sum} $both_checksums {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg [format "Old %-8s %s" ${type}: $sum]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg [format "New %-8s %s" ${type}: $calculated_sum]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set patterns {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set whitespace {[[:space:]\\]+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Create substitution pattern(s) for checksum
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach {type sum calculated_sum} $both_checksums {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend patterns "s/(${type}${whitespace})${sum}/\\1${calculated_sum}/g"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Create substitution pattern for revision (reset to 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend patterns {s/(revision[[:space:]\\]+)[0-9]+/\10/g}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Construct sed command
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set cmdline {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend cmdline $portutil::autoconf::sed_command -E
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach pattern $patterns {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend cmdline -e $pattern
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Get the uid of Portfile owner
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set owneruid [name_to_uid [file attributes ${portfile} -owner]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # root -> owner id
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exec_as_uid $owneruid {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Create temporary Portfile.bump.XXXXXX
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {set tmpfile [mkstemp "${portpath}/Portfile.bump.XXXXXX"]} error]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "mkstemp: $error"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -code error "mkstemp failed"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Extract the Tcl Channel number
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set tmpfd [lindex $tmpfile 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Set tmpfile to only the file name
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set tmpfile [join [lrange $tmpfile 1 end]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Get Portfile attributes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set attributes [file attributes $portfile]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Direct sed command output to tempfile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend cmdline "<${portfile}" ">@$tmpfd"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Run sed command and write to Portfile.bump
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_info "$UI_PREFIX [format [msgcat::mc "Patching %s: %s"] $portfile $patterns]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {exec -ignorestderr -- {*}$cmdline} error]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "sed: $error"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete "$tmpfile"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ close $tmpfd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -code error "sed sed(1) failed"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[tbool ports_bump_patch]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Patch mode
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Set Potfile.patch path
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set patchfile "${portpath}/Portfile.patch"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set patchfd [open $patchfile w]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Construct diff command
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set diffcmd {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend diffcmd $portutil::autoconf::diff_path -u --label old/Portfile --label new/Portfile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend diffcmd $portfile $tmpfile >@$patchfd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Create and write diff to Portfile.patch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {exec -ignorestderr -- {*}$diffcmd} error]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Copy Portfile attributes to Portfile.patch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file attributes $portfile {*}$attributes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "Portfile.patch successfully created at $patchfile"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "No changes needed."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete "$patchfile"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ close $patchfd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Overwrite mode
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Replace Portfile with Portfile.bump
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {move -force $tmpfile $portfile} error]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "bump: $error"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete "$tmpfile"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -code error "bump overwrite failed"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Restore Portfile attributes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file attributes $portfile {*}$attributes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "Checksums successfully bumped. Suggested commit message:"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg [format "%-8s%s: update to %s" "" [option subport] $version]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Delete Portfile.bump
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete "$tmpfile"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span></pre><pre style='margin:0'>
</pre>