Skip to content

Commit

Permalink
Fix incorrect portimage_mode directory handling
Browse files Browse the repository at this point in the history
Specifically in the archivefetch and unarchive targets. The latter not
working was affecting its dependents like pkg and mpkg.

Closes: https://trac.macports.org/ticket/71011
  • Loading branch information
jmroot committed Oct 2, 2024
1 parent 1f565c6 commit c3c817e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
12 changes: 8 additions & 4 deletions src/package1.0/portarchivefetch.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ proc portarchivefetch::checkfiles {urls} {
# Perform a standard fetch, assembling fetch urls from
# the listed url variable and associated archive file
proc portarchivefetch::fetchfiles {args} {
global UI_PREFIX archivefetch.fulldestpath \
archivefetch.user archivefetch.password archivefetch.use_epsv \
archivefetch.ignore_sslcert archive.subdir \
portverbose ports_binary_only portdbpath
global UI_PREFIX archivefetch.fulldestpath archivefetch.user \
archivefetch.password archivefetch.use_epsv \
archivefetch.ignore_sslcert archive.subdir portverbose \
ports_binary_only portdbpath force_archive_refresh
variable archivefetch_urls
variable ::portfetch::urlmap

Expand Down Expand Up @@ -210,6 +210,10 @@ proc portarchivefetch::fetchfiles {args} {
set sorted no

set existing_archive [find_portarchive_path]
if {$existing_archive eq "" && ![tbool force_archive_refresh]
&& [file isdirectory [file rootname [get_portimage_path]]]} {
set existing_archive yes
}

foreach {url_var archive} $archivefetch_urls {
if {![file isfile ${archivefetch.fulldestpath}/${archive}] && $existing_archive eq ""} {
Expand Down
35 changes: 23 additions & 12 deletions src/package1.0/portunarchive.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ proc portunarchive::unarchive_init {args} {
set unarchive.type [string range [file extension ${unarchive.file}] 1 end]
if {${unarchive.path} ne ""} {
ui_debug "Found [string toupper ${unarchive.type}] archive: ${unarchive.path}"
} elseif {[registry_exists $subport $version $revision $portvariants]
&& [file isdirectory [set unarchive.path [file rootname [get_portimage_path]]]]} {
set unarchive.type directory
set unarchive.file [file tail ${unarchive.path}]
ui_debug "Found extracted port image: ${unarchive.path}"
} else {
if {[info exists ports_binary_only] && $ports_binary_only eq "yes"} {
return -code error "Archive for ${subport} ${version}_${revision}${portvariants} not found, required when binary-only is set!"
Expand Down Expand Up @@ -255,26 +260,32 @@ proc portunarchive::unarchive_command_setup {args} {
}

proc portunarchive::unarchive_main {args} {
global UI_PREFIX unarchive.dir unarchive.file unarchive.pipe_cmd unarchive.skip
global UI_PREFIX unarchive.dir unarchive.file unarchive.path \
unarchive.pipe_cmd unarchive.skip

if {${unarchive.skip}} {
return 0
}

# Setup unarchive command
unarchive_command_setup
if {[file isfile ${unarchive.path}]} {
# Setup unarchive command
unarchive_command_setup

# Create destination directory for unpacking
if {![file isdirectory ${unarchive.dir}]} {
file mkdir ${unarchive.dir}
}
# Create destination directory for unpacking
if {![file isdirectory ${unarchive.dir}]} {
file mkdir ${unarchive.dir}
}

# Unpack the archive
ui_info "$UI_PREFIX [format [msgcat::mc "Extracting %s"] ${unarchive.file}]"
if {${unarchive.pipe_cmd} eq ""} {
command_exec unarchive
# Unpack the archive
ui_info "$UI_PREFIX [format [msgcat::mc "Extracting %s"] ${unarchive.file}]"
if {${unarchive.pipe_cmd} eq ""} {
command_exec unarchive
} else {
command_exec unarchive "${unarchive.pipe_cmd} (" ")"
}
} else {
command_exec unarchive "${unarchive.pipe_cmd} (" ")"
ui_info "$UI_PREFIX [format [msgcat::mc "Copying %s to destroot"] ${unarchive.file}]"
copy -force ${unarchive.path} ${unarchive.dir}
}

return 0
Expand Down

0 comments on commit c3c817e

Please sign in to comment.