Commit 5837525c authored by Bernhard Landauer's avatar Bernhard Landauer
Browse files

use only first occurrance when checking repo_ver

parent d598e786
# Author: Bernhard Landauer <bernhard@manjaro.org>
pkgname=manjaro-chrootbuild
pkgver=r182.g0e0ea79
pkgver=r190.gd598e78
pkgrel=1
pkgdesc="Build packages and buildlists in a chroot filesystem."
arch=('any')
......
......@@ -25,7 +25,7 @@ get_ver() {
reset_rel() {
_rel=${git_ver#*-}
if [ $_rel != 1 ]; then
if [[ $_rel != 1 ]]; then
echo "[${pkg#*/}]: pkgrel $_rel > 1"
sed -i -e "s/pkgrel=$_rel/pkgrel=1/" PKGBUILD
fi
......@@ -39,7 +39,7 @@ prepare_list() {
}
summary() {
if [ ! -z ${build_err} ]; then
if [[ ! -z ${build_err} ]]; then
err_build
for e in "${build_err[@]}"; do
echo " $e"
......@@ -62,7 +62,7 @@ build_list() {
echo ${LOG_FILE} > $mon
cd $1
build_pkg $p &>${LOG_FILE}
if [ $status != 0 ]; then
if [[ $status != 0 ]]; then
printf "! FAILED [$p], see ${LOG_FILE}\n" >> $log
build_err+=("${LOG_FILE}")
err_build
......@@ -84,29 +84,29 @@ build_list_git() {
i=1
for p in $(cat $list); do
header "${1%-git}: $i/$num - $p"
repo_ver=$(sudo pacman -Siy "${p}" 2>/dev/null | grep "Version" | cut -d":" -f2 | cut -d ' ' -f2)
repo_ver=$(sudo pacman -Siy "${p}" 2>/dev/null | grep "Version" | head -1 | cut -d":" -f2 | cut -d ' ' -f2)
[[ -z $repo_ver ]] && repo_ver=0
# update local pkgver
cd $1/$p
rm -rf src
msg6 "updating git ..." # can take a while in some cases.
git pull &>/dev/null
[[ -d .git ]] && git pull &>/dev/null
sudo -iu ${SUDO_USER} repo=${PWD} bash -c 'cd ${repo}; makepkg -do &>/dev/null'
git_ver=$(get_ver pkgver)-$(get_ver pkgrel)
# compare, build if changed and install to chroot
if [ $repo_ver == 0 ]; then
if [[ $repo_ver == 0 ]]; then
msg6 "Package doesn't exist in repo."
repo_ver=r0
else
msg6 "repo version: $repo_ver"
fi
if [ $(vercmp $git_ver $repo_ver) == 1 ]; then
if [ $(vercmp ${repo_ver%-*} ${git_ver%-*}) == 1 ]; then
if [[ $(vercmp "$git_ver" "$repo_ver") == 1 ]]; then
if [[ $(vercmp "${repo_ver%-*}" "${git_ver%-*}") == 1 ]]; then
reset_rel
fi
if [ ${PUSH_GIT} = true ]; then
if [[ ${PUSH_GIT} = true ]]; then
git add PKGBUILD
git commit -m "$git_ver" &>/dev/null
git push &>/dev/null
......@@ -121,7 +121,7 @@ build_list_git() {
cd ..
echo ${LOG_FILE} > $mon
build_pkg $p &>${LOG_FILE}
if [ $status != 0 ]; then
if [[ $status != 0 ]]; then
printf "! FAILED [$p], see ${LOG_FILE}\n" >> $log
build_err+=("${LOG_FILE}")
err_build
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment