index : devops | |
Archlinux32 devs' convenience-scripts | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2023-07-09 20:57:41 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2023-07-09 20:57:41 +0200 |
commit | 9c942d4c60fe6d7f7f5a87cad271de3c23a2366c (patch) | |
tree | 2d4a4f9145fcc4a8eddba3c27add5bf7bbd1ff64 /update-archlinux32-package | |
parent | 0694207e50c3702184b5baceed1b6ab309782beb (diff) |
-rwxr-xr-x | update-archlinux32-package | 147 |
diff --git a/update-archlinux32-package b/update-archlinux32-package index 8c321fe..44b0693 100755 --- a/update-archlinux32-package +++ b/update-archlinux32-package @@ -22,8 +22,7 @@ # teamspeak3-server git_repo_path='/usr/src/archlinux32/packages' -upstream_git_path='/usr/src/archlinux/packages' -upstream_community_git_path='/usr/src/archlinux/community' +state_repo_path='/usr/src/archlinux/state' archlinuxewe_git_path=~erich/'archlinuxewe' base_dir=$( dirname "$( @@ -35,8 +34,7 @@ if [ "x$1" = "x-" ]; then shift else if ! git -C "${git_repo_path}" pull --ff-only || \ - ! git -C "${upstream_git_path}" pull --ff-only || \ - ! git -C "${upstream_community_git_path}" pull --ff-only || \ + ! git -C "${state_repo_path}" pull --ff-only || \ ! git -C "${archlinuxewe_git_path}" pull --ff-only; then >&2 echo 'Your git repos cannot cleanly be updated' exit 1 @@ -177,10 +175,15 @@ case ${update_path} in T sum_loop } ' "${git_repo_path}/${repo}/${pkgname}/PKGBUILD" - scp -r "${upstream_git_path}/${pkgname}/repos/${repo}-${repo_arch}" \ - "arch32-test:${pkgname}" + commit=$( + git -C "${state_repo_path}" archive HEAD -- "${repo}-${repo_arch}/${pkgname}" \ + | tar -Ox \ + | cut -d' ' -f4 + ) + curl -LSs 'https://buildmaster.archlinux32.org/upstream-packages/'"${pkgname}"'-'"${commit}"'.tar.gz' \ + | ssh 'arch32-test' 'tar -xz' if ! ssh arch32-test ' - cd "'"${pkgname}"'" + cd "'"${pkgname}"'-'"${commit}"'" cat >> PKGBUILD makepkg --verifysource ' < \ @@ -191,44 +194,39 @@ case ${update_path} in git -C "${git_repo_path}" commit "${repo}/${pkgname}/PKGBUILD" -m "${repo}/${pkgname}: ${old_pkgver} -> ${new_pkgver}" ;; 'checksum') - used_upstream_git_path="${upstream_git_path}" repo_arch=$( - git -C "${used_upstream_git_path}/${pkgname}/repos" archive HEAD -- 2>/dev/null | \ - tar -t 2>/dev/null | \ - sed -n ' - s/^'"${repo}-"'// - T - s@/$@@ - p - ' | \ - head -n1 + git -C "${state_repo_dir}" archive HEAD \ + | tar -t --wildcard "${repo}"'-*/'"${pkgname}" \ + | sed -n ' + s@^'"${repo}"'-@@ + T + s@/.*$@@ + T + p + ' \ + | head -n1 ) - if [ -z "${repo_arch}" ]; then - used_upstream_git_path="${upstream_community_git_path}" - repo_arch=$( - git -C "${used_upstream_git_path}/${pkgname}/repos" archive HEAD -- | \ - tar -t | \ - sed -n ' - s/^'"${repo}-"'// - T - s@/$@@ - p - ' | \ - head -n1 - ) - fi - scp -r "${used_upstream_git_path}/${pkgname}/repos/${repo}-${repo_arch}" \ - "arch32-test:${pkgname}" + commit=$( + git -C "${state_repo_dir}" archive HEAD -- "${repo}-${repo_arch}/${pkgname}" \ + | tar -Ox \ + | cut -d' ' -f4 + ) + curl -LSs 'https://buildmaster.archlinux32.org/upstream-packages/'"${pkgname}"'-'"${commit}"'.tar.gz' \ + | ssh 'arch32-test' 'tar -xz' ssh arch32-test ' - cd "'"${pkgname}"'" + cd "'"${pkgname}-${commit}"'" cat >> PKGBUILD echo '"'"'[ "${arch[0]}" = any ] || arch+=(i686 pentium4)'"'"' >> PKGBUILD ' < "${git_repo_path}/${repo}/${pkgname}/PKGBUILD" update_checksum - scp "${used_upstream_git_path}/${pkgname}/repos/${repo}-${repo_arch}/PKGBUILD" \ - "arch32-test:${pkgname}/" + curl -LSs 'https://buildmaster.archlinux32.org/upstream-packages/'"${pkgname}"'-'"${commit}"'.tar.gz' \ + | tar -Oxz "${pkgname}-${commit}"'/PKGBUILD' \ + | ssh 'arch32-test' ' + cd "'"${pkgname}-${commit}"'" + cat > "PKGBUILD" + ' if ! ssh arch32-test ' - cd "'"${pkgname}"'" + cd "'"${pkgname}-${commit}"'" cat >> PKGBUILD echo '"'"'[ "${arch[0]}" = any ] || arch+=(i686 pentium4)'"'"' >> PKGBUILD makepkg --verifysource @@ -342,6 +340,15 @@ case ${update_path} in >&2 echo '"# upstream git revision: ..." line is missing.' exit 1 fi + new_revision=$( + git -C "${state_repo_path}" archive HEAD -- "${repo}-x86_64/${pkgname}" \ + | tar -Ox \ + | cut -d' ' -f4 + ) + if [ "${old_revision}" = "${new_revision}" ]; then + >&2 printf 'Old and new revision are both %s. Nothing to do.\n' "${old_revision}" + exit 0 + fi config_names=$( git -C "${git_repo_path}/${repo}/${pkgname}" archive HEAD -- | \ tar -t | \ @@ -350,17 +357,17 @@ case ${update_path} in ) diff=$( diff -u <( - git -C "${upstream_git_path}/${pkgname}/repos/${repo}-x86_64" archive "${old_revision}" -- config | \ - tar -Ox | \ - sort - ) \ - <( - git -C "${upstream_git_path}/${pkgname}/repos/${repo}-x86_64" archive HEAD -- config | \ - tar -Ox | \ - sort - ) | \ - grep '^[+-].' | \ - grep -v '^+++\|^---' + curl -LSs 'https://buildmaster.archlinux32.org/upstream-packages/'"${pkgname}"'-'"${old_revision}"'.tar.gz' \ + | tar -Oxz "${pkgname}-${old_revision}/config" \ + | sort + ) \ + <( + curl -LSs 'https://buildmaster.archlinux32.org/upstream-packages/'"${pkgname}"'-'"${new_revision}"'.tar.gz' \ + | tar -Oxz "${pkgname}-${new_revision}/config" \ + | sort + ) \ + | grep '^[+-].' \ + | grep -v '^+++\|^---' ) if [ -z "${diff}" ]; then >&2 echo 'nothing changed.' @@ -386,23 +393,22 @@ case ${update_path} in sponge "${git_repo_path}/${repo}/${pkgname}/${config_name}" done sed -i ' - 1 s/^#.*$/# upstream git revision: '"$( - git -C "${upstream_git_path}" rev-parse HEAD - )"'/ + 1 s/^#.*$/# upstream git revision: '"${new_revision}"'/ s/'"$( - git -C "${upstream_git_path}/${pkgname}/repos/${repo}-x86_64" archive "${old_revision}" -- config | \ - tar -Ox | \ - sha256sum | \ - awk '{print $1}' + curl -LSs 'https://buildmaster.archlinux32.org/upstream-packages/'"${pkgname}"'-'"${old_revision}"'.tar.gz' \ + | tar -Oxz "${pkgname}-${old_revision}/config" \ + | b2sum \ + | awk '{print $1}' )"'/'"$( - git -C "${upstream_git_path}/${pkgname}/repos/${repo}-x86_64" archive HEAD -- config | \ - tar -Ox | \ - sha256sum | \ - awk '{print $1}' + curl -LSs 'https://buildmaster.archlinux32.org/upstream-packages/'"${pkgname}"'-'"${new_revision}"'.tar.gz' \ + | tar -Oxz "${pkgname}-${new_revision}/config" \ + | b2sum \ + | awk '{print $1}' )"'/g ' "${git_repo_path}/${repo}/${pkgname}/PKGBUILD" { - git -C "${upstream_git_path}/${pkgname}/repos/${repo}-x86_64" archive HEAD -- + curl -LSs 'https://buildmaster.archlinux32.org/upstream-packages/'"${pkgname}"'-'"${new_revision}"'.tar.gz' \ + | zcat git -C "${git_repo_path}/${repo}/${pkgname}" archive HEAD \ | tar -tf - \ | grep -vxF "$( @@ -414,11 +420,13 @@ case ${update_path} in for config_name in ${config_names}; do tar -c -C "${git_repo_path}/${repo}/${pkgname}" "${config_name}" done - } | \ - ssh arch32-test ' - mkdir "'"${pkgname}"'" - tar -xiC "'"${pkgname}"'" - ' + } \ + | ssh arch32-test ' + mkdir "'"${pkgname}"'" + tar -xiC "'"${pkgname}"'" + mv "'"${pkgname}/${pkgname}-${new_revision}"'"/* "'"${pkgname}"'/" || exit $? + rmdir "'"${pkgname}/${pkgname}-${new_revision}"'" || exit $? + ' || exit $? ssh arch32-test ' cd "'"${pkgname}"'" cat >> PKGBUILD @@ -428,7 +436,7 @@ case ${update_path} in printf 's/' git -C "${git_repo_path}/${repo}/${pkgname}" archive HEAD -- "${config_name}" | \ tar -Ox | \ - sha256sum | \ + b2sum | \ awk '{print $1}' | \ tr -d '\n' printf '/SKIP/g\n' @@ -437,8 +445,7 @@ case ${update_path} in /^arch=[^#]*any/!{ /^arch=(/s/(/(i486 i686 pentium4 / } - /^\s*cp .\+ \.config\s*$/ a make olddefconfig - /^}$/ i mv .config .processed-config \ + /^\s*_make olddefconfig$/ a mv .config .processed-config \ return 1 '"'"' PKGBUILD ' < \ @@ -464,11 +471,11 @@ case ${update_path} in printf 's/' git -C "${git_repo_path}/${repo}/${pkgname}" archive HEAD -- "${config_name}" | \ tar -Ox | \ - sha256sum | \ + b2sum | \ awk '{print $1}' | \ tr -d '\n' printf '/' - sha256sum "${git_repo_path}/${repo}/${pkgname}/${config_name}" | \ + b2sum "${git_repo_path}/${repo}/${pkgname}/${config_name}" | \ awk '{print $1}' | \ tr -d '\n' printf '/g\n' |