Skip to content

Commit 756a491

Browse files
committed
Makefile: split lima-additional-guestagents-*.tar.gz from lima-*.tar.gz
`make artifact` now produces two archives that will be uploaded to <https://github.com/lima-vm/lima/releases>: 1. lima-<VERSION>-Darwin-arm64.tar.gz: (`make native`) - core components (bin/limactl, share/lima/templates, ...) - share/lima/lima-guestagent.Linux-aarch64 2. lima-additional-guestagents-<VERSION>-Darwin-arm64.tar.gz: (`make additional-guestagents`) - share/lima/lima-guestagent.Linux-armv7l - share/lima/lima-guestagent.Linux-ppc64le - share/lima/lima-guestagent.Linux-riscv64 - share/lima/lima-guestagent.Linux-s390x - share/lima/lima-guestagent.Linux-x86_64 For compatibility reason, `make` still builds the guestagents for all the architectures by default. Package maintainers are suggested to split `lima` package to `lima` and `lima-additional-guestagents`. Fix issue 3321 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
1 parent cf29aba commit 756a491

File tree

5 files changed

+82
-5
lines changed

5 files changed

+82
-5
lines changed

.github/workflows/release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ jobs:
7979
run: make artifacts-linux
8080
- name: "Make misc artifacts"
8181
run: make artifacts-misc
82+
- name: "Validate artifactts"
83+
run: ./hack/validate-artifact.sh ./_artifacts/*.tar.gz
8284
- name: "SHA256SUMS"
8385
run: |
8486
( cd _artifacts; sha256sum *.tar.gz ) | tee /tmp/SHA256SUMS

Makefile

+14-2
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ generate:
509509

510510
################################################################################
511511
# _artifacts/lima-$(VERSION_TRIMMED)-$(ARTIFACT_OS)-$(ARTIFACT_UNAME_M)
512+
# _artifacts/lima-additional-guestagents-$(VERSION_TRIMMED)-$(ARTIFACT_OS)-$(ARTIFACT_UNAME_M)
512513
.PHONY: artifact
513514

514515
# returns the capitalized string of $(1).
@@ -534,11 +535,13 @@ endif
534535
ARTIFACT_OS = $(call capitalize,$(GOOS))
535536
ARTIFACT_UNAME_M = $(call to_uname_m,$(GOARCH))
536537
ARTIFACT_PATH_COMMON = _artifacts/lima-$(VERSION_TRIMMED)-$(ARTIFACT_OS)-$(ARTIFACT_UNAME_M)
538+
ARTIFACT_ADDITIONAL_GUESTAGENTS_PATH_COMMON = _artifacts/lima-additional-guestagents-$(VERSION_TRIMMED)-$(ARTIFACT_OS)-$(ARTIFACT_UNAME_M)
537539

538-
artifact: $(addprefix $(ARTIFACT_PATH_COMMON),$(ARTIFACT_FILE_EXTENSIONS))
540+
artifact: $(addprefix $(ARTIFACT_PATH_COMMON),$(ARTIFACT_FILE_EXTENSIONS)) \
541+
$(addprefix $(ARTIFACT_ADDITIONAL_GUESTAGENTS_PATH_COMMON),$(ARTIFACT_FILE_EXTENSIONS))
539542

540543
ARTIFACT_DES = _output/bin/limactl$(exe) $(LIMA_DEPS) $(HELPERS_DEPS) \
541-
$(ALL_GUESTAGENTS) \
544+
$(NATIVE_GUESTAGENT) \
542545
$(TEMPLATES) $(TEMPLATE_EXPERIMENTALS) \
543546
$(DOCUMENTATION) _output/share/doc/lima/templates \
544547
_output/share/man/man1/limactl.1
@@ -547,9 +550,18 @@ ARTIFACT_DES = _output/bin/limactl$(exe) $(LIMA_DEPS) $(HELPERS_DEPS) \
547550
$(ARTIFACT_PATH_COMMON).tar.gz: $(ARTIFACT_DES) | _artifacts
548551
$(TAR) -C _output/ --no-xattrs -czvf $@ ./
549552

553+
$(ARTIFACT_ADDITIONAL_GUESTAGENTS_PATH_COMMON).tar.gz:
554+
# FIXME: do not exec make from make
555+
make clean additional-guestagents
556+
$(TAR) -C _output/ --no-xattrs -czvf $@ ./
557+
550558
$(ARTIFACT_PATH_COMMON).zip: $(ARTIFACT_DES) | _artifacts
551559
cd _output && $(ZIP) -r ../$@ *
552560

561+
$(ARTIFACT_ADDITIONAL_GUESTAGENTS_PATH_COMMON).zip:
562+
make clean additional-guestagents
563+
cd _output && $(ZIP) -r ../$@ *
564+
553565
# generate manpages using native limactl.
554566
manpages-using-native-limactl: GOOS = $(GOHOSTOS)
555567
manpages-using-native-limactl: GOARCH = $(GOHOSTARCH)

hack/validate-artifact.sh

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# SPDX-FileCopyrightText: Copyright The Lima Authors
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# This script validates that lima-<VERSION>-Darwin-arm64.tar.gz
7+
# contains lima-guestagent.Linux-aarch64
8+
# but does not contain share/lima/lima-guestagent.Linux-x86_64
9+
10+
set -eu -o pipefail
11+
12+
must_contain() {
13+
if ! tar tzf "$1" | grep -q "$2"; then
14+
echo >&2 "ERROR: $1 must contain $2"
15+
tar tzf "$1" >&2
16+
exit 1
17+
fi
18+
}
19+
20+
must_not_contain() {
21+
if tar tzf "$1" | grep -q "$2"; then
22+
echo >&2 "ERROR: $1 must not contain $2"
23+
tar tzf "$1" >&2
24+
exit 1
25+
fi
26+
}
27+
28+
validate_artifact() {
29+
FILE="$1"
30+
MYARCH="x86_64"
31+
OTHERARCH="aarch64"
32+
if [[ $FILE == *"aarch64"* || $FILE == *"arm64"* ]]; then
33+
MYARCH="aarch64"
34+
OTHERARCH="x86_64"
35+
fi
36+
if [[ $FILE == *"go-mod-vendor.tar.gz" ]]; then
37+
: NOP
38+
elif [[ $FILE == *"lima-additional-guestagents"*".tar.gz" ]]; then
39+
must_not_contain "$FILE" "lima-guestagent.Linux-$MYARCH"
40+
must_contain "$FILE" "lima-guestagent.Linux-$OTHERARCH"
41+
elif [[ $FILE == *"lima-"*".tar.gz" ]]; then
42+
must_not_contain "$FILE" "lima-guestagent.Linux-$OTHERARCH"
43+
must_contain "$FILE" "lima-guestagent.Linux-$MYARCH"
44+
else
45+
echo >&2 "ERROR: Unexpected file: $FILE"
46+
exit 1
47+
fi
48+
}
49+
50+
for FILE in "$@"; do
51+
validate_artifact "$FILE"
52+
done

website/content/en/docs/installation/_index.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ and extract it under `/usr/local` (or somewhere else).
4545
```bash
4646
VERSION=$(curl -fsSL https://api.github.com/repos/lima-vm/lima/releases/latest | jq -r .tag_name)
4747
curl -fsSL "https://github.com/lima-vm/lima/releases/download/${VERSION}/lima-${VERSION:1}-$(uname -s)-$(uname -m).tar.gz" | tar Cxzvm /usr/local
48+
49+
# For Lima v1.1 onward
50+
curl -fsSL "https://github.com/lima-vm/lima/releases/download/${VERSION}/lima-additional-guestagents-${VERSION:1}-$(uname -s)-$(uname -m).tar.gz" | tar Cxzvm /usr/local
4851
```
4952
{{% /tab %}}
50-
{{< /tabpane >}}
53+
{{< /tabpane >}}

website/content/en/docs/installation/source.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,21 @@ export PATH=$HOME/.local/bin:$PATH
3636
## Packaging Lima for Distribution
3737
After building Lima from source, you may want to package it for installation on other machines:
3838

39+
1. The package for the core component and the native guest agent:
3940
```bash
41+
make clean native
4042
cd _output
41-
# Create a compressed archive
4243
tar czf lima-package.tar.gz *
4344
```
4445

45-
This package can then be transferred and installed on the target system.
46+
2. The package for the additional guest agents:
47+
```
48+
make clean additional-guestagents
49+
cd _output
50+
tar czf lima-additional-guestagents-package.tar.gz *
51+
```
52+
53+
These packages can then be transferred and installed on the target system.
4654

4755
## Advanced Configuration with Kconfig Tools
4856
(This step is not needed for most users)

0 commit comments

Comments
 (0)