add arch and branch param check
add doc
minor fixes
This commit is contained in:
udeved 2016-06-07 10:23:35 +02:00
parent 32d6269158
commit ccaf01d6fc
7 changed files with 20 additions and 169 deletions

View file

@ -1,94 +0,0 @@
_mkchrootpkg() {
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
case $cur in
-*)
COMPREPLY=( $( compgen -W '-I -c -h -l -r -u' -- "$cur" ) )
;;
*)
_filedir
return 0
;;
esac
true
} &&
complete -F _mkchrootpkg mkchrootpkg
_mkchroot() {
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
case $cur in
-*)
COMPREPLY=( $( compgen -W '-C -M -S -c -L -B -h' -- "$cur" ) )
;;
*)
_filedir
return 0
;;
esac
true
} &&
complete -F _mkchroot mkchroot
_chroot_run() {
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
case $cur in
-*)
COMPREPLY=( $( compgen -W '-C -M -S -c -B -h' -- "$cur" ) )
;;
*)
_filedir
return 0
;;
esac
true
} &&
complete -F _chroot_run chroot-run
_buildpkg() {
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
case $cur in
-*)
COMPREPLY=( $( compgen -W '-a -b -p -c -r -w -s -q -h' -- "$cur" ) )
;;
*)
_filedir
return 0
;;
esac
true
} &&
complete -F _buildpkg buildpkg
_buildiso() {
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
case $cur in
-*)
COMPREPLY=( $( compgen -W '-a -b -p -c -r -i -s -x -l -q -h' -- "$cur" ) )
;;
*)
_filedir
return 0
;;
esac
true
} &&
complete -F _buildiso buildiso

View file

@ -58,6 +58,8 @@ display_settings(){
msg2 "work_dir: %s" "${work_dir}" msg2 "work_dir: %s" "${work_dir}"
msg2 "pkg_dir: %s" "${pkg_dir}" msg2 "pkg_dir: %s" "${pkg_dir}"
msg2 "build_mirror: %s" "${build_mirror}/${target_branch}" msg2 "build_mirror: %s" "${build_mirror}/${target_branch}"
msg2 "pacman_conf: %s" "${pacman_conf}"
msg2 "makepkg_conf: %s" "${makepkg_conf}"
if ${clean_first};then if ${clean_first};then
msg "PKG:" msg "PKG:"

View file

@ -1,55 +0,0 @@
#compdef build-set chroot-run finddeps mkchrootpkg mkchroot
m4_include(lib/valid-tags.sh)
_build_set_args=(
'-c[Recreate chroot]'
'-r[Chroots directory]:base_dir:_files -/'
'-b[Set branch]:branch:_branch -/'
'-a[Set arch]:arch:_arch -/'
'-p[Set profile or pkg]:base_dir:_files -/'
'-w[Clean up]'
'-s[Sign packages]'
)
_chroot_run_args=(
'-C[Location of a pacman config file]:pacman_config:_files'
'-M[Location of a makepkg config file]:makepkg_config:_files'
'-S[Location of a pacman-mirrors config file]:pacman_mirrors_config:_files'
'-c[Set pacman cache]:pacman_cache:_files -/'
'-h[Display usage]'
)
_finddeps_args=(
'1:packages:_devtools_completions_all_packages'
)
_mkchrootpkg_args=(
'-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"'
'-c[Clean the chroot before building]'
'-h[Display usage]'
'-l[The directory to use as the working copy]:copy_dir:_files -/'
'-r[The chroot dir to use]:chroot_dir:_files -/'
'-u[Update the working copy of the chroot before building]'
)
_mkchroot_args=(
'-C[Location of a pacman config file]:pacman_config:_files'
'-M[Location of a makepkg config file]:makepkg_config:_files'
'-S[Location of a pacman-mirrors config file]:pacman_mirrors_config:_files'
'-c[Set pacman cache]:pacman_cache:_files -/'
'-h[Display usage]'
)
_manjaro_tools_completions_all_packages() {
typeset -U packages
packages=($(_call_program packages pacman -Sql))
compadd - "${(@)packages}"
}
_manjaro_tools() {
local argname="_${service//-/_}_args[@]"
_arguments -s "${(P)argname}"
}
_manjaro_tools

View file

@ -76,7 +76,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-a i686|x86_64|multilib</option></term> <term><option>-a i686|x86_64|multilib|arm|armv6h|armv7h|aarch64</option></term>
<listitem><para>Architecture that the iso will be built. Can be i686, x86_64 or multilib.</para></listitem> <listitem><para>Architecture that the iso will be built. Can be i686, x86_64 or multilib.</para></listitem>
</varlistentry> </varlistentry>

View file

@ -27,19 +27,26 @@ preconf_arm(){
} }
preconf(){ preconf(){
work_dir="${chroots_pkg}/${target_branch}/$1" local arch="$1" tarch="$2"
pkg_dir="${cache_dir_pkg}/${target_branch}/$1" work_dir="${chroots_pkg}/${target_branch}/$tarch"
if [[ "$1" == 'multilib' ]];then pkg_dir="${cache_dir_pkg}/${target_branch}/$tarch"
if [[ "$arch" == 'multilib' ]];then
target_arch='x86_64' target_arch='x86_64'
is_multilib=true is_multilib=true
else else
is_multilib=false is_multilib=false
fi fi
makepkg_conf="${DATADIR}/makepkg-${target_arch}.conf" makepkg_conf="${DATADIR}/makepkg-${target_arch}.conf"
pacman_conf="${DATADIR}/pacman-$1.conf" pacman_conf="${DATADIR}/pacman-$arch.conf"
} }
configure_chroot_arch(){ configure_chroot_arch(){
if ! is_valid_arch_pkg "$1";then
die "%s is not a valid arch!" "$1"
fi
if ! is_valid_branch "$1";then
die "%s is not a valid branch!" "${target_branch}"
fi
local conf_arch chost_desc cflags local conf_arch chost_desc cflags
case "$1" in case "$1" in
'arm') 'arm')
@ -317,15 +324,17 @@ chroot_init(){
build_pkg(){ build_pkg(){
setarch "${target_arch}" \ setarch "${target_arch}" \
mkchrootpkg ${mkchrootpkg_args[*]} mkchrootpkg ${mkchrootpkg_args[*]} || return 1
if [ $? -eq 0 ]; then
post_build
fi
} }
make_pkg(){ make_pkg(){
check_build "$1" check_build "$1"
msg "Start building [%s]" "$1" msg "Start building [%s]" "$1"
cd $1 cd $1
build_pkg || die build_pkg
post_build
cd .. cd ..
msg "Finished building [%s]" "$1" msg "Finished building [%s]" "$1"
show_elapsed_time "${FUNCNAME}" "${timer_start}" show_elapsed_time "${FUNCNAME}" "${timer_start}"

View file

@ -536,7 +536,7 @@ is_valid_init(){
is_valid_arch_pkg(){ is_valid_arch_pkg(){
case $1 in case $1 in
'i686'|'x86_64'|'multilib') return 0 ;; 'i686'|'x86_64'|'multilib'|'arm'|'armv6h'|'armv7h'|'aarch64') return 0 ;;
*) return 1 ;; *) return 1 ;;
esac esac
} }

View file

@ -1,11 +0,0 @@
_arch=(
i686
x86_64
any
)
_branch=(
stable
testing
unstable
)