Skip to content

Commit 9aebdbd

Browse files
committed
Add default version aliases for ubuntu and fedora
This means you can just do: $ make kernel@ppc64le@ubuntu or $ make kernel@ppc64le@fedora To use the image with the latest version.
1 parent d5be9ae commit 9aebdbd

4 files changed

Lines changed: 50 additions & 13 deletions

File tree

build/Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
all: help
22

3-
FEDORA_DISTROS := fedora@35 fedora@34 fedora@33 fedora@31
4-
UBUNTU_DISTROS := ubuntu@21.10 ubuntu@21.04 ubuntu@20.04 ubuntu@18.04 ubuntu@16.04
3+
export FEDORA_LATEST := 35
4+
export UBUNTU_LATEST := 21.10
5+
6+
FEDORA_DISTROS := fedora@${FEDORA_LATEST} fedora@34 fedora@33 fedora@31 fedora
7+
UBUNTU_DISTROS := ubuntu@${UBUNTU_LATEST} ubuntu@21.04 ubuntu@20.04 ubuntu@18.04 ubuntu@16.04 ubuntu)
58
KORG_DISTROS := korg@11.1.0 korg@10.3.0 korg@9.3.0 korg@8.1.0 korg@5.5.0
69
ALL_DISTROS := ${UBUNTU_DISTROS} ${KORG_DISTROS} ${FEDORA_DISTROS}
7-
DOCS_DISTRO := docs@21.10
8-
X86_DISTRO := ubuntu@21.10
10+
DOCS_DISTRO := docs@${UBUNTU_LATEST}
11+
X86_DISTRO := ubuntu@${UBUNTU_LATEST}
12+
ALIAS_DISTROS := ubuntu fedora
913
SUBARCHES := ppc64le ppc64 ppc
1014

1115
VERSION:
@@ -34,7 +38,7 @@ kernel@${1}@${2}: image@${1}@${2}
3438
clean-kernel@${1}@${2}:
3539
@./scripts/clean.sh $$@
3640

37-
KERNEL += kernel@${1}@${2}
41+
KERNEL += $(if $(filter-out ${ALIAS_DISTROS},${2}), kernel@${1}@${2})
3842
endef
3943

4044
define SELFTESTS_TEMPLATE =
@@ -44,8 +48,8 @@ ppctests@${1}@${2} selftests@${1}@${2}: image@${1}@${2}
4448
clean-selftests@${1}@${2}:
4549
@./scripts/clean.sh $$@
4650

47-
PPCTESTS += ppctests@${1}@${2}
48-
SELFTESTS += selftests@${1}@${2}
51+
PPCTESTS += $(if $(filter-out ${ALIAS_DISTROS},${2}), ppctests@${1}@${2})
52+
SELFTESTS += $(if $(filter-out ${ALIAS_DISTROS},${2}), selftests@${1}@${2})
4953
endef
5054

5155
define PERF_TEMPLATE =
@@ -55,7 +59,7 @@ perf@${1}@${2}: image@${1}@${2}
5559
clean-perf@${1}@${2}:
5660
@./scripts/clean.sh $$@
5761

58-
PERF += perf@${1}@${2}
62+
PERF += $(if $(filter-out ${ALIAS_DISTROS},${2}), perf@${1}@${2})
5963
endef
6064

6165
define DOCS_TEMPLATE =

build/scripts/build.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ script_base="$(realpath "$dir")"
1717

1818
IFS=@ read -r task subarch distro version <<< "$1"
1919

20-
image="docker.io/linuxppc/build:$distro-$version"
21-
2220
SRC="${SRC/#\~/$HOME}"
2321
SRC=$(realpath "$SRC")
2422

@@ -148,6 +146,13 @@ fi
148146

149147
cmd+="$PODMAN_OPTS "
150148

149+
if [[ -z "$version" ]]; then
150+
# NB, after we passed $version to get_output_dir()
151+
version=$(get_default_version $distro)
152+
fi
153+
154+
image="docker.io/linuxppc/build:$distro-$version"
155+
151156
cmd+="$image "
152157
cmd+="/bin/container-build.sh $task"
153158

build/scripts/image.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ script_base="$(realpath "$dir")"
1111

1212
IFS=@ read -r task subarch distro version <<< "$1"
1313

14+
if [[ -z "$version" ]]; then
15+
version=$(get_default_version $distro)
16+
fi
17+
1418
image="docker.io/linuxppc/build:$distro-$version"
1519

1620
if [[ "$task" == "image" ]]; then

build/scripts/lib.sh

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ function get_output_dir()
2727
local clang="$8"
2828
local d
2929

30-
if [[ -z "$script_base" || -z "$subarch" || -z "$distro" || -z "$version" ]]; then
30+
if [[ -z "$script_base" || -z "$subarch" || -z "$distro" ]]; then
3131
echo "Error: not enough arguments to get_output_dir()" >&2
3232
return 1
3333
fi
3434

3535
if [[ -n "$CI_OUTPUT" ]]; then
36-
d="$CI_OUTPUT/$subarch@$distro@$version"
36+
d="$CI_OUTPUT/$subarch@$distro"
3737
else
38-
d="$script_base/../output/$subarch@$distro@$version"
38+
d="$script_base/../output/$subarch@$distro"
39+
fi
40+
41+
if [[ -n "$version" ]]; then
42+
d="$d@$version"
3943
fi
4044

4145
case "$task" in
@@ -72,6 +76,26 @@ function get_output_dir()
7276
return 0
7377
}
7478

79+
function get_default_version()
80+
{
81+
local distro="$1"
82+
local latest
83+
84+
case "$distro" in
85+
ubuntu) latest="$UBUNTU_LATEST" ;;
86+
fedora) latest="$FEDORA_LATEST" ;;
87+
esac
88+
89+
if [[ -z "$latest" ]]; then
90+
echo "Error: No default version for $distro" >&2
91+
return 1
92+
fi
93+
94+
echo "$latest"
95+
96+
return 0
97+
}
98+
7599
podman --version > /dev/null
76100
if [[ $? -eq 0 ]]; then
77101
DOCKER="podman"

0 commit comments

Comments
 (0)