Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3763855
D3520.id9053.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D3520.id9053.diff
View Options
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/parse-portshaker-merged-ports.py b/roles/freebsd-repo/ports/files/parse-portshaker-merged-ports.py
new file mode 100755
--- /dev/null
+++ b/roles/freebsd-repo/ports/files/parse-portshaker-merged-ports.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+
+# -------------------------------------------------------------
+# portshaker merged ports -> pkglist
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Description: Read portshaker merged ports file
+# Output a pkglist for Poudriere
+# License: BSD-2-Clause
+# -------------------------------------------------------------
+
+
+import os
+import sys
+
+
+# -------------------------------------------------------------
+# Poudriere helper methods
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+POUDRIERE_CONFIG_ROOT="/usr/local/etc/poudriere.d"
+
+
+def get_ports_tree_config_dir(name):
+ return POUDRIERE_CONFIG_ROOT + "/ports/" + name
+
+
+def is_ports_tree_exists(name):
+ return os.path.exists(get_ports_tree_config_dir(name))
+
+
+def get_ports_tree_path(name):
+ mnt_path = get_ports_tree_config_dir(name) + "/mnt"
+
+ with open(mnt_path) as fd:
+ return fd.readline().strip()
+
+
+# -------------------------------------------------------------
+# Portshaker helper methods
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+def parse_port(line):
+ return line.strip().split(":")[1]
+
+
+def get_portshaker_merged_ports(name):
+ try:
+ ports_path = get_ports_tree_path(name) + "/.portshaker-merged-ports"
+ except FileNotFoundError:
+ return []
+
+ return [parse_port(line) for line in open(ports_path)]
+
+
+# -------------------------------------------------------------
+# Application entry point
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def run(tree_name):
+ ports = get_portshaker_merged_ports(tree_name)
+
+ for port in ports:
+ print(port)
+
+
+if __name__ == "__main__":
+ argc = len(sys.argv)
+
+ if argc < 2:
+ print(f"Usage: {sys.argv[0]} <ports tree name>", file=sys.stderr)
+ sys.exit(1)
+
+ run(sys.argv[1])
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/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,107 @@
+# -------------------------------------------------------------
+# 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 %}
+
+/usr/local/bin/parse-portshaker-merged-ports:
+ file.managed:
+ - source: salt://roles/freebsd-repo/ports/files/parse-portshaker-merged-ports.py
+ - mode: 755
+
+freebsd_repo_ports_poudriere_set:
+ cmd.run:
+ - name: |
+ parse-portshaker-merged-port nasqueron > /usr/local/etc/poudriere.d/nasqueron-pkglist
+ - creates: /usr/local/etc/poudriere.d/nasqueron-pkglist
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 02:58 (17 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2256944
Default Alt Text
D3520.id9053.diff (8 KB)
Attached To
Mode
D3520: Build Nasqueron FreeBSD packages with poudriere and portshaker
Attached
Detach File
Event Timeline
Log In to Comment