Skip to content

Commit

Permalink
Allow "any" in registry os_{platform,major}
Browse files Browse the repository at this point in the history
Now setting these values on installation the same way as the platform
string in the archive filename. Also don't consider a port outdated due
to platform mismatch if it has an "any" value for these.

Closes: https://trac.macports.org/ticket/68256
  • Loading branch information
jmroot committed Nov 1, 2023
1 parent c45999c commit 1b4db00
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/macports1.0/macports.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -4322,9 +4322,9 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
} elseif {[info exists options(ports_upgrade_enforce-variants)] && $options(ports_upgrade_enforce-variants)
&& [info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) ne $oldvariant} {
ui_debug "variant override ... upgrading!"
} elseif {$os_platform_installed ne "" && $os_major_installed ne "" && $os_platform_installed != 0
} elseif {$os_platform_installed ni [list any "" 0] && $os_major_installed ne ""
&& ([_mportkey $mport os.platform] ne $os_platform_installed
|| [_mportkey $mport os.major] != $os_major_installed)} {
|| ($os_major_installed ne "any" && [_mportkey $mport os.major] != $os_major_installed))} {
ui_debug "platform mismatch ... upgrading!"
set build_override 1
} elseif {$cxx_stdlib_overridden == 0 && ($cxx_stdlib_installed eq "libstdc++" || $cxx_stdlib_installed eq "libc++")
Expand Down
12 changes: 6 additions & 6 deletions src/port/port.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,9 @@ proc get_outdated_ports {} {
} else {
set wrong_stdlib libc++
}
if {($os_platform_installed ne "" && $os_platform_installed != 0
&& $os_major_installed ne "" && $os_major_installed != 0
&& ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major}))
if {($os_platform_installed ni [list any "" 0] && $os_major_installed ni [list "" 0]
&& ($os_platform_installed != ${macports::os_platform}
|| ($os_major_installed ne "any" && $os_major_installed != ${macports::os_major})))
|| ($cxx_stdlib_overridden == 0 && $cxx_stdlib_installed eq $wrong_stdlib)} {
set comp_result -1
}
Expand Down Expand Up @@ -3475,9 +3475,9 @@ proc action_outdated { action portlist opts } {
set regref [registry::open_entry $portname $installed_version $installed_revision [lindex $i 3] $installed_epoch]
set os_platform_installed [registry::property_retrieve $regref os_platform]
set os_major_installed [registry::property_retrieve $regref os_major]
if {$os_platform_installed ne "" && $os_platform_installed != 0
&& $os_major_installed ne "" && $os_major_installed != 0
&& ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major})} {
if {$os_platform_installed ni [list any "" 0] && $os_major_installed ni [list "" 0]
&& ($os_platform_installed != ${macports::os_platform}
|| ($os_major_installed ne "any" && $os_major_installed != ${macports::os_major}))} {
set comp_result -1
set reason { (platform $os_platform_installed $os_major_installed != ${macports::os_platform} ${macports::os_major})}
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/port1.0/portinstall.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,9 @@ proc portinstall::install_main {args} {
} else {
lappend regref requested 0
}
lappend regref os_platform ${os.platform}
lappend regref os_major ${os.major}
lassign [_get_compatible_platform] os_platform os_major
lappend regref os_platform $os_platform
lappend regref os_major $os_major
lappend regref archs [get_canonical_archs]
if {${portinstall::actual_cxx_stdlib} ne ""} {
lappend regref cxx_stdlib ${portinstall::actual_cxx_stdlib}
Expand Down
24 changes: 15 additions & 9 deletions src/port1.0/portutil.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -895,19 +895,25 @@ proc _handle_platforms {option action args} {
}
}

# Platform specifier for binary archive name
# "any" in platforms means the built archive will work on any OS
# Platform and major version this port will be compatible with in built form
# "any" in platforms means the built port will work on any OS
# "darwin any" means it will work on any darwin version
proc _get_archive_platform {} {
global platforms os.platform os.subplatform os.major
foreach p $platforms {
# Returns a list: {platform major}
proc _get_compatible_platform {} {
global os.platform
foreach p [option platforms] {
if {$p eq "any"} {
return any_any
} elseif {[lindex $p 0] in [list ${os.platform} ${os.subplatform}] && [lindex $p 1] eq "any"} {
return ${os.platform}_any
return [list any any]
} elseif {[lindex $p 0] in [list ${os.platform} [option os.subplatform]] && [lindex $p 1] eq "any"} {
return [list ${os.platform} any]
}
}
return ${os.platform}_${os.major}
return [list ${os.platform} [option os.major]]
}

# Platform specifier string for binary archive name
proc _get_archive_platform {} {
return [join [_get_compatible_platform] _]
}

# Portfiles may define more than one port.
Expand Down

0 comments on commit 1b4db00

Please sign in to comment.