Compare commits

21 Commits
v1 ... main

Author SHA1 Message Date
c6fe2df0d7 filter fields in functions 2025-06-21 14:43:19 +02:00
6eb5799c19 fix output 2025-06-21 14:16:12 +02:00
6ff63e2d91 fix output 2025-06-21 14:13:21 +02:00
b89b101bac fix output 2025-06-21 14:12:37 +02:00
2af2d5b8e0 fix output 2025-06-21 14:09:58 +02:00
67456923cc fix output 2025-06-21 14:08:34 +02:00
4f88573a1b fix output 2025-06-21 14:05:15 +02:00
a5c9cade3e fix script path 2025-06-21 13:41:15 +02:00
c5f45cee28 fix script path 2025-06-21 13:40:32 +02:00
f6aae053af fix script path 2025-06-21 13:39:44 +02:00
052dcf2043 fix script path 2025-06-21 13:36:30 +02:00
a29aefbdbe fix script path 2025-06-21 13:35:28 +02:00
ae3a9c1ddf fix script path 2025-06-21 13:33:07 +02:00
b2d0d6e6e6 fix script path 2025-06-21 13:31:31 +02:00
45b00ac67f fix script path 2025-06-21 13:30:11 +02:00
8ce9b297c1 fix script path 2025-06-21 13:29:24 +02:00
095c03ccda fix script path 2025-06-21 13:21:12 +02:00
59a56f0898 fix script path 2025-06-21 13:20:32 +02:00
da32b2521b fix script path 2025-06-21 13:11:56 +02:00
70970d035c fix script path 2025-06-21 13:10:05 +02:00
b8f857a860 fix params 2025-06-21 13:00:28 +02:00
2 changed files with 25 additions and 13 deletions

View File

@ -1,25 +1,32 @@
name: "Make SRCINFO"
description: "Generate .SRCINFO file from PKGBUILD"
inputs:
pkgbuild-file:
pkgbuild-path:
description: "Path to PKGBUILD file"
srcinfo-file:
srcinfo-path:
description: "Path to .SRCINFO file to be created"
default: ".SRCINFO"
outputs:
version:
description: "Version of the package"
value: ${{ steps.get-version.outputs.version }}
runs:
using: "composite"
steps:
- name: "Make SRCINFO"
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:
PKGBUILD_PATH: ${{ inputs.pkgbuild-file }}
SRCINFO_PATH: ${{ inputs.srcinfo-file }}
PKGBUILD_PATH: ${{ inputs.pkgbuild-path }}
SRCINFO_PATH: ${{ inputs.srcinfo-path }}
- name: "Get version"
id: get-version
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:
SRCINFO_PATH: ${{ inputs.srcinfo-file }}
SRCINFO_PATH: ${{ inputs.srcinfo-path }}

View File

@ -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_fields=("${section_scalar_fields[@]}" "${section_array_fields[@]}")
# load PKGBUILD
source "${1:-./PKGBUILD}"
# check if a variable is an array
is_array() {
[[ "$(declare -p $1)" =~ "declare -a" ]]
@ -43,17 +40,18 @@ print_array_field() {
}
# 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() {
if [[ -n $1 ]]; then
suffix="_$1"
else
suffix=""
fi
if [[ ! "$(type -t "package$suffix")" = function ]]; then return; fi
# eval only variable assignments in package function
while read -r line; do
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
@ -74,6 +72,13 @@ print_section_content() {
}
# main
for field in "${base_fields[@]}"; do
eval "unset $field"
done
clear_fields
# load PKGBUILD
source "${1:-./PKGBUILD}"
# determine pkgbase
if ! is_array pkgname; then