luarocks-packages-updater: handle errors better
This commit is contained in:
parent
8af52ff6ba
commit
213f4d95bf
@ -142,7 +142,15 @@ class LuaEditor(pluginupdate.Editor):
|
|||||||
finally:
|
finally:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.generate_nix(results, output_file)
|
successful_results = [(plug, nix_expr) for plug, nix_expr, error in results if nix_expr is not None]
|
||||||
|
errors = [(plug, error) for plug, nix_expr, error in results if error is not None]
|
||||||
|
|
||||||
|
self.generate_nix(successful_results, output_file)
|
||||||
|
|
||||||
|
if errors:
|
||||||
|
log.error("The following plugins failed to update:")
|
||||||
|
for plug, error in errors:
|
||||||
|
log.error("%s: %s", plug.name, error)
|
||||||
|
|
||||||
redirects = {}
|
redirects = {}
|
||||||
return redirects
|
return redirects
|
||||||
@ -171,6 +179,7 @@ def generate_pkg_nix(plug: LuaPlugin):
|
|||||||
"""
|
"""
|
||||||
log.debug("Generating nix expression for %s", plug.name)
|
log.debug("Generating nix expression for %s", plug.name)
|
||||||
|
|
||||||
|
try:
|
||||||
cmd = ["luarocks", "nix"]
|
cmd = ["luarocks", "nix"]
|
||||||
|
|
||||||
if plug.maintainers:
|
if plug.maintainers:
|
||||||
@ -203,7 +212,10 @@ def generate_pkg_nix(plug: LuaPlugin):
|
|||||||
|
|
||||||
output = subprocess.check_output(cmd, text=True)
|
output = subprocess.check_output(cmd, text=True)
|
||||||
output = "callPackage(" + output.strip() + ") {};\n\n"
|
output = "callPackage(" + output.strip() + ") {};\n\n"
|
||||||
return (plug, output)
|
return (plug, output, None)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
log.error("Failed to generate nix expression for %s: %s", plug.name, e)
|
||||||
|
return (plug, None, str(e))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user