summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-08-14 19:34:34 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2019-08-14 19:34:34 +0200
commit18d34fab0d1664112bb76c6dc4867f81a165fdb9 (patch)
tree19704c6ab6067971d9e335e89c89c5be1c8adfb5
parent68e6b94ac725fc4d6fd7db141f6039ee313414dc (diff)
downloadbuilder-18d34fab0d1664112bb76c6dc4867f81a165fdb9.tar.xz
improved local-build-package
-rwxr-xr-xbin/local-build-package119
1 files changed, 72 insertions, 47 deletions
diff --git a/bin/local-build-package b/bin/local-build-package
index 0f92bcb..53d9515 100755
--- a/bin/local-build-package
+++ b/bin/local-build-package
@@ -25,17 +25,26 @@ usage() {
>&2 echo ' -n|--nocheck:'
>&2 echo ' Normally execute all checks and do all tests.'
>&2 echo ' This switches off check() and all integrity checks.'
+ >&2 echo ' -t|--tmpdir <dir>:'
+ >&2 echo ' Specify tmpdir instead of using a random one, usually with -N'
+ >&2 echo ' -N|--nobuild:'
+ >&2 echo ' Assume packages have already been built, just upload them.'
+ >&2 echo ' -s|--signkey:'
+ >&2 echo ' Use explicit sign key instead of the one from the configuration.'
[ -z "$1" ] && exit 1 || exit "$1"
}
eval set -- "$(
- getopt -o a:bhnp:H:D: \
+ getopt -o a:bhnNp:H:D:t:s: \
--long arch \
--long bootstrap \
--long nocheck \
+ --long nobuild \
--long port \
--long dir \
--long host \
+ --long tmpdir \
+ --long signkey \
--long help \
-n "$(basename "$0")" -- "$@" || \
echo usage
@@ -44,9 +53,12 @@ eval set -- "$(
arch=$(uname -m)
bootstrap=false
nocheck=false
+nobuild=false
bootstrap_port=22
bootstrap_host=''
bootstrap_dir=''
+tmp_dir=$(mktemp -d "${work_dir}/tmp.XXXXXX")
+signkey="${package_key}"
while true
do
case "$1" in
@@ -68,10 +80,21 @@ do
-n|--nocheck)
nocheck=true
;;
+ -N|--nobuild)
+ nobuild=true
+ ;;
-p|--port)
shift
bootstrap_port="$1"
;;
+ -t|--tmpdir)
+ shift
+ tmp_dir="$1"
+ ;;
+ -s|--signkey)
+ shift
+ signkey="$1"
+ ;;
-h|--help)
usage 0
;;
@@ -103,63 +126,65 @@ if ${bootstrap}; then
fi
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
+if ! ${nobuild}; then
+ # 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=$(git -C "${repo_path}" rev-parse HEAD)
-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=$(git -C "${repo_path}" rev-parse HEAD)
+ mod_git_revision=$(git -C "${repo_paths__archlinux32}" stash create)
+ if [ -z "${mod_git_revision}" ]; then
+ mod_git_revision=$(git -C "${repo_paths__archlinux32}" rev-parse HEAD)
+ fi
+ build_command="staging-${arch}-build"
+ parameters=''
+ if ${nocheck}; then
+ parameters='-- -- --nocheck'
+ fi
-mod_git_revision=$(git -C "${repo_paths__archlinux32}" stash create)
-if [ -z "${mod_git_revision}" ]; then
- mod_git_revision=$(git -C "${repo_paths__archlinux32}" rev-parse HEAD)
-fi
-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}"
-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}"
-extract_source_directory "${git_repo}" "${git_revision}" "${mod_git_revision}" "${tmp_dir}"
+ rm -f ./*".pkg.tar.xz" ./*".pkg.tar.xz.sig"
-rm -f ./*".pkg.tar.xz" ./*".pkg.tar.xz.sig"
+ cd "${tmp_dir}" || exit 1
-cd "${tmp_dir}" || exit 1
+ makepkg_parameters=''
+ if ${nocheck}; then
+ makepkg_parameters='--skippgpcheck'
+ fi
+ makepkg ${makepkg_parameters} --verifysource
-makepkg_parameters=''
-if ${nocheck}; then
- makepkg_parameters='--skippgpcheck'
+ # shellcheck disable=SC2086
+ "${build_command}" ${parameters}
+else
+ cd "${tmp_dir}" || exit 1
fi
-makepkg ${makepkg_parameters} --verifysource
-
-# shellcheck disable=SC2086
-"${build_command}" ${parameters}
if ${bootstrap}; then
find . -maxdepth 1 -type f -name '*.pkg.tar.xz' \
- -execdir gpg --local-user="${package_key}" --detach-sign '{}' \;
+ -execdir gpg --local-user="${signkey}" --detach-sign '{}' \;
case "$repository" in
core|extra)