diff options
author | Erick Cafferata <erick@cafferata.me> | 2019-02-01 15:41:45 -0500 |
---|---|---|
committer | Erick Cafferata <erick@cafferata.me> | 2019-02-01 16:22:03 -0500 |
commit | b24995c644ac9c955daf7f0283f24eac24f5be41 (patch) | |
tree | eec96b17694e4a039a4d342c75ce10c7e627c292 /package.inc.sh | |
parent | 23e50952efdc355fa3583baaef6accaf34efd0b6 (diff) | |
download | asp32-b24995c644ac9c955daf7f0283f24eac24f5be41.tar.xz |
add checkout/export support for arch32-only packages
Diffstat (limited to 'package.inc.sh')
-rw-r--r-- | package.inc.sh | 75 |
1 files changed, 48 insertions, 27 deletions
diff --git a/package.inc.sh b/package.inc.sh index 2d7ead2..5f1d961 100644 --- a/package.inc.sh +++ b/package.inc.sh @@ -31,8 +31,10 @@ package_init() { (( do_update )) || return 0 - remote_is_tracking "${!2}" "$pkgname" || - remote_update_refs "${!2}" "packages/$pkgname" + if ! [[ ${!2} = arch32__* ]]; then + remote_is_tracking "${!2}" "$pkgname" || + remote_update_refs "${!2}" "packages/$pkgname" + fi #fetch arch32/master #test if master exists, if not, then fetch(very slow first time) @@ -60,6 +62,15 @@ package_find_remote() { fi done + # arch32-only packages + if ! (( OPT_UPSTREAM )); then + printf -v "$2" %s "$(git ls-tree -r --name-only packages32/master \ + | awk -F/ -v pkg="${pkgname}" ' $0 ~ "/"pkg"/PKGBUILD" {print "arch32__"$1;exit}')" + if [[ $2 ]]; then + return 0 + fi + fi + return 1 } @@ -129,9 +140,15 @@ package_list_files() { 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}') + if [[ $remote == arch32__* ]]; then + arch=arch32 + repo=${remote#arch32__*} + else + read -r repo arch < <(package_get_repos_with_arch "$pkgname" "$remote" \ + | awk '!/testing/ && (/x86_64/ || /any/) {print $1" "$2; exit}') + fi subtree=${1:-repos/${repo}-${arch}} + mkdir -p ${pkgname}/${subtree} && touch ${pkgname}/${subtree}/PKGBUILD awk -i inplace '!/^arch=[^#]*any/ {gsub(/^arch=\(/,"arch=(i486 i686 pentium3 ")}; {print}' \ "$pkgname/${subtree}/PKGBUILD" for line in $(git ls-tree -r --name-only remotes/packages32/master ${repo}/${pkgname}); do @@ -157,24 +174,26 @@ package_export() { subtree=repos/$repo-$OPT_ARCH fi - if ! git show "remotes/$remote/packages/$pkgname:$subtree/" &>/dev/null; then - if [[ $repo ]]; then - log_error "package '%s' not found in repo '%s-%s'" "$pkgname" "$repo" "$OPT_ARCH" - return 1 - else - log_error "package '%s' has no trunk directory!" "$pkgname" - return 1 + if ! [[ $remote = arch32__* ]]; then + if ! git show "remotes/$remote/packages/$pkgname:$subtree/" &>/dev/null; then + if [[ $repo ]]; then + log_error "package '%s' not found in repo '%s-%s'" "$pkgname" "$repo" "$OPT_ARCH" + return 1 + else + log_error "package '%s' has no trunk directory!" "$pkgname" + return 1 + fi fi - fi - if (( ! OPT_FORCE )); then - # shellcheck disable=SC2154 - mkdir "$pkgname" || return - fi + if (( ! OPT_FORCE )); then + # shellcheck disable=SC2154 + mkdir "$pkgname" || return + fi - log_info 'exporting %s:%s' "$pkgname" "$subtree" - git archive --format=tar "remotes/$remote/packages/$pkgname" "$subtree/" | - tar --transform "s,^$subtree,$pkgname," -xf - "$subtree/" + log_info 'exporting %s:%s' "$pkgname" "$subtree" + git archive --format=tar "remotes/$remote/packages/$pkgname" "$subtree/" | + tar --transform "s,^$subtree,$pkgname," -xf - "$subtree/" + fi if ! (( OPT_UPSTREAM )); then package_patch_arch32 . @@ -187,15 +206,17 @@ package_checkout() { package_init "$pkgname" remote || return - git show-ref -q "refs/heads/$remote/packages/$pkgname" || - git branch -qf --no-track {,}"$remote/packages/$pkgname" + if ! [[ $remote = arch32__* ]]; then + git show-ref -q "refs/heads/$remote/packages/$pkgname" || + git branch -qf --no-track {,}"$remote/packages/$pkgname" - quiet_git clone \ - --shared \ - --single-branch \ - --branch "$remote/packages/$pkgname" \ - --config "pull.rebase=true" \ - "$ASPROOT" "$pkgname" || return + quiet_git clone \ + --shared \ + --single-branch \ + --branch "$remote/packages/$pkgname" \ + --config "pull.rebase=true" \ + "$ASPROOT" "$pkgname" || return + fi if ! (( OPT_UPSTREAM )); then package_patch_arch32 |