Skip to content
Permalink
Browse files

registry2.0: Refactor some error handling

Keep indentation to the left.
  • Loading branch information
raimue committed Apr 18, 2018
1 parent b200459 commit 1d0a9db7fe64da6384b983cb478db0728ce9e6cc
Showing with 34 additions and 34 deletions.
  1. +34 −34 src/registry2.0/portimage.tcl
@@ -351,45 +351,45 @@ proc extract_archive_to_tmpdir {location} {
}
t(ar|bz|lz|xz|gz) {
set tar "tar"
if {[catch {set tar [macports::findBinary $tar ${macports::autoconf::tar_path}]} errmsg] == 0} {
ui_debug "Using $tar"
set unarchive.cmd "$tar"
set unarchive.pre_args {-xvpf}
if {[regexp {z2?$} ${unarchive.type}]} {
set unarchive.args {-}
if {[regexp {bz2?$} ${unarchive.type}]} {
if {![catch {macports::binaryInPath lbzip2}]} {
set gzip "lbzip2"
} elseif {![catch {macports::binaryInPath pbzip2}]} {
set gzip "pbzip2"
} else {
set gzip "bzip2"
}
} elseif {[regexp {lz$} ${unarchive.type}]} {
set gzip "lzma"
} elseif {[regexp {xz$} ${unarchive.type}]} {
set gzip "xz"
} else {
set gzip "gzip"
}
if {[info exists macports::autoconf::${gzip}_path]} {
set hint [set macports::autoconf::${gzip}_path]
if {[catch {set tar [macports::findBinary $tar ${macports::autoconf::tar_path}]} errmsg]} {
ui_debug $errmsg
throw MACPORTS "No '$tar' was found on this system!"
}

ui_debug "Using $tar"
set unarchive.cmd "$tar"
set unarchive.pre_args {-xvpf}
if {[regexp {z2?$} ${unarchive.type}]} {
set unarchive.args {-}
if {[regexp {bz2?$} ${unarchive.type}]} {
if {![catch {macports::binaryInPath lbzip2}]} {
set gzip "lbzip2"
} elseif {![catch {macports::binaryInPath pbzip2}]} {
set gzip "pbzip2"
} else {
set hint ""
}
if {[catch {set gzip [macports::findBinary $gzip $hint]} errmsg] == 0} {
ui_debug "Using $gzip"
set unarchive.pipe_cmd "$gzip -d -c ${location} |"
} else {
ui_debug $errmsg
throw MACPORTS "No '$gzip' was found on this system!"
set gzip "bzip2"
}
} elseif {[regexp {lz$} ${unarchive.type}]} {
set gzip "lzma"
} elseif {[regexp {xz$} ${unarchive.type}]} {
set gzip "xz"
} else {
set gzip "gzip"
}
if {[info exists macports::autoconf::${gzip}_path]} {
set hint [set macports::autoconf::${gzip}_path]
} else {
set unarchive.args "${location}"
set hint ""
}
if {[catch {set gzip [macports::findBinary $gzip $hint]} errmsg] == 0} {
ui_debug "Using $gzip"
set unarchive.pipe_cmd "$gzip -d -c ${location} |"
} else {
ui_debug $errmsg
throw MACPORTS "No '$gzip' was found on this system!"
}
} else {
ui_debug $errmsg
throw MACPORTS "No '$tar' was found on this system!"
set unarchive.args "${location}"
}
}
xar {

0 comments on commit 1d0a9db

Please sign in to comment.
You can’t perform that action at this time.