Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .custom_wordlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cna
buildd
hda
passt
8 changes: 8 additions & 0 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ jobs:
node-version: "22"
cache: "pnpm"

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # pin@v6.2.0
with:
python-version: "3.13"

- name: Install dependencies
run: |
pnpm install
pip install git+https://github.com/gardenlinux/glrd.git@v4.1.0
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@0.10.20
pip install -r requirements.txt

- name: Run aggregate
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
- name: Install dependencies
run: |
pnpm install
pip install git+https://github.com/gardenlinux/glrd.git@v4.1.0
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@0.10.20
pip install -r requirements.txt

- name: Run aggregate
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/woke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ jobs:
node-version: "22"
cache: "pnpm"

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # pin@v6.2.0
with:
python-version: "3.13"

- name: Install dependencies
run: |
go install github.com/get-woke/woke@latest
pnpm install
pip install git+https://github.com/gardenlinux/glrd.git@v4.1.0
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@0.10.20
pip install -r requirements.txt

- name: Run aggregate
run: |
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ help:
install:
@echo "Installing dependencies..."
pnpm install
pip install git+https://github.com/gardenlinux/glrd.git@v4.1.0
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@0.10.20
pip install -r requirements.txt

dev: install
pnpm run docs:dev
Expand Down
11 changes: 11 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ export default defineConfig({
/release-notes\/1877-12/,
// Ignore LICENSE files (e.g. from aggregated repos)
/LICENSE$/,
// Ignore broken links inside features for now
/features\/_ephemeral/,
/features\/_tpm2/,
/features\/bare/,
/features\/libc/,
/test\//,
/tests\//,
/samples\//,
/boot_modes/,
/cis\//,
/firewall\//,
],
head: [
[
Expand Down
37 changes: 10 additions & 27 deletions repos-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
"docs_path": "docs",
"target_path": "projects/gardenlinux",
"ref": "docs-ng",
"commit": "aafc4d98545ea7dcd458faff4e1b8d7e6fcb9af2",
"commit": "4c1d90299cef6cd9db3e800cdd9668949dc8ebec",
"root_files": [
"CONTRIBUTING.md",
"SECURITY.md"
"SECURITY.md",
"features/*/README.md",
"features/*/info.yaml",
"flavors.yaml"
],
"structure": {
"tutorials": "tutorials",
Expand All @@ -18,11 +21,7 @@
"reference": "reference",
"contributing": "contributing"
},
"media_directories": [
".media",
"assets",
"_static"
]
"media_directories": [".media", "assets", "_static"]
},
{
"name": "builder",
Expand All @@ -31,11 +30,7 @@
"target_path": "projects/builder",
"ref": "docs-ng",
"commit": "086e74ff032c5f2a05989aef4f20ba69f94bdbf9",
"media_directories": [
".media",
"assets",
"_static"
]
"media_directories": [".media", "assets", "_static"]
},
{
"name": "python-gardenlinux-lib",
Expand All @@ -45,11 +40,7 @@
"ref": "docs-ng",
"commit": "9142fccc3d83ab51759db7d328fa19166bc1df63",
"structure": "sphinx",
"media_directories": [
".media",
"assets",
"_static"
]
"media_directories": [".media", "assets", "_static"]
},
{
"name": "package-linux",
Expand All @@ -58,11 +49,7 @@
"target_path": "projects/package-linux",
"ref": "docs-ng",
"commit": "841139441357a222ea10349f6d09a875ce9732d1",
"media_directories": [
".media",
"assets",
"_static"
]
"media_directories": [".media", "assets", "_static"]
},
{
"name": "glrd",
Expand All @@ -71,11 +58,7 @@
"target_path": "projects/glrd",
"ref": "docs-ng",
"commit": "c444721b728c0be0de2c19a0bc328928a0091d65",
"media_directories": [
".media",
"assets",
"_static"
]
"media_directories": [".media", "assets", "_static"]
}
]
}
8 changes: 7 additions & 1 deletion repos-config.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
"name": "gardenlinux",
"url": "file://../gardenlinux",
"docs_path": "docs",
"root_files": ["CONTRIBUTING.md", "SECURITY.md"],
"root_files": [
"CONTRIBUTING.md",
"SECURITY.md",
"features/*/README.md",
"features/*/info.yaml",
"flavors.yaml"
],
"target_path": "projects/gardenlinux",
"structure": {
"tutorials": "tutorials",
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
codespell==2.4.2
pytest
glrd @ git+https://github.com/gardenlinux/glrd.git@main
pyyaml
# glrd @ git+https://github.com/gardenlinux/glrd.git@v4.2.0
# gardenlinux @ git+https://github.com/gardenlinux/python-gardenlinux-lib.git@0.10.20
10 changes: 10 additions & 0 deletions src/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
)
from aggregation.releases import generate_release_docs
from aggregation.release_notes import generate_release_notes_docs
from aggregation.flavor_matrix import generate_flavor_matrix_docs


def transform_repo_docs(
Expand Down Expand Up @@ -215,6 +216,15 @@ def main() -> int:

save_config(str(config_path), repos)
print(f"\n✓ Config updated: {config_path}")

# Generate flavor matrix documentation after all repos are aggregated
# Use docs/projects/gardenlinux path since temp_dir is cleaned up
gardenlinux_docs_path = docs_dir / "projects" / "gardenlinux"
if gardenlinux_docs_path.exists():
print(f"\n{'='*60}")
print("Generating flavor matrix documentation...")
print(f"{'='*60}\n")
generate_flavor_matrix_docs(docs_dir, gardenlinux_docs_path)

# Generate release documentation from GLRD
print(f"\n{'='*60}")
Expand Down
3 changes: 3 additions & 0 deletions src/aggregation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
process_all_markdown,
)
from .releases import generate_release_docs
from .flavor_matrix import generate_flavor_matrix_docs

__all__ = [
# Models
Expand All @@ -38,4 +39,6 @@
"process_all_markdown",
# Releases
"generate_release_docs",
# Flavor Matrix
"generate_flavor_matrix_docs",
]
71 changes: 62 additions & 9 deletions src/aggregation/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@
from .models import RepoConfig, AggregateResult


def _convert_to_git_pattern(pattern: str) -> str:
"""
Convert Python glob pattern to git sparse-checkout compatible pattern.

Git doesn't support **, so convert to folder prefix.
e.g., "features/**/*.md" -> "features/*"
"""
if "**" in pattern:
parts = pattern.split("/")
for i, part in enumerate(parts):
if "**" in part:
parts[i] = "*"
return "/".join(parts[:i+1])
return pattern
return pattern


class DocsFetcher:
"""Handles fetching documentation from remote or local repositories."""

Expand Down Expand Up @@ -73,11 +90,13 @@ def _fetch_remote(
)

# Configure sparse checkout patterns
# Git sparse-checkout doesn't support **, so convert to folder prefixes
sparse_checkout_file = temp_dir / ".git" / "info" / "sparse-checkout"
with open(sparse_checkout_file, "w") as f:
f.write(f"{repo.docs_path}/*\n")
for root_file in repo.root_files:
f.write(f"{root_file}\n")
converted = _convert_to_git_pattern(root_file)
f.write(f"{converted}\n")

# Fetch and checkout
print(" Cloning (sparse checkout)...")
Expand Down Expand Up @@ -215,22 +234,56 @@ def _copy_docs(source: Path, dest: Path) -> None:
@staticmethod
def _copy_root_files(repo_root: Path, root_files: list, dest: Path) -> None:
"""
Copy specified root-level files from repository.
Copy specified root-level files and directories from repository.

Supports glob patterns like "features/*/*.md" to match specific files
without copying entire directories.

Args:
repo_root: Root directory of the repository
root_files: List of filenames to copy
root_files: List of filenames/directories/patterns to copy
dest: Destination directory
"""
if not root_files:
return

print(" Copying root files")
for filename in root_files:
src = repo_root / filename
if src.exists():
target = dest / src.name
shutil.copy2(src, target)
print(f" ✓ {filename}")
clean_name = filename.rstrip("/")

if '*' in clean_name or '?' in clean_name or '[' in clean_name:
matches = list(repo_root.glob(clean_name))
if not matches:
print(f" Warning: {filename} not found (no matches)")
continue

for src in matches:
rel_path = src.relative_to(repo_root)
target = dest / rel_path
if src.is_dir():
try:
shutil.copytree(src, target, dirs_exist_ok=True, symlinks=False)
print(f" ✓ {filename} -> {rel_path} (directory)")
except Exception as e:
print(f" Warning: Failed to copy {rel_path}: {e}")
else:
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(src, target)
print(f" ✓ {filename} -> {rel_path}")
else:
print(f" Warning: {filename} not found")
src = repo_root / clean_name
if src.exists():
target = dest / src.name
if src.is_dir():
try:
shutil.copytree(src, target, dirs_exist_ok=True, symlinks=False)
print(f" ✓ {filename} (directory)")
except Exception as e:
print(f" Warning: Failed to copy {filename}: {e}")
else:
shutil.copy2(src, target)
print(f" ✓ {filename}")
else:
print(f" Warning: {filename} not found")


Loading
Loading