From d9c3cf22dc5a85440494e593d241a82019c86aeb Mon Sep 17 00:00:00 2001 From: Laurent Coustet Date: Fri, 15 Nov 2013 12:20:30 +0100 Subject: [PATCH] OpenBSD packages can be installed using 'flavour'. Best example is vim. It can be installed as vim--no_x11 or vim--gtk2. --- packaging/openbsd_pkg | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packaging/openbsd_pkg b/packaging/openbsd_pkg index 16f969ff0fd..079c62e191c 100644 --- a/packaging/openbsd_pkg +++ b/packaging/openbsd_pkg @@ -52,6 +52,9 @@ EXAMPLES = ''' # Make sure nmap is not installed - openbsd_pkg: name=nmap state=absent + +# Make sure vim is installed using no_x11 flavour +- openbsd_pkg name=vim--no_x11 state=present ''' # Function used for executing commands. @@ -81,13 +84,23 @@ def get_current_name(name, specific_version, module): return current_name # Function used to find out if a package is currently installed. +# OpenBSD packages can contain "flavours" +# For example vim is distributed as a "gtk2": +# - vim--gtk2 +# and "no_x11" flavour: +# - vim--no_x11 def get_package_state(name, specific_version, module): info_cmd = 'pkg_info -e' if specific_version: syntax = "%s %s" else: + if "--" in name: + (name, flavour) = name.split("--", 1) syntax = "%s %s-*" + if flavour: + syntax += "-%s" % (flavour, ) + syntax = "%s-" rc, stdout, stderr = execute_command(syntax % (info_cmd, name), module)