From a525d316f5e882039f3072f087d92e4b8f625bf9 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 17 May 2017 16:08:01 +0200 Subject: split off customization of PKGBUILDs from searching for PKGBUILDs --- bin/build-packages | 1 + bin/common-functions | 44 +++++++++++++++++++++++++++----------------- bin/get-package-updates | 1 + 3 files changed, 29 insertions(+), 17 deletions(-) (limited to 'bin') diff --git a/bin/build-packages b/bin/build-packages index 985c59a..30430a0 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -103,6 +103,7 @@ while [ ${count} -ne 0 ]; do fi cd "${PKGBUILD%/*}" + apply_package_customizations success=false for parameters in '' '-c'; do rm -f *.pkg.tar.xz{,.sig} 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 diff --git a/bin/get-package-updates b/bin/get-package-updates index caef397..71f379c 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -149,6 +149,7 @@ while read -r package git_revision mod_git_revision repository; do ( cd "${PKGBUILD%/*}" + apply_package_customizations mksrcinfo -o "${work_dir}/package-infos/${package}.${git_revision}.${new_repo_revisions["archlinux32"]}.SRCINFO" ) -- cgit v1.2.3-54-g00ecf