From 05f7459ebf1237f01df76fb989840ebf5493f1b5 Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Fri, 20 Jan 2023 19:16:07 +0000 Subject: [PATCH 1/7] Never use the "generic gnu" ponyc package The "generic gnu" package is not actually generic. It is a glibc version that is built on "some glibc using Linux" and will work if it is installed on a Linux that is compatible at a library level with the system that we built the "generic gnu" package on. Quite some time ago, Theo and I (who made the initial decision to include a "generic gnu") realized that the "generic gnu" idea was "a very bad idea". There are a couple large problems with this approach: 1- anyone using ponyup on glibc distro that isn't compatible with our "generic gnu" platform will by default have things installed that will not work. That's a bad user experience. 2- in order to not fall horribly behind, from time to time, we need to "rev" the environment used to build "generic gnu" in. For us that has meant changing the Ubuntu version periodically. That then means that people who had an environment that worked will do an update and install a ponyc that doesn't work because it is for a different set of libraries. That's a bad user experience as well. This PR drops "generic gnu" from being used by the ponyup installer and it avoids it being set as a target platform. Instead when the installer detects that it is being run on a glibc based Linux, it will attempt to identify the distro being used and if we support it, it will use the builds we do for that distro. In the case of "distros built on distros" like Linux Mint being built on Ubuntu, it will set the platform to the builds for the appropriate "base distro". If we are unable to determine the distro or the distro isn't supported, an error message is displayed that directs them to the Linux install instructions in the ponyc repo. I will be doing a corresponding PR to ponyc to update the Linux section of INSTALL.md to account for the changes from this PR. Additionally, once this is merged, we can stop building the "generic gnu" package which I will also open a PR for. --- .release-notes/245.md | 0 README.md | 30 ++++++++++----------- cmd/cli.pony | 6 ++--- ponyup-init.sh | 62 ++++++++++++++++++++++++++----------------- test/main.pony | 6 ++--- 5 files changed, 59 insertions(+), 45 deletions(-) create mode 100644 .release-notes/245.md diff --git a/.release-notes/245.md b/.release-notes/245.md new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index ee22bda..e1ba59c 100644 --- a/README.md +++ b/README.md @@ -79,9 +79,9 @@ The `ponyup show` command will display the installed package versions with the s $ ponyup show stable-nightly-20191116 * stable-nightly-20191115 -ponyc-release-0.33.0-gnu * -ponyc-nightly-20191116-gnu -ponyc-nightly-20191115-gnu +ponyc-release-0.33.0-musl * +ponyc-nightly-20191116-musl +ponyc-nightly-20191115-musl corral-nightly-20191115 * -- corral-nightly-20191116 changelog-tool-nightly-20191116 changelog-tool-nightly-20191115 * @@ -91,9 +91,9 @@ The `show` command also has an optional `package` argument to show only the inst ```console $ ponyup show ponyc -ponyc-release-0.33.0-gnu * -ponyc-nightly-20191116-gnu -ponyc-nightly-20191115-gnu +ponyc-release-0.33.0-musl * +ponyc-nightly-20191116-musl +ponyc-nightly-20191115-musl ``` ### Select an installed package as default @@ -102,19 +102,19 @@ The `select` command can switch which installed package version to set as defaul ```console $ ponyup show ponyc -ponyc-release-0.33.0-gnu * -ponyc-nightly-20191116-gnu -ponyc-nightly-20191115-gnu +ponyc-release-0.33.0-ubuntu18.04 * +ponyc-nightly-20191116-ubuntu18.04 +ponyc-nightly-20191115-ubuntu18.04 $ ponyc --version 0.33.0-98c36095 [release] compiled with: llvm 7.0.1 -- cc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 Defaults: pic=true $ ponyup select ponyc nightly-20191116 -selecting ponyc-nightly-20191116-gnu as default for ponyc +selecting ponyc-nightly-20191116-ubuntu18.04 as default for ponyc $ ponyup show ponyc -ponyc-release-0.33.0-gnu -ponyc-nightly-20191116-gnu * -ponyc-nightly-20191115-gnu +ponyc-release-0.33.0-ubuntu18.04 +ponyc-nightly-20191116-ubuntu18.04 * +ponyc-nightly-20191115-ubuntu18.04 $ ponyc --version nightly-20191116 [release] compiled with: llvm 7.1.0 -- cc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 @@ -123,7 +123,7 @@ Defaults: pic=true ### Platform options -Ponyup is able to detect the CPU architecture and operating system of the platform on which it is running. The `--platform` option is used to override any field in the platform identifier (e.g. `x86_64-linux-gnu`). +Ponyup is able to detect the CPU architecture and operating system of the platform on which it is running. The `--platform` option is used to override any field in the platform identifier (e.g. `x86_64-linux-ubuntu22.04`). ### Common Issues @@ -133,4 +133,4 @@ Ponyup is able to detect the CPU architecture and operating system of the platfo error: unexpected selection: ponyc-release-x86_64-unknown-linux ``` - This is likely caused by a target triple that does not specify the libc ABI for the platform, as detected by `cc -dumpmachine`. The solution is to manually set the platform identifier using `ponyup default `, where `` is a platform identifier such as `x86_64-linux-gnu`. + This is likely caused by a target triple that does not specify the libc ABI for the platform, as detected by `cc -dumpmachine`. The solution is to manually set the platform identifier using `ponyup default `, where `` is a platform identifier such as `x86_64-linux-ubuntu22.04`. diff --git a/cmd/cli.pony b/cmd/cli.pony index 3ea410e..94bf7e0 100644 --- a/cmd/cli.pony +++ b/cmd/cli.pony @@ -47,7 +47,7 @@ primitive CLI "Install or update a package", [ OptionSpec.string( "platform", - "Specify platform (such as x86_64-linux-gnu)", + "Specify platform (such as x86_64-linux-ubuntu22.04)", None, "") ], @@ -59,7 +59,7 @@ primitive CLI "Select the default version for a package", [ OptionSpec.string( "platform", - "Specify platform (such as x86_64-linux-gnu)", + "Specify platform (such as x86_64-linux-ubuntu22.04)", None, "") ], @@ -68,7 +68,7 @@ primitive CLI ])? CommandSpec.leaf( "default", - "Set the default platform (such as x86_64-linux-gnu)", + "Set the default platform (such as x86_64-linux-ubuntu22.04)", [], [ ArgSpec.string("platform") ])? diff --git a/ponyup-init.sh b/ponyup-init.sh index 6fceffa..4b02e1d 100755 --- a/ponyup-init.sh +++ b/ponyup-init.sh @@ -95,7 +95,36 @@ case "${uname_s}" in Linux*) case $(cc -dumpmachine) in *gnu) - platform_triple_distro="gnu" + case "$(lsb_release -d)" in + *"Ubuntu 22.04"*) + platform_triple_distro="ubuntu_22.04" + ;; + *"Ubuntu 20.04"*) + platform_triple_distro="ubuntu_20.04" + ;; + *"Ubuntu 18.04"*) + platform_triple_distro="ubuntu_18.04" + ;; + *"Linux Mint 21"*) + platform_triple_distro="ubuntu_22.04" + ;; + *"Linux Mint 20"*) + platform_triple_distro="ubuntu_20.04" + ;; + *"Linux Mint 19"*) + platform_triple_distro="ubuntu_18.04" + ;; + *"Pop!_OS 22.04"*) + platform_triple_distro="ubuntu_22.04" + ;; + *"Pop!_OS 20.04"*) + platform_triple_distro="ubuntu_20.04" + ;; + *"Pop!_OS 18.04"*) + platform_triple_distro="ubuntu_18.04" + ;; + *) ;; + esac ;; *musl) platform_triple_distro="musl" @@ -198,29 +227,14 @@ fi case "${uname_s}" in Linux*) if [ "${platform_triple_distro}" = "" ]; then - while true; do - echo "Unable to determine libc type. Please select one of the following:" - echo "1) glibc" - echo "2) musl" - echo "3) cancel" - printf "selection: " - read -r selection - case ${selection} in - 1 | glibc) - platform_triple_distro="gnu" - break - ;; - 2 | musl) - platform_triple_distro="musl" - break - ;; - 3 | cancel) - exit 1 - ;; - *) ;; - esac - done - platform_triple="${platform_triple}-${platform_triple_distro}" + echo "Unable to determine Linux platform type." + echo "Please see to manually https://github.com/ponylang/ponyc/blob/main/INSTALL.md#linux to manually set your platform." + + # set prefix even if we don't know the default platform to set + "${ponyup_root}/bin/ponyup" --prefix="${prefix}" + + # we don't consider this exit to be an error + exit 0 fi esac diff --git a/test/main.pony b/test/main.pony index ff7469c..deb8e4b 100644 --- a/test/main.pony +++ b/test/main.pony @@ -29,10 +29,10 @@ class _TestParsePlatform is UnitTest let tests = [ as (String, ((CPU, OS, Distro) | None)): - ("ponyc-?-?-x86_64-unknown-linux-gnu", (AMD64, Linux, "gnu")) - ("ponyc-?-?-x64-linux-gnu", (AMD64, Linux, "gnu")) + ("ponyc-?-?-x86_64-unknown-linux-ubuntu22.04", (AMD64, Linux, "ubuntu22.04")) + ("ponyc-?-?-x64-linux-ubuntu22.04", (AMD64, Linux, "ubuntu22.04")) ("ponyc-x86_64-pc-linux-ubuntu18.04", (AMD64, Linux, "ubuntu18.04")) - ("?-?-?-amd64-linux-gnu", (AMD64, Linux, None)) + ("?-?-?-amd64-linux-ubuntu22.04", (AMD64, Linux, None)) ("ponyc-?-?-x86_64-alpine-linux-musl", (AMD64, Linux, "musl")) ("?-?-?-x86_64-alpine-linux-musl", (AMD64, Linux, None)) ("ponyc-?-?-x86_64-apple-darwin", (AMD64, Darwin, None)) From a70f99ea31a17b8ed67c801168a127f16af16622 Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Fri, 20 Jan 2023 19:38:08 +0000 Subject: [PATCH 2/7] Add release notes --- .release-notes/245.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.release-notes/245.md b/.release-notes/245.md index e69de29..b4a39d6 100644 --- a/.release-notes/245.md +++ b/.release-notes/245.md @@ -0,0 +1,5 @@ +## Stop installing "generic gnu" ponyc builds + +Previously, on glibc based Linux distributions, the default setup of ponyup would install the "generic gnu" builds of ponyc. These "generic builds" only work on Linux distributions that are library compatible with the build environment. This use of "generic gnu" made it easy to install a ponyc that wouldn't work on the users platform even if we have ponyc builds for said distribution. + +We've stopped using the "generic gnu" builds and instead, on glibc Linux distributions, are using `lsb_release -d` to determine the distribution and if we support the distribution, set up ponyup to install ponyc builds for the distribution in question. If we don't support the distribution or recognize the output of `lsb_release`, an error message is displayed. From ab6bc123bb11b650239f98ae86c88b4187ac550e Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Fri, 20 Jan 2023 19:47:09 +0000 Subject: [PATCH 3/7] Update bootstrap environments --- .ci-dockerfiles/ubuntu18.04-bootstrap-tester/Dockerfile | 1 + .ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile | 5 +++++ .ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile | 1 + .github/workflows/pr.yml | 6 +++--- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.ci-dockerfiles/ubuntu18.04-bootstrap-tester/Dockerfile b/.ci-dockerfiles/ubuntu18.04-bootstrap-tester/Dockerfile index ab48480..a842e18 100644 --- a/.ci-dockerfiles/ubuntu18.04-bootstrap-tester/Dockerfile +++ b/.ci-dockerfiles/ubuntu18.04-bootstrap-tester/Dockerfile @@ -7,5 +7,6 @@ RUN apt-get update \ curl \ git \ libssl-dev \ + lsb-core \ make \ && rm -rf /var/lib/apt/lists/* diff --git a/.ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile b/.ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile index 33df894..139d135 100644 --- a/.ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile +++ b/.ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile @@ -1,5 +1,9 @@ FROM ubuntu:20.04 +# Keep annoying tzdata prompt from coming up +ENV DEBIAN_FRONTEND noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN true + RUN apt-get update \ && apt-get install -y --no-install-recommends \ ca-certificates \ @@ -7,5 +11,6 @@ RUN apt-get update \ curl \ git \ libssl-dev \ + lsb-core \ make \ && rm -rf /var/lib/apt/lists/* diff --git a/.ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile b/.ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile index 1cb02f0..514f624 100644 --- a/.ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile +++ b/.ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile @@ -7,5 +7,6 @@ RUN apt-get update \ curl \ git \ libssl-dev \ + lsb-core \ make \ && rm -rf /var/lib/apt/lists/* diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index fd6ae08..e01e21e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -60,7 +60,7 @@ jobs: name: Test bootstrapping on Ubuntu 20.04 runs-on: ubuntu-latest container: - image: ponylang/ponyup-ci-ubuntu20.04-bootstrap-tester:20210414 + image: ponylang/ponyup-ci-ubuntu20.04-bootstrap-tester:20230120 steps: - uses: actions/checkout@v2 - name: Bootstrap test @@ -70,7 +70,7 @@ jobs: name: Test bootstrapping on Ubuntu 22.04 runs-on: ubuntu-latest container: - image: ponylang/ponyup-ci-ubuntu22.04-bootstrap-tester:20230103 + image: ponylang/ponyup-ci-ubuntu22.04-bootstrap-tester:20230120 steps: - uses: actions/checkout@v2 - name: Bootstrap test @@ -80,7 +80,7 @@ jobs: name: Test bootstrapping on Ubuntu 18.04 runs-on: ubuntu-latest container: - image: ponylang/ponyup-ci-ubuntu18.04-bootstrap-tester:20200901 + image: ponylang/ponyup-ci-ubuntu18.04-bootstrap-tester:20230120 steps: - uses: actions/checkout@v2 - name: Bootstrap test From 374fd7668af677a752a15bec2539d0a39d33ad1b Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Fri, 20 Jan 2023 19:51:54 +0000 Subject: [PATCH 4/7] Git fuckery --- .ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile | 2 ++ .ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile b/.ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile index 139d135..e531f36 100644 --- a/.ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile +++ b/.ci-dockerfiles/ubuntu20.04-bootstrap-tester/Dockerfile @@ -14,3 +14,5 @@ RUN apt-get update \ lsb-core \ make \ && rm -rf /var/lib/apt/lists/* + +RUN git config --global --add safe.directory /__w/ponyup/ponyup diff --git a/.ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile b/.ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile index 514f624..03f1ad3 100644 --- a/.ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile +++ b/.ci-dockerfiles/ubuntu22.04-bootstrap-tester/Dockerfile @@ -10,3 +10,5 @@ RUN apt-get update \ lsb-core \ make \ && rm -rf /var/lib/apt/lists/* + +RUN git config --global --add safe.directory /__w/ponyup/ponyup From 698bd5d5a93716171d86d4cf60cd7a8ea538762b Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Fri, 20 Jan 2023 19:53:01 +0000 Subject: [PATCH 5/7] Fix target distro --- ponyup-init.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ponyup-init.sh b/ponyup-init.sh index 4b02e1d..a42ed6e 100755 --- a/ponyup-init.sh +++ b/ponyup-init.sh @@ -97,31 +97,31 @@ Linux*) *gnu) case "$(lsb_release -d)" in *"Ubuntu 22.04"*) - platform_triple_distro="ubuntu_22.04" + platform_triple_distro="ubuntu22.04" ;; *"Ubuntu 20.04"*) - platform_triple_distro="ubuntu_20.04" + platform_triple_distro="ubuntu20.04" ;; *"Ubuntu 18.04"*) - platform_triple_distro="ubuntu_18.04" + platform_triple_distro="ubuntu18.04" ;; *"Linux Mint 21"*) - platform_triple_distro="ubuntu_22.04" + platform_triple_distro="ubuntu22.04" ;; *"Linux Mint 20"*) - platform_triple_distro="ubuntu_20.04" + platform_triple_distro="ubuntu20.04" ;; *"Linux Mint 19"*) - platform_triple_distro="ubuntu_18.04" + platform_triple_distro="ubuntu18.04" ;; *"Pop!_OS 22.04"*) - platform_triple_distro="ubuntu_22.04" + platform_triple_distro="ubuntu22.04" ;; *"Pop!_OS 20.04"*) - platform_triple_distro="ubuntu_20.04" + platform_triple_distro="ubuntu20.04" ;; *"Pop!_OS 18.04"*) - platform_triple_distro="ubuntu_18.04" + platform_triple_distro="ubuntu18.04" ;; *) ;; esac From 0563da4e2fad887d17bc9ba2985172b2018f4e30 Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Fri, 20 Jan 2023 19:54:46 +0000 Subject: [PATCH 6/7] Fix typo in error message --- ponyup-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ponyup-init.sh b/ponyup-init.sh index a42ed6e..b2f6850 100755 --- a/ponyup-init.sh +++ b/ponyup-init.sh @@ -228,7 +228,7 @@ case "${uname_s}" in Linux*) if [ "${platform_triple_distro}" = "" ]; then echo "Unable to determine Linux platform type." - echo "Please see to manually https://github.com/ponylang/ponyc/blob/main/INSTALL.md#linux to manually set your platform." + echo "Please see https://github.com/ponylang/ponyc/blob/main/INSTALL.md#linux to manually set your platform." # set prefix even if we don't know the default platform to set "${ponyup_root}/bin/ponyup" --prefix="${prefix}" From aaef2a7fed4b10827cbc229dc95a4f0b9a5bf76e Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Fri, 20 Jan 2023 19:58:17 +0000 Subject: [PATCH 7/7] printf for color! --- ponyup-init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ponyup-init.sh b/ponyup-init.sh index b2f6850..b932d61 100755 --- a/ponyup-init.sh +++ b/ponyup-init.sh @@ -227,8 +227,8 @@ fi case "${uname_s}" in Linux*) if [ "${platform_triple_distro}" = "" ]; then - echo "Unable to determine Linux platform type." - echo "Please see https://github.com/ponylang/ponyc/blob/main/INSTALL.md#linux to manually set your platform." + printf "%bUnable to determine Linux platform type.%b\n" "${YELLOW}" "${DEFAULT}" + printf "%bPlease see https://github.com/ponylang/ponyc/blob/main/INSTALL.md#linux to manually set your platform.%b\n" "${YELLOW}" "${DEFAULT}" # set prefix even if we don't know the default platform to set "${ponyup_root}/bin/ponyup" --prefix="${prefix}"