aboutsummaryrefslogtreecommitdiffstats
path: root/slackrepo_SBo-danix.conf
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-19 20:53:05 +0200
committerDanilo M. <danix@danix.xyz>2026-10-19 20:53:05 +0200
commite6ac42e158ed5ceee2c58eaf2f23a0ad3bb82f41 (patch)
treeaf12ae932e9cbbf774f5a03cceeba0dc20c4b1c0 /slackrepo_SBo-danix.conf
parent30c6bc22a445105e7e7f37fb00ca054de1ecf3ad (diff)
downloadslackrepo_setup-e6ac42e158ed5ceee2c58eaf2f23a0ad3bb82f41.tar.gz
slackrepo_setup-e6ac42e158ed5ceee2c58eaf2f23a0ad3bb82f41.zip
Track the slackrepo config; add sb-publish and publish gates
slackrepo_SBo-danix.conf is now kept here. Site values (rsync target, Gotify URL and key) moved to the root-only SBo-danix.local it sources; make-local.py migrates them out of an old inline config. The rsync push moved into sb-publish; rsync_push_hook calls it and holds back when SBB_PUBLISH=n, so sb-builder can build without publishing and publish later. --preview does not set OPT_DRY_RUN, so the hooks now also check OPT_PREVIEW: previews no longer notify Gotify or run manage-packages.sh for real. gpg-agent.conf adds allow-preset-passphrase so sb-builder can unlock the signing key for jobs without a tty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'slackrepo_SBo-danix.conf')
-rw-r--r--slackrepo_SBo-danix.conf310
1 files changed, 310 insertions, 0 deletions
diff --git a/slackrepo_SBo-danix.conf b/slackrepo_SBo-danix.conf
new file mode 100644
index 0000000..b789c0b
--- /dev/null
+++ b/slackrepo_SBo-danix.conf
@@ -0,0 +1,310 @@
+# slackrepo configuration file for the SBo-danix personal repository.
+#
+# Priority order:
+# (1) Environment variables
+# (2) ~/.slackreporc
+# (3) /etc/slackrepo/slackrepo_SBo-danix.conf
+#
+# %REPO%, %SLACKVER% and %ARCH% are replaced at runtime.
+
+#-------------------------------------------------------------------------------
+# Filestore locations
+
+# Personal SlackBuilds repo (managed as a git fork of SBo):
+# Site settings (rsync target, Gotify URL and key) live outside git in a
+# root-only file, see SBo-danix.local.example in slackrepo_setup.
+SB_LOCAL='/etc/slackrepo/SBo-danix.local'
+[ -r "$SB_LOCAL" ] && . "$SB_LOCAL"
+
+SBREPO="/var/lib/sbopkg/SBo-danix"
+
+# Cached sources:
+SRCREPO="/var/lib/slackrepo/%REPO%/source"
+
+# Built packages:
+#PKGREPO="/var/lib/slackrepo/%REPO%/packages/%SLACKVER%/%ARCH%"
+PKGREPO="/repo"
+
+# Backups (comment out to disable):
+#PKGBACKUP="/var/lib/slackrepo/%REPO%/backups/%SLACKVER%/%ARCH%"
+
+# Local hintfiles (for overriding SBo packages without touching the SlackBuild):
+HINTDIR="/etc/slackrepo/%REPO%/hintfiles"
+
+# Default hintfiles from slackrepo-hints package (optional):
+DEFAULT_HINTDIR="/etc/slackrepo/%REPO%/default_hintfiles/%SLACKVER%"
+
+# Logs:
+LOGDIR="/var/log/slackrepo/%REPO%"
+
+# Database:
+DATABASE="/var/lib/slackrepo/%REPO%/database_%REPO%_%ARCH%.sqlite3"
+
+# Temporary build space (needs plenty of room):
+TMP="/tmp/%REPO%"
+
+#-------------------------------------------------------------------------------
+# Package tag
+# Using _danix instead of _SBo to identify your personal builds.
+TAG='_danix'
+
+# Package compression:
+PKGTYPE='txz'
+
+#-------------------------------------------------------------------------------
+# Build control
+
+SUBSTITUTE=""
+NUMJOBS=''
+ARCH=''
+
+#-------------------------------------------------------------------------------
+# Control argument defaults
+
+VERBOSE='n'
+VERY_VERBOSE='n'
+DRY_RUN='n'
+INSTALL='n'
+CHROOT='/'
+LINT='n'
+KEEP_TMP='n'
+COLOR='auto'
+NICE='5'
+NOWARNING=''
+
+#-------------------------------------------------------------------------------
+# Git branch setup
+#
+# INIT_GITCLONE is only used if SBREPO does not exist yet.
+# INIT_GITBRANCH must match the branch you have checked out in SBREPO.
+# Since we use a personal branch, gitfetch_hook is replaced below with a
+# custom hook that fetches upstream and rebases your branch on top of it.
+
+INIT_GITCLONE='https://github.com/Ponce/slackbuilds.git'
+INIT_GITBRANCH='danix-current'
+
+#-------------------------------------------------------------------------------
+# Hooks
+
+function danix_gitfetch_hook
+{
+ local upstream_branch='current'
+ local personal_branch='danix-current'
+
+ cd "$SR_SBREPO" || return 1
+
+ local currbranch
+ currbranch=$(git rev-parse --abbrev-ref HEAD)
+ if [ "$currbranch" != "$personal_branch" ]; then
+ echo "slackrepo: WARNING: SBREPO is on branch '$currbranch', expected '$personal_branch'. Skipping git update."
+ return 0
+ fi
+
+ local muck
+ muck=$(git status -s .)
+ if [ -n "$muck" ]; then
+ echo "slackrepo: WARNING: SBREPO has uncommitted changes. Skipping git update."
+ return 0
+ fi
+
+ echo "slackrepo: Fetching upstream SBo..."
+ git fetch origin || { echo "slackrepo: WARNING: git fetch failed."; return 1; }
+
+ echo "slackrepo: Rebasing $personal_branch onto origin/$upstream_branch..."
+ git rebase --rebase-merges -X theirs origin/"$upstream_branch" || {
+ echo "slackrepo: ERROR: rebase failed. Resolve conflicts in $SR_SBREPO and run 'git rebase --continue'."
+ return 1
+ }
+
+ return 0
+}
+
+HOOK_START=( danix_gitfetch_hook )
+
+function manage_packages_hook
+{
+ local args=()
+ # --preview does not set OPT_DRY_RUN (slackrepo cmdfunctions.sh), check both
+ if [ "$OPT_DRY_RUN" = 'y' ] || [ "$OPT_PREVIEW" = 'y' ]; then
+ args+=( --dry-run )
+ fi
+ REPO="$SR_PKGREPO" /usr/local/bin/manage-packages.sh "${args[@]}"
+}
+
+#-------------------------------------------------------------------------------
+# generate web files
+
+function gen_web_hook
+{
+ if [ "$OPT_DRY_RUN" = 'y' ] || [ ! -s "$CHANGELOG" ]; then
+ return 0
+ fi
+ SR_PKGREPO="$SR_PKGREPO" /usr/local/bin/gen_web_hook.sh
+ local stat=$?
+ [ $stat -ne 0 ] && log_warning "gen_web_hook failed, status $stat"
+ return $stat
+}
+
+#-------------------------------------------------------------------------------
+# dep template generator
+# Writes <TEMPLATE_DIR>/<prgnam>.template for each successfully built package
+# that has one or more recursive dependencies.
+
+TEMPLATE_DIR='/repo/templates'
+
+function dep_template_hook
+{
+ local template_dir="${TEMPLATE_DIR:-/repo/templates}"
+
+ [ "$OPT_DRY_RUN" = 'y' ] && return 0
+ [ ${#OKLIST[@]} -eq 0 ] && return 0
+
+ mkdir -p "$template_dir" || return 1
+
+ local itemid prgnam dep depname outfile
+ for itemid in "${OKLIST[@]}"; do
+ [ -z "${FULLDEPS[$itemid]}" ] && continue
+
+ prgnam="${ITEMPRGNAM[$itemid]}"
+ outfile="$template_dir/${prgnam}.template"
+
+ {
+ for dep in ${FULLDEPS[$itemid]}; do
+ depname="${ITEMPRGNAM[$dep]}"
+ printf '%s\n' "${depname:-$dep}"
+ done
+ printf '%s\n' "$prgnam"
+ } > "$outfile"
+
+ log_normal "dep_template_hook: wrote $outfile"
+ done
+
+ return 0
+}
+
+#-------------------------------------------------------------------------------
+# rsync push config
+
+function rsync_push_hook
+{
+ # SBB_PUBLISH=n (set by sb-builder for an unpublished run) holds the push
+ # back; sb-publish pushes later. Unset means publish, as from a terminal.
+ if [ "$OPT_DRY_RUN" = 'y' ] || [ "$OPT_PREVIEW" = 'y' ] || [ ! -s "$CHANGELOG" ] \
+ || [ "${SBB_PUBLISH:-y}" = 'n' ]; then
+ return 0
+ fi
+ /usr/local/bin/sb-publish "$SR_PKGREPO"
+ local rsyncstat=$?
+ if [ "$rsyncstat" != 0 ]; then
+ log_warning "rsync_push_hook failed, status $rsyncstat"
+ return 1
+ fi
+ return 0
+}
+
+function recap_hook
+{
+ # TODOLIST is per-item scratch (overwritten on each build_command call), so it
+ # only ever holds the last item. Build the recap from the cumulative status
+ # lists that slackrepo dedupes before running the finish hooks.
+ local recaplist=(
+ "${OKLIST[@]}" "${FAILEDLIST[@]}" "${ABORTEDLIST[@]}"
+ "${SKIPPEDLIST[@]}" "${UNSUPPORTEDLIST[@]}"
+ )
+ recaplist=( $(printf '%s\n' "${recaplist[@]}" | sort -u) )
+ [ ${#recaplist[@]} -eq 0 ] && return 0
+
+ local col_name=4 col_ver=7 col_status=6
+ local itemid prgnam ver stat
+ for itemid in "${recaplist[@]}"; do
+ prgnam="${ITEMPRGNAM[$itemid]}"
+ ver="${HINT_VERSION[$itemid]:-${INFOVERSION[$itemid]:-?}}"
+ stat="${STATUS[$itemid]:-?}"
+ [ ${#prgnam} -gt $col_name ] && col_name=${#prgnam}
+ [ ${#ver} -gt $col_ver ] && col_ver=${#ver}
+ [ ${#stat} -gt $col_status ] && col_status=${#stat}
+ done
+
+ local sep
+ sep="+-$(printf '%*s' "$col_name" '' | tr ' ' '-')-+-$(printf '%*s' "$col_ver" '' | tr ' ' '-')-+-$(printf '%*s' "$col_status" '' | tr ' ' '-')-+"
+
+ echo ""
+ echo "Build recap:"
+ echo "$sep"
+ printf "| %-*s | %-*s | %-*s |\n" "$col_name" "Name" "$col_ver" "Version" "$col_status" "Status"
+ echo "$sep"
+ for itemid in "${recaplist[@]}"; do
+ prgnam="${ITEMPRGNAM[$itemid]}"
+ ver="${HINT_VERSION[$itemid]:-${INFOVERSION[$itemid]:-?}}"
+ stat="${STATUS[$itemid]:-?}"
+ printf "| %-*s | %-*s | %-*s |\n" "$col_name" "$prgnam" "$col_ver" "$ver" "$col_status" "$stat"
+ done
+ echo "$sep"
+ echo ""
+
+ return 0
+}
+
+function gotify_hook
+{
+ # --preview does not set OPT_DRY_RUN (slackrepo cmdfunctions.sh), check both
+ if [ "$OPT_DRY_RUN" = 'y' ] || [ "$OPT_PREVIEW" = 'y' ]; then
+ return 0
+ fi
+ if [ -z "${SB_GOTIFY_URL:-}" ] || [ -z "${SB_GOTIFY_KEY:-}" ]; then
+ log_warning "SB_GOTIFY_URL/SB_GOTIFY_KEY not set in $SB_LOCAL, skipping gotify_hook"
+ return 0
+ fi
+
+ local curl_bin
+ curl_bin=$(which curl 2>/dev/null)
+ if [ ! -x "$curl_bin" ]; then
+ log_warning "curl not found, skipping gotify_hook"
+ return 1
+ fi
+
+ local ok="${#OKLIST[@]}"
+ local failed="${#FAILEDLIST[@]}"
+ local aborted="${#ABORTEDLIST[@]}"
+ local skipped="${#SKIPPEDLIST[@]}"
+
+ local title msg priority
+ if [ $(( failed + aborted )) -gt 0 ]; then
+ title="slackrepo [$CMD]: FAILED"
+ priority=8
+ else
+ title="slackrepo [$CMD]: OK"
+ priority=5
+ fi
+
+ msg="OK: $ok Failed: $failed Aborted: $aborted Skipped: $skipped"
+ [ ${#OKLIST[@]} -gt 0 ] && msg+=$'\nOK: '"$(printf '%s ' "${OKLIST[@]}")"
+ [ ${#FAILEDLIST[@]} -gt 0 ] && msg+=$'\nFailed: '"$(printf '%s ' "${FAILEDLIST[@]}")"
+ [ ${#ABORTEDLIST[@]} -gt 0 ] && msg+=$'\nAborted: '"$(printf '%s ' "${ABORTEDLIST[@]}")"
+
+ "$curl_bin" -s \
+ -H "X-Gotify-Key: $SB_GOTIFY_KEY" \
+ -F "title=$title" \
+ -F "message=$msg" \
+ -F "priority=$priority" \
+ "$SB_GOTIFY_URL" >/dev/null
+ local stat=$?
+ [ $stat -ne 0 ] && log_warning "gotify_hook failed, status $stat"
+ return $stat
+}
+
+function bell_hook
+{
+ printf '\a'
+ return 0
+}
+
+HOOK_FINISH=( manage_packages_hook bell_hook genrepos_hook gen_web_hook dep_template_hook rsync_push_hook recap_hook gotify_hook )
+
+#-------------------------------------------------------------------------------
+# gen_repos_files.sh (disabled by default)
+
+USE_GENREPOS='1'
+
+#-------------------------------------------------------------------------------
+export XZ_OPT="--threads=0"