From ccaf01d6fc7c09691524b7b5e1c9e00ac754201d Mon Sep 17 00:00:00 2001 From: udeved Date: Tue, 7 Jun 2016 10:23:35 +0200 Subject: [PATCH] buildpkg: #209 add arch and branch param check add doc minor fixes --- bin/bash_completion.in | 94 ------------------------------------------ bin/buildpkg.in | 2 + bin/zsh_completion.in | 55 ------------------------ docbook/buildpkg.xml | 2 +- lib/util-pkg.sh | 23 +++++++---- lib/util.sh | 2 +- lib/valid-tags.sh | 11 ----- 7 files changed, 20 insertions(+), 169 deletions(-) delete mode 100644 bin/bash_completion.in delete mode 100644 bin/zsh_completion.in delete mode 100644 lib/valid-tags.sh diff --git a/bin/bash_completion.in b/bin/bash_completion.in deleted file mode 100644 index 3b5a719..0000000 --- a/bin/bash_completion.in +++ /dev/null @@ -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 diff --git a/bin/buildpkg.in b/bin/buildpkg.in index d51024b..d35417a 100644 --- a/bin/buildpkg.in +++ b/bin/buildpkg.in @@ -58,6 +58,8 @@ display_settings(){ msg2 "work_dir: %s" "${work_dir}" msg2 "pkg_dir: %s" "${pkg_dir}" msg2 "build_mirror: %s" "${build_mirror}/${target_branch}" + msg2 "pacman_conf: %s" "${pacman_conf}" + msg2 "makepkg_conf: %s" "${makepkg_conf}" if ${clean_first};then msg "PKG:" diff --git a/bin/zsh_completion.in b/bin/zsh_completion.in deleted file mode 100644 index 5760df6..0000000 --- a/bin/zsh_completion.in +++ /dev/null @@ -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 diff --git a/docbook/buildpkg.xml b/docbook/buildpkg.xml index d61f90a..d64aef3 100644 --- a/docbook/buildpkg.xml +++ b/docbook/buildpkg.xml @@ -76,7 +76,7 @@ - + Architecture that the iso will be built. Can be i686, x86_64 or multilib. diff --git a/lib/util-pkg.sh b/lib/util-pkg.sh index 8dfadce..08f0a94 100644 --- a/lib/util-pkg.sh +++ b/lib/util-pkg.sh @@ -27,19 +27,26 @@ preconf_arm(){ } preconf(){ - work_dir="${chroots_pkg}/${target_branch}/$1" - pkg_dir="${cache_dir_pkg}/${target_branch}/$1" - if [[ "$1" == 'multilib' ]];then + local arch="$1" tarch="$2" + work_dir="${chroots_pkg}/${target_branch}/$tarch" + pkg_dir="${cache_dir_pkg}/${target_branch}/$tarch" + if [[ "$arch" == 'multilib' ]];then target_arch='x86_64' is_multilib=true else is_multilib=false fi makepkg_conf="${DATADIR}/makepkg-${target_arch}.conf" - pacman_conf="${DATADIR}/pacman-$1.conf" + pacman_conf="${DATADIR}/pacman-$arch.conf" } 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 case "$1" in 'arm') @@ -317,15 +324,17 @@ chroot_init(){ build_pkg(){ setarch "${target_arch}" \ - mkchrootpkg ${mkchrootpkg_args[*]} + mkchrootpkg ${mkchrootpkg_args[*]} || return 1 + if [ $? -eq 0 ]; then + post_build + fi } make_pkg(){ check_build "$1" msg "Start building [%s]" "$1" cd $1 - build_pkg || die - post_build + build_pkg cd .. msg "Finished building [%s]" "$1" show_elapsed_time "${FUNCNAME}" "${timer_start}" diff --git a/lib/util.sh b/lib/util.sh index fca2acc..d28c433 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -536,7 +536,7 @@ is_valid_init(){ is_valid_arch_pkg(){ case $1 in - 'i686'|'x86_64'|'multilib') return 0 ;; + 'i686'|'x86_64'|'multilib'|'arm'|'armv6h'|'armv7h'|'aarch64') return 0 ;; *) return 1 ;; esac } diff --git a/lib/valid-tags.sh b/lib/valid-tags.sh deleted file mode 100644 index 49553c0..0000000 --- a/lib/valid-tags.sh +++ /dev/null @@ -1,11 +0,0 @@ -_arch=( - i686 - x86_64 - any -) - -_branch=( - stable - testing - unstable -) \ No newline at end of file