| |
@@ -277,18 +277,22 @@
|
| |
def compress_live_log(self, job):
|
| |
log_basename = "builder-live.log"
|
| |
src = os.path.join(job.results_dir, log_basename)
|
| |
-
|
| |
+
|
| |
+ # For automatic redirect from log to log.gz, consider configuring
|
| |
+ # lighttpd like:
|
| |
+ # url.rewrite-if-not-file = ("^/(.*)/builder-live.log$" => "/$1/redirect-live.log")
|
| |
+ # url.redirect("^/(.*)/redirect-live.log$" => "/$1/builder-live.log.gz")
|
| |
+ # or apache by:
|
| |
+ # <Files builder-live.log>
|
| |
+ # RewriteEngine on
|
| |
+ # RewriteCond %{REQUEST_FILENAME} !-f
|
| |
+ # RewriteRule ^(.*)$ %{REQUEST_URI}.gz [R]
|
| |
+ # </files>
|
| |
self.log.info("Compressing {} by gzip".format(src))
|
| |
if subprocess.call(["gzip", src]) not in [0, 2]:
|
| |
self.log.error("Unable to compress file {}".format(src))
|
| |
return
|
| |
|
| |
- try:
|
| |
- with open(src, "w") as f_src:
|
| |
- f_src.write("{} was moved to {}.gz\n".format(log_basename, log_basename))
|
| |
- except Exception as e:
|
| |
- self.log.exception(e)
|
| |
-
|
| |
def reattach_to_pkg_build(self):
|
| |
"""
|
| |
:raises VmError, BuilderError
|
| |
Turns out that my original idea for PR#788 wasn't ideal and it is better
to not provide builder-live.log stub. Especially after
4aa9324 (UI generates appropriate link), so the http server
redirect configuration is mostly voluntary.
The thing is that it is very complicated (if possible at all) to
configure lighttpd (Fedora Copr deployment case) to redirect
automatically from 'builder-live.log' to 'builder-live.log.gz' when the
'builder-live.log.gz' exists. And OTOH it is pretty trivial to
redirect to if 'builder-live.log' doesn't exist.
Also, notable benefit of this change is that we'll save some inode
quota.
While I'm on it, I'm adding single-shot script which will traverse the
build directory and (a) remove the stub logs we created before, and (b)
compress the non-stub uncompressed builder-live.log files (from the
times we did not compress at all). This is needed to have working
'builder-live.log.gz' links from UI.
Relates: #921, PR#788, #941