|
|
|
@ -19,8 +19,9 @@ options:
|
|
|
|
|
- The package manager used by the system so we can query the package information.
|
|
|
|
|
- Since 2.8 this is a list and can support multiple package managers per system.
|
|
|
|
|
- The 'portage' and 'pkg' options were added in version 2.8.
|
|
|
|
|
- The 'apk' option was added in version 2.11.
|
|
|
|
|
default: ['auto']
|
|
|
|
|
choices: ['auto', 'rpm', 'apt', 'portage', 'pkg', 'pacman']
|
|
|
|
|
choices: ['auto', 'rpm', 'apt', 'portage', 'pkg', 'pacman', 'apk']
|
|
|
|
|
required: False
|
|
|
|
|
type: list
|
|
|
|
|
strategy:
|
|
|
|
@ -376,6 +377,28 @@ class PORTAGE(CLIMgr):
|
|
|
|
|
return dict(zip(self.atoms, package.split()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class APK(CLIMgr):
|
|
|
|
|
|
|
|
|
|
CLI = 'apk'
|
|
|
|
|
atoms = ['name', 'version']
|
|
|
|
|
|
|
|
|
|
def list_installed(self):
|
|
|
|
|
rc, out, err = module.run_command([self._cli, 'info', '-v'])
|
|
|
|
|
if rc != 0 or err:
|
|
|
|
|
raise Exception("Unable to list packages rc=%s : %s" % (rc, err))
|
|
|
|
|
return out.splitlines()
|
|
|
|
|
|
|
|
|
|
def get_package_details(self, package):
|
|
|
|
|
raw_pkg_details = {}
|
|
|
|
|
for line in package.splitlines():
|
|
|
|
|
m = re.match(r"([\w ].*?)-([0-9-\.]+[0-9a-z-\.]*-r[0-9]+)", to_native(line))
|
|
|
|
|
if m:
|
|
|
|
|
raw_pkg_details['name'] = m.group(1)
|
|
|
|
|
raw_pkg_details['version'] = m.group(2)
|
|
|
|
|
|
|
|
|
|
return raw_pkg_details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
|
|
|
|
|
# get supported pkg managers
|
|
|
|
|