test: Ignore database locks if the process that locked the database no longer exists in pmtest
This commit is contained in:
parent
52996a3727
commit
32de51318d
2 changed files with 13 additions and 1 deletions
|
@ -232,7 +232,7 @@ class pmtest(object):
|
|||
return files
|
||||
|
||||
def run(self, pacman):
|
||||
if os.path.isfile(util.PM_LOCK):
|
||||
if util.ispacmanlocked():
|
||||
tap.bail("\tERROR: another pacman session is on-going -- skipping")
|
||||
return
|
||||
|
||||
|
|
|
@ -184,3 +184,15 @@ def mkdir(path):
|
|||
elif os.path.isfile(path):
|
||||
raise OSError("'%s' already exists and is not a directory" % path)
|
||||
os.makedirs(path, 0o755)
|
||||
|
||||
#
|
||||
# Locking
|
||||
#
|
||||
def ispacmanlocked():
|
||||
if not os.path.exists(PM_LOCK):
|
||||
return False
|
||||
|
||||
with open(PM_LOCK, 'r') as f:
|
||||
pid = f.read().strip()
|
||||
|
||||
return pid.isdigit() and os.path.exists(f'/proc/{pid}')
|
||||
|
|
Loading…
Add table
Reference in a new issue