The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/133
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) ===
From 8b80b8840fa5c198e3411713c44445c844bbf4fa Mon Sep 17 00:00:00 2001 From: Thomas Hipp <thomas.h...@canonical.com> Date: Fri, 15 Feb 2019 08:24:32 +0100 Subject: [PATCH 1/2] shared: Add Architecture to package set definition Signed-off-by: Thomas Hipp <thomas.h...@canonical.com> --- shared/definition.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shared/definition.go b/shared/definition.go index 367f13b..33fa9e3 100644 --- a/shared/definition.go +++ b/shared/definition.go @@ -15,9 +15,10 @@ import ( // A DefinitionPackagesSet is a set of packages which are to be installed // or removed. type DefinitionPackagesSet struct { - Packages []string `yaml:"packages"` - Action string `yaml:"action"` - Releases []string `yaml:"releases,omitempty"` + Packages []string `yaml:"packages"` + Action string `yaml:"action"` + Releases []string `yaml:"releases,omitempty"` + Architectures []string `yaml:"architectures,omitempty"` } // A DefinitionPackagesRepository contains data of a specific repository From 8fa1835ee6e6d66b5fce76e6defa9461fc262d7b Mon Sep 17 00:00:00 2001 From: Thomas Hipp <thomas.h...@canonical.com> Date: Fri, 15 Feb 2019 08:24:48 +0100 Subject: [PATCH 2/2] distrobuilder: Architecture specific package sets This adds support for architecture specific package sets. If the field is unset, packages will be installed/removed on all architectures. Signed-off-by: Thomas Hipp <thomas.h...@canonical.com> --- distrobuilder/chroot.go | 6 +++++- distrobuilder/main.go | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/distrobuilder/chroot.go b/distrobuilder/chroot.go index 8983831..ac0a4dd 100644 --- a/distrobuilder/chroot.go +++ b/distrobuilder/chroot.go @@ -10,7 +10,7 @@ import ( ) func managePackages(def shared.DefinitionPackages, actions []shared.DefinitionAction, - release string) error { + release string, architecture string) error { var err error manager := managers.Get(def.Manager) @@ -60,6 +60,10 @@ func managePackages(def shared.DefinitionPackages, actions []shared.DefinitionAc continue } + if len(set.Architectures) > 0 && !lxd.StringInSlice(architecture, set.Architectures) { + continue + } + if set.Action == "install" { installablePackages = append(installablePackages, set.Packages...) } else if set.Action == "remove" { diff --git a/distrobuilder/main.go b/distrobuilder/main.go index fa075e6..a2b96a2 100644 --- a/distrobuilder/main.go +++ b/distrobuilder/main.go @@ -214,7 +214,8 @@ func (c *cmdGlobal) preRunBuild(cmd *cobra.Command, args []string) error { // Install/remove/update packages err = managePackages(c.definition.Packages, - c.definition.GetRunnableActions("post-update"), c.definition.Image.Release) + c.definition.GetRunnableActions("post-update"), c.definition.Image.Release, + c.definition.Image.ArchitectureMapped) if err != nil { return fmt.Errorf("Failed to manage packages: %s", err) }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel