diff options
-rw-r--r-- | package.inc.sh | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/package.inc.sh b/package.inc.sh index 4c5db80..2650301 100644 --- a/package.inc.sh +++ b/package.inc.sh @@ -31,12 +31,12 @@ package_init() { (( do_update )) || return 0 - if ! [[ ${!2} = arch32__* ]]; then + if ! [[ ${!2} = packages32 ]]; then remote_is_tracking "${!2}" "$pkgname" || remote_update_refs "${!2}" "packages/$pkgname" fi - #fetch arch32/master + #fetch packages32/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 @@ -65,7 +65,7 @@ package_find_remote() { # 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}')" + | awk -F/ -v pkg="${pkgname}" ' $0 ~ "/"pkg"/PKGBUILD" {print "packages32";exit}')" if [[ ${!2} ]]; then return 0 fi @@ -140,13 +140,8 @@ package_list_files() { package_patch_arch32() { local arch repo subtree - 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 + read -r repo arch < <(package_get_repos_with_arch "$pkgname" "$remote" \ + | awk '!/testing/ && (/x86_64/ || /arch32/ || /any/) {print $1" "$2; exit}') 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}' \ @@ -174,7 +169,7 @@ package_export() { subtree=repos/$repo-$OPT_ARCH fi - if ! [[ $remote = arch32__* ]]; then + if ! [[ $remote = packages32 ]]; 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" @@ -206,7 +201,7 @@ package_checkout() { package_init "$pkgname" remote || return - if ! [[ $remote = arch32__* ]]; then + if ! [[ $remote = packages32 ]]; then git show-ref -q "refs/heads/$remote/packages/$pkgname" || git branch -qf --no-track {,}"$remote/packages/$pkgname" @@ -227,12 +222,20 @@ package_get_repos_with_arch() { local remote=$2 path arch repo pkgname=$1 - while read -r path; do - path=${path##*/} - repo=${path%-*} - arch=${path##*-} + if [[ $remote == packages32 ]]; then + repo="$(git ls-tree -r --name-only packages32/master \ + | awk -F/ -v pkg="${pkgname}" ' $0 ~ "/"pkg"/PKGBUILD" {print $1;exit}')" + [[ $repo ]] && arch=arch32 printf '%s %s\n' "$repo" "$arch" - done < <(git ls-tree --name-only "remotes/$remote/packages/$pkgname" repos/) + else + while read -r path; do + path=${path##*/} + repo=${path%-*} + arch=${path##*-} + printf '%s %s\n' "$repo" "$arch" + done < <(git ls-tree --name-only "remotes/$remote/packages/$pkgname" repos/) + fi + } package_get_arches() { |