From 1bbe56f6c4fd628944d0d8402938c0221f307f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 7 Jun 2021 22:50:49 +0200 Subject: [PATCH 01/35] add step that changes gentoo overlay from using rsync to git --- .../compatibility_layer/tasks/add_overlay.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 28a81364..e6f69337 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -58,6 +58,28 @@ selectattr('eclass-overrides', 'equalto', True) | map(attribute='name') | join(' ') }} +- name: Use git instead of rsync for the Gentoo overlay + copy: + dest: "{{ gentoo_prefix_path }}/etc/portage/repos.conf/gentoo.conf" + mode: "0644" + content: | + [DEFAULT] + main-repo = gentoo + sync-git-pull-extra-opts = --quiet + + [gentoo] + priority = 1 + location = {{ gentoo_prefix_path }}/var/db/repos/gentoo + sync-uri = https://github.com/gentoo/gentoo.git + sync-type = git + auto-sync = Yes + clone-depth = 1 + +- name: Remove the old contents of the Gentoo overlay + file: + state: absent + path: "{{ gentoo_prefix_path }}/var/db/repos/gentoo" + - name: Sync the repositories portage: sync: 'yes' From 9baff727e677a1fab73d88312c76f48223d97109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 13:58:57 +0200 Subject: [PATCH 02/35] use latest version of gentoo prefix bootstrap script --- bootstrap-prefix.sh | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/bootstrap-prefix.sh b/bootstrap-prefix.sh index 26ea17fd..d7204e6a 100755 --- a/bootstrap-prefix.sh +++ b/bootstrap-prefix.sh @@ -282,7 +282,7 @@ configure_toolchain() { ;; esac - return + return 0 } bootstrap_setup() { @@ -450,6 +450,12 @@ bootstrap_setup() { ACCEPT_KEYWORDS="~${ARCH}-linux" EOF + # bug #788613 avoid gcc-11 during stage 2/3 prior sync/emerge -e + is-rap && cat >> "${ROOT}"/etc/portage/make.profile/package.mask <<-EOF + # during bootstrap mask, bug #788613 + >=sys-devel/gcc-11 + EOF + # Use package.use to disable in the portage tree to be shared between # stage2 and stage3. The hack will be undone during tree sync in stage3. cat >> "${ROOT}"/etc/portage/make.profile/package.use <<-EOF @@ -1355,8 +1361,8 @@ bootstrap_libressl() { bootstrap_stage_host_gentoo() { if ! is-rap ; then - einfo "Shortcut only supports prefix-standalone, but we are bootstrapping" - einfo "prefix-rpath. Do nothing." + einfo "Shortcut only supports prefix-standalone, but we " + einfo "are bootstrapping prefix-rpath. Do nothing." return 0 fi @@ -1447,6 +1453,7 @@ bootstrap_stage1() { # we're working with now, bug #650284 [[ -x ${ROOT}/tmp/usr/bin/bash ]] \ || (bootstrap_bash) || return 1 + # Some host tools need to be wrapped to be useful for us. # We put them in tmp/usr/local/bin, to not accidentally # be identified as stage1-installed like in bug #615410. @@ -1475,10 +1482,14 @@ bootstrap_stage1() { # We need to direct the system gcc to find the system binutils. cat >> "${ROOT}"/tmp/usr/local/bin/gcc <<-EOF #! /bin/sh - PATH="${STAGE1_PATH}" export PATH - exec "\${0##*/}" "\$@" + PATH="${ORIGINAL_PATH}" export PATH + exec "$(type -P gcc)" "\$@" + EOF + cat >> "${ROOT}"/tmp/usr/local/bin/g++ <<-EOF + #! /bin/sh + PATH="${ORIGINAL_PATH}" export PATH + exec "$(type -P g++)" "\$@" EOF - cp "${ROOT}"/tmp/usr/local/bin/g{cc,++} chmod 755 "${ROOT}"/tmp/usr/local/bin/g{cc,++} fi ;; @@ -1905,7 +1916,11 @@ bootstrap_stage3() { } # pre_emerge_pkgs relies on stage 2 portage. - pre_emerge_pkgs() { is-rap && without_stack_emerge_pkgs "$@" || with_stack_emerge_pkgs "$@"; } + pre_emerge_pkgs() { + is-rap \ + && without_stack_emerge_pkgs "$@" \ + || with_stack_emerge_pkgs "$@" + } # Some packages fail to properly depend on sys-apps/texinfo. # We don't really need that package, so we fake it instead, @@ -2768,7 +2783,6 @@ EOF # location seems ok break done - export STAGE1_PATH=${PATH} export PATH="$EPREFIX/usr/bin:$EPREFIX/bin:$EPREFIX/tmp/usr/bin:$EPREFIX/tmp/bin:$EPREFIX/tmp/usr/local/bin:${PATH}" cat << EOF @@ -3078,9 +3092,6 @@ case ${CHOST} in powerpc-*darwin*) DARWIN_USE_GCC=1 # must use GCC, Clang is impossible ;; -# arm64-*darwin*) -# DARWIN_USE_GCC=0 # cannot use GCC yet (needs silicon support) -# ;; *-darwin*) # normalise value of DARWIN_USE_GCC case ${DARWIN_USE_GCC} in @@ -3116,6 +3127,9 @@ case ${CHOST}:${LC_ALL}:${LANG} in ;; esac +# save original path, need this before interactive, #788334 +ORIGINAL_PATH="${PATH}" + # Just guessing a prefix is kind of scary. Hence, to make it a bit less # scary, we force the user to give the prefix location here. This also # makes the script a bit less dangerous as it will die when just run to From 68c88d71cf601daf86c9092d7de321e58a34d85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 14:12:02 +0200 Subject: [PATCH 03/35] bump version to 2021.06 --- ansible/playbooks/roles/compatibility_layer/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml index 4b32a311..b92e595b 100644 --- a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml @@ -1,6 +1,6 @@ # Defaults file for the compatibility layer role. --- -eessi_version: "2021.03" +eessi_version: "2021.06" custom_overlays: - name: eessi From 122022d3f3d6af13504409323e0f73741adf72fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 14:16:06 +0200 Subject: [PATCH 04/35] change snapshot host url, bump snapshot version --- ansible/playbooks/roles/compatibility_layer/defaults/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml index b92e595b..922029b7 100644 --- a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml @@ -17,8 +17,8 @@ gentoo_prefix_path: /cvmfs/{{ cvmfs_repository }}/{{ eessi_version }}/compat/{{ # How to build the prefix prefix_required_space: 15 GB -prefix_snapshot_url: http://cvmfs-s0.eessi-hpc.org/snapshots -prefix_snapshot_version: 20210322 +prefix_snapshot_url: https://eessi-gentoo-snapshot.s3-eu-west-1.amazonaws.com +prefix_snapshot_version: 20210607 prefix_python_targets: python3_8 prefix_user_defined_trusted_dirs: - "/cvmfs/{{ cvmfs_repository }}/host_injections/{{ eessi_version }}/compat/{{ eessi_host_os }}/{{ eessi_host_arch }}/lib" From a1c31829ff171f96eb8311f35eeb951d4554f56c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 17:13:52 +0200 Subject: [PATCH 05/35] add step for generating post-sync hooks --- .../roles/compatibility_layer/tasks/add_overlay.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index e6f69337..363a1a4d 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -75,6 +75,18 @@ auto-sync = Yes clone-depth = 1 +- name: Add post-sync hooks for Gentoo overlay + template: + src: "{{ item }}.j2" + dest: "{{ gentoo_prefix_path }}/etc/portage/repo.postsync.d/{{ item }}" + with_items: + - sync_gentoo_cache + - sync_gentoo_dtd + - sync_gentoo_glsa + - sync_gentoo_news + - sync_gentoo_projects_xml + - sync_overlay_cache + - name: Remove the old contents of the Gentoo overlay file: state: absent From 6f2ff40cb00e028508cedd92880731f27c1dc85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 17:15:41 +0200 Subject: [PATCH 06/35] extra step for creating postsync dir --- .../roles/compatibility_layer/tasks/add_overlay.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 363a1a4d..7ae73129 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -75,6 +75,12 @@ auto-sync = Yes clone-depth = 1 +- name: Create repo.postsync.d directory + file: + path: "{{ gentoo_prefix_path }}/etc/portage/repo.postsync.d" + state: directory + mode: '0755' + - name: Add post-sync hooks for Gentoo overlay template: src: "{{ item }}.j2" From bf7c37c9f698a7a8686d6b6f64c58b6ed1101cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 17:16:40 +0200 Subject: [PATCH 07/35] rename step --- .../playbooks/roles/compatibility_layer/tasks/add_overlay.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 7ae73129..cae02a86 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -93,7 +93,7 @@ - sync_gentoo_projects_xml - sync_overlay_cache -- name: Remove the old contents of the Gentoo overlay +- name: Remove the old Gentoo overlay directory file: state: absent path: "{{ gentoo_prefix_path }}/var/db/repos/gentoo" From 66482ca5fdaaabebbd74a3c6ab3cf702f6b63ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 17:23:23 +0200 Subject: [PATCH 08/35] add mode for template task --- .../roles/compatibility_layer/tasks/add_overlay.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index cae02a86..14fdb6ea 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -66,7 +66,7 @@ [DEFAULT] main-repo = gentoo sync-git-pull-extra-opts = --quiet - + [gentoo] priority = 1 location = {{ gentoo_prefix_path }}/var/db/repos/gentoo @@ -85,13 +85,14 @@ template: src: "{{ item }}.j2" dest: "{{ gentoo_prefix_path }}/etc/portage/repo.postsync.d/{{ item }}" + mode: 0755 with_items: - sync_gentoo_cache - sync_gentoo_dtd - sync_gentoo_glsa - sync_gentoo_news - - sync_gentoo_projects_xml - - sync_overlay_cache + #- sync_gentoo_projects_xml + #- sync_overlay_cache - name: Remove the old Gentoo overlay directory file: From fd52eb74ebc5bb4d456fcbf8ac9c2243254396ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 17:33:24 +0200 Subject: [PATCH 09/35] also generate metadata for custom overlays --- .../playbooks/roles/compatibility_layer/tasks/add_overlay.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 14fdb6ea..534be4d7 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -91,8 +91,8 @@ - sync_gentoo_dtd - sync_gentoo_glsa - sync_gentoo_news - #- sync_gentoo_projects_xml - #- sync_overlay_cache + - sync_gentoo_projects_xml + - sync_overlay_cache - name: Remove the old Gentoo overlay directory file: From d98d6ed6d9f22db0a639c62f49aa1e2f3211b7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 17:36:46 +0200 Subject: [PATCH 10/35] add postsync scripts --- .../templates/sync_gentoo_cache.j2 | 34 +++++++++++++++++++ .../templates/sync_gentoo_dtd.j2 | 17 ++++++++++ .../templates/sync_gentoo_glsa.j2 | 17 ++++++++++ .../templates/sync_gentoo_news.j2 | 17 ++++++++++ .../templates/sync_overlay_cache.j2 | 14 ++++++++ 5 files changed, 99 insertions(+) create mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_cache.j2 create mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_dtd.j2 create mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_glsa.j2 create mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_news.j2 create mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_overlay_cache.j2 diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_cache.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_cache.j2 new file mode 100755 index 00000000..f1f572d2 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_cache.j2 @@ -0,0 +1,34 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh + +# Number of jobs for egencache, default is number or processors. +parallel_jobs="$(nproc)" + +if [[ -f ${repository_path}/metadata/timestamp.x ]]; then + portage_current_timestamp=$(cut -f 1 -d " " "${repository_path}/metadata/timestamp.x" ) +else + portage_current_timestamp=0 +fi + +ebegin "Fetching metadata timestamp for ${repository_name}" +rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/timestamp.x "${repository_path}"/metadata/timestamp.x +eend $? +portage_new_timestamp=$(cut -f 1 -d " " "${repository_path}/metadata/timestamp.x" ) + +if [[ ${portage_current_timestamp} -lt ${portage_new_timestamp} ]]; then + ebegin "Fetching pre-generated metadata cache for ${repository_name}" + rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/md5-cache/ "${repository_path}"/metadata/md5-cache/ + eend $? +else + einfo "Metadata cache for ${repository_name} already recent, no need to fetch it :-)" +fi + +ebegin "Updating metadata cache for ${repository_name}" +egencache --jobs="${parallel_jobs}" --repo="${repository_name}" --update --update-use-local-desc +eend $? diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_dtd.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_dtd.j2 new file mode 100755 index 00000000..81d8ff0f --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_dtd.j2 @@ -0,0 +1,17 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh + +DTDDIR="${repository_path}"/metadata/dtd +ebegin "Updating DTDs" +if [[ -e ${DTDDIR} ]]; then + git -C "${DTDDIR}" pull -q --ff-only +else + git clone -q https://anongit.gentoo.org/git/data/dtd.git "${DTDDIR}" +fi +eend "$?" diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_glsa.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_glsa.j2 new file mode 100755 index 00000000..220e3aea --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_glsa.j2 @@ -0,0 +1,17 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh + +GLSADIR="${repository_path}"/metadata/glsa +ebegin "Updating GLSAs" +if [[ -e ${GLSADIR} ]]; then + git -C "${GLSADIR}" pull -q --ff-only +else + git clone -q https://anongit.gentoo.org/git/data/glsa.git "${GLSADIR}" +fi +eend "$?" diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_news.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_news.j2 new file mode 100755 index 00000000..dbab56ca --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_news.j2 @@ -0,0 +1,17 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh + +NEWSDIR="${repository_path}"/metadata/news +ebegin "Updating news items" +if [[ -e ${NEWSDIR} ]]; then + git -C "${NEWSDIR}" pull -q --ff-only +else + git clone -q https://anongit.gentoo.org/git/data/gentoo-news.git "${NEWSDIR}" +fi +eend $? "Try to remove ${NEWSDIR}" diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_overlay_cache.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_overlay_cache.j2 new file mode 100755 index 00000000..e373c810 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/templates/sync_overlay_cache.j2 @@ -0,0 +1,14 @@ +#!/bin/bash + +repository_name="${1}" + +[[ ${repository_name} == "gentoo" ]] && exit 0 + +source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh + +# Number of jobs for egencache, default is number or processors. +parallel_jobs="$(nproc)" + +ebegin "Updating metadata cache for ${repository_name}" +egencache --jobs="${parallel_jobs}" --repo="${repository_name}" --update --update-use-local-desc +eend $? From e433003bd98541b677f049ca1452c167f84335fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 17:38:50 +0200 Subject: [PATCH 11/35] add other script, which we won't use for now --- .../templates/sync_gentoo_projects_xml.j2 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_projects_xml.j2 diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_projects_xml.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_projects_xml.j2 new file mode 100644 index 00000000..07067e5b --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_projects_xml.j2 @@ -0,0 +1,12 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh + +ebegin "Updating projects.xml" +wget -q -P "${repository_path}"/metadata/ -N https://api.gentoo.org/metastructure/projects.xml +eend $? From 2f1b85e1339058438ef78f49ad9fa221e2f0a31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 9 Jun 2021 17:39:25 +0200 Subject: [PATCH 12/35] dont run sync_gentoo_projects_xml for now --- .../playbooks/roles/compatibility_layer/tasks/add_overlay.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 534be4d7..aabc0f90 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -91,8 +91,8 @@ - sync_gentoo_dtd - sync_gentoo_glsa - sync_gentoo_news - - sync_gentoo_projects_xml - sync_overlay_cache + #- sync_gentoo_projects_xml - name: Remove the old Gentoo overlay directory file: From 1a3448867e0c580cb20a48770aa62722cf3c581b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 10 Jun 2021 00:12:46 +0200 Subject: [PATCH 13/35] bump python to 3.9 --- ansible/playbooks/roles/compatibility_layer/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml index 922029b7..4b0528c6 100644 --- a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml @@ -19,7 +19,7 @@ gentoo_prefix_path: /cvmfs/{{ cvmfs_repository }}/{{ eessi_version }}/compat/{{ prefix_required_space: 15 GB prefix_snapshot_url: https://eessi-gentoo-snapshot.s3-eu-west-1.amazonaws.com prefix_snapshot_version: 20210607 -prefix_python_targets: python3_8 +prefix_python_targets: python3_9 prefix_user_defined_trusted_dirs: - "/cvmfs/{{ cvmfs_repository }}/host_injections/{{ eessi_version }}/compat/{{ eessi_host_os }}/{{ eessi_host_arch }}/lib" prefix_singularity_command: "singularity run -B {{ gentoo_prefix_path }}:{{ gentoo_prefix_path }}" From bd8ca8ed20cafcd8a56be444f8ec80310a9b8c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 10 Jun 2021 09:19:35 +0200 Subject: [PATCH 14/35] move glibc steps to a separate task --- .../tasks/install_packages.yml | 22 ---------- .../roles/compatibility_layer/tasks/main.yml | 2 + .../tasks/set_glibc_trusted_dirs.yml | 44 +++++++++++++++++++ 3 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/install_packages.yml b/ansible/playbooks/roles/compatibility_layer/tasks/install_packages.yml index 78a5c8b6..7d245297 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/install_packages.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/install_packages.yml @@ -1,27 +1,5 @@ # Install a specified list of sets and packages. --- -- name: Find all strings in libc library - command: "strings {{ gentoo_prefix_path }}/usr/lib64/libc.a" - register: libc_strings - when: eessi_host_os == "linux" - -- name: Find user defined trusted dirs in libc strings output - set_fact: match='{{ libc_strings.stdout | regex_search("\n" + item + "/?\n") | default('', True) | string | length>0 }}' - with_items: "{{ prefix_user_defined_trusted_dirs }}" - register: trusted_dirs_in_libc - -- name: (Re)install glibc with the user-defined-trusted-dirs option - portage: - package: sys-libs/glibc - noreplace: no - oneshot: yes - become: no - environment: - EXTRA_EMAKE: "user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" - when: - - eessi_host_os == "linux" - - trusted_dirs_in_libc.results | selectattr('ansible_facts.match', 'equalto', False) | list | length>0 - - name: Install package set {{ package_sets }} portage: package: "@{{ item }}" diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml index 402c9d11..0fc0e4b8 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml @@ -27,6 +27,8 @@ environment: PYTHON_TARGETS: "{{ prefix_python_targets }}" + - include_tasks: set_glibc_trusted_dirs.yml + - include_tasks: install_packages.yml - include_tasks: create_host_symlinks.yml diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml new file mode 100644 index 00000000..a2ee3361 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml @@ -0,0 +1,44 @@ +# Make sure that glibc is always compiled with a user-defined-trusted-dirs option +--- +- name: Find all strings in libc library + command: "strings {{ gentoo_prefix_path }}/usr/lib64/libc.a" + register: libc_strings + when: eessi_host_os == "linux" + +- name: Find user defined trusted dirs in libc strings output + set_fact: match='{{ libc_strings.stdout | regex_search("\n" + item + "/?\n") | default('', True) | string | length>0 }}' + with_items: "{{ prefix_user_defined_trusted_dirs }}" + register: trusted_dirs_in_libc + +- name: (Re)install glibc with the user-defined-trusted-dirs option + portage: + package: sys-libs/glibc + noreplace: no + oneshot: yes + become: no + environment: + EXTRA_EMAKE: "user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" + when: + - eessi_host_os == "linux" + - trusted_dirs_in_libc.results | selectattr('ansible_facts.match', 'equalto', False) | list | length>0 + +- name: Create portage env directory + file: + path: "{{ gentoo_prefix_path }}/etc/portage/env" + state: directory + mode: '0755' + +- name: Add env file for glibc to make sure the user-defined-trusted-dirs is always used + copy: + dest: "{{ gentoo_prefix_path }}/etc/portage/env/glibc-user-defined-trusted-dirs.conf" + content: | + EXTRA_EMAKE: "user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" + +- name: Add glibc env file to package.env + lineinfile: + path: "{{ gentoo_prefix_path }}/etc/portage/package.env" + create: yes + mode: 0644 + line: sys-libs/glibc glibc-user-defined-trusted-dirs.conf + state: present + From 0d2ef192c6cc1eb8bbfb5c1902b5a0a658a79fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 10 Jun 2021 09:23:57 +0200 Subject: [PATCH 15/35] add mode for new file --- .../roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml index a2ee3361..8d6de02e 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml @@ -31,6 +31,7 @@ - name: Add env file for glibc to make sure the user-defined-trusted-dirs is always used copy: dest: "{{ gentoo_prefix_path }}/etc/portage/env/glibc-user-defined-trusted-dirs.conf" + mode: 0644 content: | EXTRA_EMAKE: "user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" From abe38e4659abc4cfde5d64f5a22481fc063331c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 10 Jun 2021 09:27:20 +0200 Subject: [PATCH 16/35] remove quotes --- .../roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml index 8d6de02e..6dc16917 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml @@ -26,7 +26,7 @@ file: path: "{{ gentoo_prefix_path }}/etc/portage/env" state: directory - mode: '0755' + mode: 0755 - name: Add env file for glibc to make sure the user-defined-trusted-dirs is always used copy: From c88d68a9a93e3c342cff9e8b1b95527c9bc87081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 10 Jun 2021 09:39:01 +0200 Subject: [PATCH 17/35] use copy instead of template for post-sync scripts --- .../playbooks/roles/compatibility_layer/tasks/add_overlay.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index aabc0f90..e3d05bc8 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -82,8 +82,8 @@ mode: '0755' - name: Add post-sync hooks for Gentoo overlay - template: - src: "{{ item }}.j2" + copy: + src: "{{ item }}" dest: "{{ gentoo_prefix_path }}/etc/portage/repo.postsync.d/{{ item }}" mode: 0755 with_items: From e2e694ef52b2449517fe4b8ebcff4a82a15e0759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 10 Jun 2021 09:42:37 +0200 Subject: [PATCH 18/35] use portageq to find EPREFIX, remove .j2 extensions --- .../files/sync_gentoo_cache | 34 +++++++++++++++++++ .../compatibility_layer/files/sync_gentoo_dtd | 17 ++++++++++ .../files/sync_gentoo_glsa | 17 ++++++++++ .../files/sync_gentoo_news | 17 ++++++++++ .../files/sync_gentoo_projects_xml | 12 +++++++ .../files/sync_overlay_cache | 14 ++++++++ 6 files changed, 111 insertions(+) create mode 100755 ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_cache create mode 100755 ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_dtd create mode 100755 ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_glsa create mode 100755 ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_news create mode 100644 ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_projects_xml create mode 100755 ansible/playbooks/roles/compatibility_layer/files/sync_overlay_cache diff --git a/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_cache b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_cache new file mode 100755 index 00000000..65b4f709 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_cache @@ -0,0 +1,34 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source $(portageq envvar EPREFIX)/lib/gentoo/functions.sh + +# Number of jobs for egencache, default is number or processors. +parallel_jobs="$(nproc)" + +if [[ -f ${repository_path}/metadata/timestamp.x ]]; then + portage_current_timestamp=$(cut -f 1 -d " " "${repository_path}/metadata/timestamp.x" ) +else + portage_current_timestamp=0 +fi + +ebegin "Fetching metadata timestamp for ${repository_name}" +rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/timestamp.x "${repository_path}"/metadata/timestamp.x +eend $? +portage_new_timestamp=$(cut -f 1 -d " " "${repository_path}/metadata/timestamp.x" ) + +if [[ ${portage_current_timestamp} -lt ${portage_new_timestamp} ]]; then + ebegin "Fetching pre-generated metadata cache for ${repository_name}" + rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/md5-cache/ "${repository_path}"/metadata/md5-cache/ + eend $? +else + einfo "Metadata cache for ${repository_name} already recent, no need to fetch it :-)" +fi + +ebegin "Updating metadata cache for ${repository_name}" +egencache --jobs="${parallel_jobs}" --repo="${repository_name}" --update --update-use-local-desc +eend $? diff --git a/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_dtd b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_dtd new file mode 100755 index 00000000..c12f6c3b --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_dtd @@ -0,0 +1,17 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source $(portageq envvar EPREFIX)/lib/gentoo/functions.sh + +DTDDIR="${repository_path}"/metadata/dtd +ebegin "Updating DTDs" +if [[ -e ${DTDDIR} ]]; then + git -C "${DTDDIR}" pull -q --ff-only +else + git clone -q https://anongit.gentoo.org/git/data/dtd.git "${DTDDIR}" +fi +eend "$?" diff --git a/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_glsa b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_glsa new file mode 100755 index 00000000..e2a2face --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_glsa @@ -0,0 +1,17 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source $(portageq envvar EPREFIX)/lib/gentoo/functions.sh + +GLSADIR="${repository_path}"/metadata/glsa +ebegin "Updating GLSAs" +if [[ -e ${GLSADIR} ]]; then + git -C "${GLSADIR}" pull -q --ff-only +else + git clone -q https://anongit.gentoo.org/git/data/glsa.git "${GLSADIR}" +fi +eend "$?" diff --git a/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_news b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_news new file mode 100755 index 00000000..92c69a63 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_news @@ -0,0 +1,17 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source $(portageq envvar EPREFIX)/lib/gentoo/functions.sh + +NEWSDIR="${repository_path}"/metadata/news +ebegin "Updating news items" +if [[ -e ${NEWSDIR} ]]; then + git -C "${NEWSDIR}" pull -q --ff-only +else + git clone -q https://anongit.gentoo.org/git/data/gentoo-news.git "${NEWSDIR}" +fi +eend $? "Try to remove ${NEWSDIR}" diff --git a/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_projects_xml b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_projects_xml new file mode 100644 index 00000000..fe1ac0e9 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/files/sync_gentoo_projects_xml @@ -0,0 +1,12 @@ +#!/bin/bash + +repository_name="${1}" +repository_path="${3}" + +[[ ${repository_name} == "gentoo" ]] || exit 0 + +source $(portageq envvar EPREFIX)/lib/gentoo/functions.sh + +ebegin "Updating projects.xml" +wget -q -P "${repository_path}"/metadata/ -N https://api.gentoo.org/metastructure/projects.xml +eend $? diff --git a/ansible/playbooks/roles/compatibility_layer/files/sync_overlay_cache b/ansible/playbooks/roles/compatibility_layer/files/sync_overlay_cache new file mode 100755 index 00000000..e7f5ecf0 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/files/sync_overlay_cache @@ -0,0 +1,14 @@ +#!/bin/bash + +repository_name="${1}" + +[[ ${repository_name} == "gentoo" ]] && exit 0 + +source $(portageq envvar EPREFIX)/lib/gentoo/functions.sh + +# Number of jobs for egencache, default is number or processors. +parallel_jobs="$(nproc)" + +ebegin "Updating metadata cache for ${repository_name}" +egencache --jobs="${parallel_jobs}" --repo="${repository_name}" --update --update-use-local-desc +eend $? From 4ace650a2861cd81e086aa83784ea32d50ebfc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 10 Jun 2021 09:53:29 +0200 Subject: [PATCH 19/35] fix syntax error in env file --- .../roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml index 6dc16917..baaf36bb 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml @@ -17,7 +17,7 @@ oneshot: yes become: no environment: - EXTRA_EMAKE: "user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" + EXTRA_EMAKE="user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" when: - eessi_host_os == "linux" - trusted_dirs_in_libc.results | selectattr('ansible_facts.match', 'equalto', False) | list | length>0 From cd5d3784eb7dd3fb535a2f2979260948a2b3a928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 10 Jun 2021 10:35:33 +0200 Subject: [PATCH 20/35] fixed the wrong line... --- .../compatibility_layer/tasks/set_glibc_trusted_dirs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml index baaf36bb..0650d73d 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/set_glibc_trusted_dirs.yml @@ -17,7 +17,7 @@ oneshot: yes become: no environment: - EXTRA_EMAKE="user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" + EXTRA_EMAKE: "user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" when: - eessi_host_os == "linux" - trusted_dirs_in_libc.results | selectattr('ansible_facts.match', 'equalto', False) | list | length>0 @@ -33,7 +33,7 @@ dest: "{{ gentoo_prefix_path }}/etc/portage/env/glibc-user-defined-trusted-dirs.conf" mode: 0644 content: | - EXTRA_EMAKE: "user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" + EXTRA_EMAKE="user-defined-trusted-dirs={{ prefix_user_defined_trusted_dirs | join(':') }}" - name: Add glibc env file to package.env lineinfile: From 60e4addf678fdb6d597dd663fc04676fa30b296e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 11 Jun 2021 15:06:57 +0200 Subject: [PATCH 21/35] add test to verify that the glibc env file is used --- test/compat_layer.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/compat_layer.py b/test/compat_layer.py index 132f2009..2e2fb745 100644 --- a/test/compat_layer.py +++ b/test/compat_layer.py @@ -182,3 +182,28 @@ def __init__(self): sn.assert_eq(self.exit_code, 0), sn.assert_found(f'\n/{self.symlink_to_host}\n', self.stdout), ]) + +@rfm.simple_test +class GlibcEnvFileTest(RunInGentooPrefixTest): + def __init__(self): + # the glibc env file was added in 2021.06 + self.skip_if(self.eessi_version == '2021.03') + + super().__init__() + self.descr = 'Verify that the env file for sys-libs/glibc was created and is picked up by emerge.' + self.command = 'equery has --package glibc EXTRA_EMAKE' + + trusted_dir = os.path.join( + self.eessi_repo_dir, + 'host_injections', + self.eessi_version, + 'compat', + self.eessi_os, + self.eessi_arch, + 'lib' + ) + + self.sanity_patterns = sn.assert_found( + f'user-defined-trusted-dirs={trusted_dir}', + self.stdout + ) From c01cf2d321c01c99bccfc3f7bca701affb5c183a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 11 Jun 2021 16:26:31 +0200 Subject: [PATCH 22/35] add reframe test for validating that gentoo overlay uses git --- test/compat_layer.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/compat_layer.py b/test/compat_layer.py index 132f2009..17e0f500 100644 --- a/test/compat_layer.py +++ b/test/compat_layer.py @@ -182,3 +182,21 @@ def __init__(self): sn.assert_eq(self.exit_code, 0), sn.assert_found(f'\n/{self.symlink_to_host}\n', self.stdout), ]) + + +@rfm.simple_test +class GentooOverlayGitTest(RunInGentooPrefixTest): + def __init__(self): + # the switch to git was made in pilot version 2021.06 + self.skip_if(self.eessi_version == '2021.03') + + super().__init__() + self.descr = 'Verify that the Gentoo overlay is synced using git.' + self.command = f'emerge --info' + + gentoo_git_repo_info = '''gentoo + location: /cvmfs/pilot.eessi-hpc.org/2021.06/compat/linux/x86_64/var/db/repos/gentoo + sync-type: git + sync-uri: https://github.com/gentoo/gentoo.git''' + + self.sanity_patterns = sn.assert_found(gentoo_git_repo_info, self.stdout) From 7a08570eb8bb54ea4e12b64545ba033dc02b70a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 11 Jun 2021 18:03:19 +0200 Subject: [PATCH 23/35] fix hardcoded path --- test/compat_layer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/compat_layer.py b/test/compat_layer.py index 17e0f500..dcd6f461 100644 --- a/test/compat_layer.py +++ b/test/compat_layer.py @@ -194,9 +194,10 @@ def __init__(self): self.descr = 'Verify that the Gentoo overlay is synced using git.' self.command = f'emerge --info' + gentoo_repo_dir = os.path.join(self.compat_dir, 'var', 'db', 'repos', 'gentoo') gentoo_git_repo_info = '''gentoo - location: /cvmfs/pilot.eessi-hpc.org/2021.06/compat/linux/x86_64/var/db/repos/gentoo + location: %s sync-type: git - sync-uri: https://github.com/gentoo/gentoo.git''' + sync-uri: https://github.com/gentoo/gentoo.git''' % gentoo_repo_dir self.sanity_patterns = sn.assert_found(gentoo_git_repo_info, self.stdout) From b2fb15bb4a5d8e0bacbc309314927afdab38ae2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 15 Jun 2021 09:53:21 +0200 Subject: [PATCH 24/35] try without setting python targets --- ansible/playbooks/roles/compatibility_layer/defaults/main.yml | 4 ++-- ansible/playbooks/roles/compatibility_layer/tasks/main.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml index 4b0528c6..b5b3ecdc 100644 --- a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml @@ -19,7 +19,7 @@ gentoo_prefix_path: /cvmfs/{{ cvmfs_repository }}/{{ eessi_version }}/compat/{{ prefix_required_space: 15 GB prefix_snapshot_url: https://eessi-gentoo-snapshot.s3-eu-west-1.amazonaws.com prefix_snapshot_version: 20210607 -prefix_python_targets: python3_9 +#prefix_python_targets: python3_9 prefix_user_defined_trusted_dirs: - "/cvmfs/{{ cvmfs_repository }}/host_injections/{{ eessi_version }}/compat/{{ eessi_host_os }}/{{ eessi_host_arch }}/lib" prefix_singularity_command: "singularity run -B {{ gentoo_prefix_path }}:{{ gentoo_prefix_path }}" @@ -27,7 +27,7 @@ prefix_source: "docker://eessi/bootstrap-prefix:centos8-{{ eessi_host_arch }}" prefix_source_options: "{{ gentoo_prefix_path }} noninteractive" prefix_install: >- SINGULARITYENV_USE_CPU_CORES={{ ansible_processor_vcpus }} - SINGULARITYENV_PYTHON_TARGETS="{{ prefix_python_targets }}" + #SINGULARITYENV_PYTHON_TARGETS="{{ prefix_python_targets }}" SINGULARITYENV_CUSTOM_SNAPSHOT_URL="{{ prefix_snapshot_url }}" SINGULARITYENV_CUSTOM_SNAPSHOT_VERSION="{{ prefix_snapshot_version }}" {{ prefix_singularity_command }} {{ prefix_source }} {{ prefix_source_options }} diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml index 402c9d11..1e7ad13b 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml @@ -24,8 +24,8 @@ args: apply: become: False - environment: - PYTHON_TARGETS: "{{ prefix_python_targets }}" + #environment: + # PYTHON_TARGETS: "{{ prefix_python_targets }}" - include_tasks: install_packages.yml From a6eefe99d71615cecf6afd5f0a27224721384fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 17 Jun 2021 13:28:56 +0200 Subject: [PATCH 25/35] Remove commented python targets lines --- ansible/playbooks/roles/compatibility_layer/defaults/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml index b5b3ecdc..af6f3bea 100644 --- a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml @@ -19,7 +19,6 @@ gentoo_prefix_path: /cvmfs/{{ cvmfs_repository }}/{{ eessi_version }}/compat/{{ prefix_required_space: 15 GB prefix_snapshot_url: https://eessi-gentoo-snapshot.s3-eu-west-1.amazonaws.com prefix_snapshot_version: 20210607 -#prefix_python_targets: python3_9 prefix_user_defined_trusted_dirs: - "/cvmfs/{{ cvmfs_repository }}/host_injections/{{ eessi_version }}/compat/{{ eessi_host_os }}/{{ eessi_host_arch }}/lib" prefix_singularity_command: "singularity run -B {{ gentoo_prefix_path }}:{{ gentoo_prefix_path }}" @@ -27,7 +26,6 @@ prefix_source: "docker://eessi/bootstrap-prefix:centos8-{{ eessi_host_arch }}" prefix_source_options: "{{ gentoo_prefix_path }} noninteractive" prefix_install: >- SINGULARITYENV_USE_CPU_CORES={{ ansible_processor_vcpus }} - #SINGULARITYENV_PYTHON_TARGETS="{{ prefix_python_targets }}" SINGULARITYENV_CUSTOM_SNAPSHOT_URL="{{ prefix_snapshot_url }}" SINGULARITYENV_CUSTOM_SNAPSHOT_VERSION="{{ prefix_snapshot_version }}" {{ prefix_singularity_command }} {{ prefix_source }} {{ prefix_source_options }} From ecdc20d2bda30d3a940d872c94f8753edeade285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 17 Jun 2021 13:29:25 +0200 Subject: [PATCH 26/35] Remove commented python targets env var --- ansible/playbooks/roles/compatibility_layer/tasks/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml index 1e7ad13b..616f1f4a 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml @@ -24,8 +24,6 @@ args: apply: become: False - #environment: - # PYTHON_TARGETS: "{{ prefix_python_targets }}" - include_tasks: install_packages.yml From 0e64d56a24580233942c58fe55c6dccbe3cdc7ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Sun, 20 Jun 2021 14:21:59 +0200 Subject: [PATCH 27/35] remove old versions of scripts in template dir --- .../templates/sync_gentoo_cache.j2 | 34 ------------------- .../templates/sync_gentoo_dtd.j2 | 17 ---------- .../templates/sync_gentoo_glsa.j2 | 17 ---------- .../templates/sync_gentoo_news.j2 | 17 ---------- .../templates/sync_gentoo_projects_xml.j2 | 12 ------- .../templates/sync_overlay_cache.j2 | 14 -------- 6 files changed, 111 deletions(-) delete mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_cache.j2 delete mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_dtd.j2 delete mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_glsa.j2 delete mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_news.j2 delete mode 100644 ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_projects_xml.j2 delete mode 100755 ansible/playbooks/roles/compatibility_layer/templates/sync_overlay_cache.j2 diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_cache.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_cache.j2 deleted file mode 100755 index f1f572d2..00000000 --- a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_cache.j2 +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -repository_name="${1}" -repository_path="${3}" - -[[ ${repository_name} == "gentoo" ]] || exit 0 - -source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh - -# Number of jobs for egencache, default is number or processors. -parallel_jobs="$(nproc)" - -if [[ -f ${repository_path}/metadata/timestamp.x ]]; then - portage_current_timestamp=$(cut -f 1 -d " " "${repository_path}/metadata/timestamp.x" ) -else - portage_current_timestamp=0 -fi - -ebegin "Fetching metadata timestamp for ${repository_name}" -rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/timestamp.x "${repository_path}"/metadata/timestamp.x -eend $? -portage_new_timestamp=$(cut -f 1 -d " " "${repository_path}/metadata/timestamp.x" ) - -if [[ ${portage_current_timestamp} -lt ${portage_new_timestamp} ]]; then - ebegin "Fetching pre-generated metadata cache for ${repository_name}" - rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/md5-cache/ "${repository_path}"/metadata/md5-cache/ - eend $? -else - einfo "Metadata cache for ${repository_name} already recent, no need to fetch it :-)" -fi - -ebegin "Updating metadata cache for ${repository_name}" -egencache --jobs="${parallel_jobs}" --repo="${repository_name}" --update --update-use-local-desc -eend $? diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_dtd.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_dtd.j2 deleted file mode 100755 index 81d8ff0f..00000000 --- a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_dtd.j2 +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -repository_name="${1}" -repository_path="${3}" - -[[ ${repository_name} == "gentoo" ]] || exit 0 - -source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh - -DTDDIR="${repository_path}"/metadata/dtd -ebegin "Updating DTDs" -if [[ -e ${DTDDIR} ]]; then - git -C "${DTDDIR}" pull -q --ff-only -else - git clone -q https://anongit.gentoo.org/git/data/dtd.git "${DTDDIR}" -fi -eend "$?" diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_glsa.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_glsa.j2 deleted file mode 100755 index 220e3aea..00000000 --- a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_glsa.j2 +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -repository_name="${1}" -repository_path="${3}" - -[[ ${repository_name} == "gentoo" ]] || exit 0 - -source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh - -GLSADIR="${repository_path}"/metadata/glsa -ebegin "Updating GLSAs" -if [[ -e ${GLSADIR} ]]; then - git -C "${GLSADIR}" pull -q --ff-only -else - git clone -q https://anongit.gentoo.org/git/data/glsa.git "${GLSADIR}" -fi -eend "$?" diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_news.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_news.j2 deleted file mode 100755 index dbab56ca..00000000 --- a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_news.j2 +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -repository_name="${1}" -repository_path="${3}" - -[[ ${repository_name} == "gentoo" ]] || exit 0 - -source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh - -NEWSDIR="${repository_path}"/metadata/news -ebegin "Updating news items" -if [[ -e ${NEWSDIR} ]]; then - git -C "${NEWSDIR}" pull -q --ff-only -else - git clone -q https://anongit.gentoo.org/git/data/gentoo-news.git "${NEWSDIR}" -fi -eend $? "Try to remove ${NEWSDIR}" diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_projects_xml.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_projects_xml.j2 deleted file mode 100644 index 07067e5b..00000000 --- a/ansible/playbooks/roles/compatibility_layer/templates/sync_gentoo_projects_xml.j2 +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -repository_name="${1}" -repository_path="${3}" - -[[ ${repository_name} == "gentoo" ]] || exit 0 - -source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh - -ebegin "Updating projects.xml" -wget -q -P "${repository_path}"/metadata/ -N https://api.gentoo.org/metastructure/projects.xml -eend $? diff --git a/ansible/playbooks/roles/compatibility_layer/templates/sync_overlay_cache.j2 b/ansible/playbooks/roles/compatibility_layer/templates/sync_overlay_cache.j2 deleted file mode 100755 index e373c810..00000000 --- a/ansible/playbooks/roles/compatibility_layer/templates/sync_overlay_cache.j2 +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -repository_name="${1}" - -[[ ${repository_name} == "gentoo" ]] && exit 0 - -source {{ gentoo_prefix_path }}/lib/gentoo/functions.sh - -# Number of jobs for egencache, default is number or processors. -parallel_jobs="$(nproc)" - -ebegin "Updating metadata cache for ${repository_name}" -egencache --jobs="${parallel_jobs}" --repo="${repository_name}" --update --update-use-local-desc -eend $? From 2c5b58f14bc2cff6ecd2f62ee734aba6356e9e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Sun, 20 Jun 2021 14:23:07 +0200 Subject: [PATCH 28/35] remove commented sync_gentoo_project_xml --- .../playbooks/roles/compatibility_layer/tasks/add_overlay.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index e3d05bc8..523782bd 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -92,7 +92,6 @@ - sync_gentoo_glsa - sync_gentoo_news - sync_overlay_cache - #- sync_gentoo_projects_xml - name: Remove the old Gentoo overlay directory file: From 2c1a333eb4f3780c0c7286ed5970559c3e5c2d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 21 Jun 2021 13:12:33 +0200 Subject: [PATCH 29/35] Add a system update step for existing Prefix --- .../roles/compatibility_layer/tasks/add_overlay.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 523782bd..0d22db1c 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -13,12 +13,21 @@ path: /etc/group regexp: portage line: portage::250:portage - + - name: Install equery command (dependency for the portage module) command: cmd: emerge gentoolkit creates: "{{ gentoo_prefix_path }}/usr/bin/equery" +- name: Update system set if we are running in an existing Prefix installation + portage: + changed_use: yes + deep: yes + package: system + update: yes + + when: not startprefix.stat.exists + - name: Create repos directory file: path: "{{ gentoo_prefix_path }}/etc/portage/repos.conf" From 397ac8d8658058e36835b0056534e763b1e7478a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 21 Jun 2021 13:16:17 +0200 Subject: [PATCH 30/35] remove trailing spaces --- .../playbooks/roles/compatibility_layer/tasks/add_overlay.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 0d22db1c..4e58a827 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -13,7 +13,7 @@ path: /etc/group regexp: portage line: portage::250:portage - + - name: Install equery command (dependency for the portage module) command: cmd: emerge gentoolkit @@ -25,7 +25,6 @@ deep: yes package: system update: yes - when: not startprefix.stat.exists - name: Create repos directory From 9db7b4ba55e34955fe2883e40283465e1f05dd90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 21 Jun 2021 14:10:00 +0200 Subject: [PATCH 31/35] remove wrong 'not' operator --- .../playbooks/roles/compatibility_layer/tasks/add_overlay.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 4e58a827..3339d979 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -25,7 +25,7 @@ deep: yes package: system update: yes - when: not startprefix.stat.exists + when: startprefix.stat.exists - name: Create repos directory file: From 973081fb887c4e1ae0580aae49c8713188c00854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 21 Jun 2021 14:36:01 +0200 Subject: [PATCH 32/35] update world instead of system --- .../playbooks/roles/compatibility_layer/tasks/add_overlay.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 3339d979..239dc860 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -19,11 +19,11 @@ cmd: emerge gentoolkit creates: "{{ gentoo_prefix_path }}/usr/bin/equery" -- name: Update system set if we are running in an existing Prefix installation +- name: Update world set if we are running in an existing Prefix installation portage: changed_use: yes deep: yes - package: system + package: "@world" update: yes when: startprefix.stat.exists From 3044dff1676188b7c8212e6edf36bca26cbe6ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 21 Jun 2021 15:00:23 +0200 Subject: [PATCH 33/35] verbose output for ansible-playbook --- .github/actions/install_compatibility_layer/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/install_compatibility_layer/entrypoint.sh b/.github/actions/install_compatibility_layer/entrypoint.sh index aca33c96..b4904ddd 100755 --- a/.github/actions/install_compatibility_layer/entrypoint.sh +++ b/.github/actions/install_compatibility_layer/entrypoint.sh @@ -5,7 +5,7 @@ cat << EOF > hosts 127.0.0.1 eessi_host_arch=$(uname -m) eessi_host_os=linux EOF -ansible-playbook --connection=local --inventory=hosts -e ansible_python_interpreter=python3 -e gentoo_prefix_path=$1 ${GITHUB_WORKSPACE}/ansible/playbooks/install.yml +ansible-playbook -v --connection=local --inventory=hosts -e ansible_python_interpreter=python3 -e gentoo_prefix_path=$1 ${GITHUB_WORKSPACE}/ansible/playbooks/install.yml # A successful installation should at least have Lmod and archspec, # so let's check if we can use them. From cdeb9e72c1c9d8878d72e9cc521f46d33a6f2321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 21 Jun 2021 15:18:21 +0200 Subject: [PATCH 34/35] Update of system set should go after the sync... --- .../compatibility_layer/tasks/add_overlay.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 239dc860..3733afae 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -19,14 +19,6 @@ cmd: emerge gentoolkit creates: "{{ gentoo_prefix_path }}/usr/bin/equery" -- name: Update world set if we are running in an existing Prefix installation - portage: - changed_use: yes - deep: yes - package: "@world" - update: yes - when: startprefix.stat.exists - - name: Create repos directory file: path: "{{ gentoo_prefix_path }}/etc/portage/repos.conf" @@ -125,3 +117,11 @@ force: yes with_items: "{{ find_configs.results | rejectattr('files', 'equalto', []) | map(attribute='files') | list }}" + +- name: Update system set if we are running in an existing Prefix installation + portage: + changed_use: yes + deep: yes + package: "@system" + update: yes + when: startprefix.stat.exists From 254a1b82232e573d58fa50ef4e116d0b4b3b1879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Mon, 21 Jun 2021 15:52:59 +0200 Subject: [PATCH 35/35] update world instead of system --- .../playbooks/roles/compatibility_layer/tasks/add_overlay.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml index 3733afae..0454e1aa 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/add_overlay.yml @@ -122,6 +122,6 @@ portage: changed_use: yes deep: yes - package: "@system" + package: "@world" update: yes when: startprefix.stat.exists