Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c635266
Fix `parse_flavors` result to comply expected formats and `flags` han…
NotTheEvilOne Apr 18, 2025
ceade8a
Add support to read existing `flavors.yaml` with `gl-flavors-parse`
NotTheEvilOne Apr 16, 2025
ff3c0ad
Add support to parse and return the GardenLinux "cname"
NotTheEvilOne Apr 4, 2025
c221788
Restructure GL flavors parsing and module structure
NotTheEvilOne Apr 28, 2025
b41949c
Restructure GL features parsing and module structure
NotTheEvilOne Apr 28, 2025
c8046d1
Use more common name `setup` for GitHub action `python_lib`
NotTheEvilOne May 6, 2025
b1884e5
Move `logger` to module `gardenlinux`
NotTheEvilOne May 7, 2025
e6327b6
Move `apt` to module `gardenlinux`
NotTheEvilOne May 7, 2025
96816a4
Move `git` to module `gardenlinux`
NotTheEvilOne May 7, 2025
f13917d
Code cleanup
NotTheEvilOne May 7, 2025
471c9fc
Add GitHub action `features_parse`
NotTheEvilOne May 7, 2025
05be222
Add support to read `COMMIT` and `VERSION` files
NotTheEvilOne May 7, 2025
e798faa
Fix architecture `assert` in `gl-cname`
NotTheEvilOne May 7, 2025
a290418
Always shorten commit ID to 8 characters for "cname" creation
NotTheEvilOne May 8, 2025
ad5dcd6
Fix "cname" generation with non-reversed graph as source
NotTheEvilOne May 8, 2025
d394261
Fix "cname" creation from flavor if `--arch` is specified
NotTheEvilOne May 8, 2025
22cef2a
Add "special" `bare` feature as `platform` for the graph parser
NotTheEvilOne May 12, 2025
8eefc93
Add "special" bare `libc` feature as `element` for the graph parser
NotTheEvilOne May 14, 2025
4b57caf
Fix race-condition in `features.Parser.filter()`
NotTheEvilOne May 15, 2025
377e95a
Fix RegEx to parse cname as `platform_element` correctly
NotTheEvilOne May 15, 2025
78a7ae2
Remove unused code in `python_gardenlinux_lib` module
NotTheEvilOne May 15, 2025
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
18 changes: 18 additions & 0 deletions .github/actions/features_parse/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: features_parse
description: Parses the given GardenLinux features parameters
inputs:
flags:
description: 'Flags passed to `gl-features-parse`'
required: true
outputs:
result:
description: 'features result'
value: ${{ steps.result.outputs.result }}
runs:
using: composite
steps:
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@feature/gardenlinux-restructure
- id: result
shell: bash
run: |
echo "result=$(gl-features-parse ${{ inputs.flags }})" | tee -a $GITHUB_OUTPUT
34 changes: 34 additions & 0 deletions .github/actions/flavors_parse/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: flavors_parse
description: Parses the given GardenLinux flavors parameters
inputs:
flags:
description: 'Flags passed to `gl-flavors-parse`'
required: true
flavors_matrix:
description: 'Generated GitHub workflow flavors matrix'
outputs:
matrix:
description: 'Flavors matrix'
value: ${{ steps.matrix.outputs.matrix }}
runs:
using: composite
steps:
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@feature/gardenlinux-restructure
- id: matrix
shell: bash
run: |
MATRIX='${{ inputs.flavors_matrix }}'

if [[ $(echo "${MATRIX}" | jq -r 'type') != 'object' ]]; then
FLAVORS=$(gl-flavors-parse ${{ inputs.flags }})
MATRIX=$(jq -nc \
--argjson flavors "$(echo $FLAVORS)" \
'{
include: (
$flavors | reduce (to_entries[]) as $item ([]; . + ($item.value | map({"arch": $item.key, "flavor": .})))
)
}'
)
fi

echo "matrix=$MATRIX" | tee -a $GITHUB_OUTPUT
17 changes: 17 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: python_lib
description: Installs the given GardenLinux Python library
inputs:
version:
description: GardenLinux Python library version
default: "feature/gardenlinux-restructure"
runs:
using: composite
steps:
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install GardenLinux Python library
shell: bash
run: |
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}
91 changes: 77 additions & 14 deletions poetry.lock

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[tool.poetry]
name = "python_gardenlinux_lib"
name = "gardenlinux"
version = "0.6.0"
description = "Contains tools to work with the features directory of gardenlinux, for example deducting dependencies from feature sets or validating cnames"
authors = ["Garden Linux Maintainers <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
packages = [{include = "python_gardenlinux_lib", from="src"}]
packages = [{include = "gardenlinux", from="src"}, {include = "python_gardenlinux_lib", from="src"}]

[tool.poetry.dependencies]
python = "^3.10"
networkx = "^3.3"
PyYAML = "^6.0.2"
pytest = "^8.3.2"
gitpython = "^3.1.43"
gitpython = "^3.1.44"
sphinx-rtd-theme = "^2.0.0"
apt-repo = "^0.5"
jsonschema = "^4.23.0"
Expand All @@ -21,19 +21,17 @@ python-dotenv = "^1.0.1"
cryptography = "^44.0.0"
boto3 = "*"


[tool.poetry.group.dev.dependencies]
black = "^24.8.0"

[tool.poetry.scripts]
gl-cname = "python_gardenlinux_lib.cname:main"
gl-flavors-parse = "python_gardenlinux_lib.flavors.parse_flavors:main"
flavors-parse = "python_gardenlinux_lib.flavors.parse_flavors:main"
gl-cname = "gardenlinux.features.cname_main:main"
gl-features-parse = "gardenlinux.features.__main__:main"
gl-flavors-parse = "gardenlinux.flavors.__main__:main"
flavors-parse = "gardenlinux.flavors.__main__:main"

[tool.pytest.ini_options]
pythonpath = [
"src"
]
pythonpath = ["src"]
norecursedirs = "test-data"

[build-system]
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions src/gardenlinux/apt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-

from .debsource import Debsrc, DebsrcFile

__all__ = ["Parser"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT

# Based on code from glvd https://github.com/gardenlinux/glvd/blob/7ca2ff54e01da5e9eae61d1cd565eaf75f3c62ce/src/glvd/data/debsrc.py#L1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

from apt_repo import APTRepository
from typing import Optional

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,57 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# GardenLinux "bare" feature
BARE_FLAVOR_FEATURE_CONTENT = {"description": "Bare flavor", "type": "platform"}

BARE_FLAVOR_LIBC_FEATURE_CONTENT = {
"description": "Bare libc feature",
"type": "element",
}

# GardenLinux flavors schema for validation
GL_FLAVORS_SCHEMA = {
"type": "object",
"version": {"type": "integer"},
"properties": {
"targets": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {"type": "string"},
"category": {"type": "string"},
"flavors": {
"type": "array",
"items": {
"type": "object",
"properties": {
"features": {
"type": "array",
"items": {"type": "string"},
},
"arch": {"type": "string"},
"build": {"type": "boolean"},
"test": {"type": "boolean"},
"test-platform": {"type": "boolean"},
"publish": {"type": "boolean"},
},
"required": [
"features",
"arch",
"build",
"test",
"test-platform",
"publish",
],
},
},
},
"required": ["name", "category", "flavors"],
},
},
},
"required": ["targets"],
}

# It is important that this list is sorted in descending length of the entries
GL_MEDIA_TYPES = [
Expand Down
5 changes: 5 additions & 0 deletions src/gardenlinux/features/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-

from .parser import Parser

__all__ = ["Parser"]
Loading
Loading