tuse the locking functions - amprolla - devuan's apt repo merger
 (HTM) git clone git://parazyd.org/amprolla.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 992d24959e7e85852557df8ad553c711af5a9729
 (DIR) parent 32b7d87eeed5748306269f5eb1eaaf55e06bba3c
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Mon,  6 Nov 2017 13:55:29 +0100
       
       use the locking functions
       
       Diffstat:
         M amprolla_init.py                    |       3 +++
         M amprolla_merge.py                   |       3 +++
         M amprolla_merge_contents.py          |       5 ++++-
         M amprolla_update.py                  |       5 ++++-
         M orchestrate.sh                      |       2 ++
       
       5 files changed, 16 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/amprolla_init.py b/amprolla_init.py
       t@@ -12,6 +12,7 @@ from time import time
        
        from lib.config import (aliases, arches, categories, cpunm, mainrepofiles,
                                repos, spooldir, suites)
       +from lib.lock import check_lock, free_lock
        from lib.net import download
        from lib.parse import parse_release
        
       t@@ -87,6 +88,8 @@ def main():
        
        if __name__ == '__main__':
            t1 = time()
       +    check_lock()
            main()
       +    free_lock()
            t2 = time()
            print('total time: %s' % (t2 - t1))
 (DIR) diff --git a/amprolla_merge.py b/amprolla_merge.py
       t@@ -14,6 +14,7 @@ import lib.globalvars as globalvars
        from lib.config import (aliases, arches, banpkgs, categories, cpunm, mergedir,
                                mergesubdir, pkgfiles, repos, repo_order, signrelease,
                                spooldir, srcfiles, suites)
       +from lib.lock import check_lock, free_lock
        from lib.package import (load_packages_file, merge_packages_many,
                                 write_packages)
        from lib.release import write_release
       t@@ -195,6 +196,8 @@ def main():
        
        if __name__ == '__main__':
            t1 = time()
       +    check_lock()
            main()
       +    free_lock()
            t2 = time()
            print('total time: %s' % (t2 - t1))
 (DIR) diff --git a/amprolla_merge_contents.py b/amprolla_merge_contents.py
       t@@ -11,10 +11,11 @@ from os import makedirs
        from os.path import dirname, join, isfile
        from time import time
        
       +import lib.globalvars as globalvars
        from amprolla_merge import prepare_merge_dict
        from lib.config import (arches, categories, cpunm, mergedir, mergesubdir,
                                repos, spooldir)
       -import lib.globalvars as globalvars
       +from lib.lock import check_lock, free_lock
        
        
        def merge_contents(filelist):
       t@@ -105,6 +106,8 @@ def main():
        
        if __name__ == '__main__':
            t1 = time()
       +    check_lock()
            main()
       +    free_lock()
            t2 = time()
            print('total time: %s' % (t2 - t1))
 (DIR) diff --git a/amprolla_update.py b/amprolla_update.py
       t@@ -11,11 +11,12 @@ from time import time
        import requests
        
        import lib.globalvars as globalvars
       +from amprolla_merge import gen_release, merge, prepare_merge_dict
        from lib.config import aliases, cpunm, repos, repo_order, spooldir
       +from lib.lock import check_lock, free_lock
        from lib.log import info, warn
        from lib.parse import compare_dict, get_date, get_time, parse_release
        from lib.net import download
       -from amprolla_merge import gen_release, merge, prepare_merge_dict
        
        
        def remote_is_newer(remote, local):
       t@@ -142,6 +143,8 @@ def main():
        
        if __name__ == '__main__':
            t1 = time()
       +    check_lock()
            main()
       +    free_lock()
            t2 = time()
            print('total time: %s' % (t2 - t1))
 (DIR) diff --git a/orchestrate.sh b/orchestrate.sh
       t@@ -10,6 +10,7 @@ REPO_ROOT="${REPO_ROOT:-/srv/amprolla}"
        # TODO: Remove the while loop and run with cron after testing phase
        
        while true; do
       +        [ -f "/tmp/amprolla.lock" ] || {
                ln -snf "$REPO_ROOT"/merged-staging "$REPO_ROOT"/merged
                # The break call is temporary to catch unhandled exceptions in the testing phase
                python3 "$AMPROLLA_UPDATE" || {
       t@@ -29,6 +30,7 @@ while true; do
        
                # handle obsolete package logs
                cat "$REPO_ROOT"/log/*-oldpackages.txt | sort | uniq > "$REPO_ROOT"/log/oldpackages.txt
       +        }
        
                sleep 3600
        done