Skip to content

Commit a97098b

Browse files
v2.2.2
Co-Authored-By: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-Authored-By: userdocs <[email protected]>
1 parent a7986a6 commit a97098b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+5991
-956
lines changed

.github/copilot-instructions.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,104 @@
1+
# AI Coding Guide for This Repo
2+
3+
Purpose: Make AI contributions precise, minimal, and correct. Follow these rules strictly. Do not expand scope beyond the prompt.
4+
5+
## Bash scripting (applies to all repos)
6+
7+
Do
8+
- Use `#!/bin/bash` as the shebang for Bash scripts.
9+
- Use the `.bash` extension for Bash; use `.sh` only for POSIX-only scripts.
10+
- Prefer `$BASH_SOURCE` over `$0` for script path detection.
11+
- Use `printf '%s'` for plain strings and `printf '%b'` for escape sequences. Avoid `echo`.
12+
- Keep changes simple, modular, and scoped to the exact prompt.
13+
- Write readable code; add concise comments explaining intent and non-obvious logic.
14+
- Handle errors explicitly (per function is acceptable); return helpful, actionable messages.
15+
- Structure changes in small stages; keep functions focused.
16+
- Format using Google’s Shell Style Guide: https://google.github.io/styleguide/shellguide.html
17+
- For Bash references, consult: https://mywiki.wooledge.org and https://mywiki.wooledge.org/BashFAQ and include a source link when possible. Do not invent links.
18+
19+
Avoid
20+
- Global “set -euo pipefail”; prefer targeted checks and explicit error handling.
21+
- Uppercase variable names for general scripting (reserve UPPERCASE for Docker/env settings).
22+
- Clever one-liners that harm clarity.
23+
- Generalized or speculative changes not asked for in the prompt.
24+
- Over-engineering; keep it stable, concise, and C-like in mindset.
25+
26+
Scope and behavior
27+
- Only implement what the prompt requests.
28+
- Keep solutions minimal and modular; do not add placeholders or future-proofing unless required.
29+
- When giving Bash/shell answers, add a relevant wooledge link if helpful; never fabricate links.
30+
31+
## GitHub Workflows (all repos)
32+
33+
- In reusable workflows, any job that uses outputs from another job must declare that job in `needs` to avoid null outputs.
34+
- Do not use outdated Actions. Check for current recommended versions before editing.
35+
- The `gh` CLI cannot fetch the ID of a workflow run it just started via `gh run workflow`. List runs afterward and extract the ID.
36+
37+
## If repo name matches `*-musl-cross-make`
38+
39+
Toolchain specifics
40+
- Use both `-static` and `--static` to produce static toolchain binaries. Using only `-static` can miss POSIX threads.
41+
- When using `../config.mak`, always load options from both `../gcc-configure-options.md` and `../gcc-configure-options-recursive.md`.
42+
- The binutils gold linker is deprecated. Use `ld=default` and `--disable-gold`.
43+
44+
Fully static toolchains with musl
45+
- Do not use LTO: avoid `-flto` and `-fuse-linker-plugin`.
46+
- Do not add any LTO-related settings.
47+
- Only set linker options such as `LDFLAGS` at link time, not during library builds.
48+
- GNU libtool redefines `-static`; to ensure static linking, use `--static` or `-Wl,-static` (optionally with `-static`) in `LDFLAGS`.
49+
- For static OpenSSL: do not use `openssl -static` (it disables threads/PIE/PIC). For `-static-pie` with musl/Alpine, use the correct flags and approach.
50+
- Do not use glibc-only flags or glibcisms for musl toolchains.
51+
52+
## Debugging with QEMU
53+
54+
- Start the target under QEMU with gdbstub, then attach with gdb:
55+
- `qemu -g <port> <binary>` (e.g., `qemu -g 1234 ./qbt-nox-static`)
56+
- In another terminal: `gdb ./qbt-nox-static` and `target remote :1234`
57+
58+
## If repo name matches `*qbittorrent-nox-static`
59+
60+
`qi.bash` script goals
61+
- Simple installer that verifies installation and binaries.
62+
- Shebang must be `#!/bin/bash`.
63+
64+
OS detection
65+
- `source /etc/os-release`.
66+
- Supported: `ID=alpine`, `ID=debian`, or `ID_LIKE` contains `debian`. Otherwise exit with a clear reason.
67+
68+
Transfer tools
69+
- Prefer `curl` if present; use `wget` if present and `curl` is not; exit if neither is available.
70+
- Detect presence of `gh` CLI and use it when available, but it is not required.
71+
72+
Architecture detection
73+
- Alpine: `apk --print-arch`.
74+
- Debian-like: `dpkg --print-architecture`.
75+
- Architectures are the same across distros except `armhf`: Debian uses `armv7`, Alpine uses `armv6`.
76+
- If architecture is not valid/supported, exit with a reason.
77+
78+
Download function
79+
- Build the download URL from the detected architecture.
80+
- Create and store the download’s SHA-256 sum.
81+
82+
Attestation (optional)
83+
- When `gh` CLI is available and usable, verify downloaded binaries:
84+
- `gh attestation verify <INSTALL_PATH> --repo <REPO> 2> /dev/null`
85+
86+
Error handling
87+
- Provide a helper that checks command exit codes and exits with a concise, helpful message on failure.
88+
89+
Output formatting
90+
- Provide a print helper that supports:
91+
- `[INFO]` (blue), `[WARNING]` (yellow), `[ERROR]` (red), `[SUCCESS]` (green), `[FAILURE]` (magenta)
92+
- Use `printf '%s'` and `printf '%b'`; do not use `echo`.
93+
- Keep messages succinct. Be verbose only on errors to aid troubleshooting.
94+
95+
---
96+
97+
Meta for AI contributors
98+
- Be conservative: do only what the prompt requests. No broad refactors.
99+
- Prefer small, well-named functions and staged changes.
100+
- Preserve existing public behavior and style unless the prompt requires changes.
101+
- If something cannot be done with available context/tools, state why and propose the smallest viable alternative.
1102
# Bash Scripting - All repos
2103

3104
- use $BASH_SOURCE instead of $0
@@ -10,10 +111,16 @@
10111
- Always makes changes in stages, a modular approach.
11112
- use Google style guide for formatting of bash scripts - https://google.github.io/styleguide/shellguide.html
12113
- Always use `#!/bin/bash` as the shebang.
114+
- Always use the extensions `bash` for bash script and `sh` only for posix shell scripts
13115
- Use `printf '%s'` for printing strings and `printf '%b'` for escape sequences. **Avoid using `echo`.**
14116
- Comment code to explain changes and logic.
15117
- always prefer readability of code over complex one lines. Unless that foramt is promoted by the style guide.
16118
- For Bash/shell questions, consult [mywiki.wooledge.org](https://mywiki.wooledge.org) or [BashFAQ](https://mywiki.wooledge.org/BashFAQ) first. **Provide a source link when possible.**
119+
- Don't hallucinate <mywiki.wooledge.org> links in comments
120+
- think like a c developer not a javascript developer. stable, concise, elegant and thoughtful. Not edgy and bleeding edge for the sake of it.
121+
- when providing a solution to a prompt don't provide solutions outside the scope of the prompt nor add loads checks and fallbacks that quickly become redundant in following prompts.
122+
- it makes me wast premium tokens making you fix the brken things you added or changed that were outside the scope of the prompt to begin with.
123+
- provide changes specific to the prompt given.
17124

18125
# GitHub Workflows - All repos
19126

@@ -80,3 +187,8 @@ ouputs
80187
- Use `printf '%s'` for printing strings and `printf '%b'` for escape sequences. **Avoid using `echo`.**
81188
- this function will provide end user information understanding or troubleshooting script outcomes.
82189
- it should be succinct unless there is an error or failure, then it should be verbose enough to help.
190+
191+
## Astro and Astro starlight template for documentation
192+
193+
- Always use the mcp server https://mcp.docs.astro.build/mcp
194+
- Always make sure imported mdx components start with an upper case letter.

.github/workflows/ci-alpine-build.yml

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
runs_on: ["ubuntu-24.04-arm"]
34-
os_id: [alpine]
35-
os_version_id: [edge]
34+
os_id: ["alpine"]
35+
os_version_id: ["edge"]
3636
qbt_cross_name: ["armhf", "armv7", "aarch64", "riscv64", "x86_64", "x86"]
3737
qbt_libtorrent_version: ["1.2", "2.0"]
3838
qbt_build_tool: [""]
@@ -45,7 +45,6 @@ jobs:
4545

4646
env:
4747
qbt_build_dir: "qbt-build"
48-
container_name: "multiarch"
4948
script_name: ${{ inputs.script_name }}
5049
set_skip_icu: ${{ inputs.icu }}
5150
set_workflow_files: ${{ inputs.workflow-files }}
@@ -54,6 +53,7 @@ jobs:
5453
set_qbt_with_qemu: "" # default is yes
5554
set_qbt_host_deps: "" # default is no
5655
set_qbt_host_deps_repo: "" # default is userdocs/qbt-host-deps
56+
workspace: ${{ github.workspace }}
5757

5858
steps:
5959
- name: Checkout ${{ inputs.distinct_id }}
@@ -106,78 +106,77 @@ jobs:
106106
printf '%s\n\n' "DEBIAN_FRONTEND=noninteractive" >> env.custom
107107
108108
- name: Host - Bootstrap qemu
109-
uses: userdocs/actions/qemu@e74d179578ddcf1cd07cd9eefd0915f33a3bd600 # v1.0.1
109+
uses: userdocs/actions/qemu@e8f57bd585c7bb6dcce011694d6772bab657abca # v1.0.7
110+
with:
111+
target_arch: ${{ matrix.qbt_cross_name }}
110112

111-
- uses: userdocs/actions/qbt_docker@e74d179578ddcf1cd07cd9eefd0915f33a3bd600 # v1.0.1
113+
- name: Host - Bootstrap docker container
114+
uses: userdocs/actions/qbt_docker@e8f57bd585c7bb6dcce011694d6772bab657abca # v1.0.7
112115
with:
113-
# if the env.custom file exists, it will be used to pass environment
114-
distinct_id: ${{ inputs.distinct_id }}
115-
use_host_env: "false"
116-
container_name: ${{ env.container_name }}
117116
os_id: ${{ matrix.os_id }}
118117
os_version_id: ${{ matrix.os_version_id }}
119-
custom_docker_commands: ""
120-
additional_alpine_apps: "bash curl git"
121-
additional_debian_apps: "bash curl git"
118+
additional_apps: "curl git"
122119

123120
- name: Host - patches ${{ inputs.distinct_id }}
124121
if: hashFiles('patches/**') != ''
125-
run: mkdir -p ${qbt_build_dir}/patches && cp -rf patches/* ${qbt_build_dir}/patches/
122+
run: mkdir -p "${qbt_build_dir}/patches" && cp -rf patches/* "${qbt_build_dir}/patches/"
126123

127124
- name: Docker - bootstrap_deps ${{ inputs.distinct_id }}
128125
if: inputs.script_name == 'qbt-nox-static.bash'
129-
run: docker exec -u gh:gh ${container_name} bash ${script_name} bootstrap_deps
126+
run: docker exec "${container_name}" bash "${script_name}" bootstrap_deps
130127

131128
- name: Docker - Bootstrap build ${{ inputs.distinct_id }}
132-
run: docker exec -u gh:gh ${container_name} bash ${script_name} -bs-a
129+
run: docker exec "${container_name}" bash "${script_name}" -bs-a
133130

134131
- name: Docker - glibc ${{ inputs.distinct_id }}
135132
if : matrix.os_id != 'alpine'
136-
run: docker exec -u gh:gh ${container_name} bash ${script_name} glibc
133+
run: docker exec "${container_name}" bash "${script_name}" glibc
137134

138135
- name: Docker - zlib ${{ inputs.distinct_id }}
139-
run: docker exec -u gh:gh ${container_name} bash ${script_name} zlib
136+
run: docker exec "${container_name}" bash "${script_name}" zlib
140137

141138
- name: Docker - iconv ${{ inputs.distinct_id }}
142139
if: matrix.qbt_libtorrent_version == '1.2'
143-
run: docker exec -u gh:gh ${container_name} bash ${script_name} iconv
140+
run: docker exec "${container_name}" bash "${script_name}" iconv
144141

145142
- name: Docker - icu ${{ inputs.distinct_id }}
146143
if: env.set_skip_icu == 'no'
147-
run: docker exec -u gh:gh ${container_name} bash ${script_name} icu
144+
run: docker exec "${container_name}" bash "${script_name}" icu
148145

149146
- name: Docker - openssl ${{ inputs.distinct_id }}
150-
run: docker exec -u gh:gh ${container_name} bash ${script_name} openssl
147+
run: docker exec "${container_name}" bash "${script_name}" openssl
151148

152149
- name: Docker - boost ${{ inputs.distinct_id }}
153-
run: docker exec -u gh:gh ${container_name} bash ${script_name} boost
150+
run: docker exec "${container_name}" bash "${script_name}" boost
154151

155152
- name: Docker - libtorrent ${{ inputs.distinct_id }}
156-
run: docker exec -u gh:gh ${container_name} bash ${script_name} libtorrent
153+
run: docker exec "${container_name}" bash "${script_name}" libtorrent
157154

158-
- name: Docker - double_conversion ${{ inputs.distinct_id }}
159-
if: matrix.qbt_build_tool == ''
160-
run: docker exec -u gh:gh ${container_name} bash ${script_name} double_conversion
155+
# - name: Docker - double_conversion ${{ inputs.distinct_id }}
156+
# if: matrix.qbt_build_tool == ''
157+
# run: docker exec "${container_name}" bash "${script_name}" double_conversion
161158

162159
- name: Docker - qtbase ${{ inputs.distinct_id }}
163-
run: docker exec -u gh:gh ${container_name} bash ${script_name} qtbase
160+
run: docker exec "${container_name}" bash "${script_name}" qtbase
164161

165162
- name: Docker - qttools ${{ inputs.distinct_id }}
166-
run: docker exec -u gh:gh ${container_name} bash ${script_name} qttools
163+
run: docker exec "${container_name}" bash "${script_name}" qttools
167164

168165
- name: Docker - qbittorrent ${{ inputs.distinct_id }}
169-
run: docker exec -u gh:gh ${container_name} bash ${script_name} qbittorrent
166+
run: docker exec "${container_name}" bash "${script_name}" qbittorrent
170167

171168
- name: Docker - Set release asset name ${{ inputs.distinct_id }}
172-
run: docker exec -u gh:gh -w /home/gh/${qbt_build_dir}/completed ${container_name} mv -f qbittorrent-nox ${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}qbittorrent-nox
169+
run: docker exec -w ${wd}/${qbt_build_dir}/completed "${container_name}" mv -f qbittorrent-nox "${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}qbittorrent-nox"
173170

174171
- name: Generate artifact attestation ${{ inputs.distinct_id }}
175-
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
172+
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
176173
with:
177174
subject-path: "${{ env.qbt_build_dir }}/completed/${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}qbittorrent-nox"
178175

179176
- name: Docker - Release Info ${{ inputs.distinct_id }}
180-
run: docker exec -u gh:gh -w /home/gh/${qbt_build_dir}/release_info ${container_name} bash -c 'mv *.md *.json '/home/gh/${qbt_build_dir}/completed''
177+
working-directory: "${{ env.workspace }}/${{ env.qbt_build_dir }}/release_info"
178+
run: |
179+
mv *.md *.json "${workspace}/${qbt_build_dir}/completed"
181180
182181
- name: Host - Upload libtorrent-v${{ matrix.qbt_libtorrent_version }}-qbittorrent-nox and release info artifact ${{ inputs.distinct_id }}
183182
if: success()
@@ -197,7 +196,7 @@ jobs:
197196

198197
# - name: Host - Upload build dir on error or cancel
199198
# if: ( cancelled() || failure() )
200-
# uses: actions/upload-artifact@v4
199+
# uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
201200
# with:
202201
# name: "${{ matrix.qbt_cross_name }}-libtorrent-v${{ matrix.qbt_libtorrent_version }}-logs"
203202
# path: "${{ env.qbt_build_dir }}"

.github/workflows/ci-alpine-release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,22 @@ jobs:
5656
env:
5757
lt_version: ${{ matrix.qbt_libtorrent_version }}
5858
run: |
59-
revision="$(jq -r .revision ${lt_version}/*-dependency-version.json | sort -nr | head -n1)"
60-
boost="$(jq -r .boost ${lt_version}/*-dependency-version.json | head -n1)"
59+
shopt -s nullglob
6160
62-
for dependency_version_json in ${lt_version}/*-dependency-version.json; do
61+
revision="$(jq -r .revision "${lt_version}"/*-dependency-version.json | sort -nr | head -n1)"
62+
boost="$(jq -r .boost "${lt_version}"/*-dependency-version.json | head -n1)"
63+
64+
# this need to check both 1.2 and 2.0 folders to merge the libtorrent versions in the dependency-version.json
65+
for dependency_version_json in {1.2,2.0}/*-dependency-version.json; do
6366
if [[ -f ${dependency_version_json} ]]; then
6467
sed -r 's/"boost": (.*)/BOOST_PLACEHOLDER/g' -i "${dependency_version_json}"
6568
sed -r 's/"revision": (.*)/REVISION_PLACEHOLDER/g' -i "${dependency_version_json}"
6669
dependency_version+=("${dependency_version_json}")
6770
fi
6871
done
6972
70-
for release_md in ${lt_version}/*-release.md; do
73+
# This file only needs to merge info specific to the libtorrent matrix running it.
74+
for release_md in "${lt_version}"/*-release.md; do
7175
if [[ -f ${release_md} ]]; then
7276
sed -r 's/^\|(.*)revision(.*)\|(.*)\|$/REVISION_PLACEHOLDER/g' -i "${release_md}"
7377
release_md+=("${release_md}")

0 commit comments

Comments
 (0)