Skip to content

Commit

Permalink
Added option to explicitly state pkgname
Browse files Browse the repository at this point in the history
  • Loading branch information
adi-g15 committed Jun 18, 2021
1 parent 6a449d9 commit d8bd7d3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The directory containing `PKGBUILD` and `.SRCINFO` files can be specified in `pk
## Inputs

> ALL of these are optional
### `target`

**Default: pkgbuild** Validation target. Can be one of: `pkgbuild`, `srcinfo`, `run`.
Expand All @@ -22,7 +24,12 @@ The directory containing `PKGBUILD` and `.SRCINFO` files can be specified in `pk

**Default: '.'** Path to DIRECTORY where the PKGBUILD file is.

The `pkgname` is automatically extracted from the PKGBUILD
### `pkgname`

Totally optional, will work for most cases even if you leave it
**If needed, you can explicitly state it**

**Default: ** The `pkgname` is automatically extracted from the PKGBUILD

> TODO: Add this as input to explicitly tell the pkgname
Expand All @@ -46,7 +53,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: adig-pkgs/arch-pkgbuild-builder@v2.0
- uses: adig-pkgs/arch-pkgbuild-builder@v2.1
```
> This currently doesn't work for split-packages (ie. if your PKGBUILD contains `pkgname=('a-aef' 'b-aef' 'c-aef') # my package`)
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ inputs:
Path to Directory containing the PKGBUILD file
required: false
default: '.'
pkgname:
description: >-
Explicitly state the pkgname, if you are facing any difficulties
required: false
default: ''
target:
description: >-
Validation target.
Expand All @@ -34,3 +39,4 @@ runs:
- ${{ inputs.target }}
- ${{ inputs.command }}
- ${{ inputs.debug }}
- ${{ inputs.pkgname }}
5 changes: 4 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ pkgbuild_dir=$1
pkgbuild_dir=$(realpath ${pkgbuild_dir})

# Remove comments
pkgname=$(awk '/pkgname=/ {print}' "${pkgbuild_dir}/PKGBUILD" | head -n1 | cut -d'#' -f1 | cut -d'=' -f2 | sed -e 's/^ *//g' | sed -e 's/ *$//g')
pkgname=$5
if [ "$pkgname" == "" ]; then
pkgname=$(awk '/pkgname=/ {print}' "${pkgbuild_dir}/PKGBUILD" | head -n1 | cut -d'#' -f1 | cut -d'=' -f2 | sed -e 's/^ *//g' | sed -e 's/ *$//g')
fi
command=$3

# assumes that package files are in a subdirectory
Expand Down

0 comments on commit d8bd7d3

Please sign in to comment.