2014-10-04 00:46:40 +02:00
|
|
|
#!/bin/bash
|
2014-10-08 11:11:19 +02:00
|
|
|
#
|
2014-10-04 15:41:22 +02:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
2014-10-08 13:14:28 +02:00
|
|
|
version=@version@
|
|
|
|
|
2014-11-13 00:19:49 +01:00
|
|
|
shopt -s nullglob
|
|
|
|
|
2014-12-14 03:48:46 +01:00
|
|
|
LIBDIR='@libdir@'
|
|
|
|
PKGDATADIR='@pkgdatadir@'
|
|
|
|
SYSCONFDIR='@sysconfdir@'
|
|
|
|
|
|
|
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
|
|
|
[[ -r ${LIBDIR}/util.sh ]] && source ${LIBDIR}/util.sh
|
|
|
|
[[ -r ${LIBDIR}/util-pkg.sh ]] && source ${LIBDIR}/util-pkg.sh
|
2014-11-13 13:33:38 +01:00
|
|
|
|
2015-02-14 11:06:20 +01:00
|
|
|
show_build_queue(){
|
|
|
|
if ${is_buildset};then
|
|
|
|
local list=$(cat ${sets_dir_pkg}/${buildset_pkg}.set)
|
|
|
|
for item in ${list[@]}; do
|
|
|
|
msg2 "$item"
|
|
|
|
done
|
|
|
|
else
|
|
|
|
for arg in "${makepkg_args[@]}"; do
|
|
|
|
case ${arg} in
|
|
|
|
--pkg) continue ;;
|
|
|
|
-*) continue ;;
|
|
|
|
*) local split_arg=${arg} ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
if [[ -n ${split_arg} ]]; then
|
|
|
|
local IFS=','
|
|
|
|
for item in ${split_arg}; do
|
|
|
|
msg2 "$item"
|
|
|
|
done
|
|
|
|
unset IFS
|
|
|
|
else
|
|
|
|
msg2 "${buildset_pkg}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
display_settings(){
|
2015-02-13 15:17:00 +01:00
|
|
|
msg "manjaro-tools"
|
|
|
|
msg2 "version: ${version}"
|
|
|
|
|
|
|
|
if [[ -f ${USER_CONFIG}/manjaro-tools.conf ]]; then
|
|
|
|
msg2 "user_config: ${USER_CONFIG}/manjaro-tools.conf"
|
|
|
|
else
|
|
|
|
msg2 "manjaro_tools_conf: ${manjaro_tools_conf}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
msg "PROFILE:"
|
|
|
|
msg2 "buildsets: $(load_sets ${sets_dir_pkg})"
|
|
|
|
msg2 "buildset_pkg: ${buildset_pkg}"
|
|
|
|
msg2 "is_buildset: ${is_buildset}"
|
|
|
|
|
|
|
|
msg "OPTIONS:"
|
|
|
|
msg2 "arch: ${arch}"
|
|
|
|
msg2 "branch: ${branch}"
|
|
|
|
msg2 "chroots_pkg: ${chroots_pkg}"
|
|
|
|
|
|
|
|
msg "ARGS:"
|
|
|
|
msg2 "clean_first: ${clean_first}"
|
|
|
|
msg2 "wipe_clean: ${wipe_clean}"
|
|
|
|
msg2 "namcap: ${namcap}"
|
|
|
|
msg2 "sign: ${sign}"
|
|
|
|
msg2 "makepkg_args: ${makepkg_args[*]}"
|
|
|
|
|
|
|
|
msg "PATHS:"
|
|
|
|
msg2 "work_dir: ${work_dir}"
|
|
|
|
msg2 "sets_dir_pkg: ${sets_dir_pkg}"
|
|
|
|
msg2 "cache_dir_pkg: ${cache_dir_pkg}"
|
|
|
|
msg2 "build_mirror: ${build_mirror}/${branch}"
|
|
|
|
|
|
|
|
msg "BLACKLIST:"
|
|
|
|
msg2 "blacklist_trigger: ${blacklist_trigger[*]}"
|
|
|
|
msg2 "blacklist: ${blacklist[*]}"
|
|
|
|
|
|
|
|
if ${clean_first};then
|
|
|
|
msg "PKG:"
|
|
|
|
msg2 "base_packages: ${base_packages[*]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
msg "BUILD QUEUE:"
|
2015-02-14 11:06:20 +01:00
|
|
|
show_build_queue
|
2014-11-16 23:18:01 +01:00
|
|
|
}
|
|
|
|
|
2015-01-13 13:41:28 +01:00
|
|
|
load_user_info
|
2014-12-14 03:48:46 +01:00
|
|
|
|
2015-02-02 06:36:39 +01:00
|
|
|
load_config "${USER_CONFIG}/manjaro-tools.conf"
|
2014-12-14 03:48:46 +01:00
|
|
|
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
2014-12-08 22:16:06 +01:00
|
|
|
|
2014-12-08 22:58:38 +01:00
|
|
|
load_vars "$USER_HOME/.makepkg.conf"
|
2014-11-14 23:33:53 +01:00
|
|
|
load_vars /etc/makepkg.conf
|
|
|
|
|
2014-10-08 11:11:19 +02:00
|
|
|
pacman_conf_arch='default'
|
2014-11-16 23:18:01 +01:00
|
|
|
base_packages=('base-devel')
|
2014-10-08 11:11:19 +02:00
|
|
|
|
2014-11-13 00:19:49 +01:00
|
|
|
clean_first=false
|
2014-11-13 01:53:11 +01:00
|
|
|
wipe_clean=false
|
2014-10-04 00:46:40 +02:00
|
|
|
namcap=false
|
|
|
|
pretend=false
|
2015-01-14 22:29:46 +01:00
|
|
|
is_buildset=false
|
2014-10-06 23:35:01 +02:00
|
|
|
sign=false
|
2014-10-04 00:46:40 +02:00
|
|
|
|
|
|
|
usage() {
|
2015-02-13 15:17:00 +01:00
|
|
|
echo "Usage: ${0##*/} [options] [--] [makepkg args]"
|
|
|
|
echo " -p <pkg> Buildset or pkg [default: ${buildset_pkg}]"
|
|
|
|
echo " -a <arch> Arch [default: ${arch}]"
|
|
|
|
echo " -b <branch> Branch [default: ${branch}]"
|
|
|
|
echo ' -r <dir> Chroots directory'
|
|
|
|
echo " [default: ${chroots_pkg}]"
|
|
|
|
echo ' -c Recreate chroot'
|
|
|
|
echo ' -w Clean up cache and sources'
|
|
|
|
echo ' -n Install and run namcap check'
|
|
|
|
echo ' -s Sign packages'
|
|
|
|
echo ' -q Query settings and pretend build'
|
|
|
|
echo ' -h This help'
|
|
|
|
echo ''
|
|
|
|
echo ''
|
|
|
|
exit $1
|
2014-10-04 00:46:40 +02:00
|
|
|
}
|
|
|
|
|
2014-11-12 04:15:40 +01:00
|
|
|
orig_argv=("$@")
|
|
|
|
|
2014-11-14 23:33:53 +01:00
|
|
|
opts='p:a:b:r:cwnsqh'
|
2014-10-04 00:46:40 +02:00
|
|
|
|
|
|
|
while getopts "${opts}" arg; do
|
2015-02-13 15:17:00 +01:00
|
|
|
case "${arg}" in
|
|
|
|
p) buildset_pkg="$OPTARG" ;;
|
|
|
|
a) arch="$OPTARG" ;;
|
|
|
|
b) branch="$OPTARG" ;;
|
|
|
|
r) chroots_pkg="$OPTARG" ;;
|
|
|
|
c) clean_first=true; mkchroot_args+=(-L) ;;
|
|
|
|
w) wipe_clean=true ;;
|
|
|
|
n) namcap=true; mkchrootpkg_args+=(-n) ;;
|
|
|
|
s) sign=true ;;
|
|
|
|
q) pretend=true ;;
|
|
|
|
h|?) usage 0 ;;
|
|
|
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
|
|
|
esac
|
2014-10-04 00:46:40 +02:00
|
|
|
done
|
|
|
|
|
2015-02-02 06:36:39 +01:00
|
|
|
if [[ "${arch}" == 'multilib' ]]; then
|
2015-02-13 15:17:00 +01:00
|
|
|
pacman_conf_arch='multilib'
|
2015-02-28 01:22:47 +01:00
|
|
|
base_packages+=('multilib-devel')
|
2015-02-13 15:17:00 +01:00
|
|
|
work_dir=${chroots_pkg}/${branch}/${arch}
|
|
|
|
cache_dir_pkg=${cache_dir}/${branch}/${arch}
|
|
|
|
arch='x86_64'
|
|
|
|
is_multilib=true
|
2015-02-02 06:36:39 +01:00
|
|
|
else
|
2015-02-13 15:17:00 +01:00
|
|
|
work_dir=${chroots_pkg}/${branch}/${arch}
|
|
|
|
cache_dir_pkg=${cache_dir}/${branch}/${arch}
|
|
|
|
is_multilib=false
|
2014-10-04 00:46:40 +02:00
|
|
|
fi
|
|
|
|
|
2014-12-31 01:02:43 +01:00
|
|
|
pacman_conf="${PKGDATADIR}/pacman-${pacman_conf_arch}.conf"
|
2014-12-14 03:48:46 +01:00
|
|
|
makepkg_conf="${PKGDATADIR}/makepkg-${arch}.conf"
|
|
|
|
mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf"
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2015-01-15 18:15:24 +01:00
|
|
|
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${branch}")
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2015-01-13 01:32:31 +01:00
|
|
|
mkchrootpkg_args+=(-r ${work_dir})
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2014-11-12 04:15:40 +01:00
|
|
|
makepkg_args+=("${@:$OPTIND}")
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2014-11-12 04:15:40 +01:00
|
|
|
check_root "$0" "${orig_argv[@]}"
|
2014-10-07 10:34:58 +02:00
|
|
|
|
2015-02-18 20:08:59 +01:00
|
|
|
timer_start=$(get_timer)
|
|
|
|
|
2015-01-15 02:49:21 +01:00
|
|
|
prepare_cachedir
|
2014-11-13 22:43:07 +01:00
|
|
|
|
2015-01-14 22:29:46 +01:00
|
|
|
eval_buildset "${buildset_pkg}" "${sets_dir_pkg}"
|
2014-11-13 22:43:07 +01:00
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
${pretend} && display_settings && exit
|
|
|
|
|
|
|
|
${wipe_clean} && clean_up
|
|
|
|
|
2015-05-06 23:03:53 +02:00
|
|
|
[[ -d ${work_dir}/root ]] && check_chroot_version
|
2015-05-03 23:12:27 +02:00
|
|
|
|
2015-02-02 06:36:39 +01:00
|
|
|
chroot_init
|
2014-11-16 23:18:01 +01:00
|
|
|
|
|
|
|
chroot_build
|