From f460957ab84aafca99a207b5b38fc081351362f4 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sun, 2 Jun 2024 14:10:11 +0500 Subject: [PATCH 1/6] Add debian package --- debian/changelog | 5 +++++ debian/control | 33 +++++++++++++++++++++++++++++++++ debian/rules | 7 +++++++ debian/source/format | 1 + debian/source/options | 1 + 5 files changed, 47 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/options 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..fe3fc6f --- /dev/null +++ b/debian/control @@ -0,0 +1,33 @@ +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-ruamel.yaml, + 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-ruamel.yaml, + 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/" From 834669e0b7f0a4acf513f87fd163af54f28a0029 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sun, 2 Jun 2024 14:10:54 +0500 Subject: [PATCH 2/6] Add workflow to build debian package --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8ebf843 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: [push] + +jobs: + build-deb: + runs-on: ubuntu-latest + container: + image: ixsystems/apps_validation:latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - 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-catalog-validation + path: artifacts + if: success() From c300ca41a0d1d1145a4bb0301f7aa05906cefefc Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Mon, 3 Jun 2024 21:49:45 +0500 Subject: [PATCH 3/6] Adjust tag --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ebf843..0e765e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: build-deb: runs-on: ubuntu-latest container: - image: ixsystems/apps_validation:latest + image: ghcr.io/truenas/apps_validation:latest steps: - name: Checkout @@ -29,6 +29,6 @@ jobs: - uses: actions/upload-artifact@v1 with: - name: py-catalog-validation + name: py-apps-validation path: artifacts if: success() From 6ef1f4fbcb1be36e8b37cc0a387dd29a9a14d64a Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 4 Jun 2024 05:03:37 +0500 Subject: [PATCH 4/6] Install required deps --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e765e5..44183b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,8 @@ jobs: - 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 From d6b2c04f2ecf6c75d98ebd63d3eef2f970d30f78 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 4 Jun 2024 05:04:10 +0500 Subject: [PATCH 5/6] Remove ruamel.yaml dep --- debian/control | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/control b/debian/control index fe3fc6f..0a1e4d1 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,6 @@ Build-Depends: debhelper-compat (= 12), python3-jinja2, python3-jsonschema, python3-markdown, - python3-ruamel.yaml, python3-semantic-version, python3-yaml, python3-setuptools @@ -24,7 +23,6 @@ Depends: python3-semantic-version, python3-git, python3-jinja2, python3-markdown, - python3-ruamel.yaml, python3-yaml, ${shlibs:Depends}, ${misc:Depends}, From 4943487db9af5b6a0b430762a1cc06371c6abc45 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 4 Jun 2024 05:16:17 +0500 Subject: [PATCH 6/6] Remove ruamel.yaml usages --- catalog_reader/scripts/apps_hashes.py | 9 ++------- requirements.txt | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) 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/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