If any URL of a repository (the index itself, or any of the other
resources associated except the templates themselves) cannot be
downloaded, ignore the repository with a warning message.
This way, if a repository is temporary unavailable, the rest of the
repositories can still be used.
---
builder/builder.ml | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index 651db83f0..b8d36f6fa 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -199,18 +199,26 @@ let main () =
let sources = List.append sources repos in
let index : Index.index =
List.concat (
- List.map (
+ List.filter_map (
fun source ->
- let sigchecker =
- Sigchecker.create ~gpg:cmdline.gpg
- ~check_signature:cmdline.check_signature
- ~gpgkey:source.Sources.gpgkey
- ~tmpdir in
- match source.Sources.format with
- | Sources.FormatNative ->
- Index_parser.get_index ~downloader ~sigchecker source
- | Sources.FormatSimpleStreams ->
- Simplestreams_parser.get_index ~downloader ~sigchecker source
+ try
+ let sigchecker =
+ Sigchecker.create ~gpg:cmdline.gpg
+ ~check_signature:cmdline.check_signature
+ ~gpgkey:source.Sources.gpgkey
+ ~tmpdir in
+ let parsed_index =
+ match source.Sources.format with
+ | Sources.FormatNative ->
+ Index_parser.get_index ~downloader ~sigchecker source
+ | Sources.FormatSimpleStreams ->
+ Simplestreams_parser.get_index ~downloader ~sigchecker source in
+ Some parsed_index
+ with
+ | Curl.Curl_failed (code, url) ->
+ warning (f_"failed to download ā%sā (code %d), ignoring repository
ā%sā")
+ url code source.Sources.name;
+ None
) sources
) in
let index = remove_duplicates index in
--
2.20.1