Show build for non-git installations.

This commit is contained in:
salman committed 2026-11-04 16:32:11 +01:00
1 parent 3f9ecb4fd7
commit 141baeb779
6 files changed
+28 -4

No files matched your search

+1
View File
@@ -0,0 +1 @@
build-revision.txt export-subst
+2 -1
View File
@@ -10,7 +10,8 @@ release path documented in [`TODO.md`](TODO.md).
version. Development and locally packaged modified trees are marked as such.
- Electron packages embed build provenance during Linux and Windows packaging;
web deployment stamps equivalent provenance from the deployed checkout and
configured server tools.
configured server tools. Gitea source archives preserve their commit through
Git archive substitution even though the extracted directory has no `.git`.
- Parameter-plot controls are hidden by default and toggle with a deliberate
tap or click on all pointer types; drag gestures remain reserved for plots.
+5 -1
View File
@@ -89,7 +89,11 @@ deployed tree is not already owned by the invoking user, so the script also
runs unprivileged against a developer-owned web tree (skip that case's `sudo`).
Override the targets and owner as needed with `MUSRFLOW_WEB_TARGET`,
`MUSRFLOW_CGI_TARGET`, `MUSRFLOW_STARTUP_XML_TARGET`, `MUSRFLOW_WEB_OWNER`, and
`MUSRFLOW_WEB_GROUP`.
`MUSRFLOW_WEB_GROUP`. Official Git source archives carry their commit through
`build-revision.txt`, so Quick Start can identify an archive deployment without
a `.git` directory. For a tar file produced by another tool, set
`MUSRFLOW_BUILD_REVISION` to its full Git commit when running the deployment
script; otherwise the UI identifies it as a versioned source archive.
The installed `musrfit_startup.xml` is rewritten when the machine's data tree
lives under a non-PSI root: set `MUSRFLOW_DATA_ROOT` (e.g. `/mnt/fake`) and the
+1
View File
@@ -0,0 +1 @@
muSRFlow=$Format:%H$
+17 -1
View File
@@ -49,7 +49,23 @@ find "$web_target/docs" -type f -exec chmod 0644 {} +
# its own and ROOT's versions using the same executable configured for the CGI.
if command -v node >/dev/null 2>&1; then
version="$(node -p 'require(process.argv[1]).version' "$project_root/package.json")"
revision="$(git -C "$project_root" rev-parse --short=12 HEAD 2>/dev/null || printf 'unrecorded')"
revision="${MUSRFLOW_BUILD_REVISION:-}"
if [[ "$revision" =~ ^[0-9a-fA-F]{7,40}$ ]]; then
revision="${revision:0:12}"
elif git_revision="$(git -C "$project_root" rev-parse --short=12 HEAD 2>/dev/null)"; then
revision="$git_revision"
else
# git archive expands the export-subst placeholder in this file. Gitea
# source archives therefore retain the exact commit without a .git tree.
archive_revision="$(sed -n 's/^muSRFlow=//p' "$project_root/build-revision.txt" 2>/dev/null || true)"
if [[ "$archive_revision" =~ ^[0-9a-fA-F]{40}$ ]]; then
revision="${archive_revision:0:12}"
else
# Third-party tar programs do not expand git placeholders. The
# release version is still more useful and honest than "unrecorded".
revision="v${version}-archive"
fi
fi
modified=""
if [ -n "$(git -C "$project_root" status --porcelain 2>/dev/null || true)" ]; then
modified=" (modified)"
+2 -1
View File
@@ -77,6 +77,7 @@ function testDocumentationDeployment() {
"cgi/single_musrfit.cgi", "cgi/musrfit_startup.xml"];
for (const file of assets) fs.writeFileSync(path.join(source, file), "fixture\n");
fs.copyFileSync(path.join(repoRoot, "quick-start.html"), path.join(source, "quick-start.html"));
fs.writeFileSync(path.join(source, "build-revision.txt"), "muSRFlow=" + "b".repeat(40) + "\n");
fs.writeFileSync(path.join(source, "package.json"), JSON.stringify({ version: "1.2.3" }));
const options = { encoding: "utf8", env: { ...process.env,
MUSRFLOW_WEB_TARGET: path.join(target, "web"),
@@ -102,7 +103,7 @@ function testDocumentationDeployment() {
const installedHelp = fs.readFileSync(path.join(target, "web/quick-start.html"), "utf8");
assert.match(installedHelp, /id="musrflowVersion">1\.2\.3</);
assert.match(installedHelp, /id="musrflowEdition">Web</);
assert.match(installedHelp, /id="musrflowRevision">unrecorded</);
assert.match(installedHelp, /id="musrflowRevision">bbbbbbbbbbbb</);
assert.doesNotMatch(installedHelp, /__MUSRFLOW_|__MUSRFIT_|__ROOT_/);
for (const file of pages) {
const installed = path.join(target, "web/docs", file);