Browse Source

Add --no-lock-I-am-sure to all amprolla steps.

This is necessary to have orchestrate deal with all steps in the correct order.
wip/archive
Evilham 2 years ago
parent
commit
97777c1a63
  1. 5
      amprolla_init.py
  2. 5
      amprolla_merge.py
  3. 5
      amprolla_merge_contents.py
  4. 5
      amprolla_merge_translations.py
  5. 7
      amprolla_update.py
  6. 23
      lib/lock.py

5
amprolla_init.py

@ -12,7 +12,7 @@ import sys
from lib.config import (aliases, arches, categories, cpunm, mainrepofiles,
repos, spooldir, suites, skips)
from lib.lock import run_with_amprolla_lock
from lib.lock import run_with_args_locking
from lib.net import download
from lib.parse import parse_release
from lib.log import die, info
@ -87,5 +87,4 @@ def main():
if __name__ == '__main__':
if not run_with_amprolla_lock(main, "init"):
sys.exit(1)
run_with_args_locking(main, "init"):

5
amprolla_merge.py

@ -13,7 +13,7 @@ import lib.globalvars as globalvars
from lib.config import (aliases, arches, banpkgs, categories, cpunm, i18n,
mergedir, mergesubdir, pkgfiles, repos, repo_order,
srcfiles, spooldir, suites, skips)
from lib.lock import run_with_amprolla_lock
from lib.lock import run_with_args_locking
from lib.package import (load_packages_file, merge_packages_many,
write_packages)
from lib.release import write_release
@ -203,5 +203,4 @@ def main():
if __name__ == '__main__':
if not run_with_amprolla_lock(main, "full merge"):
sys.exit(1)
run_with_args_locking(main, "full merge")

5
amprolla_merge_contents.py

@ -14,7 +14,7 @@ import sys
import lib.globalvars as globalvars
from lib.config import (arches, categories, cpunm, mergedir, mergesubdir,
repos, spooldir)
from lib.lock import run_with_amprolla_lock
from lib.lock import run_with_args_locking
from lib.log import die, info
from amprolla_merge import prepare_merge_dict
@ -106,5 +106,4 @@ def main():
if __name__ == '__main__':
if not run_with_amprolla_lock(main, "contents merge"):
sys.exit(1)
run_with_args_locking(main, "contents merge")

5
amprolla_merge_translations.py

@ -14,7 +14,7 @@ import sys
import lib.globalvars as globalvars
from lib.config import (arches, categories, cpunm, i18n, mergedir, mergesubdir,
repos, spooldir)
from lib.lock import run_with_amprolla_lock
from lib.lock import run_with_args_locking
from lib.log import die, info
from lib.parse import parse_packages
from amprolla_merge import prepare_merge_dict
@ -118,5 +118,4 @@ def main():
if __name__ == '__main__':
if not run_with_amprolla_lock(main, "translations merge"):
sys.exit(1)
run_with_args_locking(main, "translations merge")

7
amprolla_update.py

@ -12,7 +12,7 @@ import sys
import lib.globalvars as globalvars
from lib.config import aliases, cpunm, repos, repo_order, spooldir, skips
from lib.lock import run_with_amprolla_lock, run_without_lock
from lib.lock import run_with_args_locking
from lib.log import info, warn, die
from lib.parse import compare_dict, get_date, get_time, parse_release
from lib.net import download
@ -143,7 +143,4 @@ def main():
if __name__ == '__main__':
if '--no-lock-I-am-sure' in sys.argv:
run_without_lock(main, "incremental update")
elif not run_with_amprolla_lock(main, "incremental update"):
sys.exit(1)
run_with_args_locking(main, "incremental update")

23
lib/lock.py

@ -62,3 +62,26 @@ def run_with_amprolla_lock(f, name, *args, **kwargs):
return True
else:
return False
def run_with_args_locking(f, name, *args, **kwargs):
"""
Simplify logic in each amprolla step by dealing with sys args and exit
codes here.
"""
import sys
if '--help' in sys.argv or '-h' in sys.argv:
print("""This is an amprolla step to achieve {step}.
If you run it without arguments, it will use the amprolla lock at:
{lockpath}
You can also run it with --no-lock-I-am-sure as an argument, which will skip
locking.
Notice that if you run multiple amprolla steps simultaneously, this can lead
to a corrupt state, so make sure you have some locking at a different level.
""".format(step=name, lockpath=lockpath))
sys.exit(0)
if '--no-lock-I-am-sure' in sys.argv:
run_without_lock(f, name, *args, **kwargs)
elif not run_with_amprolla_lock(f, name, *args, **kwargs):
sys.exit(1)

Loading…
Cancel
Save