Skip to content
Permalink
Browse files

portindex: Do not exit non-zero on failed ports

The change in 217d852 broke existing use cases, including the portindex
run in mportsync. Restore the previous behavior by default and only exit
with a non-zero exit code if requested with the new flag 'portindex -e'.

See: #64
  • Loading branch information
raimue committed Mar 28, 2018
1 parent 954bd3c commit 3515cc62b22c4e0a5a8ee41727cfa9da6083edf1
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/port/portindex.tcl
@@ -8,6 +8,7 @@ package require Pextlib

# Globals
set full_reindex 0
set permit_error 0
set stats(total) 0
set stats(failed) 0
set stats(skipped) 0
@@ -22,9 +23,10 @@ mportinit ui_options global_options global_variations
# Standard procedures
proc print_usage args {
global argv0
puts "Usage: $argv0 \[-df\] \[-o output directory\] \[-p plat_ver_arch\] \[directory\]"
puts "Usage: $argv0 \[-dfe\] \[-o output directory\] \[-p plat_ver_arch\] \[directory\]"
puts "-d:\tOutput debugging information"
puts "-f:\tDo a full re-index instead of updating"
puts "-e:\tExit code indicates if ports failed to parse"
puts "-o:\tOutput all files to specified directory"
puts "-p:\tPretend to be on another platform"
}
@@ -205,6 +207,8 @@ for {set i 0} {$i < $argc} {incr i} {
lappend port_options os.platform $os_platform os.major $os_major os.arch $os_arch
} elseif {$arg eq "-f"} { # Completely rebuild index
set full_reindex 1
} elseif {$arg eq "-e"} { # Non-zero exit code on errors
set permit_error 1
} else {
puts stderr "Unknown option: $arg"
print_usage
@@ -301,6 +305,6 @@ puts "\nTotal number of ports parsed:\t$stats(total)\
\nPorts failed:\t\t\t$stats(failed)\
\nUp-to-date ports skipped:\t$stats(skipped)\n"

if {$stats(failed) > 0} {
if {${permit_error} && $stats(failed) > 0} {
exit 1
}

0 comments on commit 3515cc6

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