Page MenuHomeDevCentral

D3520.id9054.diff
No OneTemporary

D3520.id9054.diff

diff --git a/roles/freebsd-repo/init.sls b/roles/freebsd-repo/init.sls
--- a/roles/freebsd-repo/init.sls
+++ b/roles/freebsd-repo/init.sls
@@ -8,3 +8,4 @@
include:
- .signing-key
- .repo
+ - .ports
diff --git a/roles/freebsd-repo/ports/files/portshaker.conf b/roles/freebsd-repo/ports/files/portshaker.conf
new file mode 100644
--- /dev/null
+++ b/roles/freebsd-repo/ports/files/portshaker.conf
@@ -0,0 +1,21 @@
+# -------------------------------------------------------------
+# Portshaker
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/freebsd-repo/ports/files/portshaker.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+mirror_base_dir=/var/cache/portshaker
+
+ports_trees="final"
+
+final_ports_tree="/usr/local/poudriere/ports/nasqueron"
+final_merge_from="freebsd nasqueron"
diff --git a/roles/freebsd-repo/ports/files/portshaker_tree b/roles/freebsd-repo/ports/files/portshaker_tree
new file mode 100644
--- /dev/null
+++ b/roles/freebsd-repo/ports/files/portshaker_tree
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Portshaker
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/freebsd-repo/ports/files/portshaker_tree
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+. /usr/local/share/portshaker/portshaker.subr
+
+if [ "$1" != '--' ]; then
+ err 1 "Extra arguments"
+fi
+shift
+
+# -------------------------------------------------------------
+# Git configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+method="git"
+git_clone_uri="{{ repository.url }}"
+git_branch="{{ repository.branch }}"
+
+# -------------------------------------------------------------
+# Invoke portshaker
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+run_portshaker_command "$@"
diff --git a/roles/freebsd-repo/ports/files/rebuild-nasqueron-packages.sh b/roles/freebsd-repo/ports/files/rebuild-nasqueron-packages.sh
new file mode 100755
--- /dev/null
+++ b/roles/freebsd-repo/ports/files/rebuild-nasqueron-packages.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Rebuild Nasqueron FreeBSD packages
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: BSD-2-Clause
+# Source file: roles/freebsd-repo/ports/files/rebuild-nasqueron-packages.sh
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+set -e
+
+JAILS="{{ jails | join(" ") }}"
+PORTS_PATH="{{ ports_path }}"
+
+# -------------------------------------------------------------
+# Ensure user is root
+#
+# Note: POSIX shells don't always define $UID or $EUID.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ "${EUID:-$(id -u)}" -ne 0 ]; then
+ echo "This command must be run as root." >&2
+ exit 1
+fi
+
+# -------------------------------------------------------------
+# Portshaker
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+portshaker -U
+portshaker -M
+
+PORTS_TO_BUILD=$(awk -F : '{print $2}' $PORTS_PATH/.portshaker-merged-ports)
+
+# -------------------------------------------------------------
+# Poudriere
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+for jail in $JAILS; do
+ poudriere bulk -j "$jail" -p nasqueron "$PORTS_TO_BUILD"
+done
diff --git a/roles/freebsd-repo/init.sls b/roles/freebsd-repo/ports/init.sls
copy from roles/freebsd-repo/init.sls
copy to roles/freebsd-repo/ports/init.sls
--- a/roles/freebsd-repo/init.sls
+++ b/roles/freebsd-repo/ports/init.sls
@@ -6,5 +6,4 @@
# -------------------------------------------------------------
include:
- - .signing-key
- - .repo
+ - .portshaker
diff --git a/roles/freebsd-repo/ports/portshaker.sls b/roles/freebsd-repo/ports/portshaker.sls
new file mode 100644
--- /dev/null
+++ b/roles/freebsd-repo/ports/portshaker.sls
@@ -0,0 +1,115 @@
+# -------------------------------------------------------------
+# Salt — FreeBSD repository
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# Software
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+freebsd_repo_ports_dependencies:
+ pkg.installed:
+ - pkgs:
+ - portshaker
+
+# -------------------------------------------------------------
+# Directory to store merged ports trees
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% if salt['node.has']('zfs:pool') %}
+
+{% set tank = salt["node.get"]("zfs:pool") %}
+{{ tank }}/poudriere/ports/nasqueron:
+ zfs.filesystem_present:
+ - properties:
+ compression: zstd
+
+{% else %}
+
+/usr/local/poudriere/ports/nasqueron:
+ file.directory:
+ makedirs: True
+
+{% endif %}
+
+# -------------------------------------------------------------
+# Portshaker main configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/usr/local/etc/portshaker.conf:
+ file.managed:
+ - source: salt://roles/freebsd-repo/ports/files/portshaker.conf
+
+/var/cache/portshaker:
+ file.directory
+
+# -------------------------------------------------------------
+# Configuration for individual ports tree
+#
+# :: FreeBSD ports tree
+# :: Nasqueron ports tree
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/usr/local/etc/portshaker.d:
+ file.directory
+
+/usr/local/etc/portshaker.d/nasqueron:
+ file.managed:
+ - source: salt://roles/freebsd-repo/ports/files/portshaker_tree
+ - mode: 755
+ - template: jinja
+ - context:
+ repository:
+ url: https://devcentral.nasqueron.org/source/freebsd-ports-nasqueron.git
+ branch: main
+
+/usr/local/etc/portshaker.d/freebsd:
+ file.managed:
+ - source: salt://roles/freebsd-repo/ports/files/portshaker_tree
+ - mode: 755
+ - template: jinja
+ - context:
+ repository:
+ url: https://git.FreeBSD.org/ports.git
+ branch: main
+
+# -------------------------------------------------------------
+# First merge
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+freebsd_repo_ports_initial_merge:
+ cmd.run:
+ - name: portshaker
+ - creates: /usr/local/poudriere/ports/nasqueron/.portshaker-merged-ports
+
+# -------------------------------------------------------------
+# Poudriere
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% if salt['file.file_exists']("/usr/local/bin/poudriere") %}
+
+freebsd_repo_ports_poudriere:
+ cmd.run:
+ - name: poudriere ports -c -m null -M /usr/local/poudriere/ports/nasqueron -p nasqueron
+ - creates: /usr/local/etc/poudriere.d/ports/nasqueron
+
+{% endif %}
+
+# -------------------------------------------------------------
+# Rebuild script
+#
+# Jails: base jails for Poudriere to use to build packages
+# allows to maintain packages for several versions
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/usr/local/bin/rebuild-nasqueron-packages:
+ file.managed:
+ - source: salt://roles/freebsd-repo/ports/files/rebuild-nasqueron-packages.sh
+ - mode: 755
+ - template: jinja
+ - context:
+ ports_path: /usr/local/poudriere/ports/nasqueron
+ jails:
+ - base14

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 07:32 (17 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259734
Default Alt Text
D3520.id9054.diff (8 KB)

Event Timeline