[lxc-devel] [distrobuilder/master] Don't attempt to re-install packages that were installed early
eddyg on Github
lxc-bot at linuxcontainers.org
Tue Nov 19 12:44:38 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 738 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191119/2a9dc006/attachment.bin>
-------------- next part --------------
From 60aab351bd9444234eca06fed1872a1bf595127b Mon Sep 17 00:00:00 2001
From: Eddy G <github at 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 <github at 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) {
More information about the lxc-devel
mailing list