imbajin commented on code in PR #497:
URL: https://github.com/apache/hugegraph-doc/pull/497#discussion_r4099847251
##########
scripts/oink_module.py:
##########
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0.
+
+"""Resolve the sole theme dependency from the checked-in Go lock files."""
+import json
+import os
+import re
+import subprocess
+from pathlib import Path
+
+MODULE = "github.com/pgsty/oink"
Review Comment:
Confirmed on #496 at 7477493fee: the English/Chinese README and contribution
guide describe the go.mod/go.sum contract, and NOTICE no longer hardcodes an
OINK version. No duplicated version assertion is needed. These changes remain
in #496; this task does not merge or modify master.
##########
scripts/versioning.py:
##########
@@ -4068,30 +4070,10 @@ def build(args: argparse.Namespace) -> None:
json.dumps(override, ensure_ascii=False), encoding="utf-8"
)
hugo = os.environ.get("HUGO_BIN", "hugo")
- go = os.environ.get("GO_BIN", "go")
- go_executable = shutil.which(go)
+ go_executable = shutil.which(os.environ.get("GO_BIN", "go"))
if go_executable is None:
- fail(f"Go executable is unavailable: {go}")
- module_result = subprocess.run(
- [
- go_executable,
- "mod",
- "download",
- "-json",
- "github.com/pgsty/[email protected]",
- ],
- cwd=assembly,
- check=True,
- stdout=subprocess.PIPE,
- text=True,
- )
- module = json.loads(module_result.stdout)
- if (
- module.get("Path") != "github.com/pgsty/oink"
- or module.get("Version") != "v1.0.0"
- or module.get("Sum") !=
"h1:E+WHFP9zSRT+5RKoIkWNp+ASRGS1BKG+rDEi9by/BjE="
- ):
- fail(f"unexpected OINK module metadata: {module!r}")
+ fail("Go executable is unavailable")
+ module = download_locked(assembly)
Review Comment:
Addressed in 7477493fee on #496. Lock mismatch diagnostics include
expected/actual metadata, Go failures retain useful diagnostic output, and the
build reports them through fail() without a traceback. A real tampered-checksum
run and targeted tests verify the failure path. This follow-up is not yet
merged to master.
##########
scripts/versioning.py:
##########
@@ -4068,30 +4070,10 @@ def build(args: argparse.Namespace) -> None:
json.dumps(override, ensure_ascii=False), encoding="utf-8"
)
hugo = os.environ.get("HUGO_BIN", "hugo")
- go = os.environ.get("GO_BIN", "go")
- go_executable = shutil.which(go)
+ go_executable = shutil.which(os.environ.get("GO_BIN", "go"))
Review Comment:
Addressed in 7477493fee on #496. GO_BIN is resolved once to an absolute path
and passed through download_locked/command and the Hugo environment. The
unavailable executable message names the configured value. A relative-path
regression runs from the temporary assembly directory. This follow-up is not
yet merged to master.
##########
.github/workflows/hugo.yml:
##########
@@ -231,11 +231,7 @@ jobs:
restore-keys: ${{ runner.os }}-hugo-${{ env.HUGO_VERSION }}-${{
matrix.version.id }}-
- name: Verify pinned OINK module
run: |
- go mod verify
- test "$(go list -m -f '{{ .Path }}')" =
"github.com/apache/hugegraph-doc"
- test "$(go list -m all | wc -l)" -eq 2
- test "$(go list -m -f '{{ .Path }}@{{ .Version }}'
github.com/pgsty/oink)" = "github.com/pgsty/[email protected]"
- test -z "$(go list -m -f '{{ with .Replace }}{{ .Path }}@{{ .Version
}}{{ end }}' github.com/pgsty/oink)"
+ python3 scripts/oink_module.py
Review Comment:
Addressed in 7477493fee on #496. The workflow retains inline,
version-independent checks for the site module path, two-module graph and
absence of an OINK replacement, alongside the helper. The workflow contract
test covers them. These checks will become master-authoritative when #496 is
merged; the current trusted master workflow remains unchanged, as requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]