Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
c6fe2df0d7
|
|||
|
6eb5799c19
|
|||
|
6ff63e2d91
|
|||
|
b89b101bac
|
|||
|
2af2d5b8e0
|
|||
|
67456923cc
|
|||
|
4f88573a1b
|
|||
|
a5c9cade3e
|
|||
|
c5f45cee28
|
|||
|
f6aae053af
|
|||
|
052dcf2043
|
|||
|
a29aefbdbe
|
|||
|
ae3a9c1ddf
|
|||
|
b2d0d6e6e6
|
|||
|
45b00ac67f
|
|||
|
8ce9b297c1
|
|||
|
095c03ccda
|
|||
|
59a56f0898
|
|||
|
da32b2521b
|
|||
|
70970d035c
|
|||
|
b8f857a860
|
21
action.yml
21
action.yml
@ -1,25 +1,32 @@
|
|||||||
name: "Make SRCINFO"
|
name: "Make SRCINFO"
|
||||||
description: "Generate .SRCINFO file from PKGBUILD"
|
description: "Generate .SRCINFO file from PKGBUILD"
|
||||||
inputs:
|
inputs:
|
||||||
pkgbuild-file:
|
pkgbuild-path:
|
||||||
description: "Path to PKGBUILD file"
|
description: "Path to PKGBUILD file"
|
||||||
srcinfo-file:
|
srcinfo-path:
|
||||||
description: "Path to .SRCINFO file to be created"
|
description: "Path to .SRCINFO file to be created"
|
||||||
default: ".SRCINFO"
|
default: ".SRCINFO"
|
||||||
outputs:
|
outputs:
|
||||||
version:
|
version:
|
||||||
description: "Version of the package"
|
description: "Version of the package"
|
||||||
|
value: ${{ steps.get-version.outputs.version }}
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: "Make SRCINFO"
|
- name: "Make SRCINFO"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: "./mksrcinfo.sh $PKGBUILD_PATH > $SRCINFO_PATH"
|
run: |
|
||||||
|
echo "PKGBUILD_PATH: $PKGBUILD_PATH"
|
||||||
|
echo "SRCINFO_PATH: $SRCINFO_PATH"
|
||||||
|
$GITHUB_ACTION_PATH/mksrcinfo.sh $PKGBUILD_PATH > $SRCINFO_PATH
|
||||||
env:
|
env:
|
||||||
PKGBUILD_PATH: ${{ inputs.pkgbuild-file }}
|
PKGBUILD_PATH: ${{ inputs.pkgbuild-path }}
|
||||||
SRCINFO_PATH: ${{ inputs.srcinfo-file }}
|
SRCINFO_PATH: ${{ inputs.srcinfo-path }}
|
||||||
- name: "Get version"
|
- name: "Get version"
|
||||||
|
id: get-version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: "grep 'pkgver = ' $SRCINFO_PATH | sed 's/ = /=/' >> $GITHUB_OUTPUT"
|
run: |
|
||||||
|
grep 'pkgver = ' $SRCINFO_PATH | sed -e 's/^\s*//' -e 's/ = /=/'
|
||||||
|
grep 'pkgver = ' $SRCINFO_PATH | sed -e 's/^\s*//' -e 's/ = /=/' -e 's/pkgver/version/' >> $GITHUB_OUTPUT
|
||||||
env:
|
env:
|
||||||
SRCINFO_PATH: ${{ inputs.srcinfo-file }}
|
SRCINFO_PATH: ${{ inputs.srcinfo-path }}
|
||||||
|
|||||||
17
mksrcinfo.sh
17
mksrcinfo.sh
@ -7,9 +7,6 @@ section_arch_fields=(source depends checkdepends makedepends optdepends provides
|
|||||||
section_array_fields=(arch groups license noextract options backup validpgpkeys "${section_arch_fields[@]}")
|
section_array_fields=(arch groups license noextract options backup validpgpkeys "${section_arch_fields[@]}")
|
||||||
section_fields=("${section_scalar_fields[@]}" "${section_array_fields[@]}")
|
section_fields=("${section_scalar_fields[@]}" "${section_array_fields[@]}")
|
||||||
|
|
||||||
# load PKGBUILD
|
|
||||||
source "${1:-./PKGBUILD}"
|
|
||||||
|
|
||||||
# check if a variable is an array
|
# check if a variable is an array
|
||||||
is_array() {
|
is_array() {
|
||||||
[[ "$(declare -p $1)" =~ "declare -a" ]]
|
[[ "$(declare -p $1)" =~ "declare -a" ]]
|
||||||
@ -43,17 +40,18 @@ print_array_field() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# load section content from its package function
|
# load section content from its package function
|
||||||
|
for field in "${section_fields[@]}"; do
|
||||||
|
_load_section_content_fields_pattern="$field|$_load_section_content_fields_pattern"
|
||||||
|
done
|
||||||
load_section_content() {
|
load_section_content() {
|
||||||
if [[ -n $1 ]]; then
|
if [[ -n $1 ]]; then
|
||||||
suffix="_$1"
|
suffix="_$1"
|
||||||
else
|
|
||||||
suffix=""
|
|
||||||
fi
|
fi
|
||||||
if [[ ! "$(type -t "package$suffix")" = function ]]; then return; fi
|
if [[ ! "$(type -t "package$suffix")" = function ]]; then return; fi
|
||||||
# eval only variable assignments in package function
|
# eval only variable assignments in package function
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
eval "$line"
|
eval "$line"
|
||||||
done < <(declare -f "package$suffix" | grep -E '^[[:space:]]*(declare +)?[[:alnum:]_]*=')
|
done < <(declare -f "package$suffix" | grep -E "^[[:space:]]*(declare +)?($_load_section_content_fields_pattern)=" | sed 's/^[[:space:]]*(declare +)?//')
|
||||||
}
|
}
|
||||||
|
|
||||||
# print fields for a section
|
# print fields for a section
|
||||||
@ -74,6 +72,13 @@ print_section_content() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# main
|
# main
|
||||||
|
for field in "${base_fields[@]}"; do
|
||||||
|
eval "unset $field"
|
||||||
|
done
|
||||||
|
clear_fields
|
||||||
|
|
||||||
|
# load PKGBUILD
|
||||||
|
source "${1:-./PKGBUILD}"
|
||||||
|
|
||||||
# determine pkgbase
|
# determine pkgbase
|
||||||
if ! is_array pkgname; then
|
if ! is_array pkgname; then
|
||||||
|
|||||||
Reference in New Issue
Block a user