Skip to content

Commit

Permalink
dependencies.tcl: activate using already open mport
Browse files Browse the repository at this point in the history
Doing this instead of using registry::run_target saves running another
mportopen for each dependency, so should perform better. This wasn't
originally possible due to the workaround for
https://trac.macports.org/ticket/24857.
  • Loading branch information
jmroot committed Oct 4, 2023
1 parent 3a17fcd commit c48853e
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions tools/dependencies.tcl
Expand Up @@ -425,7 +425,6 @@ proc install_dep {ditem} {
if {[registry::entry imaged $depinfo(name) $depinfo(version) $depinfo(revision) $depinfo(canonical_active_variants)] ne ""} {
puts "Already installed, nothing to do"
puts $::log_status_dependencies {[OK]}
catch {mportclose $ditem}
return
}
# clean up any work directories left over from earlier
Expand Down Expand Up @@ -526,7 +525,6 @@ proc install_dep {ditem} {
failcache_update $depinfo(name) [ditem_key $ditem porturl] $depinfo(canonical_active_variants) 0
}
}
catch {mportclose $ditem}
puts $::log_status_dependencies {[OK]}
}

Expand Down Expand Up @@ -561,21 +559,17 @@ if {$any_built} {
}

proc activate_dep {ditem} {
array set depinfo $::mportinfo_array($ditem)
set entrylist [registry::entry imaged $depinfo(name) $depinfo(version) $depinfo(revision) $depinfo(canonical_active_variants)]
if {[llength $entrylist] < 1} {
puts stderr "Failed to activate $depinfo(name) @$depinfo(version)_$depinfo(revision)$depinfo(canonical_active_variants): Not installed?!"
exit 2
}
if {[llength $entrylist] > 1} {
puts stderr "Warning: got multiple registry entries matching $depinfo(name) @$depinfo(version)_$depinfo(revision)$depinfo(canonical_active_variants)"
}
set e [lindex $entrylist 0]
if {![registry::run_target $e activate [list]]
&& [catch {portimage::activate [$e name] [$e version] [$e revision] [$e variants] [list]} result]} {
set fail 0
if {[catch {mportexec $ditem activate} result]} {
puts stderr $::errorInfo
puts stderr "Activating [$e name] @[$e version]_[$e revision][$e variants] failed: $result"
exit 2
ui_error "Activate failed: $result"
set fail 1
}
if {$fail || $result > 0} {
array set depinfo $::mportinfo_array($ditem)
puts stderr "Activation of dependency '$depinfo(name)' with variants '$depinfo(canonical_active_variants)' failed, aborting."
puts $::log_subports_progress "Building '$::portname' ... \[ERROR\] (failed to activate dependency '$depinfo(name)') maintainers: [get_maintainers $::portname $depinfo(name)]."
exit 1
}
}

Expand Down

2 comments on commit c48853e

@barracuda156
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmroot Possibly this caused a breakage on CI: macports/macports-ports#20736 (sorry if in fact unrelated).

@barracuda156
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmroot At this point I am reasonably sure that recent commits here have broken CI.

Activating all dependencies...
invalid command name ""
    while executing
"$workername eval {validate_macportsuser}"
    (procedure "mportexec" line 5)
    invoked from within
"mportexec $ditem activate"
Error: Activate failed: invalid command name ""
Activation of dependency 'gcc12-libcxx' with variants '+clang14' failed, aborting.
Processing dependencies for 'R-ic.infer' failed, aborting.

Please sign in to comment.