diff options
author | Erick Cafferata <erick@cafferata.me> | 2019-01-19 13:31:57 -0500 |
---|---|---|
committer | Erick Cafferata <erick@cafferata.me> | 2019-01-22 22:09:05 -0500 |
commit | 8f9432ff83f64399f756260dc6d579d7af78ab96 (patch) | |
tree | 505fec5258cbbceb3afa955670d66781cb1ff774 | |
parent | 4494fd2afb566fc906dcb86f01f93d58ca42da37 (diff) | |
download | asp32-8f9432ff83f64399f756260dc6d579d7af78ab96.tar.xz |
add support for patch to arch32 build
- add package_patch_arch32() function
- enables patching for export and checkout commands
-rw-r--r-- | package.inc.sh | 40 |
1 files 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() { |