<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/55d56ee91483132e341c83c65474df3853dc39b2">https://github.com/macports/macports-base/commit/55d56ee91483132e341c83c65474df3853dc39b2</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 55d56ee91483132e341c83c65474df3853dc39b2
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Wed Feb 14 08:48:45 2024 +1100
<span style='display:block; white-space:pre;color:#404040;'> portmpkg: use FQ name for infrequently used globals
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Also use dict for portinfo.
</span>---
src/package1.0/portmpkg.tcl | 48 +++++++++++++++++++--------------------------
1 file changed, 20 insertions(+), 28 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/package1.0/portmpkg.tcl b/src/package1.0/portmpkg.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 279f8aca7..e5e88e564 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/package1.0/portmpkg.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/package1.0/portmpkg.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -47,45 +47,40 @@ options package.destpath package.flat
</span> set_ui_prefix
proc portmpkg::mpkg_main {args} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global subport epoch version revision os.major package.destpath package.flat UI_PREFIX
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {!${package.flat} || ${os.major} < 10} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {!${::package.flat} || ${::os.major} < 10} {
</span> # Make sure the destination path exists.
<span style='display:block; white-space:pre;background:#ffe0e0;'>- file mkdir ${package.destpath}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file mkdir ${::package.destpath}
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return [package_mpkg $subport $epoch $version $revision]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [package_mpkg $::subport $::epoch $::version $::revision]
</span> }
proc portmpkg::make_dependency_list {portname destination} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global requested_variations prefix package.destpath package.flat
</span> set result [list]
if {[catch {set res [mport_lookup $portname]} error]} {
ui_debug $::errorInfo
return -code error "port lookup failed: $error"
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- array set portinfo [lindex $res 1]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lassign $res portname portinfo
</span>
if {[getuid] == 0 && [geteuid] != 0} {
seteuid 0; setegid 0
set deprivileged 1
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set mport [mport_open $portinfo(porturl) [list prefix $prefix package.destpath ${destination} package.flat ${package.flat} subport $portinfo(name)] [array get requested_variations]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set mport [mport_open [dict get $portinfo porturl] [dict create prefix $::prefix package.destpath ${destination} package.flat ${::package.flat} subport $portname] [array get ::requested_variations]]
</span>
if {[info exists deprivileged]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global macportsuser
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- setegid [uname_to_gid "$macportsuser"]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- seteuid [name_to_uid "$macportsuser"]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ setegid [uname_to_gid $::macportsuser]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ seteuid [name_to_uid $::macportsuser]
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- unset portinfo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- array set portinfo [mport_info $mport]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portinfo [mport_info $mport]
</span>
# get the union of depends_run and depends_lib
set depends [list]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists portinfo(depends_run)]} { lappend depends {*}$portinfo(depends_run) }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists portinfo(depends_lib)]} { lappend depends {*}$portinfo(depends_lib) }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[dict exists $portinfo depends_run]} { lappend depends {*}[dict get $portinfo depends_run] }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[dict exists $portinfo depends_lib]} { lappend depends {*}[dict get $portinfo depends_lib] }
</span>
foreach depspec $depends {
set dep [_get_dep_port $depspec]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -94,7 +89,7 @@ proc portmpkg::make_dependency_list {portname destination} {
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend result [list $portinfo(name) $portinfo(version) $portinfo(revision) $mport]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend result [list $portname [dict get $portinfo version] [dict get $portinfo revision] $mport]
</span> return $result
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -112,28 +107,26 @@ proc portmpkg::make_one_package {portname mport} {
</span> }
if {[info exists deprivileged]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global macportsuser
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- setegid [uname_to_gid "$macportsuser"]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- seteuid [name_to_uid "$macportsuser"]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ setegid [uname_to_gid $::macportsuser]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ seteuid [name_to_uid $::macportsuser]
</span> }
}
proc portmpkg::mpkg_path {portname portversion portrevision} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global package.destpath
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return "${package.destpath}/[portpkg::image_name ${portname} ${portversion} ${portrevision}].mpkg"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return "${::package.destpath}/[portpkg::image_name ${portname} ${portversion} ${portrevision}].mpkg"
</span> }
proc portmpkg::package_mpkg {portname portepoch portversion portrevision} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global os.major destpath workpath prefix porturl description package.destpath package.flat long_description homepage
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global os.major workpath description package.flat long_description homepage
</span>
set mpkgpath [portmpkg::mpkg_path $portname $portversion $portrevision]
if {${package.flat} && ${os.major} >= 10} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set pkgpath ${package.destpath}/[portpkg::image_name ${portname} ${portversion} ${portrevision}]-component.pkg
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set pkgpath ${::package.destpath}/[portpkg::image_name ${portname} ${portversion} ${portrevision}]-component.pkg
</span> set packages_path ${workpath}/mpkg_packages
set resources_path ${workpath}/mpkg_resources
} else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set pkgpath ${package.destpath}/[portpkg::image_name ${portname} ${portversion} ${portrevision}].pkg
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set pkgpath ${::package.destpath}/[portpkg::image_name ${portname} ${portversion} ${portrevision}].pkg
</span> set packages_path ${mpkgpath}/Contents/Packages
set resources_path ${mpkgpath}/Contents/Resources
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -170,7 +163,7 @@ proc portmpkg::package_mpkg {portname portepoch portversion portrevision} {
</span>
if {!${package.flat} || ${os.major} < 10} {
portpkg::write_PkgInfo ${mpkgpath}/Contents/PkgInfo
<span style='display:block; white-space:pre;background:#ffe0e0;'>- mpkg_write_info_plist ${mpkgpath}/Contents/Info.plist $portname $portversion $portrevision $prefix $dependencies
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mpkg_write_info_plist ${mpkgpath}/Contents/Info.plist $portname $portversion $portrevision $::prefix $dependencies
</span> portpkg::write_description_plist ${mpkgpath}/Contents/Resources/Description.plist $portname $portversion $description
set resources_path ${mpkgpath}/Contents/Resources
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -183,7 +176,7 @@ proc portmpkg::package_mpkg {portname portepoch portversion portrevision} {
</span> }
}
portpkg::write_welcome_html ${resources_path}/Welcome.html $portname $portversion $portrevision $pkg_long_description $pkg_description $pkg_homepage
<span style='display:block; white-space:pre;background:#ffe0e0;'>- file copy -force -- [getportresourcepath $porturl "port1.0/package/background.tiff"] ${resources_path}/background.tiff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file copy -force -- [getportresourcepath $::porturl "port1.0/package/background.tiff"] ${resources_path}/background.tiff
</span>
if {${package.flat} && ${os.major} >= 10} {
write_distribution ${workpath}/Distribution $portname $dependencies
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -198,14 +191,13 @@ proc portmpkg::package_mpkg {portname portepoch portversion portrevision} {
</span> }
proc portmpkg::write_distribution {dfile portname dependencies} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global macosx_deployment_target
</span> set portname [xml_escape $portname]
set dfd [open $dfile w+]
puts $dfd "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<installer-gui-script minSpecVersion=\"1\">
<title>${portname}</title>
<options customize=\"never\"/>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- <allowed-os-versions><os-version min=\"${macosx_deployment_target}\"/></allowed-os-versions>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <allowed-os-versions><os-version min=\"${::macosx_deployment_target}\"/></allowed-os-versions>
</span> <background file=\"background.tiff\" mime-type=\"image/tiff\" alignment=\"bottomleft\" scaling=\"none\"/>
<welcome mime-type=\"text/html\" file=\"Welcome.html\"/>
<choices-outline>
</pre><pre style='margin:0'>
</pre>