Skip to content

Commit

Permalink
Merge pull request #1 from grumlimited/rg/actual_pr
Browse files Browse the repository at this point in the history
More flexible path
  • Loading branch information
gr211 authored Jun 25, 2020
2 parents 4e49977 + 0408ef4 commit d812bfe
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

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 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.
This assumption is made so this action works well with [aurpublish].

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

Expand All @@ -28,18 +23,18 @@ It differs in that the `PKGBUILD` and related files do not need to be place in t
Verifies and builds the package.

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

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

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

So far this action is used by the following packages:

* [authenticator-rs](https://github.com/grumlimited/authenticator-rs)
* [ucm-bin](https://github.com/2m/ucm-bin-pkgbuild)
10 changes: 7 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ branding:
color: 'blue'

inputs:
pkgbuild:
description: 'Path to file PKGBUILD. Assumes to be placed in a directory with the name of package, ie /path/to/pkgname'
pkgname:
description: 'Path to DIRECTORY where the PKGBUILD file is. Assumes the directory is the name of package, ie /path/to/pkgname/'
required: true
target:
description: 'Validation target. Can be one of: "pkgbuild", "srcinfo"'
Expand All @@ -16,11 +16,15 @@ inputs:
command:
description: 'Command to run after package installation'
required: false
debug:
description: 'Turns debugging on'
required: false

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

DEBUG=$4

if [[ -n $DEBUG && $DEBUG = true ]]; then
set -x
fi

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

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

pkgbuild_dir=$(dirname $(readlink $pkgbuild -f))
cd $pkgbuild_dir || exit
if [[ ! -d $pkgname ]]; then
echo "$pkgname should be a directory."
exit 1
fi

if [[ ! -e $pkgname/PKGBUILD ]]; then
echo "$pkgname does not contain a PKGBUILD file."
exit 1
fi

pkgbuild_dir=$(readlink $pkgname -f) # nicely cleans up path, ie. ///dsq/dqsdsq/my-package//// -> /dsq/dqsdsq/my-package

# '/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
# set the owner of $pkgbuild_dir to the 'build' user, so it can access package files.
sudo chown -R build $pkgbuild_dir

pkgname=$(basename $pkgbuild_dir)
cd $pkgbuild_dir

pkgname="$(basename $pkgbuild_dir)" # keep quotes in case someone passes in a directory path with whitespaces...

install_deps() {
# install make and regular package dependencies
Expand Down

0 comments on commit d812bfe

Please sign in to comment.