The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/264

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) ===
If a package set has the `early: true` option set, those packages are installed with the source (when using `debootstrap`). But because the early packages remain in the set of packages, they are attempted to be installed again.

This is a minor cosmetic issue, but not attempting to re-install the early packages makes the install log slightly cleaner.

Also remove references to the old `early_packages` option in the docs.
From 60aab351bd9444234eca06fed1872a1bf595127b Mon Sep 17 00:00:00 2001
From: Eddy G <git...@eddyg.promessage.com>
Date: Tue, 19 Nov 2019 07:34:47 -0500
Subject: [PATCH] Don't attempt to re-install packages that were installed
 early

If a package set has the `early: true` option set, those packages are
installed with the source (when using `debootstrap`). But because the
early packages remain in the set of packages, they are attempted to be
installed again.

This is a minor cosmetic issue, but not attempting to re-install the
early packages makes the install log slightly cleaner.

Also remove references to the old `early_packages` option in the docs.

Signed-off-by: Eddy Gurney <git...@eddyg.promessage.com>
---
 doc/source.md        |  6 +++---
 shared/definition.go | 23 ++++++++++++-----------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/doc/source.md b/doc/source.md
index 0fc56c6..d741b8c 100644
--- a/doc/source.md
+++ b/doc/source.md
@@ -13,7 +13,6 @@ source:
     suite: <string>
     same_as: <boolean>
     skip_verification: <boolean>
-    early_packages: <array>
 ```
 
 The `downloader` field defines a downloader which pulls a rootfs image which 
will be used as a starting point.
@@ -64,5 +63,6 @@ This can be used if you want to run `debootstrap foo` but 
`foo` is missing due t
 
 If `skip_verification` is true, the source tarball is not verified.
 
-`early_packages` is a list of packages which is to be installed while the 
source is being downloaded.
-This is only used by the `debootstrap` downloader.
+If a package set has the `early` flag enabled, that list of packages will be 
installed
+while the source is being downloaded. (Note that `early` packages are only 
supported by
+the `debootstrap` downloader.)
diff --git a/shared/definition.go b/shared/definition.go
index 6db514a..c4a83d8 100644
--- a/shared/definition.go
+++ b/shared/definition.go
@@ -454,23 +454,24 @@ func (d *Definition) GetRunnableActions(trigger string) 
[]DefinitionAction {
        return out
 }
 
-// GetEarlyPackages returns a list of packages which are to be installed or 
removed earlier than the actual package handling.
+// GetEarlyPackages returns a list of packages which are to be installed or 
removed earlier than the actual package handling
+// Also removes them from the package set so they aren't attempted to be 
re-installed again as normal packages
 func (d *Definition) GetEarlyPackages(action string) []string {
-       var out []string
+       var early []string
 
-       for _, set := range d.Packages.Sets {
-               if set.Action != action || !set.Early {
-                       continue
-               }
+       normal := d.Packages.Sets[:0]
 
-               if !ApplyFilter(&set, d.Image.Release, 
d.Image.ArchitectureMapped, d.Image.Variant) {
-                       continue
+       for _, set := range d.Packages.Sets {
+               if set.Early && set.Action == action && ApplyFilter(&set, 
d.Image.Release, d.Image.ArchitectureMapped, d.Image.Variant) {
+                       early = append(early, set.Packages...)
+               } else {
+                       normal = append(normal, set)
                }
-
-               out = append(out, set.Packages...)
        }
 
-       return out
+       d.Packages.Sets = normal
+
+       return early
 }
 
 func (d *Definition) getMappedArchitecture() (string, error) {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to