Skip to content

Commit c6d91a4

Browse files
authored
pkginfo: avoid lock loop (NethServer#149)
- Remove unused clean_all option to avoid cache changes - Release lock before invoking 'yum changelog' NethServer/dev#5667
1 parent ab8cae0 commit c6d91a4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎root/usr/libexec/nethserver/pkginfo‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,16 @@ def compsdump(yb):
103103

104104
print( simplejson.dumps(comps) )
105105

106-
def check_update(yb, clean_all = False, strict = False):
107-
if clean_all:
108-
subprocess.call(["/usr/bin/yum", "clean", "all"], stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT)
109-
yb.conf.reposdir = '/etc/nethserver/yum-update.d/'
106+
def check_update(yb, strict = False):
110107
updates = map(lambda i: {'name': i[0], 'arch': i[1], 'epoch': i[2], 'version': i[3], 'release': i[4]}, yb.up.getUpdatesList())
108+
yb.doUnlock()
111109

112110
if strict:
113111
changelog = subprocess.Popen(['/usr/bin/yum', 'changelog', '1', 'updates', '--setopt=reposdir=/etc/nethserver/yum-update.d/'], stdout=subprocess.PIPE, shell=False, env={'LANG': 'en_US.UTF-8'}).communicate()[0];
114112
else:
115113
changelog = subprocess.Popen(['/usr/bin/yum', 'changelog', '1', 'updates'], stdout=subprocess.PIPE, shell=False, env={'LANG': 'en_US.UTF-8'}).communicate()[0];
116114

115+
yb.doLock()
117116
simplejson.dump({'updates': updates, 'changelog': changelog.decode('utf-8')}, sys.stdout)
118117

119118
def parse_pkginfo_conf():

0 commit comments

Comments
 (0)