Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/build-and-deploy-bootstrap-package
diff options
context:
space:
mode:
Diffstat (limited to 'bin/build-and-deploy-bootstrap-package')
-rwxr-xr-xbin/build-and-deploy-bootstrap-package116
1 files changed, 116 insertions, 0 deletions
diff --git a/bin/build-and-deploy-bootstrap-package b/bin/build-and-deploy-bootstrap-package
new file mode 100755
index 0000000..5560d1e
--- /dev/null
+++ b/bin/build-and-deploy-bootstrap-package
@@ -0,0 +1,116 @@
+#!/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 <repository> <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}"