Merge branch 'devel'

This commit is contained in:
artoo 2014-11-14 23:58:57 +01:00
commit 352aed0dde
10 changed files with 143 additions and 120 deletions

View file

@ -73,7 +73,7 @@ install:
#ln -sf fstabgen $(DESTDIR)$(PREFIX)/bin/genfstab
#ln -sf manjaro-chroot $(DESTDIR)$(PREFIX)/bin/arch-chroot
install -Dm0644 bin/bash_completion $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro-tools
install -Dm0644 bin/bash_completion $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
install -Dm0644 bin/zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
uninstall:
@ -88,7 +88,7 @@ uninstall:
#rm -f $(DESTDIR)$(PREFIX)/bin/genfstab
#rm -f $(DESTDIR)$(PREFIX)/bin/arch-chroot
rm $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro-tools
rm $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
dist:

View file

@ -1,7 +1,7 @@
# Maintainer: artoo <flower_of_life@gmx.net>
pkgname=manjaro-tools-git
pkgver=r105.46014ce
pkgver=r119.225ebe1
pkgrel=1
pkgdesc='Tools for Manjaro Linux'
arch=('any')

View file

@ -1,4 +1,4 @@
_manjaro-tools_compgen() {
_manjaro_tools_compgen() {
local i r
COMPREPLY=($(compgen -W '$*' -- "$cur"))
for ((i=1; i < ${#COMP_WORDS[@]}-1; i++)); do
@ -66,4 +66,25 @@ _chroot-run() {
true
} &&
complete -F _chroot-run chroot-run
_build-set() {
local cur
COMPREPLY=()
_get_comp_words_by_ref cur
case $cur in
-*)
COMPREPLY=( $( compgen -W '-a -b -p -c -r -w -s -h' -- "$cur" ) )
;;
*)
_filedir
return 0
;;
esac
true
} &&
complete -F _build-set build-set
# ex:et ts=2 sw=2 ft=sh

View file

@ -17,25 +17,12 @@ shopt -s nullglob
[[ -r @libdir@/util.sh ]] && source @libdir@/util.sh
[[ -r @libdir@/util-build.sh ]] && source @libdir@/util-build.sh
pkg_owner=${SUDO_USER:-$USER}
if [[ -n $SUDO_USER ]]; then
eval "USER_HOME=~$SUDO_USER"
else
USER_HOME=$HOME
fi
load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf
load_config '@sysconfdir@'
chroot_create(){
mkdir -p "${chrootdir}"
setarch "${arch}" mkchroot \
${mkchroot_args[*]} \
"${chrootdir}/root" \
"${base_packages[*]}" || abort
${base_packages[*]} || abort
}
chroot_update(){
@ -54,8 +41,8 @@ chroot_build(){
blacklist_pkg "${chrootdir}"
fi
setarch "${arch}" \
mkchrootpkg ${mkchrootpkg_args[*]} -- "${makepkg_args[*]}" || break
move_pkg "${pkg}"
mkchrootpkg ${mkchrootpkg_args[*]} -- ${makepkg_args[*]} || break
move_pkg "${pkg_owner}"
cd ..
done
msg "Finished building profile: [${profile}]"
@ -65,8 +52,8 @@ chroot_build(){
blacklist_pkg "${chrootdir}"
fi
setarch "${arch}" \
mkchrootpkg ${mkchrootpkg_args[*]} -- "${makepkg_args[*]}" || abort
move_pkg "${profile}"
mkchrootpkg ${mkchrootpkg_args[*]} -- ${makepkg_args[*]} || abort
move_pkg "${pkg_owner}"
cd ..
fi
}
@ -85,11 +72,15 @@ chroot_init(){
display_settings(){
msg "manjaro-tools version: ${version}"
msg "OPTARGS:"
msg "OPTIONS:"
msg2 "arch: ${arch}"
msg2 "branch: ${branch}"
msg2 "chroots: ${chroots}"
msg "ARGS:"
msg2 "mkchrootpkg_args: ${mkchrootpkg_args[*]}"
msg2 "makepkg_args: ${makepkg_args[*]}"
msg "PATHS:"
msg2 "chrootdir: ${chrootdir}"
msg2 "profiledir: ${profiledir}"
@ -109,40 +100,32 @@ display_settings(){
msg2 "is_profile: ${is_profile}"
if ${is_profile};then
msg "These packages will be built:"
msg "Build queue:"
local list=$(cat ${profiledir}/${profile}.set)
for item in ${list[@]}; do
msg2 "$item"
done
else
msg "This package will be built:"
msg "Build queue:"
msg2 "${profile}"
fi
}
run(){
eval_profile "${profile}"
if ${pretend}; then
display_settings
exit 1
else
if ${wipe_clean}; then
clean_up
fi
display_settings
chroot_init
prepare_dir "${pkgdir}"
chroot_build
ch_owner "${pkg_owner}" "$(dirname ${pkgdir})"
if ${sign}; then
sign_pkgs "${pkg_owner}"
fi
fi
}
export LC_MESSAGES=C
load_config '@sysconfdir@'
pkg_owner=${SUDO_USER:-$USER}
if [[ -n $SUDO_USER ]]; then
eval "USER_HOME=~$SUDO_USER"
else
USER_HOME=$HOME
fi
load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf
arch=$(uname -m)
pacman_conf_arch='default'
@ -161,14 +144,14 @@ mkchrootpkg_args=()
makepkg_args=()
usage() {
echo "Usage: ${0##*/} [options] -- [makepkg_args]"
echo "Usage: ${0##*/} [options] [--] [makepkg args]"
echo " -p <profile> Set profile or pkg [default: ${profile}]"
echo " -a <arch> Set arch [default: ${arch}]"
echo " -b <branch> Set branch [default: ${branch}]"
echo " -r <dir> Chroots directory [default: ${chroots}]"
echo ' -c Clean up and recreate chroot'
echo ' -w Wipe clean pkgbuild and pkg directory'
echo ' -n Run namcap check'
echo ' -c Recreate chroot'
echo ' -w Clean up'
echo ' -n Install and run namcap check'
echo ' -s Sign packages'
echo ' -q Query settings and pretend build'
echo ' -h This help'
@ -198,23 +181,18 @@ done
if [[ "$arch" == 'multilib' ]]; then
pacman_conf_arch='multilib'
chrootdir=${chroots}/${branch}/${arch}
arch='x86_64'
base_packages+=('multilib-devel')
else
chrootdir=${chroots}/${branch}/${arch}
arch='x86_64'
fi
chrootdir=${chroots}/${branch}/${arch}
pkgdir="${pkgdir}/${branch}/${arch}"
pacman_conf="@pkgdatadir@/pacman-${pacman_conf_arch}.conf"
makepkg_conf="@pkgdatadir@/makepkg-${arch}.conf"
pm_conf="@pkgdatadir@/pacman-mirrors-${branch}.conf"
if [[ -n ${pkgdir} ]];then
pkgdir="${pkgdir}/${branch}/${arch}"
else
pkgdir="/var/cache/manjaro-tools/pkg/${branch}/${arch}"
fi
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${pm_conf})
mkchrootpkg_args+=(-r ${chrootdir})
@ -223,4 +201,17 @@ makepkg_args+=("${@:$OPTIND}")
check_root "$0" "${orig_argv[@]}"
run $@
[[ -d "${pkgdir}" ]] || prepare_dir "${pkgdir}" "${pkg_owner}"
eval_profile "${profile}"
if ${pretend}; then
display_settings
exit $?
else
${wipe_clean} && clean_up
display_settings
chroot_init
chroot_build
${sign} && sign_pkgs "${pkg_owner}"
fi

View file

@ -18,7 +18,7 @@ working_dir=''
usage() {
echo "Usage: ${0##*/} [options] working-dir [systemd-nspawn arguments]"
echo "A wrapper around systemd-nspawn. Provides support for pacman."
echo "A wrapper around chroot. Provides support for pacman."
echo
echo ' options:'
echo ' -C <file> Location of a pacman config file'

View file

@ -3,8 +3,13 @@
m4_include(lib/valid-tags.sh)
_build_set_args=(
'-c[Recreate the chroot before building]'
'-r[Create chroots in this directory]:base_dir:_files -/'
'-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=(
@ -36,7 +41,7 @@ _mkchroot_args=(
'-h[Display usage]'
)
__manjaro_tools_completions_all_packages() {
_manjaro_tools_completions_all_packages() {
typeset -U packages
packages=($(_call_program packages pacman -Sql))
compadd - "${(@)packages}"

View file

@ -9,11 +9,6 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
ch_owner(){
#msg "Changing owner [$1:users] [$2]"
chown -R "$1:users" "$2"
}
sign_pkgs(){
cd $pkgdir
su $1 <<'EOF'
@ -22,13 +17,13 @@ EOF
}
move_pkg(){
#msg2 "Moving [$1] to [${pkgdir}]"
local ext='pkg.tar.xz'
if [[ -n $PKGDEST ]];then
mv $PKGDEST/*{any,$arch}.${ext} ${pkgdir}/
else
mv *.${ext} ${pkgdir}/
fi
chown -R "$1:users" "${pkgdir}"
}
get_profiles(){
@ -41,9 +36,8 @@ get_profiles(){
}
prepare_dir(){
if ! [[ -d $1 ]];then
mkdir -p $1
fi
chown -R "$2:users" "$(dirname $1)"
}
clean_up(){

View file

@ -189,4 +189,10 @@ load_config(){
else
chroots='/srv/manjarobuild'
fi
if [[ -n ${pkgdir} ]];then
pkgdir=${pkgdir}
else
pkgdir='/var/cache/manjaro-tools/pkg'
fi
}

View file

@ -3,3 +3,9 @@ _arch=(
x86_64
any
)
_branch=(
stable
testing
unstable
)