Skip to content

Commit 3d00648

Browse files
committed
revisions
1 parent a7986a6 commit 3d00648

File tree

8 files changed

+151
-21
lines changed

8 files changed

+151
-21
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-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}")

docs/src/components/buildinfo-introduction.astro

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
import { Code } from "@astrojs/starlight/components";
33
const response = await fetch(
4-
"https://github.com/userdocs/qbt-workflow-files/releases/latest/download/dependency-version.json"
4+
"https://github.com/userdocs/qbt-workflow-files/releases/latest/download/dependency-version.json",
55
);
66
77
const data = await response.json();
88
9-
const codeblock = `qBittorrent ${data.qbittorrent || "4.6.3"} was built with the following libraries:
10-
Qt: ${data.qt6 || "6.6.2"}
11-
Libtorrent: ${data.libtorrent_2_0 || "2.0.10"}
12-
Boost: ${data.boost || "1.84.0"}
13-
OpenSSL: ${data.openssl || "3.2.1"}
14-
zlib: ${data.zlib || "1.3.2"}-motley`;
9+
const codeblock = `qBittorrent ${data.qbittorrent || "5.1.2"} was built with the following libraries:
10+
Qt: ${data.qt6 || "6.9.1"}
11+
Libtorrent: ${data.libtorrent_2_0 || "2.0.11"}
12+
Boost: ${data.boost || "1.89.0"}
13+
OpenSSL: ${data.openssl || "3.5.2"}
14+
zlib: ${data.zlib || "1.3.1.1"}-motley`;
1515
1616
// {
1717
// "glibc_2_31": "2.31",

docs/src/content/docs/build-help.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ Add your patches there, for example.
252252

253253
## Build - default profile
254254

255-
Install all default modules (ICU is skipped) and build `qbittorrent-nox` to the default build directory `qbt-build/compelted`.
255+
Install all default modules (ICU is skipped) and build `qbittorrent-nox` to the default build directory `qbt-build/completed`.
256256

257257
```bash
258258
./qbt-nox-static.bash all
@@ -275,11 +275,11 @@ Here are the list of supported modules:
275275
```bash
276276
glibc (Debian based only)
277277
zlib (default)
278-
iconv (default)
278+
iconv (default libtorrent v1.2 only)
279279
icu (optional)
280280
openssl (default)
281281
boost (default)
282-
double_conversion (default for Qt6 on a modern OS - Bullseye / Jammy)
282+
double_conversion (default for Qt6 on a modern OS)
283283
qtbase (default)
284284
qttools (default)
285285
libtorrent (default)

docs/src/content/docs/script-installation.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ Some notes on the dockers method:
2929
- We use `-e "LANG=C.UTF-8"` with Debian based images to avoid some UTF errors.
3030

3131
:::tip[env file]
32+
You do not need to configure the env while bootstrapping the container. It can be done after via the `.qbt_env` file or exporting them.
33+
3234
There are multiple ways to pass an env file when using Docker.
3335

3436
- You can use the `--env-file` switch when creating the docker and provide a file with your [envs](/qbittorrent-nox-static/build-help#env-settings).
3537
- If a `.qbt_env` file is found in the same directory as the script, it will be used automatically.
3638
- Using ENV in a dockerfile is also possible.
39+
40+
The easist method is the `.qbt_env` as the script has support flags for this purpose.
3741
:::
3842

3943
</TabItem>
@@ -73,7 +77,7 @@ docker run -it -w /root -p 8080:8080 -e "LANG=C.UTF-8" -v ~/qbt:/root debian:lat
7377
If you need to download the script use this command
7478

7579
```bash
76-
curl --sLO https://raw.githubusercontent.com/userdocs/qbittorrent-nox-static/refs/heads/master/qbt-nox-static.bash && chmod +x qbt-nox-static.bash
80+
curl -sLO https://raw.githubusercontent.com/userdocs/qbittorrent-nox-static/refs/heads/master/qbt-nox-static.bash && chmod +x qbt-nox-static.bash
7781
```
7882

7983
</TabItem>

docs/src/content/docs/script-usage.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ Don't run this directly on the host system unless you know what you are doing. I
2121

2222
### Execute the script
2323

24+
:::caution[A reminder about the `.qbt_env`]
25+
If you have a `.qbt_env` in the same folder as the script it will override any custom env settings you provide.
26+
27+
Using flags will override your `.qbt_env`
28+
:::
29+
2430
```bash
2531
./qbt-nox-static.bash
2632
```
@@ -41,7 +47,11 @@ By passing `all` as the first argument, you can build everything based on the de
4147
./qbt-nox-static.bash all
4248
```
4349

44-
For example, to use `ICU` using `-i`, optimise for the host system CPU using `-o` to set `-march=native` and `-s` to strip the binary and build using libtorrent v1.2.19
50+
For example of using custom settings,
51+
52+
- to use `ICU` using `-i`
53+
- optimise for the host system CPU using `-o` to set `-march=native`
54+
- build using libtorrent v1.2.19
4555

4656
```bash
4757
./qbt-nox-static.bash all -i -o -s -lt v1.2.19
@@ -50,7 +60,7 @@ For example, to use `ICU` using `-i`, optimise for the host system CPU using `-o
5060
Same as previous command but using `env` settings
5161

5262
```bash
53-
qbt_libtorrent_tag="v1.2.19" qbt_skip_icu="yes" qbt_optimise_strip="yes" qbt_optimize="yes" ./qbt-nox-static.bash all
63+
qbt_libtorrent_tag="v1.2.19" qbt_skip_icu="yes" qbt_optimize="yes" ./qbt-nox-static.bash all
5464
```
5565

5666
For an older version of qBittorrent, you can specify the version using `-qt` and the libtorrent version using `-lt`

qbittorrent-nox-static.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,8 +2187,8 @@ _release_info() {
21872187
| Libtorrent | ${app_version[libtorrent]} |
21882188
| Boost | ${app_version[boost]} |
21892189
| OpenSSL | ${app_version[openssl]} |
2190-
| ${qbt_zlib_type} | ${app_version[zlib]} |
2191-
| revision | ${qbt_revision_version} |
2190+
| ${qbt_zlib_type} | ${app_version[zlib]} |
2191+
| revision | ${qbt_revision_version:-0} |
21922192
21932193
## Architecture and build info
21942194

qbt-nox-static.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,8 +2380,8 @@ _release_info() {
23802380
| Libtorrent | ${app_version[libtorrent]} |
23812381
| Boost | ${app_version[boost]} |
23822382
| OpenSSL | ${app_version[openssl]} |
2383-
| ${qbt_zlib_type} | ${app_version[zlib]} |
2384-
| revision | ${qbt_revision_version} |
2383+
| ${qbt_zlib_type} | ${app_version[zlib]} |
2384+
| revision | ${qbt_revision_version:-0} |
23852385
23862386
## Architecture and build info
23872387

0 commit comments

Comments
 (0)