Skip to content

build(release): mozconfig和出包脚本入库,补上编译机准备文档 - #27

Merged
WhiteNightShadow merged 5 commits into
mainfrom
chore/release-build
Oct 25, 2026
Merged

WhiteNightShadow merged 5 commits into
mainfrom
chore/release-build

Conversation

@WhiteNightShadow

@WhiteNightShadow WhiteNightShadow commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

背景

正式包一直在编译机上出。五个目标真正用的mozconfig只存在编译机的objdir里,每次发版的激活和编译脚本也只在那台机器上。编译机2026-10-25退掉了,这些东西跟着就没了。这个pr把它们整理进仓库,换一台新编译机也能照着出包。仓库里不写机器地址、账号、密钥和本机目录。

改动(按提交)

  • build(configs) mozconfig和v0.26.2发布包对齐,补上linux x86_64和windows:
    • 依据是五个v0.26.2发布包about:buildconfig里记的configure参数;
    • 五个目标都改用--enable-bootstrap=no-update:缺的工具链会下载,已有的不更新;
    • mac配置去掉--disable-debug、--disable-update-agent、--disable-default-browser-agent,linux arm64去掉--disable-debug。发布包里都没有这几项。锁定基线cebc55aab4的update-programs.configure里,关掉backgroundtasks和updater后update agent默认就是关的,default browser agent只在windows上生效,所以产物不变;
    • 新增mozconfig.linux-x64、mozconfig.windows-x64,windows保留--disable-default-browser-agent,和发布包一致;
    • --with-l10n-base是编译机上的路径,不写进配置,由脚本加上。
  • build(release) 编译机出包脚本:新增scripts/release-build.sh,取代只在编译机上的activate-v*.sh和build-v*.sh,步骤照v0.26.2实际跑通的那两段。
    • activate:在锁定基线源码树上打当前提交的补丁,先跑npm ci和全量自测,最后把提交写进.frx-release-applied。开头就删掉旧标记,激活中途失败时,build不会用只打了一半补丁的源码树。
    • build <目标>:
      • 先核对锁定基线、固定的firefox-l10n提交和激活标记;
      • 把这次用的mozconfig存进候选目录,再configure、重链BuildID、编译;
      • 在共享锁下做zh-CN重打包,只收这次新打出的包,按发布文件名改名;
      • 跑linux包检查或windows安装程序比对,写<目标>.sha256。
    • mozconfig <目标>:只打印实际用的mozconfig。
    • 路径都从环境变量来(UPSTREAM_DIR、FRX_L10N_BASE、FRX_OBJDIR、FRX_DIST_DIR),脚本里没有任何机器的信息。
    • 新增单测scripts/tests/test-release-build.py,已加进自测。
  • test(release) 锁的测试:
    • 激活要等所有编译结束;激活中不能开编;同一目标不能同时编两份;
    • 不同目标可以同时编;
    • 这一项要util-linux的flock,macos上跳过。
  • ci(release) 自托管源码树改从仓库变量读:
    • release.yml原来写死了旧编译机上的源码树路径,现在从仓库变量FRX_UPSTREAM_DIR读,没设置时直接报错;
    • 和旧编译机上未入库mozconfig.mac的比对删掉了,配置已经入库,没有可比的副本了;
    • 文件头写明正式包走release-build.sh,这个工作流打的是en-US包。
  • docs 编译机准备和发布流程:
    • 新增docs/build-host.md,写新编译机需要什么:
      • 机器:内存、磁盘、网络;
      • 系统包;
      • rust 1.95.0和四个交叉编译目标;
      • 锁定基线、固定的l10n提交;
      • bootstrap会下载的工具链;
      • 五个目标的配置和objdir。
    • docs/release-process.md:
      • 第2步改成用release-build.sh;
      • 第7步的备份示例去掉了本机目录;
      • “已知缺口”改写为release.yml还缺什么。
    • README指向这两份文档。

验证

  • 全量自测bash scripts/selftest-agent-tools.sh通过,共39步。新增的test-release-build.py有9项:

    • 本机macos(bash 3.2,没有util-linux的flock):8项通过,锁那一项跳过。ci的自测也跑在macos runner上,结果相同;
    • linux容器(node:22-bookworm-slim,bash 5.2,真实的flock和GNU工具):9项全部通过。

    各项内容:

    • 五个目标生成的mozconfig,configure参数逐项等于v0.26.2发布包里记的(只差下面说的一处例外),objdir是绝对路径,l10n路径来自环境变量;
    • FRX_OBJDIR必须是绝对路径,未知目标报用法错误;
    • 编译前的检查:BuildID格式、锁定基线、l10n提交、l10n检出有改动,都会在开编前停下;
    • 用假的mach和替身脚本走一遍activate和build:
      • 调用顺序对;
      • objdir里已有的旧包不会被误收;
      • 发布文件名、sha256和mozconfig记录都对;
      • 重打包没出包时报错停下;
    • 锁:用fcntl.flock占住锁,确认激活和编译互相排斥、同一目标不能重复编,另一个目标在编时这个目标照样能编。
  • 和发布包的对照:从v0.26.2五个目标的发布包(sha256和release一致)取出about:buildconfig。唯一例外是mac arm64:它的objdir配置得更早,没有显式写--enable-bootstrap=no-update。锁定基线的bootstrap.configure里,nightly的git检出默认就开着bootstrap,这个选项只管下不下载工具链。

  • 敏感信息:新增内容、删除内容和提交信息都扫过,没有ip、账号、密钥和本机路径。旧编译机、历史编译机和windows验证机的ip,在git历史里一次都没出现过。

没验证的

  • release-build.sh还没在真实编译机上跑过。编译机已经退掉,要等新机器准备好、出下一版时才能实测。命令顺序没有改动,和v0.26.2跑通的脚本一致。
  • build-host.md的装机步骤是按锁定基线的源码和旧机器上的记录写的,还没在一台新机器上从零走过一遍,主要是rust 1.95.0加交叉目标,以及bootstrap下载工具链这两步。

已知问题(本pr未处理)

  • release.yml的mac任务仍然只打en-US包,不做zh-CN重打包,和正式包不等价。正式包走release-build.sh。

🤖 Generated with Claude Code

WhiteNightShadow and others added 5 commits October 25, 2026 06:12
…ux x86_64 and Windows

The release packages were built from mozconfigs that lived only in the build
host's object directories. The configure options recorded in the five v0.26.2
packages (about:buildconfig) are now the repository's configs:

- all five use --enable-bootstrap=no-update, so a release build fetches
  missing toolchains but never updates existing ones;
- --disable-debug, --disable-update-agent and --disable-default-browser-agent
  are dropped from the macOS configs and --disable-debug from Linux ARM64:
  none of them was in the packages, and with background tasks and the updater
  disabled the update agent is off anyway;
- mozconfig.linux-x64 and mozconfig.windows-x64 are new; Windows keeps
  --disable-default-browser-agent, as its package did.

The build host's --with-l10n-base path stays out of the repository; the
release script adds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/release-build.sh replaces the per-release activate and build scripts
that only existed on the build host:

- activate patches the locked baseline with the current commit after npm ci
  and the selftests, and records the commit in .frx-release-applied; the old
  marker is removed first, so a half-patched tree is never built;
- build <target> checks the baseline, the pinned firefox-l10n commit and the
  activation marker, writes the mozconfig it uses into the candidate
  directory, configures, relinks the build ID and builds, repacks zh-CN under
  a shared lock, collects only the packages that repack produced under the
  release file names, runs the Linux package or Windows installer check and
  writes <target>.sha256;
- mozconfig <target> prints the effective mozconfig.

Paths come from the environment (UPSTREAM_DIR, FRX_L10N_BASE, FRX_OBJDIR,
FRX_DIST_DIR); nothing about a particular machine is in the script. It runs
under bash 3.2, where a variable followed directly by a multibyte character
must be braced.

scripts/tests/test-release-build.py checks the effective mozconfig of every
target against the configure options of the v0.26.2 packages, the checks that
run before any build work, and the activate/build flow with a stub mach and
stub helper scripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mac job read its source tree from a path on the retired build host and
compared that host's untracked mozconfig.mac with the repository. The path now
comes from the FRX_UPSTREAM_DIR repository variable, and the job stops with a
clear error when it is unset. The mozconfig comparison is gone: the configs
are in the repository and there is no untracked copy left to compare.

The header now says that release packages come from scripts/release-build.sh
and that this workflow builds en-US packages without the zh-CN repack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/build-host.md records what a new build host needs: the machine, the
packages, Rust 1.95.0 with the four cross targets, the locked baseline, the
pinned firefox-l10n commit, the bootstrapped toolchains and the five configs.
Machine addresses, accounts and keys stay out of the repository.

docs/release-process.md step 2 now runs scripts/release-build.sh instead of
listing the commands of the old host scripts, the backup example no longer
names a local directory, and the known gap describes what release.yml still
does differently. README points to both documents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xists

activate must refuse while any build holds the shared tree lock, a build must
refuse while activation holds it exclusively or the same target is already
building, and a build must still run while another target is building. The
test holds the locks with fcntl.flock, which util-linux flock interoperates
with; hosts without util-linux flock, such as the macOS selftest runner, skip
it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@WhiteNightShadow
WhiteNightShadow merged commit 81b9b2b into main Oct 25, 2026
2 checks passed
@WhiteNightShadow
WhiteNightShadow deleted the chore/release-build branch October 25, 2026 10:49
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.

1 participant