about summary refs log tree commit diff
path: root/tools/nixery/server/builder/builder.go
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-11-27T11·44+0000
committerVincent Ambo <github@tazj.in>2019-11-27T13·28+0000
commitdf88da126a5c0dc97aa0fadaf1baf069b80ce251 (patch)
treec38673f6ade2b103bc996f0400931aac554e3d04 /tools/nixery/server/builder/builder.go
parenta924093d0932b01e03a9cc6979926dddadb67323 (diff)
fix(builder): Ensure "solo-metapackages" do not break builds
The previous logic failed because single meta-packages such as
"nixery.dev/shell" would not end up removing the meta-package itself
from the list of packages passed to Nix, causing a build failure.

This was a regression introduced in 827468a.
Diffstat (limited to 'tools/nixery/server/builder/builder.go')
-rw-r--r--tools/nixery/server/builder/builder.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/nixery/server/builder/builder.go b/tools/nixery/server/builder/builder.go
index 57b94090911e..da9dede1acd7 100644
--- a/tools/nixery/server/builder/builder.go
+++ b/tools/nixery/server/builder/builder.go
@@ -149,16 +149,22 @@ type ImageResult struct {
 // * `arm64`: Causes Nixery to build images for the ARM64 architecture
 func metaPackages(packages []string) (*Architecture, []string) {
 	arch := &amd64
+
 	var metapkgs []string
+	lastMeta := 0
 	for idx, p := range packages {
 		if p == "shell" || p == "arm64" {
 			metapkgs = append(metapkgs, p)
+			lastMeta = idx + 1
 		} else {
-			packages = packages[idx:]
 			break
 		}
 	}
 
+	// Chop off the meta-packages from the front of the package
+	// list
+	packages = packages[lastMeta:]
+
 	for _, p := range metapkgs {
 		switch p {
 		case "shell":