Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add installation of debian 12 and required dependencies #161

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion install/swiftly-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ install_system_deps () {
return
fi

if [[ "$docker_platform_name" == "debian" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I filed swiftlang/swift-docker#409 to cover adding the proper Debian 12 images so we don't need the hard code or fallback to swift-ci's list.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think hard coding the dependencies is a much better option, especially for all the ubuntu and debian platforms. Trying to parse multiple dockerfiles to obtain the same dependency list is over engineering what should be a very simple task.
The following list of dependencies covers all current versions of ubuntu and debian with swift releases.

build-essential 
git 
gnupg2  
libcurl4 
libedit2 
libncurses-dev 
libpython3-dev  
libxml2  
libz3-dev 
pkg-config 
python3 
python3-lldb 
tzdata 
unzip 
zlib1g-dev

I'm sure a similar simplified list could be made for RHEL platforms.

If in some future swift release some extra dependencies are required, then it is a very quick and simple task to add it to the list.

Simple to update, simple to maintain and guaranteed to work correctly.

echo "Detected Debian platform."
set +o errexit
if [[ "$(id --user)" == "0" ]]; then
apt-get install --quiet -y build-essential git gnupg2 libcurl4 libedit2 libncurses-dev libpython3-dev libxml2 libz3-dev pkg-config python3 python3-lldb tzdata unzip zlib1g-dev
else
sudo apt-get install --quiet -y build-essential git gnupg2 libcurl4 libedit2 libncurses-dev libpython3-dev libxml2 libz3-dev pkg-config python3 python3-lldb tzdata unzip zlib1g-dev
fi
return
fi


dockerfile_url="https://raw.githubusercontent.com/apple/swift-docker/main/nightly-main/$docker_platform_name/$docker_platform_version/Dockerfile"
dockerfile="$(curl --silent --retry 3 --location --fail $dockerfile_url)"
if [[ "$?" -ne 0 ]]; then
Expand Down Expand Up @@ -176,7 +188,7 @@ set_platform_ubuntu () {
docker_platform_name="ubuntu"
package_manager="apt-get"
export DEBIAN_FRONTEND=noninteractive

PLATFORM_NAME="ubuntu$1$2"
PLATFORM_NAME_FULL="ubuntu$1.$2"
docker_platform_version="$1.$2"
Expand All @@ -186,6 +198,20 @@ set_platform_ubuntu () {
fi
}

set_platform_debian () {
docker_platform_name="debian"
package_manager="apt-get"
export DEBIAN_FRONTEND=noninteractive

PLATFORM_NAME="debian$1$2"
PLATFORM_NAME_FULL="debian$1$2"
docker_platform_version="$1$2"

if [[ -z "$PLATFORM_NAME_PRETTY" ]]; then
PLATFORM_NAME_PRETTY="Debian $1$2"
fi
}

set_platform_amazonlinux () {
PLATFORM_NAME="amazonlinux$1"
PLATFORM_NAME_FULL="amazonlinux$1"
Expand Down Expand Up @@ -251,6 +277,18 @@ detect_platform () {
esac
;;

*"debian"*)
case "$VERSION_CODENAME" in
"bookworm")
set_platform_debian "12"
;;

*)
manually_select_platform
;;
esac
;;

*"rhel"*)
if [[ "$VERSION_ID" != 9* ]]; then
manually_select_platform
Expand Down Expand Up @@ -415,6 +453,10 @@ EOF

"--platform" | "-p")
case "$2" in
"debian12")
set_platform_debian "12"
;;

"ubuntu22.04")
set_platform_ubuntu "22" "04"
;;
Expand Down