From 9bc7ef3b5a75393aeacc0725d5959375585a86ec Mon Sep 17 00:00:00 2001 From: cflmy Date: Thu, 17 Sep 2026 09:57:11 +0800 Subject: [PATCH] feat(packaging): scaffold Ubuntu PPA debian/ for marqdo CLI Add control/rules/changelog and ppa-build-source.sh (cargo vendor + debuild -S). Co-authored-by: Cursor --- .gitignore | 6 +-- debian/README.Debian | 14 ++++++ debian/changelog | 6 +++ debian/control | 26 +++++++++++ debian/copyright | 24 ++++++++++ debian/rules | 40 +++++++++++++++++ debian/source/format | 1 + debian/source/options | 2 + doc/README.md | 1 + doc/design/ubuntu-ppa.md | 88 ++++++++++++++++++++++++++++++++++++ scripts/ppa-build-source.sh | 90 +++++++++++++++++++++++++++++++++++++ 11 files changed, 294 insertions(+), 4 deletions(-) create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/options create mode 100644 doc/design/ubuntu-ppa.md create mode 100755 scripts/ppa-build-source.sh diff --git a/.gitignore b/.gitignore index 4186dce..ad308fa 100644 --- a/.gitignore +++ b/.gitignore @@ -24,10 +24,8 @@ .marqdo/ **/.marqdo/ .marqdo-ext/ -.env -.env.r2 -*.pem -**/r2.env +/vendor/ +/.cargo/config.toml # Generated HTML beside tracked public/*.mq.md (sources stay in git) /public/index.html diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..e0c2f64 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,14 @@ +Marqdo for Ubuntu (PPA) +======================= + +This package installs the marqdo CLI (/usr/bin/marqdo). + +Official language extensions are not bundled. After install: + + marqdo ext add web + marqdo ext add quantum + +Extension packs download from https://ext.marqdo.com (then GitHub / proxy). + +Documentation: https://github.com/cflmy/marqdo +PPA packaging notes: doc/design/ubuntu-ppa.md in the upstream repository. diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..91e70de --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +marqdo (1.0.2-1ppa1) noble; urgency=medium + + * Initial Ubuntu PPA packaging for Marqdo 1.0.2. + * CLI only; extensions via "marqdo ext add" / ext.marqdo.com. + + -- cflmy Thu, 17 Sep 2026 09:55:00 +0800 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..7d3554d --- /dev/null +++ b/debian/control @@ -0,0 +1,26 @@ +Source: marqdo +Section: devel +Priority: optional +Maintainer: cflmy +Build-Depends: + debhelper-compat (= 13), + cargo, + rustc, + pkg-config, + libssl-dev, + ca-certificates +Standards-Version: 4.7.0 +Homepage: https://github.com/cflmy/marqdo +Vcs-Git: https://github.com/cflmy/marqdo.git +Vcs-Browser: https://github.com/cflmy/marqdo +Rules-Requires-Root: no + +Package: marqdo +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, ca-certificates +Description: Markdown markers as an interpreted programming language + Marqdo treats Markdown markers as executable syntax (code / return / + control flow). This package installs the marqdo CLI. + . + Official extensions (web, quantum, …) are installed separately via + "marqdo ext add" and download from https://ext.marqdo.com . diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..a548a8a --- /dev/null +++ b/debian/copyright @@ -0,0 +1,24 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: marqdo +Upstream-Contact: cflmy +Source: https://github.com/cflmy/marqdo + +Files: * +Copyright: 2024-2026 cflmy +License: Apache-2.0 + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian systems, the complete text of the Apache License version 2 + can be found in "/usr/share/common-licenses/Apache-2.0". diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..1540d54 --- /dev/null +++ b/debian/rules @@ -0,0 +1,40 @@ +#!/usr/bin/make -f + +export DH_VERBOSE = 1 +# Offline builds on Launchpad: use vendored crates when present. +export CARGO_HOME = $(CURDIR)/debian/cargo_home +export CARGO_NET_OFFLINE = true + +%: + dh $@ + +override_dh_auto_configure: + mkdir -p debian/cargo_home + @if [ -f "$(CURDIR)/.cargo/config.toml" ] || [ -d "$(CURDIR)/vendor" ]; then \ + echo "Using vendored Cargo dependencies"; \ + else \ + echo "WARNING: no vendor/ — online cargo fetch required (not for Launchpad)"; \ + export CARGO_NET_OFFLINE=false; \ + fi + +override_dh_auto_build: + mkdir -p debian/cargo_home + if [ -d "$(CURDIR)/vendor" ]; then \ + CARGO_NET_OFFLINE=true cargo build --release --locked --offline; \ + else \ + cargo build --release --locked; \ + fi + +override_dh_auto_test: + @echo "Skipping full test suite on package build (run cargo test in CI)." + +override_dh_auto_install: + install -d $(CURDIR)/debian/marqdo/usr/bin + install -m 0755 $(CURDIR)/target/release/marqdo \ + $(CURDIR)/debian/marqdo/usr/bin/marqdo + +override_dh_auto_clean: + dh_auto_clean + rm -rf debian/cargo_home + # keep vendor/ if present (part of source package) + cargo clean || true diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..88a6d9f --- /dev/null +++ b/debian/source/options @@ -0,0 +1,2 @@ +# Ignore temporary files while editing patches +extend-diff-ignore = "^vendor/" diff --git a/doc/README.md b/doc/README.md index 6e18da0..f012f3e 100644 --- a/doc/README.md +++ b/doc/README.md @@ -54,6 +54,7 @@ | [design/ext-agent-plan.md](design/ext-agent-plan.md) | **`## 多步` / `## plan` 锁定设计**(工作簿文件、subtask 执行、修订循环、`step` 默认写回) | | [design/ext-cli.md](design/ext-cli.md) | **`marqdo ext list/add/remove` 官方扩展安装器** | | [design/ext-cdn.md](design/ext-cdn.md) | **扩展 CDN(R2 / ext.marqdo.com)与分开发版** | +| [design/ubuntu-ppa.md](design/ubuntu-ppa.md) | **Ubuntu PPA 打包与上传** | | [design/ext-web.md](design/ext-web.md) | **官方扩展 `ext/web`(页面/库表/绑定/后台;ABI + CLI;设计锁定)** | | [design/ext-web-go-rewrite.md](design/ext-web-go-rewrite.md) | **`plugins/web` Go 全量重写**(多语言 ABI · 网页制备完备 · anlian 验收) | | [adr/0004-web-plugin-go.md](adr/0004-web-plugin-go.md) | **Accepted:web 原生插件实现语言为 Go** | diff --git a/doc/design/ubuntu-ppa.md b/doc/design/ubuntu-ppa.md new file mode 100644 index 0000000..e980009 --- /dev/null +++ b/doc/design/ubuntu-ppa.md @@ -0,0 +1,88 @@ +# Ubuntu PPA packaging (Marqdo) + +| | | +|---|---| +| Status | **Scaffold** — local `debian/` ready; first upload needs Launchpad PPA + vendored crates | +| Maintainer | cflmy \ | +| GPG | `505943294D04C803` (fingerprint `52A1…C803`) | +| Suggested PPA | `ppa:cflmy/marqdo` | + +## Goal + +Users install with: + +```bash +sudo add-apt-repository ppa:cflmy/marqdo +sudo apt update +sudo apt install marqdo +``` + +CLI and extension packs stay independent: the `.deb` ships the **interpreter**; `marqdo ext add …` still pulls from **https://ext.marqdo.com** (then GitHub / proxy). + +## One-time Launchpad setup + +1. Create PPA: https://launchpad.net/~cflmy/+activate-ppa → name e.g. `marqdo` +2. OpenPGP key already on Launchpad (done) +3. Sign Ubuntu Code of Conduct if Launchpad asks +4. On the build machine: + +```bash +sudo apt install build-essential debhelper devscripts dput lintian \ + dh-cargo cargo rustc pkg-config +``` + +## Package layout + +Debian packaging lives under repo-root `debian/` (this tree). + +| File | Role | +|------|------| +| `debian/control` | Package metadata / deps | +| `debian/changelog` | Upload revisions (`dch`) | +| `debian/rules` | `dh` + cargo build | +| `debian/copyright` | Apache-2.0 | +| `debian/source/format` | `3.0 (quilt)` | +| `debian/watch` | Optional upstream tarball watch | +| `scripts/ppa-build-source.sh` | Vendor + `debuild -S` helper | + +## Versioning + +- Upstream SemVer: `Cargo.toml` / git tag `vX.Y.Z` +- Debian revision: `X.Y.Z-1ppa1~SERIES` (SERIES = `noble`, `jammy`, …) +- **Ext pack** SemVer (`ext/VERSION`) is **not** the deb version; bump deb only when CLI/stdlib packaging changes. + +## Build source package (local) + +```bash +# from repo root, clean tree preferred +./scripts/ppa-build-source.sh noble # or jammy +# → ../build-area/marqdo_X.Y.Z-1ppa1~noble_source.changes +``` + +The script vendors Cargo crates into `vendor/` (Launchpad builders have **no network**). + +## Upload + +```bash +dput ppa:cflmy/marqdo ../build-area/marqdo_*_source.changes +``` + +Wait for https://launchpad.net/~cflmy/+archive/ubuntu/marqdo/+builds + +## Series strategy + +Start with **one** series you use daily (e.g. `noble` 24.04 or `resolute` 26.04). Copy the changelog stanza and rebuild per series, or use `backportpackage` later. + +## Out of scope (v1 deb) + +- Shipping `ext/native/*.so` inside the deb (use CDN `ext add`) +- WASM / VSIX +- Multi-arch cross builds beyond amd64 + +## Checklist for first upload + +- [ ] PPA `marqdo` exists under `~cflmy` +- [ ] `./scripts/ppa-build-source.sh ` succeeds +- [ ] `lintian` on `.changes` is acceptable +- [ ] `dput` accepted; amd64 build green on Launchpad +- [ ] Fresh VM: `add-apt-repository` + `apt install marqdo` + `marqdo version` diff --git a/scripts/ppa-build-source.sh b/scripts/ppa-build-source.sh new file mode 100755 index 0000000..3cb34cf --- /dev/null +++ b/scripts/ppa-build-source.sh @@ -0,0 +1,90 @@ +#!/usr/bin/env bash +# Build a signed Ubuntu *source* package for Launchpad PPA. +# Usage: ./scripts/ppa-build-source.sh [series] +# Example: ./scripts/ppa-build-source.sh noble +set -euo pipefail + +SERIES="${1:-noble}" +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +cd "$ROOT" + +need() { command -v "$1" >/dev/null || { echo "missing tool: $1 (sudo apt install $2)"; exit 1; }; } +need cargo cargo +need debuild devscripts +need dpkg-parsechangelog dpkg-dev + +VER="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" +DEB_VER="${VER}-1ppa1~${SERIES}" +PKG_ROOT="${TMPDIR:-/tmp}/marqdo-ppa/${VER}" +BUILD_AREA="${ROOT}/../build-area" +GPG_KEY="${MARQDO_PPA_GPG_KEY:-505943294D04C803}" + +echo "==> upstream ${VER} → debian ${DEB_VER} (${SERIES})" +rm -rf "$PKG_ROOT" +mkdir -p "$PKG_ROOT" "$BUILD_AREA" + +# Clean export of sources (no target/, .git) +if command -v git >/dev/null && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + git archive --format=tar HEAD | tar -x -C "$PKG_ROOT" +else + rsync -a --exclude target --exclude .git --exclude build-area "$ROOT"/ "$PKG_ROOT"/ +fi + +# Ensure debian/ from working tree (may be newer than last commit) +rsync -a "$ROOT/debian/" "$PKG_ROOT/debian/" + +# Series-specific changelog entry (rewrite top distribution) +cd "$PKG_ROOT" +# Update changelog top line distribution / version if needed +python3 - < cargo vendor (Launchpad offline)" +mkdir -p .cargo +cargo vendor --locked vendor >/tmp/marqdo-cargo-vendor.conf +# cargo vendor prints config to stdout; also write known-good offline config +cat > .cargo/config.toml <<'EOF' +[source.crates-io] +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "vendor" +EOF + +# Orig tarball: upstream version without debian/ +cd "$(dirname "$PKG_ROOT")" +ORIG="marqdo_${VER}.orig.tar.xz" +if [ ! -f "$BUILD_AREA/$ORIG" ]; then + tar -cJf "$BUILD_AREA/$ORIG" \ + --exclude=debian \ + -C "$(dirname "$PKG_ROOT")" "$(basename "$PKG_ROOT")" +fi +# debuild expects ../marqdo_VER.orig.tar.xz relative to package dir parent +ln -sfn "$BUILD_AREA/$ORIG" "marqdo_${VER}.orig.tar.xz" + +cd "$PKG_ROOT" +echo "==> debuild -S (key ${GPG_KEY})" +debuild -S -sa -k"${GPG_KEY}" -d + +echo "==> artifacts:" +ls -la "$BUILD_AREA"/marqdo_"${DEB_VER}"* 2>/dev/null || ls -la ../marqdo_"${DEB_VER}"* +CHANGES="$(ls -1 ../marqdo_${DEB_VER}_source.changes 2>/dev/null | head -1)" +if [ -n "${CHANGES:-}" ]; then + cp -f ../marqdo_"${DEB_VER}"* "$BUILD_AREA/" 2>/dev/null || true + echo + echo "Upload with:" + echo " dput ppa:cflmy/marqdo $BUILD_AREA/$(basename "$CHANGES")" +fi