Skip to content

Commit 7bc69ed

Browse files
andyclaude
andcommitted
Merge branch 'wip/216-help-client': help pages ship with the client
Interim until the help is rewritten. Client/server components checked for overlap (none); tests/apps 22/22 on a quiet machine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WCGMAAjNSTNh14zEkhDJn1
2 parents ce6d54a + e6f21e2 commit 7bc69ed

3 files changed

Lines changed: 38 additions & 10 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -612,15 +612,13 @@ if(EXISTS ${_ecce_help_tarball})
612612
add_custom_target(ecce_help_cgi_patch ALL
613613
DEPENDS ${CMAKE_BINARY_DIR}/ecce-help-extracted/.help-cgi-patched)
614614

615-
# Lives under data/client/ on disk (BrowserHelp's rare file:// fallback
616-
# path expects that layout - see BrowserHelp::initialize()) but this is
617-
# server content: served over HTTP by the data server's Apache instance
618-
# (httpd.conf.ecce's "/EcceHelp" Alias) and the source of the help CGI
619-
# scripts ecce-dataserver-start seeds into its own cgi-bin/ -- so it
620-
# goes in the server component, not client, when packages are split.
615+
# Client content: local mode (#216) opens these pages as files, with no
616+
# data server. A server serves the same files (httpd.conf.ecce's
617+
# "/EcceHelp" Alias) and seeds its help CGIs from them, at this path,
618+
# and ecce-server depends on ecce-client, so it always has them.
621619
install(DIRECTORY ${CMAKE_BINARY_DIR}/ecce-help-extracted/EcceHelp
622620
DESTINATION data/client/WebHelp
623-
COMPONENT server)
621+
COMPONENT client)
624622
set(ECCE_HELP_AVAILABLE TRUE)
625623
else()
626624
message(WARNING "No vendored help tarball at ${_ecce_help_tarball} - "

‎src/util/genutil/BrowserHelp.C‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,13 @@ string BrowserHelp::URL(const string& key) const
7070
}
7171
}
7272

73-
if (!LocalData::dir().empty() && ret.find("http://") == string::npos &&
74-
ret.find("file://") == string::npos)
75-
return localURL(ret);
73+
if (!LocalData::dir().empty() && ret.find("http://") == string::npos) {
74+
// A file:// entry naming a page the install lacks opens the home page.
75+
if (ret.find("file://") == 0 &&
76+
access((p_filePrefix + ret.substr(7)).c_str(), R_OK) == 0)
77+
return "file://" + p_filePrefix + ret.substr(7);
78+
return localURL(ret.find("file://") == 0 ? string("HomeFallback") : ret);
79+
}
7680

7781
if (ret.size() > 0 && ret.find("http://") == string::npos &&
7882
ret.find("file://") == string::npos)

‎tests/filedsi/run_tests.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,32 @@ def line(text, url, fn):
186186
print("%s help %s: %s" % ("PASS" if good else "FAIL", label,
187187
"" if good else "%r, want %r" % (lines, want)))
188188
ok = ok and good
189+
190+
# The built help tree: in local mode every help.urls key must open a
191+
# file that exists.
192+
built = os.path.join(BUILD, "ecce-help-extracted", "EcceHelp")
193+
if os.path.isdir(built):
194+
real = os.path.join(state, "helpreal")
195+
os.makedirs(os.path.join(real, "client", "WebHelp"))
196+
os.symlink(built, os.path.join(real, "client", "WebHelp", "EcceHelp"))
197+
os.symlink(os.path.join(REPO, "data", "client", "config"),
198+
os.path.join(real, "client", "config"))
199+
keys = []
200+
with open(os.path.join(REPO, "data", "client", "config", "help.urls")) as h:
201+
for l in h:
202+
if l.strip() and not l.startswith("#") and ":" in l:
203+
keys.append(l.split(":", 1)[0].strip())
204+
_, out = run_url(new, env, "help", *keys, ECCE_DATA=real,
205+
ECCE_HELP="http://h:8096/", ECCE_LOCAL_DATA=root)
206+
urls = [l.rsplit(" ", 1) for l in out.splitlines()]
207+
missing = ["%s %s" % (k, u) for k, u in urls
208+
if not u.startswith("file://")
209+
or not os.path.isfile(u[7:].split("#")[0])]
210+
good = not missing and len(keys) > 100
211+
print("%s help local, built tree: %d keys, %d not a file%s" % (
212+
"PASS" if good else "FAIL", len(keys), len(missing),
213+
"" if not missing else ": " + "; ".join(missing)))
214+
ok = ok and good
189215
return ok
190216

191217

0 commit comments

Comments
 (0)