From 874815ebf60569ab69b68dc1a3ea93fcebe4a21c Mon Sep 17 00:00:00 2001 From: Roman Iten Date: Mon, 14 May 2018 20:05:17 +0200 Subject: [PATCH] run: improve error handling regarding depots Fixes #2821 --- tool/run/depot.inc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tool/run/depot.inc b/tool/run/depot.inc index 32f47cbb26..b20fa259b1 100644 --- a/tool/run/depot.inc +++ b/tool/run/depot.inc @@ -67,7 +67,7 @@ proc _collect_pkg_archive_from_depot { user name version } { set archives_file "[depot_dir]/$archive_dir/archives" if {![file exists $archives_file]} { - puts "Error: missing file $archives_file" + puts stderr "Error: missing file $archives_file" exit 1 } @@ -127,20 +127,23 @@ proc _collect_src_archive_from_depot { user name version } { # Determine the current version for the given archive # # This function tries to determine the version information from the Genode -# source tree. It returns an empty string if the archive is missing from the +# source tree. It exits with an error if the archive is missing from the # depot. # proc _current_depot_archive_version { type name } { set hash_rel_path "recipes/$type/$name/hash" set repo [repository_contains $hash_rel_path] - set version "" - if {$repo != ""} { - set fh [open "$repo/$hash_rel_path" "RDONLY"] - set version [lindex [gets $fh] 0] - close $fh + if {$repo == ""} { + puts stderr "Error: unable to guess version of '$name' archive" + exit 1 } + + set fh [open "$repo/$hash_rel_path" "RDONLY"] + set version [lindex [gets $fh] 0] + close $fh + return $version }