-
-
Notifications
You must be signed in to change notification settings - Fork 665
add giskard tool #4996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Zen1th53
wants to merge
10
commits into
BlackArch:master
Choose a base branch
from
Zen1th53:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+157
−0
Open
add giskard tool #4996
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bdb6882
Update Calamares to version 3.4.2.26.0427
Zen1th53 bdd2646
Merge branch 'BlackArch:master' into master
Zen1th53 3de02b6
Create PKGBUILD for giskard package
Zen1th53 2887011
Fix install command for THIRD_PARTY_NOTICES.md
Zen1th53 9393d1e
Fix formatting in PKGBUILD
Zen1th53 5a002f8
Fix formatting in PKGBUILD file
Zen1th53 7f1c824
Delete packages/giskard directory
Zen1th53 35b4187
Create p
Zen1th53 e6abd82
Add files via upload
Zen1th53 1a22475
Delete packages/giskard/p
Zen1th53 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| # This file is part of BlackArch Linux (https://www.blackarch.org/). | ||
| # See COPYING for license details. | ||
| # | ||
| # Original Maintainer: Behruz <extreme29@proton.me> | ||
|
|
||
| pkgname=giskard | ||
| _pkgname=giskard-oss | ||
| pkgver=3.0.0b1.r10622.g8aafe5892 | ||
| pkgrel=1 | ||
| pkgdesc='Evaluation, testing and vulnerability scanning framework for AI agents.' | ||
| arch=('x86_64') | ||
| groups=('blackarch' 'blackarch-ai') | ||
| url='https://github.com/Giskard-AI/giskard-oss' | ||
| license=('Apache-2.0') | ||
| depends=('python>=3.12') | ||
| makedepends=('git' 'python-pip' 'python-virtualenv') | ||
| provides=('giskard') | ||
| conflicts=('giskard-oss-git' 'python-giskard') | ||
| options=('!strip' '!debug') | ||
| source=("git+$url.git") | ||
| sha512sums=('SKIP') | ||
|
|
||
| pkgver() { | ||
| cd "$_pkgname" | ||
|
|
||
| local _version | ||
|
|
||
| _version=$(sed -n \ | ||
| 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' \ | ||
| pyproject.toml | head -n 1) | ||
|
|
||
| printf '%s.r%s.g%s' \ | ||
| "${_version:-3.0.0b1}" \ | ||
| "$(git rev-list --count HEAD)" \ | ||
| "$(git rev-parse --short HEAD)" | ||
| } | ||
|
|
||
| package() { | ||
| cd "$_pkgname" | ||
|
|
||
| local _venv="$pkgdir/opt/$pkgname" | ||
| local _python="$_venv/bin/python" | ||
| local _file | ||
| local _cmd | ||
|
|
||
| python -m venv "$_venv" | ||
|
|
||
| PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
| "$_python" -m pip install \ | ||
| --no-cache-dir \ | ||
| --no-warn-script-location \ | ||
| --upgrade \ | ||
| pip \ | ||
| setuptools \ | ||
| wheel | ||
|
|
||
| PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
| "$_python" -m pip install \ | ||
| --no-cache-dir \ | ||
| --no-warn-script-location \ | ||
| --compile \ | ||
| "$srcdir/$_pkgname/libs/giskard-core" \ | ||
| "$srcdir/$_pkgname/libs/giskard-llm" \ | ||
| "$srcdir/$_pkgname/libs/giskard-agents" \ | ||
| "$srcdir/$_pkgname/libs/giskard-checks" \ | ||
| "$srcdir/$_pkgname/libs/giskard-scan" \ | ||
| "$srcdir/$_pkgname" | ||
|
|
||
| while IFS= read -r -d '' _file; do | ||
| if head -n 1 "$_file" 2>/dev/null | | ||
| grep -Fq "#!$pkgdir/opt/$pkgname/bin/python"; then | ||
| sed -i \ | ||
| "1s|^#!$pkgdir/opt/$pkgname/bin/python[^[:space:]]*|#!/opt/$pkgname/bin/python|" \ | ||
| "$_file" | ||
| fi | ||
| done < <( | ||
| find "$_venv/bin" \ | ||
| -maxdepth 1 \ | ||
| -type f \ | ||
| -print0 | ||
| ) | ||
|
|
||
| find "$_venv" \ | ||
| -type d \ | ||
| \( \ | ||
| -name '.pytest_cache' \ | ||
| -o -name '.mypy_cache' \ | ||
| -o -name '.ruff_cache' \ | ||
| \) \ | ||
| -prune \ | ||
| -exec rm -rf '{}' + | ||
|
|
||
| install -dm 755 "$pkgdir/usr/bin" | ||
|
|
||
| cat > "$pkgdir/usr/bin/giskard-python" << 'EOF' | ||
| #!/bin/sh | ||
| exec /opt/giskard/bin/python "$@" | ||
| EOF | ||
|
|
||
| cat > "$pkgdir/usr/bin/giskard-info" << 'EOF' | ||
| #!/opt/giskard/bin/python | ||
|
|
||
| from importlib.metadata import PackageNotFoundError, version | ||
|
|
||
| packages = ( | ||
| "giskard", | ||
| "giskard-core", | ||
| "giskard-llm", | ||
| "giskard-agents", | ||
| "giskard-checks", | ||
| "giskard-scan", | ||
| ) | ||
|
|
||
| for package in packages: | ||
| try: | ||
| installed_version = version(package) | ||
| except PackageNotFoundError: | ||
| installed_version = "not installed" | ||
|
|
||
| print(f"{package}: {installed_version}") | ||
| EOF | ||
|
|
||
| chmod 755 \ | ||
| "$pkgdir/usr/bin/giskard-python" \ | ||
| "$pkgdir/usr/bin/giskard-info" | ||
|
|
||
| for _file in "$_venv"/bin/giskard*; do | ||
| [[ -f "$_file" && -x "$_file" ]] || continue | ||
|
|
||
| _cmd="${_file##*/}" | ||
|
|
||
| [[ "$_cmd" == 'giskard-info' ]] && continue | ||
| [[ "$_cmd" == 'giskard-python' ]] && continue | ||
|
|
||
| cat > "$pkgdir/usr/bin/$_cmd" << EOF | ||
| #!/bin/sh | ||
| exec /opt/$pkgname/bin/$_cmd "\$@" | ||
| EOF | ||
|
|
||
| chmod 755 "$pkgdir/usr/bin/$_cmd" | ||
| done | ||
|
|
||
| install -Dm 644 LICENSE \ | ||
| "$pkgdir/usr/share/licenses/$pkgname/LICENSE" | ||
|
|
||
| install -Dm 644 README.md \ | ||
| "$pkgdir/usr/share/doc/$pkgname/README.md" | ||
|
|
||
| [[ -f SECURITY.md ]] && | ||
| install -Dm 644 SECURITY.md \ | ||
| "$pkgdir/usr/share/doc/$pkgname/SECURITY.md" | ||
|
|
||
| [[ -f THIRD_PARTY_NOTICES.md ]] && | ||
| install -Dm 644 THIRD_PARTY_NOTICES.md \ | ||
| "$pkgdir/usr/share/doc/$pkgname/THIRD_PARTY_NOTICES.md" | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't not seem to follow our PKGBUILD templates. Coud you follow https://github.com/BlackArch/blackarch-pkgbuilds/tree/master/python please?