Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/local-build-package
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-01-25 19:32:39 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2019-01-25 19:32:39 +0100
commit05d44e9b0cb9069ed7737264ce4fec4fbfdfb262 (patch)
treebec24a4b478c9bb0b931ca07cdbde82e68358331 /bin/local-build-package
parentf9c61396c36adb8187d90f7ff56a4e056ee6d771 (diff)
added a local build package working without the buildmaster
Diffstat (limited to 'bin/local-build-package')
-rwxr-xr-xbin/local-build-package95
1 files changed, 95 insertions, 0 deletions
diff --git a/bin/local-build-package b/bin/local-build-package
new file mode 100755
index 0000000..1c43bc9
--- /dev/null
+++ b/bin/local-build-package
@@ -0,0 +1,95 @@
+#!/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-i686-build'
+parameters=''
+
+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}"
+
+rm -f *".pkg.tar.xz" *".pkg.tar.xz.sig"
+
+cd "${tmp_dir}"
+
+makepkg --skippgpcheck --verifysource
+
+"${build_command}" ${parameters}
+
+#recursively_umount_and_rm "${tmp_dir}"