diff options
Diffstat (limited to 'package.inc.sh')
-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() { |