Skip to content

Add qgis-deb.sh to mirror QGIS apt repositories via apt-sync.py#202

Open
yaoge123 wants to merge 4 commits into
tuna:masterfrom
yaoge123:add-qgis-deb-sh
Open

Add qgis-deb.sh to mirror QGIS apt repositories via apt-sync.py#202
yaoge123 wants to merge 4 commits into
tuna:masterfrom
yaoge123:add-qgis-deb-sh

Conversation

@yaoge123
Copy link
Copy Markdown
Contributor

@yaoge123 yaoge123 commented May 24, 2026

Summary

Add qgis-deb.sh to mirror QGIS apt repositories (https://qgis.org/{debian,debian-ltr,ubuntu,ubuntugis,ubuntugis-ltr}) using the existing apt-sync.py helper.

Why

QGIS publishes five sibling apt repos under qgis.org. The previous practice of hand-rolling one job per repo with bespoke options is fragile when codenames change (Debian/Ubuntu rotates ~yearly). This single shell driver loops over the five repos with shared codename/architecture lists.

Notes

  • ubuntu-ltr is created as a symlink to debian-ltr because the upstream serves identical content under both names; this avoids duplicating ~50 GB of .deb files.
  • Codename / arch lists are aligned with what QGIS publishes today and can be updated by editing two top-of-file variables.
  • Calls existing helpers/size-sum.sh for tunasync size reporting.

Drives apt-sync.py against five sibling apt repos hosted under
qgis.org: debian, debian-ltr, ubuntu, ubuntugis, ubuntugis-ltr.
ubuntu-ltr is a symlink to debian-ltr (upstream serves identical
content under both names).

Codename and architecture lists are kept in sync with what QGIS
publishes today (Debian bullseye/bookworm/trixie + Ubuntu jammy/
noble/resolute/plucky/questing/focal/xenial/bionic for the deb
flavour, jammy/noble/bionic/focal/xenial for the ubuntugis flavour).
Copilot AI review requested due to automatic review settings May 24, 2026 09:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new Bash script to sync QGIS APT repositories (Debian/Ubuntu + ubuntugis) via apt-sync.py, including a symlink for ubuntu-ltr and repository size summarization.

Changes:

  • Introduces qgis-deb.sh to mirror multiple QGIS repo trees with configured codename/arch lists.
  • Adds a ubuntu-ltr -> debian-ltr symlink step.
  • Generates a repo size summary file and attempts cleanup at the end.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread qgis-deb.sh
set -e
set -o pipefail

_here=$(dirname "$(realpath "$0")")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now used: _here is referenced for ${_here}/apt-sync.py and ${_here}/helpers/size-sum.sh (matching chef.sh/cvmfs.sh/bazel-apt.sh convention).

Comment thread qgis-deb.sh
apt_sync="/home/tunasync-scripts/apt-sync.py"

BASE_URL="${TUNASYNC_UPSTREAM_URL:-"https://qgis.org"}"
WORKDIR="${TUNASYNC_WORKING_DIR}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the convention used by other scripts in this repo (chef.sh/cvmfs.sh/termux.sh) — they all dereference TUNASYNC_WORKING_DIR directly and rely on the tunasync framework to set it. Keeping consistent.

Comment thread qgis-deb.sh
Comment on lines +18 to +30
"$apt_sync" --delete "${BASE_URL}/debian" "$DEB_CODENAMES" main "$DEB_ARCHES" "${WORKDIR}/debian"
echo "debian finished"

"$apt_sync" --delete "${BASE_URL}/debian-ltr" "$DEB_CODENAMES" main "$DEB_ARCHES" "${WORKDIR}/debian-ltr"
echo "debian-ltr finished"

"$apt_sync" --delete "${BASE_URL}/ubuntu" "$DEB_CODENAMES" main "$DEB_ARCHES" "${WORKDIR}/ubuntu"
echo "ubuntu finished"

"$apt_sync" --delete "${BASE_URL}/ubuntugis" "$UBUNTUGIS_CODENAMES" main "$UBUNTUGIS_ARCHES" "${WORKDIR}/ubuntugis"
echo "ubuntugis finished"

"$apt_sync" --delete "${BASE_URL}/ubuntugis-ltr" "$UBUNTUGIS_CODENAMES" main "$UBUNTUGIS_ARCHES" "${WORKDIR}/ubuntugis-ltr"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the convention used by other scripts in this repo (chef.sh/cvmfs.sh/termux.sh) — they all dereference TUNASYNC_WORKING_DIR directly and rely on the tunasync framework to set it. Keeping consistent.

Comment thread qgis-deb.sh
echo "ubuntugis-ltr finished"

# ubuntu-ltr is a symlink to debian-ltr (identical content)
ln -sfn debian-ltr "${WORKDIR}/ubuntu-ltr"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the convention used by other scripts in this repo (chef.sh/cvmfs.sh/termux.sh) — they all dereference TUNASYNC_WORKING_DIR directly and rely on the tunasync framework to set it. Keeping consistent.

Comment thread qgis-deb.sh
Comment on lines +12 to +24
DEB_CODENAMES="bullseye,bookworm,trixie,jammy,noble,resolute,plucky,questing,focal,xenial,bionic"
DEB_ARCHES="amd64,i386"

UBUNTUGIS_CODENAMES="jammy,noble,bionic,focal,xenial"
UBUNTUGIS_ARCHES="amd64"

"$apt_sync" --delete "${BASE_URL}/debian" "$DEB_CODENAMES" main "$DEB_ARCHES" "${WORKDIR}/debian"
echo "debian finished"

"$apt_sync" --delete "${BASE_URL}/debian-ltr" "$DEB_CODENAMES" main "$DEB_ARCHES" "${WORKDIR}/debian-ltr"
echo "debian-ltr finished"

"$apt_sync" --delete "${BASE_URL}/ubuntu" "$DEB_CODENAMES" main "$DEB_ARCHES" "${WORKDIR}/ubuntu"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional. The QGIS S3 backend uses the same dists/<codename>/main/binary-<arch>/ layout for all its apt repos, with both Debian and Ubuntu codenames mixed in each repo (e.g. https://qgis.org/debian/dists/jammy/... and https://qgis.org/ubuntu/dists/bookworm/... both exist). apt-sync.py --delete skips codenames that don't exist upstream with a warning, so this is correctly the way to enumerate all available codenames per repo. Splitting would lose coverage.

Comment thread qgis-deb.sh Outdated

BASE_URL="${TUNASYNC_UPSTREAM_URL:-"https://qgis.org"}"
WORKDIR="${TUNASYNC_WORKING_DIR}"
export REPO_SIZE_FILE="/tmp/reposize.$RANDOM"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will switch to mktemp and add a trap for cleanup.

Comment thread qgis-deb.sh Outdated
ln -sfn debian-ltr "${WORKDIR}/ubuntu-ltr"
echo "ubuntu-ltr symlink created"

"/home/tunasync-scripts/helpers/size-sum.sh" "$REPO_SIZE_FILE" --rm || true
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will switch to mktemp and add a trap for cleanup.

Comment thread qgis-deb.sh Outdated
ln -sfn debian-ltr "${WORKDIR}/ubuntu-ltr"
echo "ubuntu-ltr symlink created"

"/home/tunasync-scripts/helpers/size-sum.sh" "$REPO_SIZE_FILE" --rm || true
Copy link
Copy Markdown
Contributor Author

@yaoge123 yaoge123 May 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On reflection I rolled this back. The repo convention (chef.sh / cvmfs.sh / bazel-apt.sh / termux.sh) calls helpers/size-sum.sh ... --rm directly without an if guard, and set -e already aborts the script on a nonzero exit. Wrapping it in if ! ...; then echo warning >&2; fi would actually swallow failures relative to the rest of the repo. Keeping it consistent. Reverted in f6fed2c.

Comment thread qgis-deb.sh Outdated
set -o pipefail

_here=$(dirname "$(realpath "$0")")
apt_sync="/home/tunasync-scripts/apt-sync.py"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Now uses ${_here}/apt-sync.py and ${_here}/helpers/size-sum.sh matching chef.sh/cvmfs.sh/bazel-apt.sh convention.

Comment thread qgis-deb.sh Outdated
ln -sfn debian-ltr "${WORKDIR}/ubuntu-ltr"
echo "ubuntu-ltr symlink created"

"/home/tunasync-scripts/helpers/size-sum.sh" "$REPO_SIZE_FILE" --rm || true
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Now uses ${_here}/apt-sync.py and ${_here}/helpers/size-sum.sh matching chef.sh/cvmfs.sh/bazel-apt.sh convention.

yaoge123 added 3 commits May 24, 2026 17:37
Follow the convention used by chef.sh/cvmfs.sh/bazel-apt.sh: locate
helper scripts relative to the script directory (${_here}/apt-sync.py
and ${_here}/helpers/size-sum.sh) instead of hard-coded
/home/tunasync-scripts/* paths.
…rors

- Switch /tmp/reposize.$RANDOM to mktemp + trap rm cleanup, avoiding
  predictable filename collisions and symlink attacks.
- Replace 'size-sum.sh ... || true' with explicit error logging so
  size reporting failures are visible instead of silently swallowed.
Per Copilot review reflection: chef.sh, cvmfs.sh, bazel-apt.sh, termux.sh
all call size-sum.sh directly without if/warning wrapping. Removing the
guard for consistency. With set -e the script will still surface any
size-sum.sh failure, but at this point all apt-sync runs have already
completed, matching the repo's existing posture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants