diff options
author | Erich Eckner <git@eckner.net> | 2017-05-17 16:08:01 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-05-17 16:08:01 +0200 |
commit | a525d316f5e882039f3072f087d92e4b8f625bf9 (patch) | |
tree | 5404977c00989662180fd6d3fdba782073c91a6d /bin/common-functions | |
parent | 9703006a04a334e40a894849a6a962b8fed1a947 (diff) | |
download | builder-a525d316f5e882039f3072f087d92e4b8f625bf9.tar.xz |
split off customization of PKGBUILDs from searching for PKGBUILDs
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-x | bin/common-functions | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/bin/common-functions b/bin/common-functions index d5a15f8..7783031 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -38,28 +38,38 @@ find_pkgbuild() { )" if [ -n "${PKGBUILD}" ]; then echo "${PKGBUILD}" - if [ ! -f "${PKGBUILD}.changes-applied" ]; then - # add i486 to the arch list - sed '/^arch=[^#]*any/!s|^\(arch=(\)\([^#]*)\)\s*\(#.*\)\?$|\1i486 \2|' -i "${PKGBUILD}" - if [ -f "${repo_paths["archlinux32"]}/$2/$1/PKGBUILD" ]; then - # If this package has modifications (or is new), apply them now: - # append PKGBUILD - cat "${repo_paths["archlinux32"]}/$2/$1/PKGBUILD" >> \ - "${PKGBUILD}" - # copy (and overwrite) other files - for file in "${repo_paths["archlinux32"]}/$2/$1/"*; do - if [ -f "${file}" ] && [ "${file##*/}" != "PKGBUILD" ]; then - cp "${file}" "${PKGBUILD%/*}/" - fi - done - fi - touch "${PKGBUILD}.changes-applied" - fi break fi done } +# to be executed in the package directory +apply_package_customizations() { + if [ ! -f 'PKGBUILD' ]; then + >&2 echo 'PKGBUILD not found.' + pwd + exit 1 + fi + + if [ ! -f 'PKGBUILD.changes-applied' ]; then + # add i486 to the arch list + sed '/^arch=[^#]*any/!s|^\(arch=(\)\([^#]*)\)\s*\(#.*\)\?$|\1i486 \2|' -i 'PKGBUILD' + if [ -f "${repo_paths["archlinux32"]}/$2/$1/PKGBUILD" ]; then + # If this package has modifications (or is new), apply them now: + # append PKGBUILD + cat "${repo_paths["archlinux32"]}/$2/$1/PKGBUILD" >> \ + 'PKGBUILD' + # copy (and overwrite) other files + for file in "${repo_paths["archlinux32"]}/$2/$1/"*; do + if [ -f "${file}" ] && [ "${file##*/}" != 'PKGBUILD' ]; then + cp "${file}" ./ + fi + done + fi + touch 'PKGBUILD.changes-applied' + fi +} + find_repository_with_commit() { local repository |