|
|
@ -76,9 +76,19 @@ def query_package(module, pkgin_path, name):
|
|
|
|
* False - not installed or not found
|
|
|
|
* False - not installed or not found
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# test whether '-p' (parsable) flag is supported.
|
|
|
|
|
|
|
|
rc, out, err = module.run_command("%s -p -v" % pkgin_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if rc == 0:
|
|
|
|
|
|
|
|
pflag = '-p'
|
|
|
|
|
|
|
|
splitchar = ';'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
pflag = ''
|
|
|
|
|
|
|
|
splitchar = ' '
|
|
|
|
|
|
|
|
|
|
|
|
# Use "pkgin search" to find the package. The regular expression will
|
|
|
|
# Use "pkgin search" to find the package. The regular expression will
|
|
|
|
# only match on the complete name.
|
|
|
|
# only match on the complete name.
|
|
|
|
rc, out, err = module.run_command("%s search \"^%s$\"" % (pkgin_path, name))
|
|
|
|
rc, out, err = module.run_command("%s %s search \"^%s$\"" % (pkgin_path, pflag, name))
|
|
|
|
|
|
|
|
|
|
|
|
# rc will not be 0 unless the search was a success
|
|
|
|
# rc will not be 0 unless the search was a success
|
|
|
|
if rc == 0:
|
|
|
|
if rc == 0:
|
|
|
@ -93,7 +103,7 @@ def query_package(module, pkgin_path, name):
|
|
|
|
# '<' - installed but out of date
|
|
|
|
# '<' - installed but out of date
|
|
|
|
# '=' - installed and up to date
|
|
|
|
# '=' - installed and up to date
|
|
|
|
# '>' - installed but newer than the repository version
|
|
|
|
# '>' - installed but newer than the repository version
|
|
|
|
pkgname_with_version, raw_state = out.split(' ')[0:2]
|
|
|
|
pkgname_with_version, raw_state = out.split(splitchar)[0:2]
|
|
|
|
|
|
|
|
|
|
|
|
# Strip version
|
|
|
|
# Strip version
|
|
|
|
# (results in sth like 'gcc47-libs')
|
|
|
|
# (results in sth like 'gcc47-libs')
|
|
|
|