Merge "Support arch-specific package-installs"

This commit is contained in:
Jenkins 2015-05-07 09:29:29 +00:00 committed by Gerrit Code Review
commit a10ac00756
2 changed files with 14 additions and 1 deletions

View file

@ -16,6 +16,8 @@ example package-installs.yaml::
uninstall: True
os-collect-config:
installtype: source
linux-image-amd64:
arch: amd64
example package-installs.json::
@ -33,11 +35,15 @@ the following default values::
phase: install.d
uninstall: False
installtype: * (Install package for all installtypes)
arch: * (Install package for all architectures)
Setting the installtype property causes the package only to be installed if
the specified installtype would be used for the element. See the
diskimage-builder docs for more information on installtypes.
Setting the arch property causes the package only to be installed for the
specified target architecture. See documentation about the ARCH variable
for more information.
DEPRECATED: Adding a file under your elements pre-install.d, install.d, or
post-install.d directories called package-installs-<element-name> will cause

View file

@ -46,7 +46,14 @@ def collect_data(data, filename, element_name):
# Filter out incorrect installtypes
installtype = params.get('installtype', None)
elem_installtype = get_element_installtype(element_name)
if installtype is None or installtype == elem_installtype:
valid_installtype = (installtype is None or
installtype == elem_installtype)
# Filter out incorrect ARCH versions
arch = params.get('arch', None)
valid_arch = arch is None or arch == os.environ['ARCH']
if valid_installtype and valid_arch:
data[phase][install].append((pkg_name, element_name))
return data