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
2 changes: 1 addition & 1 deletion .github/actions/features_parse/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ outputs:
runs:
using: composite
steps:
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@0.8.7
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@0.8.8
- id: result
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/flavors_parse/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ outputs:
runs:
using: composite
steps:
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@0.8.7
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@0.8.8
- id: matrix
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Installs the given GardenLinux Python library
inputs:
version:
description: GardenLinux Python library version
default: "0.8.7"
default: "0.8.8"
runs:
using: composite
steps:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gardenlinux"
version = "0.8.7"
version = "0.8.8"
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 <contact@gardenlinux.io>"]
license = "Apache-2.0"
Expand Down
36 changes: 20 additions & 16 deletions src/gardenlinux/features/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import argparse
import logging
import os
import re
import sys
Expand Down Expand Up @@ -65,24 +66,30 @@ def main() -> None:
args.cname
), "Please provide either `--features` or `--cname` argument"

arch = None
arch = args.arch
flavor = None
commit_id = None
gardenlinux_root = path.dirname(args.feature_dir)
version = None

if args.arch is not None:
arch = args.arch

if args.version is not None:
version = args.version
version = args.version

if arch is None or arch == "":
arch = args.default_arch

if gardenlinux_root == "":
gardenlinux_root = "."

if version is None or version == "":
version_data = get_version_and_commit_id_from_files(gardenlinux_root)
version = f"{version_data[0]}-{version_data[1]}"
try:
version_data = get_version_and_commit_id_from_files(gardenlinux_root)
version = f"{version_data[0]}-{version_data[1]}"
except RuntimeError as exc:
logging.debug(
"Failed to parse version information for GL root '{0}': {1}".format(
gardenlinux_root, exc
)
)

version = args.default_version

if args.cname:
cname = CName(args.cname, arch=arch, version=version)
Expand All @@ -106,12 +113,6 @@ def main() -> None:

feature_dir_name = path.basename(args.feature_dir)

if gardenlinux_root == "":
gardenlinux_root = "."

if gardenlinux_root == "":
gardenlinux_root = "."

additional_filter_func = lambda node: node not in args.ignore

if args.type == "arch":
Expand Down Expand Up @@ -199,6 +200,9 @@ def get_version_and_commit_id_from_files(gardenlinux_root: str) -> tuple[str, st
with open(path.join(gardenlinux_root, "VERSION"), "r") as fp:
version = fp.read().strip()

if commit_id is None or version is None:
raise RuntimeError("Failed to read version or commit ID from files")

return (version, commit_id)


Expand Down
21 changes: 13 additions & 8 deletions src/gardenlinux/features/cname_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from functools import reduce
from os.path import basename, dirname
import argparse
import logging
import re

from .cname import CName
Expand Down Expand Up @@ -44,19 +45,23 @@ def main():

assert re_match, f"Not a valid GardenLinux canonical name {args.cname}"

arch = None
arch = args.arch
gardenlinux_root = dirname(args.feature_dir)
version = args.version

if args.arch is not None:
arch = args.arch

if args.version is not None:
version = args.version
if gardenlinux_root == "":
gardenlinux_root = "."

if not version:
version_data = get_version_and_commit_id_from_files(gardenlinux_root)
version = f"{version_data[0]}-{version_data[1]}"
try:
version_data = get_version_and_commit_id_from_files(gardenlinux_root)
version = f"{version_data[0]}-{version_data[1]}"
except RuntimeError as exc:
logging.warning(
"Failed to parse version information for GL root '{0}': {1}".format(
gardenlinux_root, exc
)
)

cname = CName(args.cname, arch=arch, version=version)

Expand Down