Skip to content

Commit

Permalink
More flexible path
Browse files Browse the repository at this point in the history
  • Loading branch information
gr211 committed Jun 21, 2020
1 parent 2f9787a commit 4e49977
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
*.iml
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

This action builds an validates Arch Linux package.
The `PKGBUILD` and `.SRCINFO` files should be under a subdirectory named the same as the `pkgbuild` of the package.
This assumption is made so this action works well with [aurpublish].

This assumption made is so that this action works well with [aurpublish] (_untested in this fork yet_).

This version is a fork from the original [arch-pkgbuild-builder](https://github.com/2m/arch-pkgbuild-builder).

It differs in that the `PKGBUILD` and related files do not need to be place in the root of the github workspace.

[aurpublish]: https://github.com/eli-schwartz/aurpublish

Expand All @@ -23,18 +28,18 @@ This assumption is made so this action works well with [aurpublish].
Verifies and builds the package.

```yml
uses: 2m/arch-pkgbuild-builder@v1
uses: grumlimited/arch-pkgbuild-builder@v1
with:
target: 'pkgbuild'
pkgname: 'ucm-bin'
pkgname: 'data/arch/authenticator-rs/PKGBUILD'
```
### srcinfo
Verifies if the `.SRCINFO` is up to date with the `PKGBUILD`.

```yml
uses: 2m/arch-pkgbuild-builder@v1
uses: grumlimited/arch-pkgbuild-builder@v1
with:
target: 'srcinfo'
pkgname: 'ucm-bin'
Expand All @@ -45,7 +50,7 @@ with:
Installs the package and runs a given `command`.

```yml
uses: 2m/arch-pkgbuild-builder@v1
uses: grumlimited/arch-pkgbuild-builder@v1
with:
target: 'run'
pkgname: 'ucm-bin'
Expand All @@ -56,4 +61,4 @@ with:

So far this action is used by the following packages:

* [ucm-bin](https://github.com/2m/ucm-bin-pkgbuild)
* [authenticator-rs](https://github.com/grumlimited/authenticator-rs)
9 changes: 6 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: 'Arch Linux PKGBUILD builder action'
description: 'Builds an validates PKGBUILD definition'

branding:
icon: 'triangle'
color: 'blue'

inputs:
pkgname:
description: 'The pkgname of the package to be validated'
pkgbuild:
description: 'Path to file PKGBUILD. Assumes to be placed in a directory with the name of package, ie /path/to/pkgname'
required: true
target:
description: 'Validation target. Can be one of: "pkgbuild", "srcinfo"'
Expand All @@ -14,10 +16,11 @@ inputs:
command:
description: 'Command to run after package installation'
required: false

runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.target }}
- ${{ inputs.pkgname }}
- ${{ inputs.pkgbuild }}
- ${{ inputs.command }}
22 changes: 13 additions & 9 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
#!/bin/sh -l

target=$1
pkgname=$2
pkgbuild=$2
command=$3

# '/github/workspace' is mounted as a volume and has owner set to root
# set the owner to the 'build' user, so it can access package files
sudo chown -R build /github/workspace /github/home

# assumes that package files are in a subdirectory
# of the same name as "pkgname", so this works well
# with "aurpublish" tool
cd "$pkgname" || exit

pkgbuild_dir=$(dirname $(readlink $pkgbuild -f))
cd $pkgbuild_dir || exit

# '/github/workspace' is mounted as a volume and has owner set to root
# set the owner to the 'build' user, so it can access package files
sudo chown -R build $pkgbuild_dir

pkgname=$(basename $pkgbuild_dir)

install_deps() {
# install make and regular package dependencies
grep -E 'depends|makedepends' PKGBUILD | \
sed -e 's/.*depends=//' -e 's/ /\n/g' | \
tr -d "'" | tr -d "(" | tr -d ")" | \
xargs yay -S --noconfirm
xargs sudo yay -S --noconfirm
}

case $target in
Expand All @@ -27,8 +31,8 @@ case $target in
install_deps
makepkg --syncdeps --noconfirm
namcap "${pkgname}"-*
pacman -Qip "${pkgname}"-*
pacman -Qlp "${pkgname}"-*
pacman -Qip "${pkgname}"-*.xz
pacman -Qlp "${pkgname}"-*.xz
;;
run)
install_deps
Expand Down

0 comments on commit 4e49977

Please sign in to comment.