diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..44183b3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI + +on: [push] + +jobs: + build-deb: + runs-on: ubuntu-latest + container: + image: ghcr.io/truenas/apps_validation:latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install Deps + run: sudo apt update && sudo apt install -y python3-git python3-jinja2 + - name: Build deb package + run: > + dpkg-buildpackage + -B + --no-sign + -jauto + + - name: Create artifacts dir + run: mkdir artifacts + if: success() + + - name: Move artifacts + run: mv ../*.deb artifacts + if: success() + + - uses: actions/upload-artifact@v1 + with: + name: py-apps-validation + path: artifacts + if: success() diff --git a/catalog_reader/scripts/apps_hashes.py b/catalog_reader/scripts/apps_hashes.py index 19a14c0..3e04159 100644 --- a/catalog_reader/scripts/apps_hashes.py +++ b/catalog_reader/scripts/apps_hashes.py @@ -2,7 +2,6 @@ import argparse import os import pathlib -import ruamel.yaml import shutil import yaml @@ -12,10 +11,6 @@ from catalog_reader.names import get_library_path, get_library_hashes_path, get_base_library_dir_name_from_version -YAML = ruamel.yaml.YAML() -YAML.indent(mapping=2, sequence=4, offset=2) - - def update_catalog_hashes(catalog_path: str) -> None: if not os.path.exists(catalog_path): raise CatalogDoesNotExist(catalog_path) @@ -54,7 +49,7 @@ def update_catalog_hashes(catalog_path: str) -> None: continue with open(str(app_metadata_file), 'r') as f: - app_config = YAML.load(f) + app_config = yaml.safe_load(f.read()) if (lib_version := app_config.get('lib_version')) and lib_version not in hashes: print( @@ -74,7 +69,7 @@ def update_catalog_hashes(catalog_path: str) -> None: app_config['lib_version_hash'] = hashes[lib_version] with open(str(app_metadata_file), 'w') as f: - YAML.dump(app_config, f) + yaml.safe_dump(app_config) print(f'[\033[92mOK\x1B[0m]\tUpdated library hash for {app_dir.name!r} in {train_dir.name}') diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..2ac22a7 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +apps-validation (0.1-0~truenas+1) bullseye-truenas-unstable; urgency=medium + + * Initial release + + -- Waqar Ahmed Fri, 2 Jun 2024 00:26:21 +0500 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..0a1e4d1 --- /dev/null +++ b/debian/control @@ -0,0 +1,31 @@ +Source: apps-validation +Section: contrib/python +Priority: optional +Maintainer: Waqar Ahmed +Build-Depends: debhelper-compat (= 12), + dh-python, + python3-dev, + python3-git, + python3-jinja2, + python3-jsonschema, + python3-markdown, + python3-semantic-version, + python3-yaml, + python3-setuptools +Standards-Version: 4.4.1 +Homepage: https://github.com/truenas/apps_validation +Testsuite: autopkgtest-pkg-python + +Package: python3-apps-validation +Architecture: any +Depends: python3-semantic-version, + python3-jsonschema, + python3-git, + python3-jinja2, + python3-markdown, + python3-yaml, + ${shlibs:Depends}, + ${misc:Depends}, + ${python3:Depends} +Description: Validate TrueNAS Catalogs + This package helps validate truenas catalogs. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..ae4efab --- /dev/null +++ b/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f +export DH_VERBOSE = 1 + +export PYBUILD_NAME=apps_validation + +%: + dh $@ --with python3 --buildsystem=pybuild diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..cb61fa5 --- /dev/null +++ b/debian/source/options @@ -0,0 +1 @@ +extend-diff-ignore = "^[^/]*[.]egg-info/" diff --git a/requirements.txt b/requirements.txt index a863b1d..ffef472 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,4 @@ jinja2 jsonschema==4.10.3 markdown pyyaml -ruamel.yaml semantic_version