Support arch-specific package-installs

In some cases, like linux-image-* on debian, we need to only install
packages for a specific target architecture.

Change-Id: Ic0009d0c1e121d6f3f1f21345c544e2d98f080f9
This commit is contained in:
Gregory Haynes 2015-04-23 00:48:51 +00:00
parent e9ac9c9823
commit 28c42fafdc
2 changed files with 14 additions and 1 deletions

View File

@ -16,6 +16,8 @@ example package-installs.yaml::
uninstall: True uninstall: True
os-collect-config: os-collect-config:
installtype: source installtype: source
linux-image-amd64:
arch: amd64
example package-installs.json:: example package-installs.json::
@ -33,11 +35,15 @@ the following default values::
phase: install.d phase: install.d
uninstall: False uninstall: False
installtype: * (Install package for all installtypes) installtype: * (Install package for all installtypes)
arch: * (Install package for all architectures)
Setting the installtype property causes the package only to be installed if Setting the installtype property causes the package only to be installed if
the specified installtype would be used for the element. See the the specified installtype would be used for the element. See the
diskimage-builder docs for more information on installtypes. 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 DEPRECATED: Adding a file under your elements pre-install.d, install.d, or
post-install.d directories called package-installs-<element-name> will cause 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 # Filter out incorrect installtypes
installtype = params.get('installtype', None) installtype = params.get('installtype', None)
elem_installtype = get_element_installtype(element_name) 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)) data[phase][install].append((pkg_name, element_name))
return data return data