run: improve error handling regarding depots

Fixes #2821
This commit is contained in:
Roman Iten 2018-05-14 20:05:17 +02:00 committed by Christian Helmuth
parent c5f1ac615c
commit 874815ebf6

View File

@ -67,7 +67,7 @@ proc _collect_pkg_archive_from_depot { user name version } {
set archives_file "[depot_dir]/$archive_dir/archives" set archives_file "[depot_dir]/$archive_dir/archives"
if {![file exists $archives_file]} { if {![file exists $archives_file]} {
puts "Error: missing file $archives_file" puts stderr "Error: missing file $archives_file"
exit 1 exit 1
} }
@ -127,20 +127,23 @@ proc _collect_src_archive_from_depot { user name version } {
# Determine the current version for the given archive # Determine the current version for the given archive
# #
# This function tries to determine the version information from the Genode # 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. # depot.
# #
proc _current_depot_archive_version { type name } { proc _current_depot_archive_version { type name } {
set hash_rel_path "recipes/$type/$name/hash" set hash_rel_path "recipes/$type/$name/hash"
set repo [repository_contains $hash_rel_path] set repo [repository_contains $hash_rel_path]
set version ""
if {$repo != ""} { if {$repo == ""} {
set fh [open "$repo/$hash_rel_path" "RDONLY"] puts stderr "Error: unable to guess version of '$name' archive"
set version [lindex [gets $fh] 0] exit 1
close $fh
} }
set fh [open "$repo/$hash_rel_path" "RDONLY"]
set version [lindex [gets $fh] 0]
close $fh
return $version return $version
} }