From 666a393a5771f1361ca58002feaba47fc170c4e5 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 27 Jan 2019 14:10:35 +0100 Subject: joined the bootstrap and local build script to one script --- bin/build-and-deploy-bootstrap-package | 116 --------------------------------- bin/local-build-package | 116 ++++++++++++++++++++++++++++----- 2 files changed, 100 insertions(+), 132 deletions(-) delete mode 100755 bin/build-and-deploy-bootstrap-package diff --git a/bin/build-and-deploy-bootstrap-package b/bin/build-and-deploy-bootstrap-package deleted file mode 100755 index 5560d1e..0000000 --- a/bin/build-and-deploy-bootstrap-package +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh - -# build one package to test if modifications are ok (before opening a pull -# request in https://github.com/archlinux32/packages) -# package is built directly on a i486/i586/i686 host without any chroots - -# shellcheck source=../lib/load-configuration -. "${0%/*}/../lib/load-configuration" - -usage() { - >&2 echo '' - >&2 echo 'test-build-package : build package for testing' - >&2 echo '' - >&2 echo 'possible options:' - >&2 echo ' -h|--help: Show this help and exit.' - [ -z "$1" ] && exit 1 || exit $1 -} - -eval set -- "$( - getopt -o hn:t:x \ - --long help \ - -n "$(basename "$0")" -- "$@" || \ - echo usage -)" - -while true -do - case "$1" in - -h|--help) - usage 0 - ;; - --) - shift - break - ;; - *) - >&2 echo 'Whoops, forgot to implement option "'"$1"'" internally.' - exit 42 - ;; - esac - shift -done - -if [ $# -ne 2 ]; then - >&2 echo 'Too few or too many arguments. Expecting exactly a repository and a package name of the package to test.' - usage -fi - -# Update git repositories (official packages, community packages and the repository of package customizations). - -for repo_name in ${repo_names}; do - eval repo_path='"${repo_paths__'"${repo_name}"'}"' - git -C "${repo_path}" pull -done - -repository=$1 -package=$2 -case $repository in - core) - repo_path='../work/repos/packages' - ;; - extra) - repo_path='../work/repos/packages' - ;; - community) - repo_path='../work/repos/community' - ;; - *) - >&2 echo 'Repository is either "core" or "community"' - usage -esac -git_revision=$(cd ${repo_path}; git rev-parse HEAD) - -mod_git_revision=$(cd ${repo_paths__archlinux32}; git stash create) -if [ -z $mod_git_revision ]; then - mod_git_revision=$(cd ${repo_paths__archlinux32}; git rev-parse HEAD) -fi -build_command='staging-i486-build' -#parameters='-- -- --nocheck' - -git_repo=$(find_repository_with_commit "${git_revision}") -find_pkgbuilds "${package}" "${repository}" "${git_repo}" "${git_revision}" "${mod_git_revision}" -tmp_dir=$(mktemp -d "${work_dir}/tmp.XXXXXX") - -extract_source_directory "${git_repo}" "${git_revision}" "${mod_git_revision}" "${tmp_dir}" "2" - -rm -f *".pkg.tar.xz" *".pkg.tar.xz.sig" - -cd "${tmp_dir}" - -makepkg --skippgpcheck --verifysource - -"${build_command}" ${parameters} - -find . -maxdepth 1 -type f -name '*.pkg.tar.xz' \ - -execdir gpg --local-user="${package_key}" --detach-sign '{}' \; - -case "$repository" in - core|extra) - staging_repo="staging" - ;; - community) - staging_repo="community-staging" - ;; - *) - staging_repo="staging" - ;; -esac - -#scp -P 2223 -rC "${tmp_dir}/"*.pkg.tar.{xz,xz.sig} httpupload@andreasbaumann.cc:/data/arch32/mirror/bootstrap/i486/${staging_repo}/. -#ssh -p 2223 httpupload@andreasbaumann.cc bash -l -c "'cd /data/arch32/mirror/bootstrap/i486/${staging_repo} && repo-add -n bootstrap-${staging_repo}.db.tar.gz *.pkg.tar.xz'" - -#scp -P 2227 -rC "${tmp_dir}/"*.pkg.tar.{xz,xz.sig} httpupload@andreasbaumann.cc:/data/arch32/mirror/bootstrap/i486/${staging_repo}/. -#ssh -p 2227 httpupload@andreasbaumann.cc bash -l -c "'cd /data/arch32/mirror/bootstrap/i486/${staging_repo} && repo-add -n bootstrap-${staging_repo}.db.tar.gz *.pkg.tar.xz'" - -#recursively_umount_and_rm "${tmp_dir}" diff --git a/bin/local-build-package b/bin/local-build-package index 1c43bc9..8b02293 100755 --- a/bin/local-build-package +++ b/bin/local-build-package @@ -13,19 +13,63 @@ usage() { >&2 echo '' >&2 echo 'possible options:' >&2 echo ' -h|--help: Show this help and exit.' + >&2 echo ' -a|--arch "i486" | "i686"' + >&2 echo ' Build locally for this architecture.' + >&2 echo ' -b|--bootstrap' + >&2 echo ' Publishes signed package to the bootstrap directory.' + >&2 echo ' -H|--host @: host and user for bootstrapping' + >&2 echo ' -D|--dir : bootstrapping directory' + >&2 echo ' $arch and $repo are attached to this path.' + >&2 echo ' -p|--port : the SSH port for bootstrapping.' + >&2 echo ' -n|--nocheck:' + >&2 echo ' Normally execute all checks and do all tests.' + >&2 echo ' This switches off check() and all integrity checks.' [ -z "$1" ] && exit 1 || exit $1 } eval set -- "$( - getopt -o hn:t:x \ + getopt -o a:bhnp:H:D: \ + --long arch \ + --long bootstrap \ + --long nocheck \ + --long port \ + --long dir \ + --long host \ --long help \ -n "$(basename "$0")" -- "$@" || \ echo usage )" +bootstrap=false +nocheck=false +bootstrap_port=22 +bootstrap_host='' +bootstrap_dir='' while true do case "$1" in + -a|--arch) + shift + arch="$1" + ;; + -b|--bootstrap) + bootstrap=true + ;; + -H|--host) + shift + bootstrap_host="$1" + ;; + -D|--dir) + shift + bootstrap_dir="$1" + ;; + -n|--nocheck) + nocheck=true + ;; + -p|--port) + shift + bootstrap_port="$1" + ;; -h|--help) usage 0 ;; @@ -46,6 +90,17 @@ if [ $# -ne 2 ]; then usage fi +if ${bootstrap}; then + if [ -z "${bootstrap_host}" ]; then + >&2 echo '-b option requires a bootstrapping host to be set with -H' + usage + fi + if [ -z "${bootstrap_dir}" ]; then + >&2 echo '-b option requires a bootstrapping directory to be set with -d' + usage + fi +fi + # Update git repositories (official packages, community packages and the repository of package customizations). for repo_name in ${repo_names}; do @@ -56,27 +111,30 @@ done repository=$1 package=$2 case $repository in - core) - repo_path='../work/repos/packages' - ;; - extra) - repo_path='../work/repos/packages' - ;; - community) - repo_path='../work/repos/community' - ;; - *) - >&2 echo 'Repository is either "core" or "community"' - usage + core) + repo_path='../work/repos/packages' + ;; + extra) + repo_path='../work/repos/packages' + ;; + community) + repo_path='../work/repos/community' + ;; + *) + >&2 echo 'Repository is either "core" or "community"' + usage esac git_revision=$(cd ${repo_path}; git rev-parse HEAD) mod_git_revision=$(cd ${repo_paths__archlinux32}; git stash create) if [ -z $mod_git_revision ]; then - mod_git_revision=$(cd ${repo_paths__archlinux32}; git rev-parse HEAD) + mod_git_revision=$(cd ${repo_paths__archlinux32}; git rev-parse HEAD) fi -build_command='staging-i686-build' +build_command="staging-${arch}-build" parameters='' +if ${nocheck}; then + parameters='-- -- --nocheck' +fi git_repo=$(find_repository_with_commit "${git_revision}") find_pkgbuilds "${package}" "${repository}" "${git_repo}" "${git_revision}" "${mod_git_revision}" @@ -88,8 +146,34 @@ rm -f *".pkg.tar.xz" *".pkg.tar.xz.sig" cd "${tmp_dir}" -makepkg --skippgpcheck --verifysource +makepkg_parameters='' +if ${nocehck}; then + makepkg_parameters='--skippgpcheck' +fi +makepkg ${makepkg_parameters} --verifysource "${build_command}" ${parameters} +if ${bootstrap}; then + find . -maxdepth 1 -type f -name '*.pkg.tar.xz' \ + -execdir gpg --local-user="${package_key}" --detach-sign '{}' \; + + case "$repository" in + core|extra) + staging_repo="staging" + ;; + community) + staging_repo="community-staging" + ;; + *) + staging_repo="staging" + ;; + esac + + scp -P ${bootstrap_port} -rC "${tmp_dir}/"*.pkg.tar.{xz,xz.sig} ${bootstrap_host}:${bootstrap_dir}/${staging_repo}/. + ssh -p ${bootstrap_port} ${bootstrap_host} bash -l -c "'cd ${bootstrap_dir}/${staging_repo} && repo-add -n bootstrap-${staging_repo}.db.tar.gz *.pkg.tar.xz'" +fi + +# do not delete build reports, why might actually to want to have a look for things +# like checksums, logfiles, etc. #recursively_umount_and_rm "${tmp_dir}" -- cgit v1.2.3-54-g00ecf