From a01756fd3e4885f8d5cb3acf3e868c920f925b3d Mon Sep 17 00:00:00 2001 From: gbarc80 Date: Mon, 14 Feb 2022 14:45:05 +0100 Subject: [PATCH 1/5] sync with tci master --- lib/travis/build/addons/rethinkdb.rb | 4 ++-- public/version-aliases/ghc.json | 27 ++++++++++++++++++++------- spec/build/addons/rethinkdb_spec.rb | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/travis/build/addons/rethinkdb.rb b/lib/travis/build/addons/rethinkdb.rb index fb8b5892a9..3537b7dee2 100644 --- a/lib/travis/build/addons/rethinkdb.rb +++ b/lib/travis/build/addons/rethinkdb.rb @@ -15,8 +15,8 @@ def after_prepare sh.else do sh.echo "Installing RethinkDB version #{rethinkdb_version}", ansi: :yellow sh.cmd "service rethinkdb stop", sudo: true - sh.cmd "sudo apt-key adv --keyserver keys.gnupg.net --recv-keys \"539A 3A8C 6692 E6E3 F69B 3FE8 1D85 E93F 801B B43F\"", echo: true - sh.cmd 'echo -e "\ndeb https://download.rethinkdb.com/repository/ubuntu-$(lsb_release -cs)/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list > /dev/null' + sh.cmd "sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys \"539A 3A8C 6692 E6E3 F69B 3FE8 1D85 E93F 801B B43F\"", echo: true + sh.cmd 'echo -e "\ndeb https://download.rethinkdb.com/repository/ubuntu-$(lsb_release -cs)/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/rethinkdb.list > /dev/null' sh.cmd 'travis_apt_get_update', assert: false sh.cmd "package_version=`apt-cache show rethinkdb | grep -F \"Version: #{rethinkdb_version}\" | sort -r | head -n 1 | awk '{printf $2}'`" sh.cmd "apt-get install -y -o Dpkg::Options::='--force-confnew' rethinkdb=$package_version", sudo: true, echo: true, timing: true diff --git a/public/version-aliases/ghc.json b/public/version-aliases/ghc.json index 7f14e208d2..92e0b94ef1 100644 --- a/public/version-aliases/ghc.json +++ b/public/version-aliases/ghc.json @@ -115,9 +115,9 @@ "7.10.2": "7.10.2", "7.10.3": "7.10.3", "8.0.1": "8.0.1", - "8": "8.10.3", - "8.x": "8.10.3", - "8.x.x": "8.10.3", + "8": "8.10.7", + "8.x": "8.10.7", + "8.x.x": "8.10.7", "8.0.x": "8.0.2", "8.0": "8.0.2", "8.0.2": "8.0.2", @@ -153,12 +153,25 @@ "8.8.3": "8.8.3", "8.8.4": "8.8.4", "8.10.1-alpha1": "8.10.1-alpha1", - "8.10": "8.10.3", + "8.10": "8.10.7", "8.10.1-alpha2": "8.10.1-alpha2", "8.10.1": "8.10.1", - "8.10.x": "8.10.3", + "8.10.x": "8.10.7", "8.10.2": "8.10.2", "8.10.3": "8.10.3", + "8.10.4": "8.10.4", + "8.10.5": "8.10.5", + "8.10.6": "8.10.6", + "8.10.7": "8.10.7", "9.0.1-alpha1": "9.0.1-alpha1", - "9.0": "9.0.1-alpha1" -} \ No newline at end of file + "9.0": "9.0.1", + "9.0.1": "9.0.1", + "9": "9.0.1", + "9.x": "9.0.1", + "9.x.x": "9.0.1", + "9.0.x": "9.0.1", + "9.2.1-alpha1": "9.2.1-alpha1", + "9.2": "9.2.1-alpha2", + "9.2.1-alpha2": "9.2.1-alpha2" + +} diff --git a/spec/build/addons/rethinkdb_spec.rb b/spec/build/addons/rethinkdb_spec.rb index 673cc79e06..eecd372793 100644 --- a/spec/build/addons/rethinkdb_spec.rb +++ b/spec/build/addons/rethinkdb_spec.rb @@ -24,7 +24,7 @@ end it { should include_sexp [:cmd, "service rethinkdb stop", sudo: true] } - it { should include_sexp [:cmd, "sudo apt-key adv --keyserver keys.gnupg.net --recv-keys \"539A 3A8C 6692 E6E3 F69B 3FE8 1D85 E93F 801B B43F\"", echo: true] } + it { should include_sexp [:cmd, "sudo apt-key adv --keyserver pgp.mit.edu --recv-keys \"539A 3A8C 6692 E6E3 F69B 3FE8 1D85 E93F 801B B43F\"", echo: true] } it { should include_sexp [:cmd, 'echo -e "\ndeb https://download.rethinkdb.com/repository/ubuntu-$(lsb_release -cs)/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list > /dev/null'] } it { should include_sexp [:cmd, 'travis_apt_get_update'] } it { should include_sexp [:cmd, "apt-get install -y -o Dpkg::Options::='--force-confnew' rethinkdb=$package_version", sudo: true, echo: true, timing: true] } From 5e3212b1bb98960a7369680dbe943636b95b8d07 Mon Sep 17 00:00:00 2001 From: gbarc80 Date: Mon, 14 Feb 2022 14:58:27 +0100 Subject: [PATCH 2/5] rhel8 changes --- lib/travis/build/addons/yum.rb | 68 +++++++++++++++++++ .../build/appliances/disable_initramfs.rb | 2 +- .../build/bash/travis_setup_postgresql.bash | 3 + lib/travis/build/errors.rb | 11 +++ .../shared/appliances/disable_initramfs.rb | 2 +- 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 lib/travis/build/addons/yum.rb diff --git a/lib/travis/build/addons/yum.rb b/lib/travis/build/addons/yum.rb new file mode 100644 index 0000000000..7d48e4a9ef --- /dev/null +++ b/lib/travis/build/addons/yum.rb @@ -0,0 +1,68 @@ +require 'travis/build/addons/base' +require 'shellwords' + +module Travis + module Build + class Addons + class Yum < Base + SUPPORTED_OPERATING_SYSTEMS = %w[ + linux + /^linux.*/ + ].freeze + + SUPPORTED_DISTS = %w( + rhel + ).freeze + + def before_prepare? + SUPPORTED_OPERATING_SYSTEMS.any? do |os_match| + data[:config][:os].to_s == os_match + end + end + + def before_prepare + return if config_yum.empty? + sh.newline + sh.fold('yum') do + install_yum + end + sh.newline + end + + def before_configure? + config + end + + def before_configure + sh.echo "Configuring default yum options", ansi: :yellow + tmp_dest = "${TRAVIS_TMPDIR}/99-travis-yum-conf" + sh.file tmp_dest, <<~YUM_CONF + assumeyes=1 + retries=5 + timeout=30 + YUM_CONF + sh.cmd %Q{su -m root -c "mv #{tmp_dest} ${TRAVIS_ROOT}/usr/local/etc/yum.conf"} + end + + def config + @config ||= Hash(super) + end + + def install_yum + sh.echo "Installing #{config_yum.count} packages", ansi: :yellow + + packages = config_yum.map{|v| Shellwords.escape(v)}.join(' ') + sh.cmd "su -m root -c 'yum install -y #{packages}'", echo: true, timing: true, assert: true + end + + def config_yum + @config_yum ||= Array(config[:packages]).flatten.compact + rescue TypeError => e + if e.message =~ /no implicit conversion of Symbol into Integer/ + raise Travis::Build::YumConfigError.new + end + end + end + end + end +end diff --git a/lib/travis/build/appliances/disable_initramfs.rb b/lib/travis/build/appliances/disable_initramfs.rb index f186f8c55b..7f25dc63ca 100644 --- a/lib/travis/build/appliances/disable_initramfs.rb +++ b/lib/travis/build/appliances/disable_initramfs.rb @@ -5,7 +5,7 @@ module Build module Appliances class DisableInitramfs < Base def apply - sh.raw "if [ ! $(uname|egrep 'Darwin|FreeBSD') ]; then echo update_initramfs=no | sudo tee -a /etc/initramfs-tools/update-initramfs.conf > /dev/null; fi" + sh.raw "if [[ ! $(uname|egrep 'Darwin|FreeBSD') && ! -f /etc/redhat-release ]]; then echo update_initramfs=no | sudo tee -a /etc/initramfs-tools/update-initramfs.conf > /dev/null; fi" end end end diff --git a/lib/travis/build/bash/travis_setup_postgresql.bash b/lib/travis/build/bash/travis_setup_postgresql.bash index ebe59f6bed..876cf679b3 100644 --- a/lib/travis/build/bash/travis_setup_postgresql.bash +++ b/lib/travis/build/bash/travis_setup_postgresql.bash @@ -19,6 +19,9 @@ travis_setup_postgresql() { focal) version='12' ;; + rhel8) + version='12' + ;; *) echo -e "${ANSI_RED}Unrecognized operating system.${ANSI_CLEAR}" ;; diff --git a/lib/travis/build/errors.rb b/lib/travis/build/errors.rb index 970230581f..e419d9ab3e 100644 --- a/lib/travis/build/errors.rb +++ b/lib/travis/build/errors.rb @@ -81,6 +81,17 @@ def doc_path '/user/installing-dependencies' end end + + + class YumConfigError < CompilationError + def initialize(msg = "\\`yum\\` should be a list.") + super + end + + def doc_path + '/user/installing-dependencies' + end + end class GithubAppsTokenFetchError < CompilationError def initialize(msg = "Unable to fetch GitHub Apps Token. GitHub may be unavailable. " \ diff --git a/spec/build/script/shared/appliances/disable_initramfs.rb b/spec/build/script/shared/appliances/disable_initramfs.rb index 18a31d54de..952a6be978 100644 --- a/spec/build/script/shared/appliances/disable_initramfs.rb +++ b/spec/build/script/shared/appliances/disable_initramfs.rb @@ -1,5 +1,5 @@ shared_examples_for 'disables updating initramfs' do - let(:disable_initramfs) { %(if [ ! $(uname|egrep 'Darwin|FreeBSD') ]; then echo update_initramfs=no | sudo tee -a /etc/initramfs-tools/update-initramfs.conf > /dev/null; fi) } + let(:disable_initramfs) { %(if [[ ! $(uname|egrep 'Darwin|FreeBSD') && ! -f /etc/redhat-release ]]; then echo update_initramfs=no | sudo tee -a /etc/initramfs-tools/update-initramfs.conf > /dev/null; fi) } it 'disables updating initramfs' do should include_sexp [:raw, disable_initramfs] From 196353397060ec57f6f8cec359bf1446f60104dd Mon Sep 17 00:00:00 2001 From: gabriel-arc Date: Wed, 6 Apr 2022 12:07:28 +0200 Subject: [PATCH 3/5] some fixes with yum packages --- lib/travis/build/addons.rb | 1 + lib/travis/build/addons/yum.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/travis/build/addons.rb b/lib/travis/build/addons.rb index 80f4c2069b..89e3e8acd2 100644 --- a/lib/travis/build/addons.rb +++ b/lib/travis/build/addons.rb @@ -2,6 +2,7 @@ require 'travis/build/addons/apt' require 'travis/build/addons/apt_packages' require 'travis/build/addons/apt_retries' +require 'travis/build/addons/yum' require 'travis/build/addons/snaps' require 'travis/build/addons/artifacts' require 'travis/build/addons/chrome' diff --git a/lib/travis/build/addons/yum.rb b/lib/travis/build/addons/yum.rb index 7d48e4a9ef..9f1d91f905 100644 --- a/lib/travis/build/addons/yum.rb +++ b/lib/travis/build/addons/yum.rb @@ -41,7 +41,7 @@ def before_configure retries=5 timeout=30 YUM_CONF - sh.cmd %Q{su -m root -c "mv #{tmp_dest} ${TRAVIS_ROOT}/usr/local/etc/yum.conf"} + sh.cmd %Q{sudo mv #{tmp_dest} ${TRAVIS_ROOT}/usr/local/etc/yum.conf} end def config @@ -52,7 +52,7 @@ def install_yum sh.echo "Installing #{config_yum.count} packages", ansi: :yellow packages = config_yum.map{|v| Shellwords.escape(v)}.join(' ') - sh.cmd "su -m root -c 'yum install -y #{packages}'", echo: true, timing: true, assert: true + sh.cmd "sudo yum install -y #{packages}", echo: true, timing: true, assert: true end def config_yum From 1c624d040e5bb9c53602f76cc4a1b880077780c9 Mon Sep 17 00:00:00 2001 From: gabriel-arc Date: Thu, 20 Oct 2022 15:35:54 +0200 Subject: [PATCH 4/5] corrected postgres setup on rhel8 --- lib/travis/build/bash/travis_setup_postgresql.bash | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/travis/build/bash/travis_setup_postgresql.bash b/lib/travis/build/bash/travis_setup_postgresql.bash index 96538c9b18..f8ced62e84 100644 --- a/lib/travis/build/bash/travis_setup_postgresql.bash +++ b/lib/travis/build/bash/travis_setup_postgresql.bash @@ -19,13 +19,14 @@ travis_setup_postgresql() { focal) version='12' ;; - rhel8) + Ootpa) version='12' + ;; jammy) version='14' ;; *) - echo -e "${ANSI_RED}Unrecognized operating system.${ANSI_CLEAR}" + echo -e "${ANSI_RED}Unrecognized operating system ${TRAVIS_DIST}.${ANSI_CLEAR}" ;; esac fi @@ -36,6 +37,9 @@ travis_setup_postgresql() { if [[ "${TRAVIS_INIT}" == upstart ]]; then start_cmd="sudo service postgresql start ${version}" stop_cmd="sudo service postgresql stop" + elif [[ "${TRAVIS_DIST}" == Ootpa ]]; then + start_cmd="sudo systemctl start postgresql-${version}" + stop_cmd="sudo systemctl stop postgresql" elif [[ "${TRAVIS_INIT}" == systemd ]]; then start_cmd="sudo systemctl start postgresql@${version}-main" stop_cmd="sudo systemctl stop postgresql" From c876f35317620fe9d9ff500ad680b658257fddca Mon Sep 17 00:00:00 2001 From: gabriel-arc Date: Wed, 30 Nov 2022 07:51:43 +0100 Subject: [PATCH 5/5] enalei386 redhat rel fix --- lib/travis/build/appliances/enable_i386.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/travis/build/appliances/enable_i386.rb b/lib/travis/build/appliances/enable_i386.rb index 2ecfecb2aa..aff12329f7 100644 --- a/lib/travis/build/appliances/enable_i386.rb +++ b/lib/travis/build/appliances/enable_i386.rb @@ -5,7 +5,7 @@ module Build module Appliances class EnableI386 < Base def apply - sh.if "$(uname -m) == x86_64 && $(command -v lsb_release) && $(lsb_release -cs) != precise" do + sh.if "$(uname -m) == x86_64 && $(command -v lsb_release) && $(lsb_release -cs) != precise && $(lsb_release -cs) != Ootpa" do sh.cmd 'dpkg --add-architecture i386', echo: false, assert: false, sudo: true end end