From 8f9432ff83f64399f756260dc6d579d7af78ab96 Mon Sep 17 00:00:00 2001 From: Erick Cafferata Date: Sat, 19 Jan 2019 13:31:57 -0500 Subject: add support for patch to arch32 build - add package_patch_arch32() function - enables patching for export and checkout commands --- package.inc.sh | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/package.inc.sh b/package.inc.sh index da6a253..1f9f824 100644 --- a/package.inc.sh +++ b/package.inc.sh @@ -33,6 +33,12 @@ package_init() { remote_is_tracking "${!2}" "$pkgname" || remote_update_refs "${!2}" "packages/$pkgname" + + #fetch arch32/master + #test if master exists, if not, then fetch(very slow first time) + if ! (( OPT_UPSTREAM )); then + git show-ref -q packages32/master || quiet_git fetch packages32 master + fi } package_find_remote() { @@ -121,6 +127,26 @@ package_list_files() { awk -v "prefix=$subtree/" 'sub(prefix, "")' } +package_patch_arch32() { + local arch repo subtree + read -r repo arch < <(package_get_repos_with_arch "$pkgname" "$remote" \ + | awk '!/testing/ && (/x86_64/ || /any/) {print $1" "$2; exit}') + subtree=${1:-repos/${repo}-${arch}} + # borrowed from archlinux32/builder/lib/common-functions' mangle_pkgbuild() + sed -i ' + /^arch=[^#]*any/!{ + /^arch=(/s/(/(i486 i686 pentium3 / + } + ' "$pkgname/${subtree}/PKGBUILD" + for line in $(git ls-tree -r --name-only remotes/packages32/master ${repo}/${pkgname}); do + if [[ "${line##*/}" = "PKGBUILD" ]]; then + git show remotes/packages32/master:${line} >> ${pkgname}/${subtree}/PKGBUILD + else + git show remotes/packages32/master:${line} > ${pkgname}/${subtree}/${line##*/} + fi + done +} + package_export() { local remote repo arch path subtree=trunk pkgname=$1 @@ -153,12 +179,10 @@ package_export() { log_info 'exporting %s:%s' "$pkgname" "$subtree" git archive --format=tar "remotes/$remote/packages/$pkgname" "$subtree/" | tar --transform "s,^$subtree,$pkgname," -xf - "$subtree/" - # borrowed from archlinux32/builder/lib/common-functions' mangle_pkgbuild() - sed -i ' - /^arch=[^#]*any/!{ - /^arch=(/s/(/(i486 i686 pentium3 / - } - ' "$pkgname/PKGBUILD" + + if ! (( OPT_UPSTREAM )); then + package_patch_arch32 . + fi } package_checkout() { @@ -176,6 +200,10 @@ package_checkout() { --branch "$remote/packages/$pkgname" \ --config "pull.rebase=true" \ "$ASPROOT" "$pkgname" || return + + if ! (( OPT_UPSTREAM )); then + package_patch_arch32 + fi } package_get_repos_with_arch() { -- cgit v1.2.3-70-g09d2