From 9be646f94389236e3a18f7ede85e7716c1fc232d Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 10 Dec 2022 18:42:02 -0500 Subject: [PATCH] Starting a poudboot rc service for building when the poudriere vm launches. --- ansible/roles/poudriere/files/poudboot | 23 ++++++++++++++++ ansible/roles/poudriere/files/poudboot.bash | 17 ++++++++++++ .../13amd64-default-framework-make.conf | 17 ++++++++++++ ansible/roles/poudriere/tasks/freebsd.yaml | 26 +++++++++++++++---- 4 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 ansible/roles/poudriere/files/poudboot create mode 100644 ansible/roles/poudriere/files/poudboot.bash create mode 100644 ansible/roles/poudriere/files/poudriere.d/13amd64-default-framework-make.conf diff --git a/ansible/roles/poudriere/files/poudboot b/ansible/roles/poudriere/files/poudboot new file mode 100644 index 0000000..17070d7 --- /dev/null +++ b/ansible/roles/poudriere/files/poudboot @@ -0,0 +1,23 @@ +#!/bin/sh +# /usr/local/etc/rc.d/poudboot +# +# REQUIRE: FILESYSTEM kld +# PROVIDE: poudboot +# AFTER: netif + +. /etc/rc.subr +name=poudboot +rcvar=${name}_enable +start_cmd="${name}_start" +stop_cmd="${name}_stop" +load_rc_config $name + +poudboot_start() { + /usr/local/bin/poudboot start +} + +poudboot_stop() { + /usr/local/bin/poudboot stop +} + +run_rc_command "$1" diff --git a/ansible/roles/poudriere/files/poudboot.bash b/ansible/roles/poudriere/files/poudboot.bash new file mode 100644 index 0000000..7b9990a --- /dev/null +++ b/ansible/roles/poudriere/files/poudboot.bash @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Run poudriere at system boot. Useful for virtual machines so launching the VM also kicks off a build. +set -euo pipefail +IFS=$'\n\t' +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +COMMAND="$1" +shift 1 + +if [ "$COMMAND" = "start" ]; then + echo "foo" +elif [ "$COMMAND" = "stop" ]; then + echo "bar" +else + echo "baz" +fi diff --git a/ansible/roles/poudriere/files/poudriere.d/13amd64-default-framework-make.conf b/ansible/roles/poudriere/files/poudriere.d/13amd64-default-framework-make.conf new file mode 100644 index 0000000..38a4330 --- /dev/null +++ b/ansible/roles/poudriere/files/poudriere.d/13amd64-default-framework-make.conf @@ -0,0 +1,17 @@ +# Disable CPUTYPE optimizations when compiling gcc48 because tigerlake is not included in gcc4.8 +# +# Disable CPUTYPE optimizations when compiling ripgrep because the build is failing https://github.com/BurntSushi/ripgrep/issues/1721 +# +# Disable CPUTYPE optimizations for firefox due to failing build. +# +# Example from bottom of /usr/share/examples/etc/make.conf +.if ${.CURDIR:N*/lang/gcc48*} && ${.CURDIR:N*/lang/gcc10*} && ${.CURDIR:N*/textproc/ripgrep*} && ${.CURDIR:N*/www/firefox*} +# Disabling tigerlake optimizations because qemu's TCG does not support avx512 +# +#CPUTYPE?=tigerlake +CPUTYPE?=x86-64-v3 +.endif +OPTIMIZED_CFLAGS=YES +BUILD_OPTIMIZED=YES +WITH_CPUFLAGS=YES +BUILD_STATIC=YES diff --git a/ansible/roles/poudriere/tasks/freebsd.yaml b/ansible/roles/poudriere/tasks/freebsd.yaml index 95bac7c..01889c3 100644 --- a/ansible/roles/poudriere/tasks/freebsd.yaml +++ b/ansible/roles/poudriere/tasks/freebsd.yaml @@ -66,17 +66,33 @@ # - src: poudriere.d # dest: /usr/local/etc/ +- name: Install scripts + copy: + src: "files/{{ item.src }}" + dest: "{{ item.dest }}" + mode: 0755 + owner: root + group: wheel + loop: + - src: poudboot.bash + dest: /usr/local/bin/poudboot + - name: Get ports tree list command: poudriere ports -ln register: ports_tree_list changed_when: false check_mode: no -# - name: Fetch a ports tree -# command: poudriere ports -c -# args: -# creates: /usr/local/poudriere/ports/default - - name: Configure the ports tree command: poudriere ports -c -m null -M /usr/local/portshaker/trees/main -p default when: '"default" not in ports_tree_list.stdout_lines' + +- name: Install rc script + copy: + src: "files/{{ item.src }}" + dest: "/usr/local/etc/rc.d/{{ item.dest|default(item.src) }}" + owner: root + group: wheel + mode: 0755 + loop: + - src: poudboot