aboutsummaryrefslogtreecommitdiff
path: root/bbot/utility.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-09-09 08:43:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-09-09 11:03:59 +0200
commit99221a546b10545a7ed7af53044b088217e150eb (patch)
treec7ba826af1a1b7249bbe3d41a15a92e81924646c /bbot/utility.txx
parent35ff21c72e65d1e01678d67c7dd985e2959d4ebf (diff)
Compress result manifest uploaded by worker
These files contain build logs and can be quite large. And large files sometimes trip up upload on Windows.
Diffstat (limited to 'bbot/utility.txx')
-rw-r--r--bbot/utility.txx21
1 files changed, 19 insertions, 2 deletions
diff --git a/bbot/utility.txx b/bbot/utility.txx
index e485a80..3199a61 100644
--- a/bbot/utility.txx
+++ b/bbot/utility.txx
@@ -150,8 +150,25 @@ namespace bbot
if (!file_exists (f))
fail (fh) << what << " manifest file " << f << " does not exist";
- ifdstream ifs (f);
- return parse_manifest<T> (ifs, f.string (), what, fh, iu);
+ bool d (f.extension () == "lz4");
+
+ ifdstream ifs (f, (d
+ ? ifdstream::badbit
+ : ifdstream::badbit | ifdstream::failbit));
+ ilz4stream izs;
+
+ if (d)
+ izs.open (ifs, true /* end */);
+
+ return parse_manifest<T> (d
+ ? static_cast<istream&> (izs)
+ : static_cast<istream&> (ifs),
+ f.string (), what, fh, iu);
+ }
+ catch (const invalid_argument& e) // Invalid compressed content.
+ {
+ fail (fh) << "invalid " << what << " manifest " << f << ": " << e
+ << endf;
}
catch (const system_error& e) // EACCES, etc.
{